public function get_troops_with_infos() { // récupération des informations dans la base $units = $this->get_troops(); $modifiers = Cards::get_static_modifiers($this->user_id); $infos = self::get_unit_infos(); foreach ($infos as $unit_id => $info) { if ($this->combat_id == -1 || !is_null($units[$unit_id]['troop_id'])) { $troop = new Troop($units[$unit_id]['troop_id']); $this->troops[$unit_id] = $troop; $troop->hydrate(['name' => $info['name'], 'description' => $info['description'], 'price' => $info['price'] * $modifiers['price'], 'building_time' => $info['building_time'] * $modifiers['building'], 'damage' => $info['damage'] * $modifiers['damage'], 'life' => $info['life'] * $modifiers['life'], 'image_name' => $info['image_name']]); $this->total_units += $troop->quantity; $this->total_damage += $troop->damage * $troop->quantity; $this->total_life += $troop->life * $troop->quantity; } } return $this->troops; }