// Sanitize the ability description and quote texts
 if (isset($form_data['ability_description'])) {
     $form_data['ability_description'] = trim(preg_replace('/\\s+/', ' ', strip_tags($form_data['ability_description'])));
 }
 if (isset($form_data['ability_description2'])) {
     $form_data['ability_description2'] = trim(preg_replace('/\\s+/', ' ', strip_tags($form_data['ability_description2'])));
 }
 // Trim the ability load, trigger, and effect function file names and encode their argument data
 $temp_func_types = array('load', 'trigger', 'effect');
 foreach ($temp_func_types as $type) {
     //echo('<pre>$type = '.print_r($type, true).'</pre>');
     if (isset($form_data['ability_' . $type . '_function'])) {
         $form_data['ability_' . $type . '_function'] = !empty($form_data['ability_' . $type . '_function']) ? trim($form_data['ability_' . $type . '_function']) : '';
         if (!empty($form_data['ability_' . $type . '_function']) && isset($form_data['ability_' . $type . '_arguments'])) {
             $temp_path = $form_data['ability_' . $type . '_function'];
             $temp_meta = rpg_functions::parse_action_meta($temp_path);
             $temp_raw_args = !empty($form_data['ability_' . $type . '_arguments']) ? $form_data['ability_' . $type . '_arguments'] : array();
             $temp_clean_args = array();
             if (!empty($temp_meta['arguments'])) {
                 foreach ($temp_meta['arguments'] as $key => $arg) {
                     $token = $arg['token'];
                     $default = $arg['default'];
                     if (isset($temp_raw_args[$token])) {
                         $value = $temp_raw_args[$token];
                         switch ($arg['datatype']) {
                             case 'bool':
                             case 'boolean':
                                 $value = $value ? 1 : 0;
                                 break;
                             case 'int':
                             case 'integer':
Example #2
0
        ?>
 Defeats</span>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <?php 
        $temp_player_data = ob_get_clean();
        $temp_canvas_markup = '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/prototype-complete/battle-field_background_base.gif?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -50px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto;">Prototype Complete</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/prototype-complete/battle-field_foreground_base.png?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -45px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto;">Prototype Complete</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_02" style="background-image: url(images/sprites/players/dr-cossack/sprite_left_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; left: 200px;">Dr. Cossack</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_02" style="background-image: url(images/sprites/robots/proto-man/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; right: 200px;">Proto Man</div>';
        $temp_console_markup = '<p><strong>Congratulations, ' . (!empty($_SESSION[$session_token]['USER']['displayname']) ? $_SESSION[$session_token]['USER']['displayname'] : $_SESSION[$session_token]['USER']['username']) . '!</strong>  You\'ve completed the <strong>Mega Man RPG World</strong> using <strong>Dr. Cossack</strong> and <strong>Proto Man</strong>! ' . rpg_functions::get_random_victory_quote() . '! Your completion records are as follows :</p>';
        $temp_console_markup .= '<div id="console" style="width: auto; height: auto;"><div class="extra"><div class="extra2">' . preg_replace('/\\s+/', ' ', $temp_player_data) . '</div></div></div>';
        array_push($_SESSION[$session_token]['EVENTS'], array('canvas_markup' => $temp_canvas_markup, 'console_markup' => $temp_console_markup));
        $temp_canvas_markup = '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/final-destination-3/battle-field_background_base.gif?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -32px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto; opacity: 0.2; filter: alpha(opacity=20); ">Prototype Complete</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/final-destination-3/battle-field_foreground_base.png?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -45px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto;">Prototype Complete</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_01" style="background-image: url(images/sprites/players/dr-cossack/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; left: 150px;">Dr. Cossack</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_00" style="background-image: url(images/sprites/abilities/item-star-fusion-1/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 52px; left: 248px;">Field Star</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_00" style="background-image: url(images/sprites/abilities/item-star-base-1/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 52px; left: 248px;">Field Star</div>';
        $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_01" style="background-image: url(images/sprites/robots/proto-man/sprite_left_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; right: 150px;">Proto Man</div>';
        $temp_console_markup = '<p>As thanks for playing to the end, <strong>Dr. Cossack</strong>\'s campaign has been upgraded with several new features and mechanics to keep things interesting while you replay missions.</p>';
        $temp_console_markup .= '<p>Two new bonus chapters containing special missions have been added to the main menu, and preview data for future robot masters will now appear in all fusion field missions. Try one of the <strong>Player Battles</strong> against another member\'s ghost data for a real challenge!</p>';
        $temp_console_markup .= '<p>A new <strong>Starforce</strong> mechanic has also been unlocked, allowing you to find and collect powerful <strong>Field Stars</strong> and <strong>Fusion Stars</strong> in battle that boost your robots\' elemental abilities.  Use the newly upgraded <strong>Player Editor</strong> to customize missions and share fields between players - doing so is an excellent way to hunt down extra <strong>Starforce</strong> energy.</p>';
        $temp_console_markup .= '<p>We hope you enjoyed this game prototype, and look forward to the final version some day!  Oh, and <a href="' . MMRPG_CONFIG_ROOTURL . 'contact/" target="_blank">please leave feedback</a> if you can! We love feedback! :D</p>';
        array_push($_SESSION[$session_token]['EVENTS'], array('canvas_markup' => $temp_canvas_markup, 'console_markup' => $temp_console_markup));
    }
}
 public static function generate_double($this_prototype_data, $this_robot_tokens, $this_field_tokens, $this_start_level = 1, $this_unlock_robots = true, $this_unlock_abilities = true)
 {
     // Pull in global variables for this function
     global $mmrpg_index, $db, $this_omega_factors_one, $this_omega_factors_two, $this_omega_factors_three, $this_omega_factors_four, $this_omega_factors_five, $this_omega_factors_six, $this_omega_factors_seven, $this_omega_factors_eight, $this_omega_factors_nine;
     // Collect the robot index for calculation purposes
     $this_robot_index = rpg_robot::get_index();
     $this_field_index = rpg_field::get_index();
     // Define the array to hold this omega battle and populate with base varaibles
     $this_robot_token = $this_robot_tokens[0];
     $this_robot_token2 = $this_robot_tokens[1];
     $temp_option_battle = array();
     $temp_option_battle2 = array();
     $temp_option_robot = is_array($this_robot_tokens[0]) ? $this_robot_tokens[0] : array('robot_token' => $this_robot_tokens[0]);
     $temp_option_robot2 = is_array($this_robot_tokens[1]) ? $this_robot_tokens[1] : array('robot_token' => $this_robot_tokens[1]);
     $temp_option_field = rpg_field::parse_index_info($this_field_index[$this_field_tokens[0]]);
     $temp_option_field2 = rpg_field::parse_index_info($this_field_index[$this_field_tokens[1]]);
     $temp_battle_omega = array();
     $temp_battle_omega['flags']['double_battle'] = true;
     $temp_battle_omega['values']['double_battle_masters'] = $this_robot_tokens;
     $temp_option_battle['battle_size'] = '1x2';
     $temp_option_battle['battle_name'] = 'Chapter Four Fusion Battle';
     $temp_option_battle['battle_token'] = $this_prototype_data['phase_battle_token'] . '-' . str_replace('-man', '', $this_robot_tokens[0]) . '-' . str_replace('-man', '', $this_robot_tokens[1]);
     $temp_option_battle['battle_phase'] = $this_prototype_data['battle_phase'];
     $temp_option_battle['battle_field_info']['field_token'] = $temp_option_field['field_token'];
     $temp_option_battle['battle_field_info']['field_name'] = preg_replace('/^([-_a-z0-9\\s]+)\\s+([-_a-z0-9]+)$/i', '$1', $temp_option_field['field_name']) . ' ' . preg_replace('/^([-_a-z0-9\\s]+)\\s+([-_a-z0-9]+)$/i', '$2', $temp_option_field2['field_name']);
     $temp_option_battle['battle_field_info']['field_type'] = !empty($temp_option_field['field_type']) ? $temp_option_field['field_type'] : '';
     $temp_option_battle['battle_field_info']['field_type2'] = !empty($temp_option_field2['field_type']) ? $temp_option_field2['field_type'] : '';
     $temp_option_battle['battle_field_info']['field_music'] = $temp_option_field2['field_token'];
     $temp_option_battle['battle_field_info']['field_foreground'] = $temp_option_field2['field_foreground'];
     $temp_option_battle['battle_field_info']['field_foreground_attachments'] = $temp_option_field2['field_foreground_attachments'];
     $temp_option_battle['battle_field_info']['field_background'] = $temp_option_field['field_background'];
     $temp_option_battle['battle_field_info']['field_background_attachments'] = $temp_option_field['field_background_attachments'];
     $temp_option_multipliers = array();
     $temp_option_field_list = array($temp_option_field, $temp_option_field2);
     foreach ($temp_option_field_list as $temp_field) {
         if (!empty($temp_field['field_multipliers'])) {
             foreach ($temp_field['field_multipliers'] as $temp_type => $temp_multiplier) {
                 if (!isset($temp_option_multipliers[$temp_type])) {
                     $temp_option_multipliers[$temp_type] = $temp_multiplier;
                 } else {
                     $temp_option_multipliers[$temp_type] = $temp_option_multipliers[$temp_type] * $temp_multiplier;
                 }
             }
         }
     }
     $temp_option_battle['battle_field_info']['field_multipliers'] = $temp_option_multipliers;
     $temp_option_battle['battle_target_player']['player_id'] = MMRPG_SETTINGS_TARGET_PLAYERID;
     $temp_option_battle['battle_target_player']['player_token'] = 'player';
     $temp_option_battle['battle_target_player']['player_robots'] = array();
     //array_merge($temp_option_battle['battle_target_player']['player_robots'], $temp_option_battle2['battle_target_player']['player_robots']);
     $temp_option_battle['battle_target_player']['player_robots'][0] = array('robot_id' => MMRPG_SETTINGS_TARGET_PLAYERID + 1, 'robot_token' => $this_robot_token);
     $temp_option_battle['battle_target_player']['player_robots'][1] = array('robot_id' => MMRPG_SETTINGS_TARGET_PLAYERID + 2, 'robot_token' => $this_robot_token2);
     //shuffle($temp_option_battle['battle_target_player']['player_robots']);
     $temp_option_battle['battle_complete'] = false;
     $temp_option_completed = rpg_prototype::battle_complete($this_prototype_data['this_player_token'], $temp_option_battle['battle_token']);
     if ($temp_option_completed) {
         $temp_option_battle['battle_complete'] = $temp_option_completed;
     }
     $temp_target_count = 4;
     $temp_ability_count = 4;
     $temp_battle_count = 0;
     if (!empty($temp_option_battle['battle_complete']['battle_count'])) {
         $temp_battle_count = $temp_option_battle['battle_complete']['battle_count'];
         $temp_target_count += $temp_battle_count;
         $temp_ability_count += $temp_battle_count;
     }
     if ($temp_target_count > 6) {
         $temp_target_count = 6;
     }
     if ($temp_ability_count > 8) {
         $temp_ability_count = 8;
     }
     // Create the quick flag to check if battle is complete
     $temp_battle_complete = !empty($temp_option_battle['battle_complete']) ? true : false;
     // Check to see if this robot master has been unlocked already
     $temp_master_unlocked = rpg_game::robot_unlocked('', $this_robot_token) ? true : false;
     $temp_master_unlocked2 = rpg_game::robot_unlocked('', $this_robot_token2) ? true : false;
     // Create a quick flah to check if the prototype is complete
     $temp_prototype_complete = !empty($this_prototype_data['prototype_complete']) ? true : false;
     // Define the fusion star token in case we need to test for it
     $temp_field_star_token = preg_replace('/^([-_a-z0-9\\s]+)-([-_a-z0-9]+)$/i', '$1', $temp_option_field['field_token']) . '-' . preg_replace('/^([-_a-z0-9\\s]+)-([-_a-z0-9]+)$/i', '$2', $temp_option_field2['field_token']);
     $temp_field_star_present = $this_prototype_data['prototype_complete'] && empty($_SESSION['GAME']['values']['battle_stars'][$temp_field_star_token]) ? true : false;
     // Define both the starforce and darkness battles to false
     $temp_darkness_battle = false;
     $temp_starforce_battle = false;
     // If the prototype is complete, this can be a starforce battle
     if ($temp_prototype_complete && $temp_field_star_present) {
         $temp_starforce_battle = true;
     }
     // If the prototype and battle are complete plus robot unlocked, this can be a darkness battle
     if ($temp_prototype_complete && $temp_battle_complete && $temp_master_unlocked && $temp_master_unlocked2) {
         // Only make this a darkness battle on a random chance and only if there isn't a star present
         if (!$temp_field_star_present && mt_rand(0, 3) == 0) {
             $temp_darkness_battle = true;
             $temp_starforce_battle = false;
         }
     }
     // If a fusion star is preent on the field, fill the empty spots with like-typed robots
     if ($temp_starforce_battle) {
         $temp_option_battle['battle_target_player']['player_switch'] = 2;
         $temp_robot_tokens = array();
         $temp_robot_tokens[] = $temp_option_battle['battle_target_player']['player_robots'][0]['robot_token'];
         $temp_robot_tokens[] = $temp_option_battle['battle_target_player']['player_robots'][1]['robot_token'];
         // Collect factors based on player
         if ($this_prototype_data['this_player_token'] == 'dr-light') {
             $temp_factors_list = array($this_omega_factors_one, array_merge($this_omega_factors_two, $this_omega_factors_three, $this_omega_factors_four, $this_omega_factors_five, $this_omega_factors_six, $this_omega_factors_seven, $this_omega_factors_eight, $this_omega_factors_nine));
         } elseif ($this_prototype_data['this_player_token'] == 'dr-wily') {
             $temp_factors_list = array($this_omega_factors_two, array_merge($this_omega_factors_three, $this_omega_factors_four, $this_omega_factors_five, $this_omega_factors_six, $this_omega_factors_seven, $this_omega_factors_eight, $this_omega_factors_nine, $this_omega_factors_one));
         } elseif ($this_prototype_data['this_player_token'] == 'dr-cossack') {
             $temp_factors_list = array($this_omega_factors_three, array_merge($this_omega_factors_four, $this_omega_factors_five, $this_omega_factors_six, $this_omega_factors_seven, $this_omega_factors_eight, $this_omega_factors_nine, $this_omega_factors_one, $this_omega_factors_two));
         }
         // Shuffle the bonus robots section of the list
         shuffle($temp_factors_list[1]);
         //$debug_backup = 'initial:count = '.count($temp_option_battle['battle_target_player']['player_robots']).' // ';
         // Loop through and add the robots
         $temp_counter = 0;
         foreach ($temp_factors_list as $this_list) {
             shuffle($this_list);
             foreach ($this_list as $this_factor) {
                 if (empty($this_factor['robot'])) {
                     continue;
                 }
                 $bonus_robot_index = $this_robot_index[$this_factor['robot']];
                 if (!isset($bonus_robot_index['robot_core'])) {
                     $bonus_robot_index['robot_core'] = '';
                 }
                 if ($bonus_robot_index['robot_core'] == $temp_option_field['field_type'] || $bonus_robot_index['robot_core'] == $temp_option_field2['field_type']) {
                     if (!in_array($bonus_robot_index['robot_token'], $temp_robot_tokens)) {
                         $bonus_robot_info = array();
                         $bonus_robot_info['flags']['hide_from_mission_select'] = true;
                         $bonus_robot_info['robot_token'] = $bonus_robot_index['robot_token'];
                         $bonus_robot_info['robot_class'] = $bonus_robot_index['robot_class'];
                         $temp_option_battle['battle_target_player']['player_robots'][] = $bonus_robot_info;
                         $temp_robot_tokens[] = $bonus_robot_info['robot_token'];
                     }
                 }
             }
         }
         //$debug_backup .= 'before:count = '.count($temp_option_battle['battle_target_player']['player_robots']).' // ';
         $temp_slice_limit = 4;
         //2 + $temp_option_battle['battle_complete']['battle_count'];
         //if ($temp_slice_limit >= (MMRPG_SETTINGS_BATTLEROBOTS_PERSIDE_MAX / 2)){ $temp_slice_limit = (MMRPG_SETTINGS_BATTLEROBOTS_PERSIDE_MAX / 2); }
         //elseif ($temp_slice_limit >= MMRPG_SETTINGS_BATTLEROBOTS_PERSIDE_MAX){ $temp_slice_limit = 8; }
         $temp_option_battle['battle_target_player']['player_robots'] = array_slice($temp_option_battle['battle_target_player']['player_robots'], 0, $temp_slice_limit);
         shuffle($temp_option_battle['battle_target_player']['player_robots']);
         //$debug_backup .= 'after:count = '.count($temp_option_battle['battle_target_player']['player_robots']).' // ';
     }
     // Define the omega variables for level, points, turns, and random encounter rate
     $omega_robot_level_max = $this_start_level + 3;
     $omega_robot_level = $this_start_level + (!empty($this_prototype_data['battles_complete']) ? ($this_prototype_data['battles_complete'] - 10) * 1 : 0);
     if ($omega_robot_level >= $omega_robot_level_max) {
         $omega_robot_level = $omega_robot_level_max;
     }
     $omega_random_encounter = false;
     // Define the battle rewards based on above data
     $temp_battle_omega['battle_rewards_robots'] = array();
     $temp_battle_omega['battle_rewards_abilities'] = array();
     if (!$temp_master_unlocked) {
         $temp_battle_omega['battle_rewards_robots'][] = array('token' => $this_robot_token);
     }
     if (!empty($temp_option_robot['robot_rewards']['abilities'])) {
         foreach ($temp_option_robot['robot_rewards']['abilities'] as $key => $info) {
             if ($info['token'] == 'buster-shot' || $info['level'] > $omega_robot_level) {
                 continue;
             }
             if (!rpg_game::ability_unlocked('', '', $info['token'])) {
                 $temp_battle_omega['battle_rewards_abilities'][] = $info;
             }
         }
     }
     if (!$temp_master_unlocked2) {
         $temp_battle_omega['battle_rewards_robots'][] = array('token' => $this_robot_token2);
     }
     if (!empty($temp_option_robot2['robot_rewards']['abilities'])) {
         foreach ($temp_option_robot2['robot_rewards']['abilities'] as $key => $info) {
             if ($info['token'] == 'buster-shot' || $info['level'] > $omega_robot_level) {
                 continue;
             }
             if (!rpg_game::ability_unlocked('', '', $info['token'])) {
                 $temp_battle_omega['battle_rewards_abilities'][] = $info;
             }
         }
     }
     // Fill the empty spots with minor enemy robots
     if (true) {
         $temp_option_battle['battle_target_player']['player_switch'] = 2.0;
         $bonus_robot_count = $temp_target_count;
         $temp_mook_options = array();
         $temp_mook_letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H');
         $temp_mook_counts = array();
         if (!isset($temp_option_field['field_mechas'])) {
             $temp_option_field['field_mechas'] = array();
         }
         if (!isset($temp_option_field2['field_mechas'])) {
             $temp_option_field2['field_mechas'] = array();
         }
         for ($key = 0; $key < count($temp_option_field['field_mechas']); $key++) {
             if (!empty($temp_option_field['field_mechas'][$key])) {
                 $temp_mook_options[] = $temp_option_field['field_mechas'][$key];
             }
             if (!empty($temp_option_field2['field_mechas'][$key])) {
                 $temp_mook_options[] = $temp_option_field2['field_mechas'][$key];
             }
         }
         $temp_mook_weights = array();
         $temp_mook_maxchance = count($temp_mook_options) * 30;
         foreach ($temp_mook_options as $key => $token) {
             $temp_mook_weights[] = $temp_mook_maxchance - $key * 15;
         }
         $temp_mook_options = array_slice($temp_mook_options, 0, $temp_battle_count + 1);
         $temp_battle_omega['battle_field_info']['field_mechas'] = $temp_mook_options;
         if ($temp_darkness_battle) {
             $temp_battle_omega['battle_field_info']['field_mechas'] = array('dark-frag');
         }
         $mt_rand = mt_rand(1, 4);
         // Allow mets to randomly show up in other battles at a low rate
         if (!empty($temp_battle_omega['battle_complete']) && !in_array('met', $temp_mook_options)) {
             $temp_mook_options[] = 'met';
             $temp_mook_weights[] = 5;
         }
         // Loop through the allowed bonus robot count placing random mooks
         $temp_base_robot_count = count($temp_option_battle['battle_target_player']['player_robots']);
         for ($i = 0; $i < MMRPG_SETTINGS_BATTLEROBOTS_PERSIDE_MAX; $i++) {
             $temp_count_target_robots = count($temp_option_battle['battle_target_player']['player_robots']);
             if ($temp_count_target_robots >= $bonus_robot_count) {
                 break;
             } elseif ($temp_count_target_robots >= MMRPG_SETTINGS_BATTLEROBOTS_PERSIDE_MAX) {
                 break;
             }
             if ($temp_darkness_battle) {
                 $temp_mook_token = 'dark-frag';
             } else {
                 $temp_mook_token = rpg_functions::weighted_chance($temp_mook_options, $temp_mook_weights);
             }
             $temp_mook_info = rpg_robot::parse_index_info($this_robot_index[$temp_mook_token]);
             $temp_mook_id = MMRPG_SETTINGS_TARGET_PLAYERID + $temp_count_target_robots;
             $bonus_robot_info = array('robot_token' => $temp_mook_token, 'robot_id' => $temp_mook_id, 'robot_level' => 1);
             $bonus_robot_info['robot_abilities'] = $temp_mook_info['robot_abilities'];
             $bonus_robot_info['robot_class'] = !empty($temp_mook_info['robot_class']) ? $temp_mook_info['robot_class'] : 'master';
             $bonus_robot_info['robot_name'] = $temp_mook_info['robot_name'];
             $temp_mook_name_token = str_replace(' ', '-', strtolower($bonus_robot_info['robot_name']));
             $bonus_robot_info['robot_name_token'] = $temp_mook_name_token;
             if (!isset($temp_mook_counts[$temp_mook_name_token])) {
                 $temp_mook_counts[$temp_mook_name_token] = 0;
             } else {
                 $temp_mook_counts[$temp_mook_name_token]++;
             }
             $temp_option_battle['battle_target_player']['player_robots'][] = $bonus_robot_info;
             $temp_robot_tokens[] = $bonus_robot_info['robot_token'];
         }
         // Remove the "A" from any mooks that are one of their kind
         foreach ($temp_option_battle['battle_target_player']['player_robots'] as $key => $info) {
             if (!isset($info['robot_class']) || $info['robot_class'] != 'mecha') {
                 continue;
             } elseif (!isset($temp_mook_counts[$info['robot_token']]) || $temp_mook_counts[$info['robot_token']] == 0) {
                 $temp_option_battle['battle_target_player']['player_robots'][$key]['robot_name'] = str_replace(' A', '', $info['robot_name']);
             }
         }
         // Loop through the target player robots to make final changes
         foreach ($temp_option_battle['battle_target_player']['player_robots'] as $key => $info) {
             // Collect an index of this robot
             $index = rpg_robot::parse_index_info($this_robot_index[$info['robot_token']]);
             // Default the stat reward boost to zero to prevent early difficulities
             $temp_stat_reward_boost = 0;
             // Update the robot ID to prevent collisions
             $info['robot_id'] = MMRPG_SETTINGS_TARGET_PLAYERID + $key + 1;
             // Append the appropriate letters to all the robot name tokens
             $info['robot_class'] = !empty($info['robot_class']) ? $info['robot_class'] : 'master';
             // Check to see if this is a support mecha and process changes accordingly
             if ($info['robot_class'] == 'mecha') {
                 /*
                 // Update this mecha's name with a letter if necessary
                 $temp_name_token = isset($info['robot_name_token']) ? $info['robot_name_token'] : $info['robot_token'];
                 if ($temp_mook_counts[$temp_name_token] > 0){
                   if (!isset($temp_mook_counts[$temp_name_token])){ $temp_mook_counts[$temp_name_token] = 0; }
                   else { $temp_mook_counts[$temp_name_token]++; }
                   $info['robot_name'] .= ' '.$temp_mook_letters[$temp_mook_counts[$temp_name_token]];
                 }
                 */
                 // If this is a starforce battle, boost the mechas stats appropriately
                 if ($temp_starforce_battle) {
                     $temp_stat_reward_boost = 0.5;
                 } elseif ($temp_darkness_battle) {
                     $temp_stat_reward_boost = 1.0;
                 }
             } else {
                 // If this is s starforce battle, the robot master should be boosted in an alt colour
                 if ($temp_starforce_battle) {
                     // Update the robot name, adding a delta symbol at the end
                     $info['robot_name'] = $index['robot_name'] . ' Δ';
                     $info['robot_number'] = $index['robot_number'] . 'Δ';
                     // Update the robot image for this battle to be the alt version
                     $info['robot_image'] = $info['robot_token'] . '_alt2';
                     // This robot should also have more stats than usual, so let's give 'em some
                     $temp_stat_reward_boost = 1.0;
                 } elseif ($temp_darkness_battle) {
                     // Update the robot name, adding a lower-case sigma symbol at the end
                     $info['robot_name'] = $index['robot_name'] . ' Σ';
                     $info['robot_number'] = $index['robot_number'] . 'Σ';
                     // Update the robot image for this battle to be the alt version
                     $info['robot_image'] = $info['robot_token'] . '_alt9';
                     // Update the robot's core type to empty
                     $info['robot_core'] = 'empty';
                     $info['robot_core2'] = '';
                     // Update the robot's weaknesses/resistances/etc.
                     $info['robot_weaknesses'] = array();
                     $info['robot_resistances'] = array();
                     $info['robot_affinities'] = array();
                     $info['robot_immunities'] = array();
                     //array('copy', 'crystal', 'cutter', 'earth', 'electric', 'explode', 'flame', 'freeze', 'impact', 'laser', 'missile', 'nature', 'shadow', 'shield', 'space', 'swift', 'time', 'water', 'wind');
                     // Remove all quotes so this robot doesn't speak
                     $info['robot_quotes'] = array();
                     // This robot should also have more stats than usual, so let's give 'em more
                     $temp_stat_reward_boost = 2.0;
                 }
                 // If the defined robot image does not actually exist, replace with placeholder base sprite
                 if (isset($info['robot_image']) && !file_exists(MMRPG_CONFIG_ROOTDIR . 'images/sprites/robots/' . $info['robot_image'] . '/')) {
                     $info['robot_image'] = $info['robot_token'];
                 }
             }
             // If there is a reward booster in place, generate values
             if ($temp_stat_reward_boost > 0) {
                 // This robot should also have more stats than usual, so let's give 'em some more
                 $temp_robot_rewards = array();
                 //$temp_stat_total = $index['robot_energy'] + $index['robot_attack'] + $index['robot_defense'] + $index['robot_speed'];
                 //$temp_robot_rewards['robot_energy'] = ceil(($index['robot_energy'] / $temp_stat_total) * MMRPG_SETTINGS_BATTLEROBOTS_TARGET_STATBOOST * $temp_stat_reward_boost);
                 $temp_stat_total = $index['robot_attack'] + $index['robot_defense'] + $index['robot_speed'];
                 $temp_robot_rewards['robot_attack'] = ceil($index['robot_attack'] / $temp_stat_total * MMRPG_SETTINGS_BATTLEROBOTS_TARGET_STATBOOST * $temp_stat_reward_boost);
                 $temp_robot_rewards['robot_defense'] = ceil($index['robot_defense'] / $temp_stat_total * MMRPG_SETTINGS_BATTLEROBOTS_TARGET_STATBOOST * $temp_stat_reward_boost);
                 $temp_robot_rewards['robot_speed'] = ceil($index['robot_speed'] / $temp_stat_total * MMRPG_SETTINGS_BATTLEROBOTS_TARGET_STATBOOST * $temp_stat_reward_boost);
                 $info['values']['robot_rewards'] = $temp_robot_rewards;
             }
             // Update the player robots array with recent changes
             $temp_option_battle['battle_target_player']['player_robots'][$key] = $info;
         }
     }
     // Reassign robot IDs to prevent errors
     foreach ($temp_option_battle['battle_target_player']['player_robots'] as $key => $info) {
         $temp_option_battle['battle_target_player']['player_robots'][$key]['robot_id'] = MMRPG_SETTINGS_TARGET_PLAYERID + $key + 1;
     }
     $temp_option_battle['battle_rewards_robots'] = array();
     $temp_option_battle['battle_rewards_abilities'] = array();
     $temp_battle_flags = !empty($temp_battle_omega['flags']) ? $temp_battle_omega['flags'] : array();
     $temp_battle_values = !empty($temp_battle_omega['values']) ? $temp_battle_omega['values'] : array();
     $temp_battle_counters = !empty($temp_battle_omega['counters']) ? $temp_battle_omega['counters'] : array();
     $temp_battle_omega = $temp_option_battle;
     $temp_battle_omega['flags'] = $temp_battle_flags;
     $temp_battle_omega['values'] = $temp_battle_values;
     $temp_battle_omega['counters'] = $temp_battle_counters;
     // Skip the empty battle button or a different phase
     if (empty($temp_battle_omega['battle_token']) || $temp_battle_omega['battle_token'] == 'battle' || $temp_battle_omega['battle_phase'] != $this_prototype_data['battle_phase']) {
         return false;
     }
     // Collect the battle token and create an omega clone from the index base
     $temp_battle_token = $temp_battle_omega['battle_token'];
     // If the battle was already complete, collect its details and modify the mission
     $temp_complete_level = 0;
     $temp_complete_count = 0;
     if (!empty($temp_battle_omega['battle_complete'])) {
         if (!empty($temp_battle_omega['battle_complete']['battle_min_level'])) {
             $temp_complete_level = $temp_battle_omega['battle_complete']['battle_min_level'];
         } else {
             $temp_complete_level = $omega_robot_level;
         }
         if (!empty($temp_battle_omega['battle_complete']['battle_count'])) {
             $temp_complete_count = $temp_battle_omega['battle_complete']['battle_count'];
         } else {
             $temp_complete_count = 1;
         }
         $omega_robot_level = $temp_complete_level + $temp_complete_count - 1;
         $omega_robot_level = $omega_robot_level >= 100 ? 100 : $omega_robot_level;
     }
     // If this is a starforce battle, we should double the level max
     if ($temp_starforce_battle) {
         $omega_robot_level_max = $omega_robot_level_max * 2;
         $omega_robot_level = $omega_robot_level * 2;
     } elseif ($temp_darkness_battle) {
         $omega_robot_level_max = $omega_robot_level_max * 3;
         $omega_robot_level = $omega_robot_level * 3;
     }
     // Define the battle difficulty level (0 - 8) based on level and completed count
     $temp_battle_difficulty = ceil(8 * ($omega_robot_level / 100));
     $temp_battle_difficulty += $temp_complete_count;
     if ($temp_battle_difficulty >= 10) {
         $temp_battle_difficulty = 10;
     }
     $temp_battle_omega['battle_difficulty'] = $temp_battle_difficulty;
     // Update the robot level for this battle
     $temp_battle_omega['battle_level'] = $omega_robot_level;
     // Start all the point-based battle vars at zero
     $temp_battle_omega['battle_points'] = 0;
     $temp_battle_omega['battle_zenny'] = 0;
     $temp_battle_omega['battle_turns_limit'] = 0;
     $temp_battle_omega['battle_robots_limit'] = 0;
     // Loop through the target robots again update with omega values
     foreach ($temp_battle_omega['battle_target_player']['player_robots'] as $key2 => $robot) {
         // Update the robot level and battle points plus turns
         if (!isset($this_robot_index[$robot['robot_token']])) {
             continue;
         }
         $temp_core_backup = !empty($robot['robot_core']) ? $robot['robot_core'] : '';
         $index = rpg_robot::parse_index_info($this_robot_index[$robot['robot_token']]);
         $robot = array_merge($index, $robot);
         if (!empty($temp_core_backup)) {
             $robot['robot_core'] = $temp_core_backup;
         }
         if (!isset($robot['robot_item'])) {
             $robot['robot_item'] = '';
         }
         $temp_opposite_type = $robot['robot_core'] != $temp_option_field['field_type'] ? $temp_option_field['field_type'] : $temp_option_field2['field_type'];
         // Increment allowable robots, points, and turns based on who's in the battle
         if ($robot['robot_class'] == 'mecha') {
             if (mt_rand(0, 6) == 0) {
                 $robot['robot_item'] = 'item-shard-' . $temp_opposite_type;
             }
             $robot['robot_level'] = mt_rand(ceil($omega_robot_level / 2), $omega_robot_level);
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_item'] = $robot['robot_item'];
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_level'] = $robot['robot_level'];
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_abilities'] = rpg_prototype::generate_abilities($robot, $omega_robot_level, ceil($temp_ability_count / 2), $robot['robot_item']);
         } elseif ($robot['robot_class'] == 'master') {
             if (mt_rand(0, 3) == 0) {
                 $robot['robot_item'] = 'item-core-' . $temp_opposite_type;
             }
             $robot['robot_level'] = $omega_robot_level;
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_item'] = $robot['robot_item'];
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_level'] = $robot['robot_level'];
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_abilities'] = rpg_prototype::generate_abilities($robot, $omega_robot_level, $temp_ability_count, $robot['robot_item']);
         } elseif ($robot['robot_class'] == 'boss') {
             $robot['robot_level'] = mt_rand($omega_robot_level, ceil($omega_robot_level * 2));
             $temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_level'] = $robot['robot_level'];
             //$temp_battle_omega['battle_target_player']['player_robots'][$key2]['robot_abilities'] = rpg_prototype::generate_abilities($robot, $omega_robot_level, floor($temp_ability_count * 2), $robot['robot_item']);
         }
         // Increment the battle's turn limit based on the class of target robot
         if ($robot['robot_class'] == 'master') {
             $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERROBOT;
         } elseif ($robot['robot_class'] == 'mecha') {
             $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERMECHA;
         } elseif ($robot['robot_class'] == 'boss') {
             $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERBOSS;
         }
         // Increment the battle's point reward based on the class of target robot
         if ($robot['robot_class'] == 'master') {
             $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERROBOT;
         } elseif ($robot['robot_class'] == 'mecha') {
             $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERMECHA;
         } elseif ($robot['robot_class'] == 'boss') {
             $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERBOSS;
         }
         // Increment the battle's zenny reward based on the class of target robot
         if ($robot['robot_class'] == 'master') {
             $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERROBOT;
         } elseif ($robot['robot_class'] == 'mecha') {
             $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERMECHA;
         } elseif ($robot['robot_class'] == 'boss') {
             $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERBOSS;
         }
         // Increment the battle's robot limit based on the class of target robot
         if ($robot['robot_class'] == 'master') {
             $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERROBOT;
         } elseif ($robot['robot_class'] == 'mecha') {
             $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERMECHA;
         } elseif ($robot['robot_class'] == 'boss') {
             $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERBOSS;
         }
     }
     // Increase expected turns if a starforce or darkness battle
     if ($temp_starforce_battle) {
         $temp_battle_omega['battle_turns_limit'] += round($temp_battle_omega['battle_turns_limit'] * 0.25);
     } elseif ($temp_darkness_battle) {
         $temp_battle_omega['battle_turns_limit'] += round($temp_battle_omega['battle_turns_limit'] * 0.5);
     }
     // Fix any zero or invalid battle values
     if ($temp_battle_omega['battle_points'] < 1) {
         $temp_battle_omega['battle_points'] = 1;
     } else {
         $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points']);
     }
     if ($temp_battle_omega['battle_turns_limit'] < 1) {
         $temp_battle_omega['battle_turns_limit'] = 1;
     } else {
         $temp_battle_omega['battle_turns_limit'] = ceil($temp_battle_omega['battle_turns_limit']);
     }
     if ($temp_battle_omega['battle_robots_limit'] < 1) {
         $temp_battle_omega['battle_robots_limit'] = 1;
     } else {
         $temp_battle_omega['battle_robots_limit'] = ceil($temp_battle_omega['battle_robots_limit']);
     }
     // Recollect the option robots
     $temp_option_robot = $this_robot_index[$temp_option_robot['robot_token']];
     $temp_option_robot2 = $this_robot_index[$temp_option_robot2['robot_token']];
     // Reverse the order of the robots in battle
     $temp_battle_omega['battle_target_player']['player_robots'] = array_reverse($temp_battle_omega['battle_target_player']['player_robots']);
     $temp_first_robot = array_shift($temp_battle_omega['battle_target_player']['player_robots']);
     shuffle($temp_battle_omega['battle_target_player']['player_robots']);
     array_unshift($temp_battle_omega['battle_target_player']['player_robots'], $temp_first_robot);
     // Empty the robot rewards array if not allowed
     if (!$this_unlock_robots) {
         $temp_battle_omega['battle_rewards_robots'] = array();
     }
     // Empty the ability rewards array if not allowed
     if (!$this_unlock_abilities) {
         $temp_battle_omega['battle_rewards_abilities'] = array();
     }
     // Define the number of abilities and robots left to unlock and start at zero
     $this_unlock_robots_count = count($temp_battle_omega['battle_rewards_robots']);
     $this_unlock_abilities_count = count($temp_battle_omega['battle_rewards_abilities']);
     // Loop through the omega battle robot rewards and update the robot levels there too
     if (!empty($temp_battle_omega['battle_rewards_robots'])) {
         foreach ($temp_battle_omega['battle_rewards_robots'] as $key2 => $robot) {
             // Update the robot level and battle points plus turns
             $temp_battle_omega['battle_rewards_robots'][$key2]['level'] = $omega_robot_level;
             // Remove if this robot is already unlocked
             if (rpg_game::robot_unlocked(false, $robot['token'])) {
                 $this_unlock_robots_count -= 1;
             }
         }
     }
     // Loop through the omega battle ability rewards and update the ability levels there too
     if (!empty($temp_battle_omega['battle_rewards_abilities'])) {
         foreach ($temp_battle_omega['battle_rewards_abilities'] as $key2 => $ability) {
             // Remove if this ability is already unlocked
             if (rpg_game::ability_unlocked($this_prototype_data['this_player_token'], false, $ability['token'])) {
                 $this_unlock_abilities_count -= 1;
             }
         }
     }
     // Check to see if we should be adding a field star to this battle
     if ($temp_starforce_battle) {
         // Generate the necessary field star variables and add them to the battle data
         $temp_field_star = array();
         $temp_field_star['star_name'] = $temp_battle_omega['battle_field_info']['field_name'];
         $temp_field_star['star_token'] = $temp_field_star_token;
         $temp_field_star['star_kind'] = 'fusion';
         $temp_field_star['star_type'] = !empty($temp_battle_omega['battle_field_info']['field_type']) ? $temp_battle_omega['battle_field_info']['field_type'] : 'none';
         $temp_field_star['star_type2'] = !empty($temp_battle_omega['battle_field_info']['field_type2']) ? $temp_battle_omega['battle_field_info']['field_type2'] : 'none';
         $temp_field_star['star_field'] = $temp_option_field['field_token'];
         $temp_field_star['star_field2'] = $temp_option_field2['field_token'];
         $temp_field_star['star_player'] = $this_prototype_data['this_player_token'];
         $temp_field_star['star_date'] = time();
         $temp_battle_omega['values']['field_star'] = $temp_field_star;
         $temp_battle_omega['battle_target_player']['player_starforce'] = array();
         if ($temp_field_star['star_type'] == $temp_field_star['star_type2']) {
             $temp_battle_omega['battle_target_player']['player_starforce'][$temp_field_star['star_type']] = 2;
         } else {
             $temp_battle_omega['battle_target_player']['player_starforce'][$temp_field_star['star_type']] = 1;
             $temp_battle_omega['battle_target_player']['player_starforce'][$temp_field_star['star_type2']] = 1;
         }
     }
     // Check to see if we should be adding darkness to this battle
     if ($temp_darkness_battle) {
         // Generate the necessary dark tower variables and add them to the battle data
         $temp_battle_omega['flags']['dark_tower'] = true;
     }
     // Update the battle description based on what we've calculated
     $temp_description_target_robots = $temp_option_robot['robot_name'] . ' and ' . $temp_option_robot2['robot_name'];
     if (!empty($this_unlock_abilities_count)) {
         $temp_battle_omega['battle_description'] = 'Defeat ' . $temp_description_target_robots . ' and download their special weapons!';
         $temp_battle_omega['battle_description2'] = 'Once we\'ve acquired them, we may be able to equip the abilities to other robots...';
     } elseif (!empty($this_unlock_robots_count)) {
         $temp_battle_omega['battle_description'] = 'Defeat ' . $temp_description_target_robots . ' and download their robot data!';
         $temp_battle_omega['battle_description2'] = 'If we use only Neutral type abilities on the targets we may be able to save them...';
     } elseif ($temp_starforce_battle) {
         $temp_battle_omega['battle_description'] = 'Defeat the starforce boosted ' . $temp_description_target_robots . ' and collect their Fusion Star! ';
         $temp_battle_omega['battle_description2'] = 'The ' . ucfirst($temp_option_field['field_type']) . ' type energy appears to have attracted more robots to the field...';
     } elseif ($temp_darkness_battle) {
         $temp_battle_omega['battle_description'] = 'Defeat the darkness boosted ' . $temp_description_target_robots . ' and destroy their Dark Tower! ';
         $temp_battle_omega['battle_description2'] = 'The negative energy appears to have attracted an army of dark elements to the field...';
     } else {
         $temp_battle_omega['battle_description'] = 'Defeat ' . $temp_description_target_robots . '!';
     }
     // If this battle has been completed already, decrease the points
     //if ($temp_battle_omega['battle_complete']){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] * 0.10); }
     // Add some random item drops to the starter battle
     $temp_battle_omega['battle_rewards_items'] = array();
     // Return the generated battle data
     return $temp_battle_omega;
 }
 /**
  * Print out array data in an easier to read format recursively
  * @param array $variable
  * @param string $base (optional)
  */
 public static function print_r_recursive($variable, $base = '/')
 {
     //if (is_array($variable)){ echo '<br /><br />'.$base;  }
     if (is_array($variable) && count($variable) > 1) {
         echo '<br /><br />' . $base;
     } elseif (is_array($variable) && count($variable) == 1) {
         echo '<br />' . $base;
     } else {
         echo $base;
     }
     if (is_bool($variable)) {
         echo ($variable == true ? 'true' : 'false') . '<br />';
     } elseif (!is_numeric($variable) && empty($variable)) {
         echo (is_array($variable) ? '=-' : '-') . '<br />';
     } elseif (!is_array($variable)) {
         echo $variable . '<br />';
     } elseif (is_array($variable)) {
         echo '=<br />';
         foreach ($variable as $key => $value) {
             echo rpg_functions::print_r_recursive($value, $base . $key . '/');
         }
         if (is_array($variable) && count($variable) > 1) {
             echo '<br />';
         }
     }
 }
 public function get_canvas_markup($options, $player_data, $robot_data)
 {
     // Define the variable to hold the console robot data
     $this_data = array();
     // Define the ability data array and populate basic data
     $this_data['ability_markup'] = '';
     $this_data['data_sticky'] = isset($options['sticky']) ? $options['sticky'] : false;
     $this_data['data_type'] = !empty($options['data_type']) ? $options['data_type'] : 'ability';
     $this_data['data_debug'] = !empty($options['data_debug']) ? $options['data_debug'] : '';
     $this_data['ability_name'] = isset($options['ability_name']) ? $options['ability_name'] : $this->ability_name;
     $this_data['ability_id'] = $this->ability_id;
     $this_data['ability_title'] = $this->ability_name;
     $this_data['ability_token'] = $this->ability_token;
     $this_data['ability_id_token'] = $this->ability_id . '_' . $this->ability_token;
     $this_data['ability_image'] = isset($options['ability_image']) ? $options['ability_image'] : $this->ability_image;
     $this_data['ability_status'] = $robot_data['robot_status'];
     $this_data['ability_position'] = $robot_data['robot_position'];
     $this_data['robot_id_token'] = $robot_data['robot_id'] . '_' . $robot_data['robot_token'];
     $this_data['ability_direction'] = $this->robot_id == $robot_data['robot_id'] ? $robot_data['robot_direction'] : ($robot_data['robot_direction'] == 'left' ? 'right' : 'left');
     $this_data['ability_float'] = $robot_data['robot_float'];
     $this_data['ability_size'] = $this_data['ability_position'] == 'active' ? $this->ability_image_size * 2 : $this->ability_image_size;
     $this_data['ability_frame'] = isset($options['ability_frame']) ? $options['ability_frame'] : $this->ability_frame;
     $this_data['ability_frame_span'] = isset($options['ability_frame_span']) ? $options['ability_frame_span'] : $this->ability_frame_span;
     $this_data['ability_frame_index'] = isset($options['ability_frame_index']) ? $options['ability_frame_index'] : $this->ability_frame_index;
     if (is_numeric($this_data['ability_frame']) && $this_data['ability_frame'] >= 0) {
         $this_data['ability_frame'] = str_pad($this_data['ability_frame'], 2, '0', STR_PAD_LEFT);
     } elseif (is_numeric($this_data['ability_frame']) && $this_data['ability_frame'] < 0) {
         $this_data['ability_frame'] = '';
     }
     //$this_data['ability_image'] = 'images/sprites/abilities/'.(!empty($this_data['ability_image']) ? $this_data['ability_image'] : $this_data['ability_token']).'/sprite_'.$this_data['ability_direction'].'_'.$this_data['ability_size'].'x'.$this_data['ability_size'].'.png?'.MMRPG_CONFIG_CACHE_DATE;
     $this_data['ability_frame_offset'] = isset($options['ability_frame_offset']) ? $options['ability_frame_offset'] : $this->ability_frame_offset;
     $animate_frames_array = isset($options['ability_frame_animate']) ? $options['ability_frame_animate'] : array($this_data['ability_frame']);
     $animate_frames_string = array();
     if (!empty($animate_frames_array)) {
         foreach ($animate_frames_array as $key => $frame) {
             $animate_frames_string[] = is_numeric($frame) ? str_pad($frame, 2, '0', STR_PAD_LEFT) : $frame;
         }
     }
     $this_data['ability_frame_animate'] = implode(',', $animate_frames_string);
     $this_data['ability_frame_styles'] = isset($options['ability_frame_styles']) ? $options['ability_frame_styles'] : $this->ability_frame_styles;
     $this_data['ability_frame_classes'] = isset($options['ability_frame_classes']) ? $options['ability_frame_classes'] : $this->ability_frame_classes;
     $this_data['ability_scale'] = isset($robot_data['robot_scale']) ? $robot_data['robot_scale'] : ($robot_data['robot_position'] == 'active' ? 1 : 0.5 + (8 - $robot_data['robot_key']) / 8 * 0.5);
     if (strstr($this_data['ability_frame_classes'], 'sprite_fullscreen')) {
         $this_data['ability_frame_styles'] = '';
         $this_data['ability_scale'] = 1;
     }
     // Calculate the rest of the sprite size variables
     $zoom_size = $this->ability_image_size * 2;
     $this_data['ability_sprite_size'] = ceil($this_data['ability_scale'] * $zoom_size);
     $this_data['ability_sprite_width'] = ceil($this_data['ability_scale'] * $zoom_size);
     $this_data['ability_sprite_height'] = ceil($this_data['ability_scale'] * $zoom_size);
     $this_data['ability_image_width'] = ceil($this_data['ability_scale'] * $zoom_size * 10);
     $this_data['ability_image_height'] = ceil($this_data['ability_scale'] * $zoom_size);
     // Calculate the canvas offset variables for this robot
     $canvas_offset_data = rpg_functions::canvas_sprite_offset($robot_data['robot_key'], $robot_data['robot_position'], $robot_data['robot_size']);
     //$this_data['canvas_offset_x'] = $temp_data['canvas_offset_x'];
     //$this_data['canvas_offset_y'] = $temp_data['canvas_offset_y'];
     //$this_data['canvas_offset_z'] = $temp_data['canvas_offset_z'];
     // Define the ability's canvas offset variables
     //$temp_size_diff = $robot_data['robot_sprite_size'] != $ability_data['ability_sprite_size'] ? ceil(($robot_data['robot_sprite_size'] - $ability_data['ability_sprite_size']) * 0.5) : ceil($ability_data['ability_sprite_size'] * 0.25);
     //$temp_size_diff = $robot_data['robot_sprite_size'] > 80 ? ceil(($robot_data['robot_sprite_size'] - 80) / 2) : 0;
     //if ($temp_size_diff > 0 && $robot_data['robot_position'] != 'active'){ $temp_size_diff += floor($this_data['ability_scale'] * $this_data['ability_sprite_size'] * 0.5); }
     $temp_size_diff = 0;
     if ($robot_data['robot_sprite_size'] != $this_data['ability_sprite_size']) {
         $temp_size_diff = ceil(($robot_data['robot_sprite_size'] - $this_data['ability_sprite_size']) / 2);
     }
     //$temp_size_diff = floor(($temp_size_diff * 2) + ($temp_size_diff * $robot_data['robot_scale']));
     // If this is a STICKY attachedment, make sure it doesn't move with the robot
     if ($this_data['data_sticky'] != false) {
         //$this_data['data_sticky'] = 'true';
         // Calculate the canvas X offsets using the robot's position as base
         if ($this_data['ability_frame_offset']['x'] > 0) {
             $this_data['canvas_offset_x'] = ceil($canvas_offset_data['canvas_offset_x'] + $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['x'] / 100)) + $temp_size_diff;
         } elseif ($this_data['ability_frame_offset']['x'] < 0) {
             $this_data['canvas_offset_x'] = ceil($canvas_offset_data['canvas_offset_x'] - $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['x'] * -1 / 100)) + $temp_size_diff;
         } else {
             $this_data['canvas_offset_x'] = $canvas_offset_data['canvas_offset_x'] + $temp_size_diff;
         }
         // Calculate the canvas Y offsets using the robot's position as base
         if ($this_data['ability_frame_offset']['y'] > 0) {
             $this_data['canvas_offset_y'] = ceil($canvas_offset_data['canvas_offset_y'] + $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['y'] / 100));
         } elseif ($this_data['ability_frame_offset']['y'] < 0) {
             $this_data['canvas_offset_y'] = ceil($canvas_offset_data['canvas_offset_y'] - $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['y'] * -1 / 100));
         } else {
             $this_data['canvas_offset_y'] = $canvas_offset_data['canvas_offset_y'];
         }
         // Calculate the canvas Z offsets using the robot's position as base
         if ($this_data['ability_frame_offset']['z'] > 0) {
             $this_data['canvas_offset_z'] = ceil($canvas_offset_data['canvas_offset_z'] + $this_data['ability_frame_offset']['z']);
         } elseif ($this_data['ability_frame_offset']['z'] < 0) {
             $this_data['canvas_offset_z'] = ceil($canvas_offset_data['canvas_offset_z'] - $this_data['ability_frame_offset']['z'] * -1);
         } else {
             $this_data['canvas_offset_z'] = $canvas_offset_data['canvas_offset_z'];
         }
         // Collect the target, damage, and recovery options
         $this_target_options = !empty($options['this_ability']->target_options) ? $options['this_ability']->target_options : array();
         $this_damage_options = !empty($options['this_ability']->damage_options) ? $options['this_ability']->damage_options : array();
         $this_recovery_options = !empty($options['this_ability']->recovery_options) ? $options['this_ability']->recovery_options : array();
         $this_results = !empty($options['this_ability']->ability_results) ? $options['this_ability']->ability_results : array();
         // Either way, apply target offsets if they exist and it's this robot using the ability
         if (isset($options['this_ability_target']) && $options['this_ability_target'] == $this_data['robot_id_token']) {
             // If any of the co-ordinates are provided, update all
             if (!empty($this_target_options['target_kickback']['x']) || !empty($this_target_options['target_kickback']['y']) || !empty($this_target_options['target_kickback']['z'])) {
                 $this_data['canvas_offset_x'] -= $this_target_options['target_kickback']['x'];
                 $this_data['canvas_offset_y'] -= $this_target_options['target_kickback']['y'];
                 $this_data['canvas_offset_z'] -= $this_target_options['target_kickback']['z'];
             }
         }
     } else {
         // Calculate the canvas X offsets using the robot's offset as base
         if ($this_data['ability_frame_offset']['x'] > 0) {
             $this_data['canvas_offset_x'] = ceil($robot_data['canvas_offset_x'] + $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['x'] / 100)) + $temp_size_diff;
         } elseif ($this_data['ability_frame_offset']['x'] < 0) {
             $this_data['canvas_offset_x'] = ceil($robot_data['canvas_offset_x'] - $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['x'] * -1 / 100)) + $temp_size_diff;
         } else {
             $this_data['canvas_offset_x'] = $robot_data['canvas_offset_x'] + $temp_size_diff;
         }
         // Calculate the canvas Y offsets using the robot's offset as base
         if ($this_data['ability_frame_offset']['y'] > 0) {
             $this_data['canvas_offset_y'] = ceil($robot_data['canvas_offset_y'] + $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['y'] / 100));
         } elseif ($this_data['ability_frame_offset']['y'] < 0) {
             $this_data['canvas_offset_y'] = ceil($robot_data['canvas_offset_y'] - $this_data['ability_sprite_size'] * ($this_data['ability_frame_offset']['y'] * -1 / 100));
         } else {
             $this_data['canvas_offset_y'] = $robot_data['canvas_offset_y'];
         }
         // Calculate the canvas Z offsets using the robot's offset as base
         if ($this_data['ability_frame_offset']['z'] > 0) {
             $this_data['canvas_offset_z'] = ceil($robot_data['canvas_offset_z'] + $this_data['ability_frame_offset']['z']);
         } elseif ($this_data['ability_frame_offset']['z'] < 0) {
             $this_data['canvas_offset_z'] = ceil($robot_data['canvas_offset_z'] - $this_data['ability_frame_offset']['z'] * -1);
         } else {
             $this_data['canvas_offset_z'] = $robot_data['canvas_offset_z'];
         }
     }
     // Define the rest of the display variables
     //$this_data['ability_image'] = 'images/sprites/abilities/'.(!empty($this_data['ability_image']) ? $this_data['ability_image'] : $this_data['ability_token']).'/sprite_'.$this_data['ability_direction'].'_80x80.png?'.MMRPG_CONFIG_CACHE_DATE;
     if (!preg_match('/^images/i', $this_data['ability_image'])) {
         $this_data['ability_image'] = 'images/sprites/abilities/' . $this_data['ability_image'] . '/sprite_' . $this_data['ability_direction'] . '_80x80.png?' . MMRPG_CONFIG_CACHE_DATE;
     }
     $this_data['ability_markup_class'] = 'sprite sprite_ability ';
     $this_data['ability_markup_class'] .= 'sprite_' . $this_data['ability_sprite_size'] . 'x' . $this_data['ability_sprite_size'] . ' sprite_' . $this_data['ability_sprite_size'] . 'x' . $this_data['ability_sprite_size'] . '_' . $this_data['ability_frame'] . ' ';
     $this_data['ability_markup_class'] .= 'ability_status_' . $this_data['ability_status'] . ' ability_position_' . $this_data['ability_position'] . ' ';
     $frame_position = is_numeric($this_data['ability_frame']) ? (int) $this_data['ability_frame'] : array_search($this_data['ability_frame'], $this_data['ability_frame_index']);
     if ($frame_position === false) {
         $frame_position = 0;
     }
     $frame_background_offset = -1 * ceil($this_data['ability_sprite_size'] * $frame_position);
     $this_data['ability_markup_style'] = 'background-position: ' . $frame_background_offset . 'px 0; ';
     $this_data['ability_markup_style'] .= 'pointer-events: none; z-index: ' . $this_data['canvas_offset_z'] . '; ' . $this_data['ability_float'] . ': ' . $this_data['canvas_offset_x'] . 'px; bottom: ' . $this_data['canvas_offset_y'] . 'px; ';
     $this_data['ability_markup_style'] .= 'background-image: url(' . $this_data['ability_image'] . '); width: ' . $this_data['ability_sprite_size'] * $this_data['ability_frame_span'] . 'px; height: ' . $this_data['ability_sprite_size'] . 'px; background-size: ' . $this_data['ability_image_width'] . 'px ' . $this_data['ability_image_height'] . 'px; ';
     // Generate the final markup for the canvas ability
     ob_start();
     // Display the ability's battle sprite
     echo '<div data-ability-id="' . $this_data['ability_id_token'] . '" data-robot-id="' . $robot_data['robot_id_token'] . '" class="' . ($this_data['ability_markup_class'] . $this_data['ability_frame_classes']) . '" style="' . ($this_data['ability_markup_style'] . $this_data['ability_frame_styles']) . '" data-debug="' . $this_data['data_debug'] . '" data-sticky="' . ($this_data['data_sticky'] === false ? 'false' : $this_data['data_sticky']) . '" data-type="' . $this_data['data_type'] . '" data-size="' . $this_data['ability_sprite_size'] . '" data-direction="' . $this_data['ability_direction'] . '" data-frame="' . $this_data['ability_frame'] . '" data-animate="' . $this_data['ability_frame_animate'] . '" data-position="' . $this_data['ability_position'] . '" data-status="' . $this_data['ability_status'] . '" data-scale="' . $this_data['ability_scale'] . '">' . $this_data['ability_token'] . '</div>';
     // Collect the generated ability markup
     $this_data['ability_markup'] .= trim(ob_get_clean());
     // Return the robot canvas data
     return $this_data;
 }
            <span class="sprite_image sprite_image_40x40 sprite_image_40x40_<?php 
