public static function ability_function_overdrive($objects, $shot_text = 'energy', $damage_text = 'damaged', $recovery_text = 'recovered') { // Extract all objects into the current scope extract($objects); // Decrease this robot's weapon energy to zero $this_robot->set_weapons(0); // Target the opposing robot $this_ability->target_options_update(array('kickback' => array(-5, 0, 0), 'frame' => 'defend', 'success' => array(0, 15, 45, 10, $this_robot->print_name() . ' uses the ' . $this_ability->print_name() . '!'))); $this_robot->trigger_target($target_robot, $this_ability); // Define this ability's attachment token $crest_attachment_token = 'ability_' . $this_ability->ability_token; $crest_attachment_info = array('class' => 'ability', 'sticky' => true, 'ability_id' => $this_ability->ability_id, 'ability_token' => $this_ability->ability_token, 'ability_image' => $this_ability->ability_token, 'ability_frame' => 0, 'ability_frame_animate' => array(1, 2), 'ability_frame_offset' => array('x' => 20, 'y' => 50, 'z' => 10), 'ability_frame_classes' => ' ', 'ability_frame_styles' => ' '); // Add the ability crest attachment $this_robot->set_frame('summon'); $this_robot->set_attachment($crest_attachment_token, $crest_attachment_info); // Define this ability's attachment token $overlay_attachment_token = 'system_fullscreen-black'; $overlay_attachment_info = array('class' => 'ability', 'sticky' => true, 'ability_id' => $this_ability->ability_id, 'ability_token' => $this_ability->ability_token, 'ability_image' => 'fullscreen-black', 'ability_frame' => 0, 'ability_frame_animate' => array(0, 1), 'ability_frame_offset' => array('x' => 0, 'y' => 0, 'z' => -12), 'ability_frame_classes' => 'sprite_fullscreen '); // Add the black overlay attachment $target_robot->set_attachment($overlay_attachment_token, $overlay_attachment_info); // prepare the ability options $this_ability->damage_options_update(array('kind' => 'energy', 'kickback' => array(20, 0, 0), 'success' => array(3, -60, -15, 10, 'A powerful ' . ($shot_text != 'energy' ? $shot_text . ' energy' : 'energy') . ' shot ' . $damage_text . ' ' . $target_robot->print_name() . '!'), 'failure' => array(3, -110, -15, -10, 'The ' . $this_ability->print_name() . ' shot missed ' . $target_robot->print_name() . '…'))); $this_ability->recovery_options_update(array('kind' => 'energy', 'frame' => 'taunt', 'kickback' => array(20, 0, 0), 'success' => array(3, -60, -15, 10, 'The ' . ($shot_text != 'energy' ? $shot_text . ' energy' : 'energy') . ' shot ' . $recovery_text . ' ' . $target_robot->print_name() . '!'), 'failure' => array(3, -110, -15, -10, 'The ' . $this_ability->print_name() . ' shot missed ' . $target_robot->print_name() . '…'))); // Inflict damage on the opposing robot $energy_damage_amount = $this_ability->ability_damage; $target_robot->trigger_damage($this_robot, $this_ability, $energy_damage_amount, false); // Remove the black overlay attachment $target_robot->unset_attachment($overlay_attachment_token); // Loop through the target's benched robots, inflicting half base damage to each $backup_robots_active = $target_player->values['robots_active']; foreach ($backup_robots_active as $key => $info) { if ($info['robot_id'] == $target_robot->robot_id) { continue; } $this_ability->ability_results_reset(); $temp_target_robot = new rpg_robot($target_player, $info); // Add the black overlay attachment $overlay_attachment_info['ability_frame_offset']['z'] -= 2; $temp_target_robot->set_attachment($overlay_attachment_token, $overlay_attachment_info); // Update the ability options $this_ability->damage_options_update(array('kind' => 'energy', 'kickback' => array(20, 0, 0), 'success' => array(3, -60, -15, 10, 'A powerful ' . ($shot_text != 'energy' ? $shot_text . ' energy' : 'energy') . ' shot ' . $damage_text . ' ' . $temp_target_robot->print_name() . '!'), 'failure' => array(3, -110, -15, -10, 'The ' . $this_ability->print_name() . ' shot missed ' . $temp_target_robot->print_name() . '…'))); $this_ability->recovery_options_update(array('kind' => 'energy', 'frame' => 'taunt', 'kickback' => array(20, 0, 0), 'success' => array(3, -60, -15, 10, 'The ' . ($shot_text != 'energy' ? $shot_text . ' energy' : 'energy') . ' shot ' . $recovery_text . ' ' . $temp_target_robot->print_name() . '!'), 'failure' => array(3, -110, -15, -10, 'The ' . $this_ability->print_name() . ' shot missed ' . $temp_target_robot->print_name() . '…'))); //$energy_damage_amount = ceil($this_ability->ability_damage / $target_robots_active); $energy_damage_amount = $this_ability->ability_damage; $temp_target_robot->trigger_damage($this_robot, $this_ability, $energy_damage_amount, false); $temp_target_robot->unset_attachment($overlay_attachment_token); } // Remove the black background attachment $this_robot->set_frame('base'); $this_robot->unset_attachment($crest_attachment_token); // Trigger the disabled event on the targets now if necessary if ($target_robot->robot_energy <= 0 || $target_robot->robot_status == 'disabled') { $target_robot->trigger_disabled($this_robot, $this_ability); } foreach ($backup_robots_active as $key => $info) { if ($info['robot_id'] == $target_robot->robot_id) { continue; } $temp_target_robot = new rpg_robot($target_player, $info); if ($temp_target_robot->robot_energy <= 0 || $temp_target_robot->robot_status == 'disabled') { $temp_target_robot->trigger_disabled($this_robot, $this_ability); } } // Return true on success return true; }