diff --git a/classes/Battles/DressedItems.php b/classes/Battles/DressedItems.php index f672735..6436244 100644 --- a/classes/Battles/DressedItems.php +++ b/classes/Battles/DressedItems.php @@ -60,57 +60,57 @@ SQL; return self::$db->fetch($query, $this->USERID); } - public function getStrengthBonus(): int + public function getStrengthBonus(): ?int { return self::getBonuses()['sum_strength']; } - public function getDexterityBonus(): int + public function getDexterityBonus(): ?int { return self::getBonuses()['sum_dexterity']; } - public function getIntuitionBonus(): int + public function getIntuitionBonus(): ?int { return self::getBonuses()['sum_intuition']; } - public function getEnduranceBonus(): int + public function getEnduranceBonus(): ?int { return self::getBonuses()['sum_endurance']; } - public function getIntelliganceBonus(): int + public function getIntelliganceBonus(): ?int { return self::getBonuses()['sum_intelligence']; } - public function getWisdomBonus(): int + public function getWisdomBonus(): ?int { return self::getBonuses()['sum_wisdom']; } - public function getAccuracyBonus(): int + public function getAccuracyBonus(): ?int { return self::getBonuses()['sum_accuracy'] ?? 0; } - public function getEvasionBonus(): int + public function getEvasionBonus(): ?int { return self::getBonuses()['sum_evasion'] ?? 0; } - public function getCriticalsBonus(): int + public function getCriticalsBonus(): ?int { return self::getBonuses()['sum_criticals'] ?? 0; } - public function getMinPhysDamage(): int + public function getMinPhysDamage(): ?int { return self::getBonuses()['sum_min_phys_damage']; } - public function getMaxPhysDamage(): int + public function getMaxPhysDamage(): ?int { return self::getBonuses()['sum_max_phys_damage']; } diff --git a/classes/Battles/InventoryItem.php b/classes/Battles/InventoryItem.php index 8b9d7ee..561d3be 100644 --- a/classes/Battles/InventoryItem.php +++ b/classes/Battles/InventoryItem.php @@ -30,4 +30,6 @@ class InventoryItem extends Item parent::printImage(); } } + + public function printControls() {} } \ No newline at end of file diff --git a/classes/Battles/Item.php b/classes/Battles/Item.php index a3ab92a..39a22ae 100644 --- a/classes/Battles/Item.php +++ b/classes/Battles/Item.php @@ -114,58 +114,38 @@ IMG; protected function printAllInfo() { - $lines = [ - "Долговечность" => $this->durability, + $needsLines = [ + "сила" => $this->need_strength, + "ловкость" =>$this->need_dexterity, + "интуиция" =>$this->need_intuition, + "выносливость" =>$this->need_endurance, + "интеллект" =>$this->need_intelligence, + "мудрость" =>$this->need_wisdom, + ]; + $addsLines = [ + "Сила" => $this->add_strength, + "Ловкость" => $this->add_dexterity, + "Интуиция" => $this->add_intuition, + "Выносливость" => $this->add_endurance, + "Интеллект" => $this->add_intelligence, + "Мудрость" => $this->add_wisdom, + "Точность" => $this->add_accuracy, + "Увёртливость" => $this->add_evasion, + "Шанс крита" => $this->add_criticals, ]; echo "" . $this->name . " (Масса: " . $this->weight . ")"; - if ($this->durability) { - echo "
Долговечность: " . $this->durability; - } + echo "
Долговечность: " . $this->durability; + echo "
{$this->typename}
"; - if ($this->need_strength > 0) { - echo "
Требуется сила" . $this->wrap($this->need_strength); + foreach ($needsLines as $stat => $value) { + if ($value > 0) { + echo "
Требуется $stat" . $this->wrap($value); + } } - if ($this->need_dexterity > 0) { - echo "
Требуется ловкость" . $this->wrap($this->need_dexterity); - } - if ($this->need_intuition > 0) { - echo "
Требуется интуиция" . $this->wrap($this->need_intuition); - } - if ($this->need_endurance > 0) { - echo "
Требуется выносливость" . $this->wrap($this->need_endurance); - } - if ($this->need_intelligence > 0) { - echo "
Требуется интеллект" . $this->wrap($this->need_intelligence); - } - if ($this->need_wisdom > 0) { - echo "
Требуется мудрость" . $this->wrap($this->need_wisdom); - } - if ($this->add_strength) { - echo "
Сила" . $this->wrap($this->add_strength); - } - if ($this->add_dexterity) { - echo "
Ловкость" . $this->wrap($this->add_dexterity); - } - if ($this->add_intuition) { - echo "
Интуиция" . $this->wrap($this->add_intuition); - } - if ($this->add_endurance) { - echo "
Выносливость" . $this->wrap($this->add_endurance); - } - if ($this->add_intelligence) { - echo "
Интеллект" . $this->wrap($this->add_intelligence); - } - if ($this->add_wisdom) { - echo "
Мудрость" . $this->wrap($this->add_wisdom); - } - if ($this->add_accuracy) { - echo "
Точность" . $this->wrap($this->add_accuracy); - } - if ($this->add_evasion) { - echo "
Увёртливость" . $this->wrap($this->add_evasion); - } - if ($this->add_criticals) { - echo "
Шанс крита" . $this->wrap($this->add_criticals); + foreach ($addsLines as $stat => $value) { + if ($value) { + echo "
$stat" . $this->wrap($value); + } } if ($this->add_min_physical_damage && !$this->add_max_physical_damage) { $damage = $this->add_min_physical_damage . " - " . $this->add_min_physical_damage;