lass Game_System
attr_accessor :terrains
alias gog_terrains_init initialize
def initialize
gog_terrains_init
@terrains = {
1 => [ 9, 8, 5, 2, 2, 0],
2 => [ 8, 8, 5, 2, 2, 0],
3 => [ 7, 8, 5, 2, 2, 0],
4 => [ 2, 8, 5, 2, 2, 0],
5 => [ 2, 8, 5, 2, 2, 0],
6 => [ 2, 8, 5, 2, 2, 0],
7 => [ 2, 8, 5, 2, 2, 0]
}
end
end
class Scene_Map
def call_battle
$game_temp.battle_calling = false
$game_temp.menu_calling = false
$game_temp.menu_beep = false
$game_player.make_encounter_count
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)
$game_player.straighten
$game_temp.in_battle = true
$game_temp.forcing_battler = nil
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
@map_id = $game_map.map_id
@player_x = $game_player.x
@player_y = $game_player.y
@rand = teleport(4)
@extra = teleport(5)
$game_variables [1] = rand(@rand) + @extra # 1st enemy
$game_variables [2] = rand(@rand) + @extra # 2nd Enemy
$game_variables [3] = rand(@rand) + @extra # 3rd enemy
$game_system.menu_disabled = true
$game_system.caterpillar = true
@phase = 1
end
alias map_update update
def update
map_update
@check_terrain
@update_phase1
@update_phase2
@update_phase3
@update_phase4
end
if @wait_count == nil
@wait_count = 0
elsif @wait_count > 0
@wait_count -= 1
return
end
end
def check_terrain
if $game_player.terrain_tag == 1
teleport = $game_system.terrains[1]
elsif $game_player.terrain_tag == 2
teleport = $game_system.terrains[2]
elsif $game_player.terrain_tag == 3
teleport = $game_system.terrains[3]
elsif $game_player.terrain_tag == 4
teleport = $game_system.terrains[4]
elsif $game_player.terrain_tag == 5
teleport = $game_system.terrains[5]
elsif $game_player.terrain_tag == 6
teleport = $game_system.terrains[6]
elsif $game_player.terrain_tag == 7
teleport = $game_system.terrains[7]
end
end
def update_phase1
$game_temp.player_transferring = true
$game_temp.player_new_map_id = teleport[0]
$game_temp.player_new_x = teleport[1]
$game_temp.player_new_y = teleport[2]
$game_temp.player_new_direction = teleport[3]
@phase = 2
end
def update_phase2
if @phase == 2
if $game_map.map_id != @map_id
@wait_count = 40
end
if @wait_count > 0
enemy1
enemy2
enemy3
@phase = 3
end
end
end
def update_phase3
if @phase == 3
if $game_variables [4] == 3
$game_system.me_play($game_system.battle_end_me)
$game_system.hud = false
$window = Window_Result.new
@wait_count = 40
end
if @wait_count == 0
$window.dispose
exp = $total1
gold = $total2
treasures = $total3
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
$total1 = 0
$total2 = 0
$total3 = 0
$game_variables [4] = 0
@phase = 4
end
end
end
def update_phase4
if @phase == 4
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @map_id
$game_temp.player_new_x = @player_x
$game_temp.player_new_y = @player_y
$game_temp.player_new_direction = 2
$game_system.bgm_play($game_temp.map_bgm)
$game_system.hud = true
$game_system.menu_disabled = false
if $game_switches [1] == true
$game_system.caterpillar = false
$game_temp.in_battle = false
end
end
end