Проще логика, новые проверки.

This commit is contained in:
lopar 2021-01-29 01:58:07 +02:00
parent 8402912098
commit 92c3ea79c0
3 changed files with 41 additions and 59 deletions

View File

@ -60,57 +60,57 @@ SQL;
return self::$db->fetch($query, $this->USERID); return self::$db->fetch($query, $this->USERID);
} }
public function getStrengthBonus(): int public function getStrengthBonus(): ?int
{ {
return self::getBonuses()['sum_strength']; return self::getBonuses()['sum_strength'];
} }
public function getDexterityBonus(): int public function getDexterityBonus(): ?int
{ {
return self::getBonuses()['sum_dexterity']; return self::getBonuses()['sum_dexterity'];
} }
public function getIntuitionBonus(): int public function getIntuitionBonus(): ?int
{ {
return self::getBonuses()['sum_intuition']; return self::getBonuses()['sum_intuition'];
} }
public function getEnduranceBonus(): int public function getEnduranceBonus(): ?int
{ {
return self::getBonuses()['sum_endurance']; return self::getBonuses()['sum_endurance'];
} }
public function getIntelliganceBonus(): int public function getIntelliganceBonus(): ?int
{ {
return self::getBonuses()['sum_intelligence']; return self::getBonuses()['sum_intelligence'];
} }
public function getWisdomBonus(): int public function getWisdomBonus(): ?int
{ {
return self::getBonuses()['sum_wisdom']; return self::getBonuses()['sum_wisdom'];
} }
public function getAccuracyBonus(): int public function getAccuracyBonus(): ?int
{ {
return self::getBonuses()['sum_accuracy'] ?? 0; return self::getBonuses()['sum_accuracy'] ?? 0;
} }
public function getEvasionBonus(): int public function getEvasionBonus(): ?int
{ {
return self::getBonuses()['sum_evasion'] ?? 0; return self::getBonuses()['sum_evasion'] ?? 0;
} }
public function getCriticalsBonus(): int public function getCriticalsBonus(): ?int
{ {
return self::getBonuses()['sum_criticals'] ?? 0; return self::getBonuses()['sum_criticals'] ?? 0;
} }
public function getMinPhysDamage(): int public function getMinPhysDamage(): ?int
{ {
return self::getBonuses()['sum_min_phys_damage']; return self::getBonuses()['sum_min_phys_damage'];
} }
public function getMaxPhysDamage(): int public function getMaxPhysDamage(): ?int
{ {
return self::getBonuses()['sum_max_phys_damage']; return self::getBonuses()['sum_max_phys_damage'];
} }

View File

@ -30,4 +30,6 @@ class InventoryItem extends Item
parent::printImage(); parent::printImage();
} }
} }
public function printControls() {}
} }

View File

@ -114,58 +114,38 @@ IMG;
protected function printAllInfo() protected function printAllInfo()
{ {
$lines = [ $needsLines = [
"Долговечность" => $this->durability, "сила" => $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 "<b>" . $this->name . "</b> (Масса: " . $this->weight . ")"; echo "<b>" . $this->name . "</b> (Масса: " . $this->weight . ")";
if ($this->durability) { echo "<br> Долговечность: " . $this->durability;
echo "<br> Долговечность: " . $this->durability;
}
echo "<br><em>{$this->typename}</em><br>"; echo "<br><em>{$this->typename}</em><br>";
if ($this->need_strength > 0) { foreach ($needsLines as $stat => $value) {
echo "<br>Требуется сила" . $this->wrap($this->need_strength); if ($value > 0) {
echo "<br>Требуется $stat" . $this->wrap($value);
}
} }
if ($this->need_dexterity > 0) { foreach ($addsLines as $stat => $value) {
echo "<br>Требуется ловкость" . $this->wrap($this->need_dexterity); if ($value) {
} echo "<br>$stat" . $this->wrap($value);
if ($this->need_intuition > 0) { }
echo "<br>Требуется интуиция" . $this->wrap($this->need_intuition);
}
if ($this->need_endurance > 0) {
echo "<br>Требуется выносливость" . $this->wrap($this->need_endurance);
}
if ($this->need_intelligence > 0) {
echo "<br>Требуется интеллект" . $this->wrap($this->need_intelligence);
}
if ($this->need_wisdom > 0) {
echo "<br>Требуется мудрость" . $this->wrap($this->need_wisdom);
}
if ($this->add_strength) {
echo "<br>Сила" . $this->wrap($this->add_strength);
}
if ($this->add_dexterity) {
echo "<br>Ловкость" . $this->wrap($this->add_dexterity);
}
if ($this->add_intuition) {
echo "<br>Интуиция" . $this->wrap($this->add_intuition);
}
if ($this->add_endurance) {
echo "<br>Выносливость" . $this->wrap($this->add_endurance);
}
if ($this->add_intelligence) {
echo "<br>Интеллект" . $this->wrap($this->add_intelligence);
}
if ($this->add_wisdom) {
echo "<br>Мудрость" . $this->wrap($this->add_wisdom);
}
if ($this->add_accuracy) {
echo "<br>Точность" . $this->wrap($this->add_accuracy);
}
if ($this->add_evasion) {
echo "<br>Увёртливость" . $this->wrap($this->add_evasion);
}
if ($this->add_criticals) {
echo "<br>Шанс крита" . $this->wrap($this->add_criticals);
} }
if ($this->add_min_physical_damage && !$this->add_max_physical_damage) { if ($this->add_min_physical_damage && !$this->add_max_physical_damage) {
$damage = $this->add_min_physical_damage . " - " . $this->add_min_physical_damage; $damage = $this->add_min_physical_damage . " - " . $this->add_min_physical_damage;