die; } // Template vars. $display_sight_table = $generic_skill_result_message = $generic_state_change = $killed_target = $loot = $added_bounty = $bounty = $suicided = $destealthed = null; //Get filtered info from input. $target = in('target'); $command = in('command'); $stealth = in('stealth'); $skillListObj = new Skill(); $poisonMaximum = 100; // *** Before level-based addition. $poisonMinimum = 1; $poisonTurnCost = $skillListObj->getTurnCost('poison touch'); // wut $turn_cost = $skillListObj->getTurnCost(strtolower($command)); $ignores_stealth = $skillListObj->getIgnoreStealth($command); $self_use = $skillListObj->getSelfUse($command); $use_on_target = $skillListObj->getUsableOnTarget($command); $ki_cost = 0; // Ki taken during use. $reuse = true; // Able to reuse the skill. $today = date("F j, Y, g:i a"); // Check whether the user actually has the needed skill. $has_skill = $skillListObj->hasSkill($command); $starting_turn_cost = $turn_cost; assert($turn_cost >= 0); $turns_to_take = null; // *** Even on failure take at least one turn. $char_id = self_char_id(); $player = new Player($char_id);
$simultaneousKill = NULL; // *** Not simultaneous by default. *** $stealthAttackDamage = $attacker_str; $turns_to_take = null; // *** Even on failure take at least one turn. *** $attack_type = 'attack'; // *** Default attack category type is single attack. *** if ($blaze) { $attack_type = 'blaze'; } elseif ($deflect) { $attack_type = 'deflect'; } elseif ($duel) { $attack_type = 'duel'; } $skillListObj = new Skill(); $ignores_stealth = $skillListObj->getIgnoreStealth($attack_type); $required_turns = $skillListObj->getTurnCost($attack_type); // *** Attack Legal section *** $attacker = $username; $params = array('required_turns' => $required_turns, 'ignores_stealth' => $ignores_stealth); assert($attacker != $target); $AttackLegal = new AttackLegal($attacker, $target, $params); // *** There's a same-domain problem with this attack-legal now that it's been modified for skills *** // *** MAIN BATTLE ALGORITHM *** if (!$AttackLegal->check()) { // *** Display the reason the attack failed. echo "<div class='ninja-error centered'>" . $AttackLegal->getError() . "</div>"; } else { // *** ATTACKING + STEALTHED SECTION *** if (!$duel && $attacker_status['Stealth']) { //Not dueling, and attacking from stealth
} if ($evade) { $attack_type['evade'] = 'evade'; } if ($duel) { $attack_type['duel'] = 'duel'; } else { $attack_type['attack'] = 'attack'; } $target_player = new Player($target); $attacking_player = new Player(self_char_id()); $attacker = $attacking_player->name(); $skillListObj = new Skill(); $ignores_stealth = false; foreach ($attack_type as $type) { $ignores_stealth = $ignores_stealth || $skillListObj->getIgnoreStealth($type); $required_turns += $skillListObj->getTurnCost($type); } // *** Attack Legal section *** $params = array('required_turns' => $required_turns, 'ignores_stealth' => $ignores_stealth); $attack_legal = new AttackLegal($attacking_player, $target_player, $params); $attack_is_legal = $attack_legal->check(); $attack_error = $attack_legal->getError(); // *** MAIN BATTLE ALGORITHM *** if ($attack_is_legal) { // *** Target's stats. *** $target_health = $target_player->health; $target_level = $target_player->level; $target_str = $target_player->getStrength(); // *** Attacker's stats. *** $attacker_health = $attacking_player->health;