Potato: drop poisonous potatoes when harvested, fixes #2830

This commit is contained in:
Dylan K. Taylor 2020-09-03 14:54:04 +01:00
parent 4448f603a6
commit 883e135bc0

View File

@ -40,9 +40,13 @@ class Potato extends Crops{
} }
public function getDropsForCompatibleTool(Item $item) : array{ public function getDropsForCompatibleTool(Item $item) : array{
return [ $result = [
ItemFactory::get(Item::POTATO, 0, $this->getDamage() >= 0x07 ? mt_rand(1, 4) : 1) ItemFactory::get(Item::POTATO, 0, $this->getDamage() >= 0x07 ? mt_rand(1, 4) : 1)
]; ];
if($this->getDamage() >= 7 && mt_rand(0, 49) === 0){
$result[] = ItemFactory::get(Item::POISONOUS_POTATO);
}
return $result;
} }
public function getPickedItem() : Item{ public function getPickedItem() : Item{