Beispiel #1
0
     // Determine how much weapon energy this should take
     $temp_ability_energy = $active_target_robot->calculate_weapon_energy($temp_ability);
     // If this robot does not have enough energy for the move, remove it
     if ($active_target_robot->robot_weapons < $temp_ability_energy) {
         unset($active_target_robot->robot_abilities[$key]);
         continue;
     }
 }
 // If there are no abilities left to use, the robot will automatically enter a recharge state
 if (empty($active_target_robot->robot_abilities)) {
     $active_target_robot->robot_abilities[] = 'action-noweapons';
 }
 // Update the robot's session with ability changes
 $active_target_robot->update_session();
 // Collect the ability choice from the robot
 $temp_token = $active_target_robot->robot_choices_abilities($this_player, $this_robot);
 $temp_id = array_search($temp_token, $active_target_robot->robot_abilities);
 if (empty($temp_id)) {
     $temp_id = $temp_abilities_index[$temp_token]['ability_id'];
 }
 $target_action_token = $temp_id . '_' . $temp_token;
 // Put the rest of the abilities back into the robot (in case it can use next turn)
 $active_target_robot->robot_abilities = $temp_abilities_backup;
 $active_target_robot->update_session();
 // Now that we're done selecting an ability, reset to normal
 $active_target_robot->robot_abilities = $temp_active_target_robot_abilities;
 $active_target_robot->update_session();
 // DEBUG
 if (empty($this_robot)) {
     die('<pre>$this_robot is empty on line ' . __LINE__ . '! :' . print_r($this_robot, true) . '</pre>');
 } elseif (empty($target_robot)) {