mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Merged class PokemonTemp into class Game_Temp
This commit is contained in:
@@ -26,10 +26,10 @@ end
|
||||
|
||||
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :batterywarning
|
||||
attr_accessor :cueBGM
|
||||
attr_accessor :cueFrames
|
||||
class Game_Temp
|
||||
attr_accessor :warned_low_battery
|
||||
attr_accessor :cue_bgm
|
||||
attr_accessor :cue_bgm_frame_delay
|
||||
end
|
||||
|
||||
|
||||
@@ -47,22 +47,22 @@ def pbBatteryLow?
|
||||
end
|
||||
|
||||
Events.onMapUpdate += proc { |_sender,_e|
|
||||
if !$PokemonTemp.batterywarning && pbBatteryLow?
|
||||
if !$game_temp.warned_low_battery && pbBatteryLow?
|
||||
if !$game_temp.in_menu && !$game_temp.in_battle &&
|
||||
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
|
||||
!pbMapInterpreterRunning?
|
||||
if pbGetTimeNow.sec==0
|
||||
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
|
||||
$PokemonTemp.batterywarning = true
|
||||
$game_temp.warned_low_battery = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if $PokemonTemp.cueFrames
|
||||
$PokemonTemp.cueFrames -= 1
|
||||
if $PokemonTemp.cueFrames<=0
|
||||
$PokemonTemp.cueFrames = nil
|
||||
if $game_system.getPlayingBGM==nil
|
||||
pbBGMPlay($PokemonTemp.cueBGM)
|
||||
if $game_temp.cue_bgm_frame_delay
|
||||
$game_temp.cue_bgm_frame_delay -= 1
|
||||
if $game_temp.cue_bgm_frame_delay <= 0
|
||||
$game_temp.cue_bgm_frame_delay = nil
|
||||
if $game_system.getPlayingBGM == nil
|
||||
pbBGMPlay($game_temp.cue_bgm)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -177,7 +177,7 @@ def pbOnStepTaken(eventTriggered)
|
||||
Events.onStepTakenTransferPossible.trigger(nil,handled)
|
||||
return if handled[0]
|
||||
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
|
||||
$PokemonTemp.encounterTriggered = false # This info isn't needed here
|
||||
$game_temp.encounter_triggered = false # This info isn't needed here
|
||||
end
|
||||
|
||||
# Start wild encounters while turning on the spot
|
||||
@@ -192,7 +192,7 @@ def pbBattleOnStepTaken(repel_active)
|
||||
encounter_type = $PokemonEncounters.encounter_type
|
||||
return if !encounter_type
|
||||
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
|
||||
$PokemonTemp.encounterType = encounter_type
|
||||
$game_temp.encounter_type = encounter_type
|
||||
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||
encounter = EncounterModifier.trigger(encounter)
|
||||
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
||||
@@ -203,10 +203,10 @@ def pbBattleOnStepTaken(repel_active)
|
||||
else
|
||||
pbWildBattle(encounter[0], encounter[1])
|
||||
end
|
||||
$PokemonTemp.encounterType = nil
|
||||
$PokemonTemp.encounterTriggered = true
|
||||
$game_temp.encounter_type = nil
|
||||
$game_temp.encounter_triggered = true
|
||||
end
|
||||
$PokemonTemp.forceSingleBattle = false
|
||||
$game_temp.force_single_battle = false
|
||||
EncounterModifier.triggerEncounterEnd
|
||||
end
|
||||
|
||||
@@ -267,15 +267,15 @@ Events.onMapSceneChange += proc { |_sender, e|
|
||||
# Display darkness circle on dark maps
|
||||
map_metadata = $game_map.metadata
|
||||
if map_metadata && map_metadata.dark_map
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
||||
$game_temp.darkness_sprite = DarknessSprite.new
|
||||
scene.spriteset.addUserSprite($game_temp.darkness_sprite)
|
||||
if $PokemonGlobal.flashUsed
|
||||
$PokemonTemp.darknessSprite.radius = $PokemonTemp.darknessSprite.radiusMax
|
||||
$game_temp.darkness_sprite.radius = $game_temp.darkness_sprite.radiusMax
|
||||
end
|
||||
else
|
||||
$PokemonGlobal.flashUsed = false
|
||||
$PokemonTemp.darknessSprite.dispose if $PokemonTemp.darknessSprite
|
||||
$PokemonTemp.darknessSprite = nil
|
||||
$game_temp.darkness_sprite.dispose if $game_temp.darkness_sprite
|
||||
$game_temp.darkness_sprite = nil
|
||||
end
|
||||
# Show location signpost
|
||||
if mapChanged && map_metadata && map_metadata.announce_location
|
||||
@@ -398,10 +398,10 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
|
||||
playingBGM = $game_system.playing_bgm
|
||||
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
|
||||
pbBGMFade(seconds)
|
||||
if !$PokemonTemp.cueFrames
|
||||
$PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5
|
||||
if !$game_temp.cue_bgm_frame_delay
|
||||
$game_temp.cue_bgm_frame_delay = (seconds * Graphics.frame_rate) * 3 / 5
|
||||
end
|
||||
$PokemonTemp.cueBGM=bgm
|
||||
$game_temp.cue_bgm = bgm
|
||||
elsif playingBGM
|
||||
pbBGMPlay(bgm)
|
||||
end
|
||||
@@ -546,7 +546,7 @@ end
|
||||
|
||||
def pbSlideOnIce
|
||||
return if !$game_player.pbTerrainTag.ice
|
||||
$PokemonTemp.followers.update
|
||||
$game_temp.followers.update
|
||||
$PokemonGlobal.sliding = true
|
||||
direction = $game_player.direction
|
||||
oldwalkanime = $game_player.walk_anime
|
||||
@@ -557,7 +557,7 @@ def pbSlideOnIce
|
||||
break if !$game_player.can_move_in_direction?(direction)
|
||||
break if !$game_player.pbTerrainTag.ice
|
||||
$game_player.move_forward
|
||||
$PokemonTemp.followers.move_followers if first_loop
|
||||
$game_temp.followers.move_followers if first_loop
|
||||
while $game_player.moving?
|
||||
pbUpdateSceneMap
|
||||
Graphics.update
|
||||
@@ -621,7 +621,7 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
|
||||
if $game_player.x!=x || $game_player.y!=y
|
||||
pbSEPlay("Player jump") if playSound
|
||||
$PokemonEncounters.reset_step_count if cancelSurf
|
||||
$PokemonTemp.endSurf = true if cancelSurf
|
||||
$game_temp.ending_surf = true if cancelSurf
|
||||
while $game_player.jumping?
|
||||
Graphics.update
|
||||
Input.update
|
||||
|
||||
@@ -10,23 +10,23 @@ end
|
||||
|
||||
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :encounterTriggered
|
||||
attr_accessor :encounterType
|
||||
class Game_Temp
|
||||
attr_accessor :encounter_triggered
|
||||
attr_accessor :encounter_type
|
||||
attr_accessor :party_levels_before_battle
|
||||
attr_accessor :party_critical_hits_dealt
|
||||
|
||||
def battleRules
|
||||
@battleRules = {} if !@battleRules
|
||||
return @battleRules
|
||||
def battle_rules
|
||||
@battle_rules = {} if !@battle_rules
|
||||
return @battle_rules
|
||||
end
|
||||
|
||||
def clearBattleRules
|
||||
self.battleRules.clear
|
||||
def clear_battle_rules
|
||||
self.battle_rules.clear
|
||||
end
|
||||
|
||||
def recordBattleRule(rule,var=nil)
|
||||
rules = self.battleRules
|
||||
def add_battle_rule(rule, var = nil)
|
||||
rules = self.battle_rules
|
||||
case rule.to_s.downcase
|
||||
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
|
||||
"double", "2v2", "2v3", "3v2", "triple", "3v3"
|
||||
@@ -67,7 +67,7 @@ def setBattleRule(*args)
|
||||
r = nil
|
||||
for arg in args
|
||||
if r
|
||||
$PokemonTemp.recordBattleRule(r,arg)
|
||||
$game_temp.add_battle_rule(r, arg)
|
||||
r = nil
|
||||
else
|
||||
case arg.downcase
|
||||
@@ -76,7 +76,7 @@ def setBattleRule(*args)
|
||||
r = arg
|
||||
next
|
||||
end
|
||||
$PokemonTemp.recordBattleRule(arg)
|
||||
$game_temp.add_battle_rule(arg)
|
||||
end
|
||||
end
|
||||
raise _INTL("Argument {1} expected a variable after it but didn't have one.",r) if r
|
||||
@@ -88,7 +88,7 @@ end
|
||||
|
||||
# Sets up various battle parameters and applies special rules.
|
||||
def pbPrepareBattle(battle)
|
||||
battleRules = $PokemonTemp.battleRules
|
||||
battleRules = $game_temp.battle_rules
|
||||
# The size of the battle, i.e. how many Pokémon on each side (default: "single")
|
||||
battle.setBattleMode(battleRules["size"]) if !battleRules["size"].nil?
|
||||
# Whether the game won't black out even if the player loses (default: false)
|
||||
@@ -172,8 +172,8 @@ def pbGetEnvironment
|
||||
ret = :None
|
||||
map_env = $game_map.metadata&.battle_environment
|
||||
ret = map_env if map_env
|
||||
if $PokemonTemp.encounterType &&
|
||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
||||
if $game_temp.encounter_type &&
|
||||
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
|
||||
terrainTag = $game_player.pbFacingTerrainTag
|
||||
else
|
||||
terrainTag = $game_player.terrain_tag
|
||||
@@ -190,11 +190,11 @@ end
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
# Record current levels of Pokémon in party, to see if they gain a level
|
||||
# during battle and may need to evolve afterwards
|
||||
$PokemonTemp.party_levels_before_battle = []
|
||||
$PokemonTemp.party_critical_hits_dealt = []
|
||||
$game_temp.party_levels_before_battle = []
|
||||
$game_temp.party_critical_hits_dealt = []
|
||||
$player.party.each_with_index do |pkmn, i|
|
||||
$PokemonTemp.party_levels_before_battle[i] = pkmn.level
|
||||
$PokemonTemp.party_critical_hits_dealt[i] = 0
|
||||
$game_temp.party_levels_before_battle[i] = pkmn.level
|
||||
$game_temp.party_critical_hits_dealt[i] = 0
|
||||
end
|
||||
}
|
||||
|
||||
@@ -211,13 +211,13 @@ end
|
||||
# Start a wild battle
|
||||
#===============================================================================
|
||||
def pbWildBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
|
||||
canLose = $game_temp.battle_rules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
|
||||
pbSet(outcomeVar,1) # Treat it as a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$game_temp.clear_battle_rules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
$PokemonGlobal.nextBattleME = nil
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
@@ -253,11 +253,11 @@ def pbWildBattleCore(*args)
|
||||
playerParty = $player.party
|
||||
playerPartyStarts = [0]
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
||||
if !room_for_partner && $game_temp.battle_rules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
if $PokemonGlobal.partner && !$game_temp.battle_rules["noPartner"] && room_for_partner
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
@@ -266,7 +266,7 @@ def pbWildBattleCore(*args)
|
||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
playerPartyStarts.push(playerParty.length)
|
||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
||||
setBattleRule("double") if !$game_temp.battle_rules["size"]
|
||||
end
|
||||
# Create the battle scene (the visual side of it)
|
||||
scene = pbNewBattleScene
|
||||
@@ -275,7 +275,7 @@ def pbWildBattleCore(*args)
|
||||
battle.party1starts = playerPartyStarts
|
||||
# Set various other properties in the battle class
|
||||
pbPrepareBattle(battle)
|
||||
$PokemonTemp.clearBattleRules
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty),(foeParty.length==1) ? 0 : 2,foeParty) {
|
||||
@@ -349,14 +349,14 @@ end
|
||||
# Start a trainer battle
|
||||
#===============================================================================
|
||||
def pbTrainerBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
|
||||
canLose = $game_temp.battle_rules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
|
||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $player.able_pokemon_count > 0
|
||||
pbSet(outcomeVar, ($player.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$game_temp.clear_battle_rules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
$PokemonGlobal.nextBattleME = nil
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
@@ -399,11 +399,11 @@ def pbTrainerBattleCore(*args)
|
||||
playerParty = $player.party
|
||||
playerPartyStarts = [0]
|
||||
room_for_partner = (foeParty.length > 1)
|
||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
||||
if !room_for_partner && $game_temp.battle_rules["size"] &&
|
||||
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
if $PokemonGlobal.partner && !$game_temp.battle_rules["noPartner"] && room_for_partner
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
@@ -412,7 +412,7 @@ def pbTrainerBattleCore(*args)
|
||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
playerPartyStarts.push(playerParty.length)
|
||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
||||
setBattleRule("double") if !$game_temp.battle_rules["size"]
|
||||
end
|
||||
# Create the battle scene (the visual side of it)
|
||||
scene = pbNewBattleScene
|
||||
@@ -424,7 +424,7 @@ def pbTrainerBattleCore(*args)
|
||||
battle.endSpeeches = foeEndSpeeches
|
||||
# Set various other properties in the battle class
|
||||
pbPrepareBattle(battle)
|
||||
$PokemonTemp.clearBattleRules
|
||||
$game_temp.clear_battle_rules
|
||||
# End the trainer intro music
|
||||
Audio.me_stop
|
||||
# Perform the battle itself
|
||||
@@ -457,10 +457,10 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# If there is another NPC trainer who spotted the player at the same time, and
|
||||
# it is possible to have a double battle (the player has 2+ able Pokémon or
|
||||
# has a partner trainer), then record this first NPC trainer into
|
||||
# $PokemonTemp.waitingTrainer and end this method. That second NPC event will
|
||||
# $game_temp.waiting_trainer and end this method. That second NPC event will
|
||||
# then trigger and cause the battle to happen against this first trainer and
|
||||
# themselves.
|
||||
if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
|
||||
if !$game_temp.waiting_trainer && pbMapInterpreterRunning? &&
|
||||
($player.able_pokemon_count > 1 ||
|
||||
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
thisEvent = pbMapInterpreter.get_character(0)
|
||||
@@ -482,27 +482,27 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# other triggered trainer event
|
||||
if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
|
||||
trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
|
||||
$PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
|
||||
$game_temp.waiting_trainer = [trainer, thisEvent.id]
|
||||
return false
|
||||
end
|
||||
end
|
||||
# Set some battle rules
|
||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
setBattleRule("canLose") if canLose
|
||||
setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
|
||||
setBattleRule("double") if doubleBattle || $game_temp.waiting_trainer
|
||||
# Perform the battle
|
||||
if $PokemonTemp.waitingTrainer
|
||||
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
|
||||
if $game_temp.waiting_trainer
|
||||
decision = pbTrainerBattleCore($game_temp.waiting_trainer[0],
|
||||
[trainerID,trainerName,trainerPartyID,endSpeech]
|
||||
)
|
||||
else
|
||||
decision = pbTrainerBattleCore([trainerID,trainerName,trainerPartyID,endSpeech])
|
||||
end
|
||||
# Finish off the recorded waiting trainer, because they have now been battled
|
||||
if decision==1 && $PokemonTemp.waitingTrainer # Win
|
||||
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
|
||||
if decision==1 && $game_temp.waiting_trainer # Win
|
||||
pbMapInterpreter.pbSetSelfSwitch($game_temp.waiting_trainer[1], "A", true)
|
||||
end
|
||||
$PokemonTemp.waitingTrainer = nil
|
||||
$game_temp.waiting_trainer = nil
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision==1)
|
||||
end
|
||||
@@ -574,8 +574,8 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
# Check for evolutions
|
||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||
(decision!=2 && decision!=5) # not a loss or a draw
|
||||
$PokemonTemp.party_levels_before_battle = nil
|
||||
$PokemonTemp.party_critical_hits_dealt = nil
|
||||
$game_temp.party_levels_before_battle = nil
|
||||
$game_temp.party_critical_hits_dealt = nil
|
||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
@@ -598,9 +598,9 @@ def pbEvolutionCheck
|
||||
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
|
||||
# Find an evolution
|
||||
new_species = nil
|
||||
if new_species.nil? && $PokemonTemp.party_levels_before_battle &&
|
||||
$PokemonTemp.party_levels_before_battle[i] &&
|
||||
$PokemonTemp.party_levels_before_battle[i] < pkmn.level
|
||||
if new_species.nil? && $game_temp.party_levels_before_battle &&
|
||||
$game_temp.party_levels_before_battle[i] &&
|
||||
$game_temp.party_levels_before_battle[i] < pkmn.level
|
||||
new_species = pkmn.check_evolution_on_level_up
|
||||
end
|
||||
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?
|
||||
|
||||
@@ -71,8 +71,8 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
location = 0 # 0=outside, 1=inside, 2=cave, 3=water
|
||||
if $PokemonGlobal.surfing || $PokemonGlobal.diving
|
||||
location = 3
|
||||
elsif $PokemonTemp.encounterType &&
|
||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
||||
elsif $game_temp.encounter_type &&
|
||||
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
|
||||
location = 3
|
||||
elsif $PokemonEncounters.has_cave_encounters?
|
||||
location = 2
|
||||
|
||||
@@ -208,7 +208,7 @@ class PokemonEncounters
|
||||
# Returns whether a wild encounter should be turned into a double wild
|
||||
# encounter.
|
||||
def have_double_wild_battle?
|
||||
return false if $PokemonTemp.forceSingleBattle
|
||||
return false if $game_temp.force_single_battle
|
||||
return false if pbInSafari?
|
||||
return true if $PokemonGlobal.partner
|
||||
return false if $player.able_pokemon_count <= 1
|
||||
@@ -459,7 +459,7 @@ end
|
||||
# Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild
|
||||
# Pokémon (or two) for a triggered wild encounter.
|
||||
def pbEncounter(enc_type)
|
||||
$PokemonTemp.encounterType = enc_type
|
||||
$game_temp.encounter_type = enc_type
|
||||
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
||||
encounter1 = EncounterModifier.trigger(encounter1)
|
||||
return false if !encounter1
|
||||
@@ -471,8 +471,8 @@ def pbEncounter(enc_type)
|
||||
else
|
||||
pbWildBattle(encounter1[0], encounter1[1])
|
||||
end
|
||||
$PokemonTemp.encounterType = nil
|
||||
$PokemonTemp.forceSingleBattle = false
|
||||
$game_temp.encounter_type = nil
|
||||
$game_temp.force_single_battle = false
|
||||
EncounterModifier.triggerEncounterEnd
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -109,8 +109,8 @@ Events.onMapChange += proc { |_sender,e|
|
||||
#===============================================================================
|
||||
# Encountering a roaming Pokémon in a wild battle.
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :roamerIndex # Index of roaming Pokémon to encounter next
|
||||
class Game_Temp
|
||||
attr_accessor :roamer_index_for_encounter # Index of roaming Pokémon to encounter next
|
||||
end
|
||||
|
||||
|
||||
@@ -136,12 +136,12 @@ def pbRoamingMethodAllowed(roamer_method)
|
||||
end
|
||||
|
||||
EncounterModifier.register(proc { |encounter|
|
||||
$PokemonTemp.roamerIndex = nil
|
||||
$game_temp.roamer_index_for_encounter = nil
|
||||
next nil if !encounter
|
||||
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
||||
next encounter if $PokemonGlobal.roamedAlready
|
||||
next encounter if $PokemonGlobal.partner
|
||||
next encounter if $PokemonTemp.pokeradar
|
||||
next encounter if $game_temp.poke_radar_data
|
||||
next encounter if rand(100) < 75 # 25% chance of encountering a roaming Pokémon
|
||||
# Look at each roaming Pokémon in turn and decide whether it's possible to
|
||||
# encounter it
|
||||
@@ -179,9 +179,9 @@ EncounterModifier.register(proc { |encounter|
|
||||
# Pick a roaming Pokémon to encounter out of those available
|
||||
roamer = possible_roamers[rand(possible_roamers.length)]
|
||||
$PokemonGlobal.roamEncounter = roamer
|
||||
$PokemonTemp.roamerIndex = roamer[0]
|
||||
$game_temp.roamer_index_for_encounter = roamer[0]
|
||||
$PokemonGlobal.nextBattleBGM = roamer[3] if roamer[3] && !roamer[3].empty?
|
||||
$PokemonTemp.forceSingleBattle = true
|
||||
$game_temp.force_single_battle = true
|
||||
next [roamer[1], roamer[2]] # Species, level
|
||||
})
|
||||
|
||||
@@ -190,14 +190,14 @@ Events.onWildBattleOverride += proc { |_sender,e|
|
||||
level = e[1]
|
||||
handled = e[2]
|
||||
next if handled[0]!=nil
|
||||
next if !$PokemonGlobal.roamEncounter || $PokemonTemp.roamerIndex.nil?
|
||||
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
||||
handled[0] = pbRoamingPokemonBattle(species, level)
|
||||
}
|
||||
|
||||
def pbRoamingPokemonBattle(species, level)
|
||||
# Get the roaming Pokémon to encounter; generate it based on the species and
|
||||
# level if it doesn't already exist
|
||||
idxRoamer = $PokemonTemp.roamerIndex
|
||||
idxRoamer = $game_temp.roamer_index_for_encounter
|
||||
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
||||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true)
|
||||
@@ -221,5 +221,5 @@ def pbRoamingPokemonBattle(species, level)
|
||||
end
|
||||
|
||||
EncounterModifier.registerEncounterEnd(proc {
|
||||
$PokemonTemp.roamerIndex = nil
|
||||
$game_temp.roamer_index_for_encounter = nil
|
||||
})
|
||||
|
||||
@@ -173,32 +173,3 @@ class PokemonMapMetadata
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Temporary data which is not saved and which is erased when a game restarts.
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :menuLastChoice
|
||||
attr_accessor :keyItemCalling
|
||||
attr_accessor :hiddenMoveEventCalling
|
||||
attr_accessor :begunNewGame
|
||||
attr_accessor :miniupdate
|
||||
attr_accessor :waitingTrainer
|
||||
attr_accessor :darknessSprite
|
||||
attr_accessor :lastbattle
|
||||
attr_accessor :flydata
|
||||
attr_accessor :surfJump
|
||||
attr_accessor :endSurf
|
||||
attr_accessor :forceSingleBattle
|
||||
|
||||
def initialize
|
||||
@menuLastChoice = 0
|
||||
@keyItemCalling = false
|
||||
@hiddenMoveEventCalling = false
|
||||
@begunNewGame = false
|
||||
@miniupdate = false
|
||||
@forceSingleBattle = false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -470,7 +470,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
|
||||
darkness = $PokemonTemp.darknessSprite
|
||||
darkness = $game_temp.darkness_sprite
|
||||
next false if !darkness || darkness.disposed?
|
||||
if !pbHiddenMoveAnimation(pokemon)
|
||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
@@ -507,10 +507,10 @@ def pbCanFly?(pkmn = nil, show_messages = false)
|
||||
end
|
||||
|
||||
def pbFlyToNewLocation(pkmn = nil, move = :FLY)
|
||||
return false if !$PokemonTemp.flydata
|
||||
return false if $game_temp.fly_destination.nil?
|
||||
pkmn = $player.get_pokemon_with_move(move) if !pkmn
|
||||
if !$DEBUG && !pkmn
|
||||
$PokemonTemp.flydata = nil
|
||||
$game_temp.fly_destination = nil
|
||||
yield if block_given?
|
||||
return false
|
||||
end
|
||||
@@ -520,11 +520,11 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
|
||||
end
|
||||
pbFadeOutIn {
|
||||
pbSEPlay("Fly")
|
||||
$game_temp.player_new_map_id = $PokemonTemp.flydata[0]
|
||||
$game_temp.player_new_x = $PokemonTemp.flydata[1]
|
||||
$game_temp.player_new_y = $PokemonTemp.flydata[2]
|
||||
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
|
||||
$game_temp.player_new_x = $game_temp.fly_destination[1]
|
||||
$game_temp.player_new_y = $game_temp.fly_destination[2]
|
||||
$game_temp.player_new_direction = 2
|
||||
$PokemonTemp.flydata = nil
|
||||
$game_temp.fly_destination = nil
|
||||
$scene.transfer_player
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
@@ -540,7 +540,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move, pkmn, showmsg|
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
||||
if !$PokemonTemp.flydata
|
||||
if $game_temp.fly_destination.nil?
|
||||
pbMessage(_INTL("Can't use that here."))
|
||||
next false
|
||||
end
|
||||
@@ -741,9 +741,9 @@ def pbStartSurfing
|
||||
$PokemonEncounters.reset_step_count
|
||||
$PokemonGlobal.surfing = true
|
||||
pbUpdateVehicle
|
||||
$PokemonTemp.surfJump = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
|
||||
$game_temp.surf_base_coords = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
|
||||
pbJumpToward
|
||||
$PokemonTemp.surfJump = nil
|
||||
$game_temp.surf_base_coords = nil
|
||||
$game_player.check_event_trigger_here([1,2])
|
||||
end
|
||||
|
||||
@@ -752,14 +752,14 @@ def pbEndSurf(_xOffset,_yOffset)
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
if $game_map.terrain_tag(x,y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
||||
$PokemonTemp.surfJump = [x,y]
|
||||
$game_temp.surf_base_coords = [x, y]
|
||||
if pbJumpToward(1,false,true)
|
||||
$game_map.autoplayAsCue
|
||||
$game_player.increase_steps
|
||||
result = $game_player.check_event_trigger_here([1,2])
|
||||
pbOnStepTaken(result)
|
||||
end
|
||||
$PokemonTemp.surfJump = nil
|
||||
$game_temp.surf_base_coords = nil
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user