} elseif (array_key_exists($victim, $npcs)) { /**** Abstracted NPCs *****/ $npc_stats = $npcs[$victim]; // Pull an npcs individual stats with generic fallbacks. /* ============= STANDARD NPCS ======================= */ $npco = new Npc($npc_stats); // Construct the npc object. $display_name = first_value(@$npc_stats['name'], ucfirst($victim)); $max_damage = $npco->max_damage(); $percent_damage = null; // Percent damage does to the player's health. $status_effect = whichever(@$npc_stats['status'], null); $reward_item = first_value(@$npc_stats['item'], null); $base_gold = $npco->gold(); $npc_gold = (int) @$npc_stats['gold']; $is_quick = $npco->speed() > $player->speed() ? true : false; // Beyond basic speed and they see you coming, so show that message. // If npc gold explicitly set to 0, then none will be given. $reward_gold = $npc_gold === 0 ? 0 : ($reward_item ? round($base_gold * 0.9) : $base_gold); // Hack a little off reward gold if items received. $bounty_mod = @$npc_stats['bounty']; $is_villager = $npco->has_trait('villager'); // Give the villager message with the bounty. $is_weaker = $npco->strength() * 3 < $player->strength(); // Npc much weaker? $is_stronger = $npco->strength() > $player->strength() * 2; // Npc More than twice as strong? //debug($is_villager, $npco->traits, $npco);die(); $image = @$npc_stats['img']; $image_path = null; if ($image && file_exists(SERVER_ROOT . 'www/images/characters/' . $image)) {