echo rpg_functions::weighted_chance(array('shoot', 'summon', 'taunt', 'defend'), array(3, 3, 2, 2));
?>
" style="position: relative; top: 15px; margin-left: -9px; z-index: 6;"><span><img src="images/sprites/robots/dust-man/sprite_left_40x40.png?<?php 
echo MMRPG_CONFIG_CACHE_DATE;
?>
" alt="Dust Man" /></span></span>
            <span class="sprite_image sprite_image_80x80 sprite_image_80x80_<?php 
echo rpg_functions::weighted_chance(array('shoot', 'summon', 'taunt', 'defend'), array(3, 3, 2, 2));
?>
" style="position: relative; top: 18px; margin-left: -9px; z-index: 7;"><span><img src="images/sprites/robots/dive-man/sprite_left_80x80.png?<?php 
echo MMRPG_CONFIG_CACHE_DATE;
?>
" alt="Dive Man" /></span></span>
            <span class="sprite_image sprite_image_40x40 sprite_image_40x40_<?php 
echo rpg_functions::weighted_chance(array('shoot', 'summon', 'taunt', 'defend'), array(3, 3, 2, 2));
?>
" style="position: relative; top: 21px; margin-left: 0; z-index: 8;"><span><img src="images/sprites/robots/skull-man/sprite_left_40x40.png?<?php 
echo MMRPG_CONFIG_CACHE_DATE;
?>
" alt="Skull Man" /></span></span>
          </span>

        </div>
      </div>
    </div>
  </div>

  <p class="text" style="margin-bottom: 0;">The robots Light and Cossack had assembled there were helpless against them, and once defeated, they use an arcane power to digitize robots and humans all over the world into the Prototype!  The robots proclaimed that humanity would have to fight one another to the top and defeat them in order to reclaim their freedom.  And thus began a mad scramble for humanity to raise their own digital robot armies and lead them into combat against one another...</p>

