diff --git a/classes/Battles/Item.php b/classes/Battles/Item.php index c9a1ccb..d1f3ec5 100644 --- a/classes/Battles/Item.php +++ b/classes/Battles/Item.php @@ -101,6 +101,28 @@ class Item default: $this->typename = 'Хлам'; } + + $sum_stats = + $this->add_strength + + $this->add_dexterity + + $this->add_intuition + + $this->add_endurance + + $this->add_intelligence + + $this->add_wisdom; + $sum_mods = + $this->add_accuracy + + $this->add_evasion + + $this->add_criticals; + $sum_damage = + $this->add_min_physical_damage + + $this->add_max_physical_damage; + // За каждые N параметров повышаем множитель на 1 чтобы цена пропрорционально росла. + $stats_cost_modifier = 5 + floor($sum_stats / 10); + $mods_cost_modifier = 2 + floor($sum_mods / 50); + $damage_cost_modifier = 1 + floor($sum_damage / 100); + $result = intval($sum_stats * $stats_cost_modifier + $sum_mods * $mods_cost_modifier + $sum_damage * $damage_cost_modifier); + + $this->item_cost = $result < 1 ? 1 : $result; } protected function wrap(int $number): string @@ -134,6 +156,7 @@ class Item "Шанс крита" => $this->add_criticals, ]; echo "$this->name (Масса: $this->weight)"; + echo "
Стоимость: " . $this->item_cost; echo "
Долговечность: " . $this->durability; echo "
$this->typename
"; foreach ($needsLines as $stat => $value) {