Exemple #1
0
 //header('Content-type: text/plain');
 //echo('action start'.PHP_EOL);
 // Define the battle's turn counter and start at 0
 $this_battle->set_counter('battle_turn', 0);
 //echo 'battle_turn = '.$this_battle->get_counter('battle_turn').PHP_EOL;
 $this_battle->increase_counter('battle_turn', 1);
 //echo 'battle_turn = '.$this_battle->get_counter('battle_turn').PHP_EOL;
 //exit('action end'.PHP_EOL);
 // Collect the base point and zenny rewards for this battle
 $target_turns_base = !empty($this_battle->battle_turns_limit) ? $this_battle->battle_turns_limit : 0;
 $target_robots_base = !empty($this_battle->battle_robots_limit) ? $this_battle->battle_robots_limit : 0;
 $reward_points_base = !empty($this_battle->battle_rewards_points) ? number_format($this_battle->battle_rewards_points, 0, '.', ',') : 0;
 $reward_zenny_base = !empty($this_battle->battle_rewards_zenny) ? number_format($this_battle->battle_rewards_zenny, 0, '.', ',') : 0;
 // Define the first event body markup, regardless of player type
 $first_event_header = $this_battle->get_name() . ' <span class="pipe">|</span> ' . $this_field->get_name();
 $first_event_body = $this_battle->get_description() . '<br />';
 $first_event_body .= 'Target : ' . ($this_battle->battle_turns_limit == 1 ? '1 Turn' : $target_turns_base . ' Turns') . ' with ' . ($this_battle->battle_robots_limit == 1 ? '1 Robot' : $target_robots_base . ' Robots');
 $first_event_body .= ' <span class="pipe">|</span> ';
 $first_event_body .= 'Reward : ' . ($this_battle->battle_rewards_points == 1 ? '1 Point' : $reward_points_base . ' Points') . ' and ' . ($this_battle->battle_rewards_zenny == 1 ? '1 Zenny' : $reward_zenny_base . ' Zenny');
 $first_event_body .= ' <br /> ';
 // Update the summon counts for all this player's robots
 foreach ($this_player->values['robots_active'] as $key => $info) {
     if (!isset($_SESSION['GAME']['values']['robot_database'][$info['robot_token']])) {
         $_SESSION['GAME']['values']['robot_database'][$info['robot_token']] = array('robot_token' => $info['robot_token']);
     }
     if (!isset($_SESSION['GAME']['values']['robot_database'][$info['robot_token']]['robot_summoned'])) {
         $_SESSION['GAME']['values']['robot_database'][$info['robot_token']]['robot_summoned'] = 0;
     }
     $_SESSION['GAME']['values']['robot_database'][$info['robot_token']]['robot_summoned'] += 1;
 }
 // Update the encounter counts for all target player's robots