</div>
Example #7
0
 }
 if ($temp_critical_chance > 100) {
     $temp_critical_chance = 100;
 }
 $temp_critical_chance = (int) $temp_critical_chance;
 // Check if the switch should be disabled
 $temp_switch_disabled = false;
 if ($active_target_robot->robot_status != 'disabled' && !empty($active_target_robot->robot_attachments)) {
     foreach ($active_target_robot->robot_attachments as $attachment_token => $attachment_info) {
         if (!empty($attachment_info['attachment_switch_disabled'])) {
             $temp_switch_disabled = true;
         }
     }
 }
 // Check if switch was successful, else we do ability
 if (!$temp_switch_disabled && $target_player->counters['robots_active'] > 1 && $target_energy_damage_percent > 0 && !in_array('start', $this_recent_actions) && !in_array('switch', $this_recent_actions) && rpg_functions::critical_chance($temp_critical_chance)) {
     // Set the target action to the switch type
     $target_action = 'switch';
 } else {
     // Set the target action to the ability type
     $target_action = 'ability';
 }
 // DEBUG
 //$this_battle->events_create(false, false, 'DEBUG_'.__LINE__, 'temp_critical_chance = '.$temp_critical_chance.'; $target_action = '.$target_action.'; </pre>');
 // Then queue up an the target robot's defined action
 //$this_battle->actions_append($target_player->get_id(), $target_robot->get_id(), $this_player->get_id(), $this_robot->get_id(), $target_action, $target_action_token);
 // Collect the abilities index for the current robot
 $temp_abilities_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token');
 // Create the temporary ability object for this player's robot
 list($temp_id, $temp_token) = explode('_', $this_action_token);
 //array('ability_token' => $this_action_token);
