mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Encounters now occur when changing direction
This commit is contained in:
@@ -128,6 +128,14 @@ class Game_Player < Game_Character
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def turnGeneric(dir)
|
||||||
|
old_direction = @direction
|
||||||
|
super
|
||||||
|
if @direction != oldDirection && !@move_route_forcing && !pbMapInterpreterRunning?
|
||||||
|
Events.onChangeDirection.trigger(self, self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def pbTriggeredTrainerEvents(triggers,checkIfRunning=true)
|
def pbTriggeredTrainerEvents(triggers,checkIfRunning=true)
|
||||||
result = []
|
result = []
|
||||||
# If event is running
|
# If event is running
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ module Events
|
|||||||
@@OnWildBattleOverride = Event.new
|
@@OnWildBattleOverride = Event.new
|
||||||
@@OnWildBattleEnd = Event.new
|
@@OnWildBattleEnd = Event.new
|
||||||
@@OnTrainerPartyLoad = Event.new
|
@@OnTrainerPartyLoad = Event.new
|
||||||
|
@@OnChangeDirection = Event.new
|
||||||
|
|
||||||
# Fires whenever a map is created. Event handler receives two parameters: the
|
# Fires whenever a map is created. Event handler receives two parameters: the
|
||||||
# map (RPG::Map) and the tileset (RPG::Tileset)
|
# map (RPG::Map) and the tileset (RPG::Tileset)
|
||||||
@@ -159,6 +160,10 @@ module Events
|
|||||||
# e[2] - Party
|
# e[2] - Party
|
||||||
def self.onTrainerPartyLoad; @@OnTrainerPartyLoad; end
|
def self.onTrainerPartyLoad; @@OnTrainerPartyLoad; end
|
||||||
def self.onTrainerPartyLoad=(v); @@OnTrainerPartyLoad = v; end
|
def self.onTrainerPartyLoad=(v); @@OnTrainerPartyLoad = v; end
|
||||||
|
|
||||||
|
# Fires whenever the player changes direction.
|
||||||
|
def self.onChangeDirection; @@OnChangeDirection; end
|
||||||
|
def self.onChangeDirection=(v); @@OnChangeDirection = v; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -365,6 +370,12 @@ def pbOnStepTaken(eventTriggered)
|
|||||||
pbBattleOnStepTaken(repel) if !eventTriggered && !$game_temp.in_menu
|
pbBattleOnStepTaken(repel) if !eventTriggered && !$game_temp.in_menu
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Start wild encounters while turning on the spot
|
||||||
|
Events.onChangeDirection += proc{
|
||||||
|
repel = ($PokemonGlobal.repel>0)
|
||||||
|
pbBattleOnStepTaken(repel) if !$game_temp.in_menu
|
||||||
|
}
|
||||||
|
|
||||||
def pbBattleOnStepTaken(repel=false)
|
def pbBattleOnStepTaken(repel=false)
|
||||||
return if $Trainer.ablePokemonCount==0
|
return if $Trainer.ablePokemonCount==0
|
||||||
encounterType = $PokemonEncounters.pbEncounterType
|
encounterType = $PokemonEncounters.pbEncounterType
|
||||||
|
|||||||
Reference in New Issue
Block a user