Example #8
0
 public function check_items(rpg_player $target_player, rpg_robot $target_robot)
 {
     // Collect references to global objects
     $db = cms_database::get_database();
     $this_battle = rpg_battle::get_battle();
     $this_field = rpg_field::get_field();
     // Collect references to relative player and robot objects
     $this_player = $this->player;
     $this_robot = $this;
     // Hide any disabled robots and return
     if ($this_robot->get_status() == 'disabled') {
         $this_robot->set_flag('apply_disabled_state', true);
         $this_battle->events_create();
         return;
     }
     // If this robot has an item attached, process actions
     if ($this_robot->has_item()) {
         $this_battle->events_debug(__FILE__, __LINE__, $this_robot->robot_token . ' checkpoint has item ' . $this_robot->get_item());
         // Define the item info based on token
         $item_id = $this_robot->get_item_id();
         $item_token = $this_robot->get_item();
         $item_info = array('ability_id' => $item_id, 'ability_token' => $item_token);
         // Load the item if it doesn't exist yet then collect a reference
         if (!$this_battle->item_exists($item_info['ability_id'])) {
             $this_battle->add_item($this_player, $this_robot, $item_info);
         } else {
             $this_battle->update_item($item_info['ability_id'], $item_info);
         }
         $this_item = $this_battle->get_item($item_info['ability_id']);
         // If the robot is holding a Field Booster item, increase multiplier
         if ($item_token == 'field-booster') {
             // Define the item object and trigger info
             $temp_core_type = $this_robot->get_core();
             $temp_field_type = $this_field->get_type();
             if (empty($temp_core_type)) {
                 $temp_boost_type = 'recovery';
             } elseif ($temp_core_type == 'empty') {
                 $temp_boost_type = 'damage';
             } else {
                 $temp_boost_type = $temp_core_type;
             }
             if (!isset($this_field->field_multipliers[$temp_boost_type]) || $this_field->field_multipliers[$temp_boost_type] < MMRPG_SETTINGS_MULTIPLIER_MAX) {
                 // Define this ability's attachment token
                 $this_star_index = rpg_prototype::star_image(!empty($temp_boost_type) ? $temp_boost_type : 'none');
                 $this_sprite_sheet = 'field-support';
                 $this_attachment_token = 'item_field-booster';
                 $this_attachment_info = array('class' => 'ability', 'ability_id' => $item_id, 'ability_token' => $item_token, 'ability_image' => $this_sprite_sheet . ($this_star_index['sheet'] > 1 ? '-' . $this_star_index['sheet'] : ''), 'ability_frame' => $this_star_index['frame'], 'ability_frame_animate' => array($this_star_index['frame']), 'ability_frame_offset' => array('x' => 0, 'y' => 0, 'z' => -10));
                 // Attach this ability attachment to this robot temporarily
                 $this_robot->set_frame('taunt');
                 $this_robot->set_attachment($this_attachment_token, $this_attachment_info);
                 // Create or increase the elemental booster for this field
                 $temp_change_percent = round($this_item->get_recovery2() / 100, 1);
                 $new_multiplier_value = $this_field->get_multiplier($temp_boost_type) + $temp_change_percent;
                 if ($new_multiplier_value >= MMRPG_SETTINGS_MULTIPLIER_MAX) {
                     $temp_change_percent = $new_multiplier_value - MMRPG_SETTINGS_MULTIPLIER_MAX;
                     $new_multiplier_value = MMRPG_SETTINGS_MULTIPLIER_MAX;
                 }
                 $this_field->set_multiplier($temp_boost_type, $new_multiplier_value);
                 // Create the event to show this element boost
                 if ($temp_change_percent > 0) {
                     $this_battle->events_create($this_robot, false, $this_field->field_name . ' Multipliers', rpg_functions::get_random_positive_word() . ' <span class="ability_name ability_type ability_type_' . $temp_boost_type . '">' . ucfirst($temp_boost_type) . ' Effects</span> were boosted by ' . ceil($temp_change_percent * 100) . '%!<br />' . 'The multiplier is now at <span class="ability_name ability_type ability_type_' . $temp_boost_type . '">' . ucfirst($temp_boost_type) . ' x ' . number_format($new_multiplier_value, 1) . '</span>!', array('canvas_show_this_ability_overlay' => true));
                 }
                 // Remove this ability attachment from this robot
                 $this_robot->unset_attachment($this_attachment_token);
             }
         } elseif ($item_token == 'attack-booster') {
             // Define the item object and trigger info
             $temp_recovery_amount = round($this_robot->get_base_attack() * ($this_item->get_recovery2() / 100));
             $this_item->recovery_options_update(array('kind' => 'attack', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . '&#39;s weapon systems!'), 'failure' => array(9, -10, -10, -10, '')));
             // Trigger stat recovery for the holding robot
             if (!empty($temp_recovery_amount)) {
                 $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount);
             }
         } elseif ($item_token == 'defense-booster') {
             // Define the item object and trigger info
             $temp_recovery_amount = round($this_robot->get_base_defense() * ($this_item->get_recovery2() / 100));
             $this_item->recovery_options_update(array('kind' => 'defense', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . '&#39;s shield systems!'), 'failure' => array(9, -10, -10, -10, '')));
             // Trigger stat recovery for the holding robot
             if (!empty($temp_recovery_amount)) {
                 $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount);
             }
         } elseif ($item_token == 'speed-booster') {
             // Define the item object and trigger info
             $temp_recovery_amount = round($this_robot->get_base_speed() * ($this_item->get_recovery2() / 100));
             $this_item->recovery_options_update(array('kind' => 'speed', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . '&#39;s mobility systems!'), 'failure' => array(9, -10, -10, -10, '')));
             // Trigger stat recovery for the holding robot
             if (!empty($temp_recovery_amount)) {
                 $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount);
             }
         }
     }
 }
                $it = new RecursiveDirectoryIterator($action_root.'abilities/');
                foreach(new RecursiveIteratorIterator($it) AS $file) {
                    $clean_path = "{$file}";
                    if (substr($clean_path, -1, 1) == '.'){ continue; }
                    $clean_path = str_replace("\\", "/", $clean_path);
                    $clean_path = str_replace($action_root, '', $clean_path);
                    $action_file_paths[] = $clean_path;
                }

                // Collect and parse the name, description, and variable info from the file
                $action_file_meta = array();
                $action_file_templates = array();
                foreach ($action_file_paths AS $key => $action_path){

                    // Generate action meta data from the function
                    $action_meta = rpg_functions::parse_action_meta($action_path);

                    // Append this meta to the overall index
                    $action_file_meta[$action_path] = $action_meta;

                }

                // Print out the tab headers for the different function sections
                ?>
                <div class="section tablinks" data-group="functions">
                    <div class="tabwrap">
                        <?
                        // Loop through and display tab links for the various alts
                        $action_key = 0;
                        foreach ($ability_action_index AS $action_token => $action_info){
                            // Print out the markup for this link tab
Example #10
0
 /**
  * Generate the console message markup for this frame of battle including players, robots, abilities etc.
  * @param array $eventinfo
  * @param array $options (optional)
  * @return string
  */
 public function get_console_markup($eventinfo, $options = array())
 {
     // Collect references to global objects
     $db = cms_database::get_database();
     $this_battle = self::get_battle();
     $this_field = rpg_field::get_field();
     // Default the return markup to empty
     $this_markup = '';
     // Ensure this side is allowed to be shown before generating any markup
     if ($options['console_show_this'] != false) {
         // Define the necessary text markup for the current player if allowed and exists
         if (!empty($eventinfo['this_player'])) {
             // Collect the console data for this player
             $this_player_data = $eventinfo['this_player']->get_console_markup($options);
         } else {
             // Define empty console data for this player
             $this_player_data = array();
             $options['console_show_this_player'] = false;
         }
         // Define the necessary text markup for the current robot if allowed and exists
         if (!empty($eventinfo['this_robot'])) {
             // Collect the console data for this robot
             $this_robot_data = $eventinfo['this_robot']->get_console_markup($options, $this_player_data);
         } else {
             // Define empty console data for this robot
             $this_robot_data = array();
             $options['console_show_this_robot'] = false;
         }
         // Define the necessary text markup for the current ability if allowed and exists
         if (!empty($options['this_ability'])) {
             // Collect the console data for this ability
             $this_ability_data = $options['this_ability']->get_console_markup($options, $this_player_data, $this_robot_data);
         } else {
             // Define empty console data for this ability
             $this_ability_data = array();
             $options['console_show_this_ability'] = false;
         }
         // Define the necessary text markup for the current star if allowed and exists
         if (!empty($options['this_star'])) {
             // Collect the console data for this star
             $this_star_data = rpg_functions::get_star_console_markup($options['this_star'], $this_player_data, $this_robot_data);
         } else {
             // Define empty console data for this star
             $this_star_data = array();
             $options['console_show_this_star'] = false;
         }
         // If no objects would found to display, turn the left side off
         if (empty($options['console_show_this_player']) && empty($options['console_show_this_robot']) && empty($options['console_show_this_ability']) && empty($options['console_show_this_star'])) {
             // Automatically set the console option to false
             $options['console_show_this'] = false;
         }
     } else {
         // Default all of this side's objects to empty arrays
         $this_player_data = array();
         $this_robot_data = array();
         $this_ability_data = array();
         $this_star_data = array();
     }
     // Ensure the target side is allowed to be shown before generating any markup
     if ($options['console_show_target'] != false) {
         // Define the necessary text markup for the target player if allowed and exists
         if (!empty($eventinfo['target_player'])) {
             // Collect the console data for this player
             $target_player_data = $eventinfo['target_player']->get_console_markup($options);
         } else {
             // Define empty console data for this player
             $target_player_data = array();
             $options['console_show_target_player'] = false;
         }
         // Define the necessary text markup for the target robot if allowed and exists
         if (!empty($eventinfo['target_robot'])) {
             // Collect the console data for this robot
             $target_robot_data = $eventinfo['target_robot']->get_console_markup($options, $target_player_data);
         } else {
             // Define empty console data for this robot
             $target_robot_data = array();
             $options['console_show_target_robot'] = false;
         }
         // Define the necessary text markup for the target ability if allowed and exists
         if (!empty($options['target_ability'])) {
             // Collect the console data for this ability
             $target_ability_data = $options['target_ability']->get_console_markup($options, $target_player_data, $target_robot_data);
         } else {
             // Define empty console data for this ability
             $target_ability_data = array();
             $options['console_show_target_ability'] = false;
         }
         // If no objects would found to display, turn the right side off
         if (empty($options['console_show_target_player']) && empty($options['console_show_target_robot']) && empty($options['console_show_target_ability'])) {
             // Automatically set the console option to false
             $options['console_show_target'] = false;
         }
     } else {
         // Default all of the target side's objects to empty arrays
         $target_player_data = array();
         $target_robot_data = array();
         $target_ability_data = array();
     }
     // Assign player-side based floats for the header and body if not set
     if (empty($options['console_header_float']) && !empty($this_robot_data)) {
         $options['console_header_float'] = $this_robot_data['robot_float'];
     }
     if (empty($options['console_body_float']) && !empty($this_robot_data)) {
         $options['console_body_float'] = $this_robot_data['robot_float'];
     }
     // Append the generated console markup if not empty
     if (!empty($eventinfo['event_header']) && !empty($eventinfo['event_body'])) {
         // Define the container class based on height
         $event_class = 'event ';
         $event_style = '';
         if ($options['console_container_height'] == 1) {
             $event_class .= 'event_single ';
         }
         if ($options['console_container_height'] == 2) {
             $event_class .= 'event_double ';
         }
         if ($options['console_container_height'] == 3) {
             $event_class .= 'event_triple ';
         }
         if (!empty($options['console_container_classes'])) {
             $event_class .= $options['console_container_classes'];
         }
         if (!empty($options['console_container_styles'])) {
             $event_style .= $options['console_container_styles'];
         }
         // Generate the opening event tag
         $this_markup .= '<div class="' . $event_class . '" style="' . $event_style . '">';
         // Generate this side's markup if allowed
         if ($options['console_show_this'] != false) {
             // Append this player's markup if allowed
             if ($options['console_show_this_player'] != false) {
                 $this_markup .= $this_player_data['player_markup'];
             } elseif ($options['console_show_this_robot'] != false) {
                 $this_markup .= $this_robot_data['robot_markup'];
             } elseif ($options['console_show_this_ability'] != false) {
                 $this_markup .= $this_ability_data['ability_markup'];
             } elseif ($options['console_show_this_star'] != false) {
                 $this_markup .= $this_star_data['star_markup'];
             }
         }
         // Generate the target side's markup if allowed
         if ($options['console_show_target'] != false) {
             // Append the target player's markup if allowed
             if ($options['console_show_target_player'] != false) {
                 $this_markup .= $target_player_data['player_markup'];
             } elseif ($options['console_show_target_robot'] != false) {
                 $this_markup .= $target_robot_data['robot_markup'];
             } elseif ($options['console_show_target_ability'] != false) {
                 $this_markup .= $target_ability_data['ability_markup'];
             }
         }
         // Prepend the turn counter to the header if necessary
         if (!empty($this_battle->counters['battle_turn']) && $this_battle->battle_status != 'complete') {
             $eventinfo['event_header'] = 'Turn #' . $this_battle->counters['battle_turn'] . ' : ' . $eventinfo['event_header'];
         }
         // Display the event header and event body
         $this_markup .= '<div class="header header_' . $options['console_header_float'] . '">' . $eventinfo['event_header'] . '</div>';
         $this_markup .= '<div class="body body_' . $options['console_body_float'] . '">' . $eventinfo['event_body'] . '</div>';
         // Displat the closing event tag
         $this_markup .= '</div>';
     }
     // Return the generated markup and robot data
     return $this_markup;
 }