mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Merged Events and EncounterModifier into module EventHandlers
This commit is contained in:
@@ -156,7 +156,7 @@ class Scene_Map
|
|||||||
@spritesetGlobal.update
|
@spritesetGlobal.update
|
||||||
pbDayNightTint(@map_renderer)
|
pbDayNightTint(@map_renderer)
|
||||||
@map_renderer.update
|
@map_renderer.update
|
||||||
Events.onMapUpdate.trigger(self)
|
EventHandlers.trigger(:on_frame_update)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -214,7 +214,7 @@ class Scene_Map
|
|||||||
elsif $game_temp.interact_calling
|
elsif $game_temp.interact_calling
|
||||||
$game_temp.interact_calling = false
|
$game_temp.interact_calling = false
|
||||||
$game_player.straighten
|
$game_player.straighten
|
||||||
Events.onAction.trigger(self)
|
EventHandlers.trigger(:on_player_interact)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,7 +60,38 @@ class Event
|
|||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
# Same as class Event, but each registered proc has a name (a symbol) so it can
|
||||||
|
# be referenced individually.
|
||||||
|
#===============================================================================
|
||||||
|
class NamedEvent
|
||||||
|
def initialize
|
||||||
|
@callbacks = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Adds an event handler procedure from the event.
|
||||||
|
def add(key, proc)
|
||||||
|
@callbacks[key] = proc if !@callbacks.has_key?(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Removes an event handler procedure from the event.
|
||||||
|
def remove(key)
|
||||||
|
@callbacks.delete(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Clears the event of event handlers.
|
||||||
|
def clear
|
||||||
|
@callbacks.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
# Triggers the event and calls all its event handlers. Normally called only
|
||||||
|
# by the code where the event occurred.
|
||||||
|
def trigger(*args)
|
||||||
|
@callbacks.each_value { |callback| callback.call(*args) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Unused.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class HandlerHash
|
class HandlerHash
|
||||||
def initialize(mod)
|
def initialize(mod)
|
||||||
@@ -144,7 +175,8 @@ end
|
|||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# A stripped-down version of class HandlerHash which only deals with symbols and
|
# A stripped-down version of class HandlerHash which only deals with symbols and
|
||||||
# doesn't care about whether those symbols actually relate to a defined thing.
|
# doesn't care about whether those symbols are defined as constants in a class
|
||||||
|
# or module.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class HandlerHash2
|
class HandlerHash2
|
||||||
def initialize
|
def initialize
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#===============================================================================
|
||||||
|
# This module stores events that can happen during the game. A procedure can
|
||||||
|
# subscribe to an event by adding itself to the event. It will then be called
|
||||||
|
# whenever the event occurs. Existing events are:
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# :on_game_map_setup - When a Game_Map is set up. Typically changes map data.
|
||||||
|
# :on_new_spriteset_map - When a Spriteset_Map is created. Adds more things to
|
||||||
|
# show in the overworld.
|
||||||
|
# :on_frame_update - Once per frame. Various frame/time counters.
|
||||||
|
# :on_leave_map - When leaving a map. End weather/expired effects.
|
||||||
|
# :on_enter_map - Upon entering a new map. Set up new effects, end expired
|
||||||
|
# effects.
|
||||||
|
# :on_map_or_spriteset_change - Upon entering a new map or when spriteset was
|
||||||
|
# made. Show things on-screen.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# :on_player_change_direction - When the player turns in a different direction.
|
||||||
|
# :on_leave_tile - When any event or the player starts to move from a tile.
|
||||||
|
# :on_step_taken - When any event or the player finishes a step.
|
||||||
|
# :on_player_step_taken - When the player finishes a step/ends surfing, except
|
||||||
|
# as part of a move route. Step-based counters.
|
||||||
|
# :on_player_step_taken_can_transfer - When the player finishes a step/ends
|
||||||
|
# surfing, except as part of a move route. Step-based effects that can
|
||||||
|
# transfer the player elsewhere.
|
||||||
|
# :on_player_interact - When the player presses the Use button in the
|
||||||
|
# overworld.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# :on_trainer_load - When an NPCTrainer is generated (to battle against or as
|
||||||
|
# a registered partner). Various modifications to that trainer and their
|
||||||
|
# Pokémon.
|
||||||
|
# :on_wild_species_chosen - When a species/level have been chosen for a wild
|
||||||
|
# encounter. Changes the species/level (e.g. roamer, Poké Radar chain).
|
||||||
|
# :on_wild_pokemon_created - When a Pokemon object has been created for a wild
|
||||||
|
# encounter. Various modifications to that Pokémon.
|
||||||
|
# :on_calling_wild_battle - When a wild battle is called. Prevents that wild
|
||||||
|
# battle and instead starts a different kind of battle (e.g. Safari Zone).
|
||||||
|
# :on_start_battle - Just before a battle starts. Memorize/reset information
|
||||||
|
# about party Pokémon, which is used after battle for evolution checks.
|
||||||
|
# :on_end_battle - Just after a battle ends. Evolution checks, Pickup/Honey
|
||||||
|
# Gather, blacking out.
|
||||||
|
# :on_wild_battle_end - After a wild battle. Updates Poké Radar chain info.
|
||||||
|
#===============================================================================
|
||||||
|
module EventHandlers
|
||||||
|
@@events = {}
|
||||||
|
|
||||||
|
# Add a named callback for the given event.
|
||||||
|
def self.add(event, key, proc)
|
||||||
|
@@events[event] = NamedEvent.new if !@@events.has_key?(event)
|
||||||
|
@@events[event].add(key, proc)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove a named callback from the given event.
|
||||||
|
def self.remove(event, key)
|
||||||
|
@@events[event]&.remove(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Clear all callbacks for the given event.
|
||||||
|
def self.clear(key)
|
||||||
|
@@events[key]&.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
# Trigger all callbacks from an Event if it has been defined.
|
||||||
|
def self.trigger(event, *args)
|
||||||
|
return @@events[event]&.trigger(*args)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
#===============================================================================
|
|
||||||
# This module stores events that can happen during the game. A procedure can
|
|
||||||
# subscribe to an event by adding itself to the event. It will then be called
|
|
||||||
# whenever the event occurs.
|
|
||||||
#===============================================================================
|
|
||||||
module Events
|
|
||||||
@@OnMapCreate = Event.new
|
|
||||||
@@OnMapUpdate = Event.new
|
|
||||||
@@OnMapChange = Event.new
|
|
||||||
@@OnMapChanging = Event.new
|
|
||||||
@@OnMapSceneChange = Event.new
|
|
||||||
@@OnSpritesetCreate = Event.new
|
|
||||||
@@OnAction = Event.new
|
|
||||||
@@OnStepTaken = Event.new
|
|
||||||
@@OnLeaveTile = Event.new
|
|
||||||
@@OnStepTakenFieldMovement = Event.new
|
|
||||||
@@OnStepTakenTransferPossible = Event.new
|
|
||||||
@@OnStartBattle = Event.new
|
|
||||||
@@OnEndBattle = Event.new
|
|
||||||
@@OnWildPokemonCreate = Event.new
|
|
||||||
@@OnWildBattleOverride = Event.new
|
|
||||||
@@OnWildBattleEnd = Event.new
|
|
||||||
@@OnTrainerPartyLoad = Event.new
|
|
||||||
@@OnChangeDirection = Event.new
|
|
||||||
|
|
||||||
# Fires whenever a map is created. Event handler receives two parameters: the
|
|
||||||
# map (RPG::Map) and the tileset (RPG::Tileset)
|
|
||||||
def self.onMapCreate; @@OnMapCreate; end
|
|
||||||
def self.onMapCreate=(v); @@OnMapCreate = v; end
|
|
||||||
|
|
||||||
# Fires each frame during a map update.
|
|
||||||
def self.onMapUpdate; @@OnMapUpdate; end
|
|
||||||
def self.onMapUpdate=(v); @@OnMapUpdate = v; end
|
|
||||||
|
|
||||||
# Fires whenever one map is about to change to a different one. Event handler
|
|
||||||
# receives the new map ID and the Game_Map object representing the new map.
|
|
||||||
# When the event handler is called, $game_map still refers to the old map.
|
|
||||||
def self.onMapChanging; @@OnMapChanging; end
|
|
||||||
def self.onMapChanging=(v); @@OnMapChanging = v; end
|
|
||||||
|
|
||||||
# Fires whenever the player moves to a new map. Event handler receives the old
|
|
||||||
# map ID or 0 if none. Also fires when the first map of the game is loaded
|
|
||||||
def self.onMapChange; @@OnMapChange; end
|
|
||||||
def self.onMapChange=(v); @@OnMapChange = v; end
|
|
||||||
|
|
||||||
# Fires whenever the map scene is regenerated and soon after the player moves
|
|
||||||
# to a new map.
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Scene_Map object.
|
|
||||||
# e[1] - Whether the player just moved to a new map (either true or false). If
|
|
||||||
# false, some other code had called $scene.createSpritesets to
|
|
||||||
# regenerate the map scene without transferring the player elsewhere
|
|
||||||
def self.onMapSceneChange; @@OnMapSceneChange; end
|
|
||||||
def self.onMapSceneChange=(v); @@OnMapSceneChange = v; end
|
|
||||||
|
|
||||||
# Fires whenever a spriteset is created.
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Spriteset being created. e[0].map is the map associated with the
|
|
||||||
# spriteset (not necessarily the current map).
|
|
||||||
# e[1] - Viewport used for tilemap and characters
|
|
||||||
def self.onSpritesetCreate; @@OnSpritesetCreate; end
|
|
||||||
def self.onSpritesetCreate=(v); @@OnSpritesetCreate = v; end
|
|
||||||
|
|
||||||
# Triggers when the player presses the Action button on the map.
|
|
||||||
def self.onAction; @@OnAction; end
|
|
||||||
def self.onAction=(v); @@OnAction = v; end
|
|
||||||
|
|
||||||
# Fires whenever the player takes a step.
|
|
||||||
def self.onStepTaken; @@OnStepTaken; end
|
|
||||||
def self.onStepTaken=(v); @@OnStepTaken = v; end
|
|
||||||
|
|
||||||
# Fires whenever the player or another event leaves a tile.
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Event that just left the tile.
|
|
||||||
# e[1] - Map ID where the tile is located (not necessarily
|
|
||||||
# the current map). Use "$map_factory.getMap(e[1])" to
|
|
||||||
# get the Game_Map object corresponding to that map.
|
|
||||||
# e[2] - X-coordinate of the tile
|
|
||||||
# e[3] - Y-coordinate of the tile
|
|
||||||
def self.onLeaveTile; @@OnLeaveTile; end
|
|
||||||
def self.onLeaveTile=(v); @@OnLeaveTile = v; end
|
|
||||||
|
|
||||||
# Fires whenever the player or another event enters a tile.
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Event that just entered a tile.
|
|
||||||
def self.onStepTakenFieldMovement; @@OnStepTakenFieldMovement; end
|
|
||||||
def self.onStepTakenFieldMovement=(v); @@OnStepTakenFieldMovement = v; end
|
|
||||||
|
|
||||||
# Fires whenever the player takes a step. The event handler may possibly move
|
|
||||||
# the player elsewhere.
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Array that contains a single boolean value. If an event handler moves
|
|
||||||
# the player to a new map, it should set this value to true. Other
|
|
||||||
# event handlers should check this parameter's value.
|
|
||||||
def self.onStepTakenTransferPossible; @@OnStepTakenTransferPossible; end
|
|
||||||
def self.onStepTakenTransferPossible=(v); @@OnStepTakenTransferPossible = v; end
|
|
||||||
|
|
||||||
def self.onStartBattle; @@OnStartBattle; end
|
|
||||||
def self.onStartBattle=(v); @@OnStartBattle = v; end
|
|
||||||
|
|
||||||
def self.onEndBattle; @@OnEndBattle; end
|
|
||||||
def self.onEndBattle=(v); @@OnEndBattle = v; end
|
|
||||||
|
|
||||||
# Triggers whenever a wild Pokémon is created
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Pokémon being created
|
|
||||||
def self.onWildPokemonCreate; @@OnWildPokemonCreate; end
|
|
||||||
def self.onWildPokemonCreate=(v); @@OnWildPokemonCreate = v; end
|
|
||||||
|
|
||||||
# Triggers at the start of a wild battle. Event handlers can provide their
|
|
||||||
# own wild battle routines to override the default behavior.
|
|
||||||
def self.onWildBattleOverride; @@OnWildBattleOverride; end
|
|
||||||
def self.onWildBattleOverride=(v); @@OnWildBattleOverride = v; end
|
|
||||||
|
|
||||||
# Triggers whenever a wild Pokémon battle ends
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Pokémon species
|
|
||||||
# e[1] - Pokémon level
|
|
||||||
# e[2] - Battle result (1-win, 2-loss, 3-escaped, 4-caught, 5-draw)
|
|
||||||
def self.onWildBattleEnd; @@OnWildBattleEnd; end
|
|
||||||
def self.onWildBattleEnd=(v); @@OnWildBattleEnd = v; end
|
|
||||||
|
|
||||||
# Triggers whenever an NPC trainer's Pokémon party is loaded
|
|
||||||
# Parameters:
|
|
||||||
# e[0] - Trainer
|
|
||||||
# e[1] - Items possessed by the trainer
|
|
||||||
# e[2] - Party
|
|
||||||
def self.onTrainerPartyLoad; @@OnTrainerPartyLoad; 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
|
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
#
|
|
||||||
#===============================================================================
|
|
||||||
def pbOnSpritesetCreate(spriteset, viewport)
|
|
||||||
Events.onSpritesetCreate.trigger(nil, spriteset, viewport)
|
|
||||||
end
|
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# This module stores encounter-modifying events that can happen during the game.
|
|
||||||
# A procedure can subscribe to an event by adding itself to the event. It will
|
|
||||||
# then be called whenever the event occurs.
|
|
||||||
#===============================================================================
|
|
||||||
module EncounterModifier
|
|
||||||
@@procs = []
|
|
||||||
@@procsEnd = []
|
|
||||||
|
|
||||||
def self.register(p)
|
|
||||||
@@procs.push(p)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.registerEncounterEnd(p)
|
|
||||||
@@procsEnd.push(p)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.trigger(encounter)
|
|
||||||
@@procs.each do |prc|
|
|
||||||
encounter = prc.call(encounter)
|
|
||||||
end
|
|
||||||
return encounter
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.triggerEncounterEnd
|
|
||||||
@@procsEnd.each do |prc|
|
|
||||||
prc.call
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -9,7 +9,7 @@ class Game_Temp
|
|||||||
attr_accessor :menu_calling # menu calling flag
|
attr_accessor :menu_calling # menu calling flag
|
||||||
attr_accessor :ready_menu_calling # ready menu calling flag
|
attr_accessor :ready_menu_calling # ready menu calling flag
|
||||||
attr_accessor :debug_calling # debug calling flag
|
attr_accessor :debug_calling # debug calling flag
|
||||||
attr_accessor :interact_calling # trigger Events.onAction flag
|
attr_accessor :interact_calling # EventHandlers.trigger(:on_player_interact) flag
|
||||||
attr_accessor :battle_abort # battle flag: interrupt (unused)
|
attr_accessor :battle_abort # battle flag: interrupt (unused)
|
||||||
attr_accessor :title_screen_calling # return to title screen flag
|
attr_accessor :title_screen_calling # return to title screen flag
|
||||||
attr_accessor :common_event_id # common event ID to start
|
attr_accessor :common_event_id # common event ID to start
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Game_Map
|
|||||||
self.display_x = 0
|
self.display_x = 0
|
||||||
self.display_y = 0
|
self.display_y = 0
|
||||||
@need_refresh = false
|
@need_refresh = false
|
||||||
Events.onMapCreate.trigger(self, map_id, @map, tileset)
|
EventHandlers.trigger(:on_game_map_setup, map_id, @map, tileset)
|
||||||
@events = {}
|
@events = {}
|
||||||
@map.events.keys.each do |i|
|
@map.events.keys.each do |i|
|
||||||
@events[i] = Game_Event.new(@map_id, @map.events[i], self)
|
@events[i] = Game_Event.new(@map_id, @map.events[i], self)
|
||||||
|
|||||||
@@ -145,16 +145,16 @@ class PokemonMapFactory
|
|||||||
end
|
end
|
||||||
|
|
||||||
def setMapChanging(newID, newMap)
|
def setMapChanging(newID, newMap)
|
||||||
Events.onMapChanging.trigger(self, newID, newMap)
|
EventHandlers.trigger(:on_leave_map, newID, newMap)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setMapChanged(prevMap)
|
def setMapChanged(prevMap)
|
||||||
Events.onMapChange.trigger(self, prevMap)
|
EventHandlers.trigger(:on_enter_map, prevMap)
|
||||||
@mapChanged = true
|
@mapChanged = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def setSceneStarted(scene)
|
def setSceneStarted(scene)
|
||||||
Events.onMapSceneChange.trigger(self, scene, @mapChanged)
|
EventHandlers.trigger(:on_map_or_spriteset_change, scene, @mapChanged)
|
||||||
@mapChanged = false
|
@mapChanged = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class Game_Character
|
|||||||
def triggerLeaveTile
|
def triggerLeaveTile
|
||||||
if @oldX && @oldY && @oldMap &&
|
if @oldX && @oldY && @oldMap &&
|
||||||
(@oldX != self.x || @oldY != self.y || @oldMap != self.map.map_id)
|
(@oldX != self.x || @oldY != self.y || @oldMap != self.map.map_id)
|
||||||
Events.onLeaveTile.trigger(self, self, @oldMap, @oldX, @oldY)
|
EventHandlers.trigger(:on_leave_tile, self, @oldMap, @oldX, @oldY)
|
||||||
end
|
end
|
||||||
@oldX = self.x
|
@oldX = self.x
|
||||||
@oldY = self.y
|
@oldY = self.y
|
||||||
@@ -918,7 +918,7 @@ class Game_Character
|
|||||||
end
|
end
|
||||||
# End of a step, so perform events that happen at this time
|
# End of a step, so perform events that happen at this time
|
||||||
if !jumping? && !moving?
|
if !jumping? && !moving?
|
||||||
Events.onStepTakenFieldMovement.trigger(self, self)
|
EventHandlers.trigger(:on_step_taken, self)
|
||||||
calculate_bush_depth
|
calculate_bush_depth
|
||||||
@stopped_this_frame = true
|
@stopped_this_frame = true
|
||||||
elsif !@moved_last_frame || @stopped_last_frame # Started a new step
|
elsif !@moved_last_frame || @stopped_last_frame # Started a new step
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class Game_Player < Game_Character
|
|||||||
old_direction = @direction
|
old_direction = @direction
|
||||||
super(dir)
|
super(dir)
|
||||||
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
|
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
|
||||||
Events.onChangeDirection.trigger(self, self)
|
EventHandlers.trigger(:on_player_change_direction)
|
||||||
$game_temp.encounter_triggered = false if !keep_enc_indicator
|
$game_temp.encounter_triggered = false if !keep_enc_indicator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Spriteset_Map
|
|||||||
@character_sprites.push(sprite)
|
@character_sprites.push(sprite)
|
||||||
end
|
end
|
||||||
@weather = RPG::Weather.new(@@viewport1)
|
@weather = RPG::Weather.new(@@viewport1)
|
||||||
pbOnSpritesetCreate(self, @@viewport1)
|
EventHandlers.trigger(:on_new_spriteset_map, self, @@viewport1)
|
||||||
update
|
update
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -170,8 +170,9 @@ GameData::TerrainTag.register({
|
|||||||
:ignore_passability => true
|
:ignore_passability => true
|
||||||
})
|
})
|
||||||
|
|
||||||
# NOTE: This is referenced by ID in an Events.onStepTakenFieldMovement proc that
|
# NOTE: This is referenced by ID in the :pick_up_soot proc added to
|
||||||
# adds soot to the Soot Sack if the player walks over one of these tiles.
|
# EventHandlers. It adds soot to the Soot Sack if the player walks over
|
||||||
|
# one of these tiles.
|
||||||
GameData::TerrainTag.register({
|
GameData::TerrainTag.register({
|
||||||
:id => :SootGrass,
|
:id => :SootGrass,
|
||||||
:id_number => 14,
|
:id_number => 14,
|
||||||
|
|||||||
@@ -205,22 +205,22 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Events.onSpritesetCreate += proc { |_sender, e|
|
EventHandlers.add(:on_new_spriteset_map, :add_light_effects,
|
||||||
spriteset = e[0] # Spriteset being created
|
proc { |spriteset, viewport|
|
||||||
viewport = e[1] # Viewport used for tilemap and characters
|
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
|
||||||
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
|
map.events.keys.each do |i|
|
||||||
map.events.keys.each do |i|
|
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
|
||||||
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
|
filename = $~[1].to_s
|
||||||
filename = $~[1].to_s
|
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))
|
||||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))
|
elsif map.events[i].name[/^outdoorlight$/i]
|
||||||
elsif map.events[i].name[/^outdoorlight$/i]
|
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map))
|
||||||
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map))
|
elsif map.events[i].name[/^light\((\w+)\)$/i]
|
||||||
elsif map.events[i].name[/^light\((\w+)\)$/i]
|
filename = $~[1].to_s
|
||||||
filename = $~[1].to_s
|
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map, filename))
|
||||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map, filename))
|
elsif map.events[i].name[/^light$/i]
|
||||||
elsif map.events[i].name[/^light$/i]
|
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map))
|
||||||
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map))
|
end
|
||||||
end
|
end
|
||||||
end
|
spriteset.addUserSprite(Particle_Engine.new(viewport, map))
|
||||||
spriteset.addUserSprite(Particle_Engine.new(viewport, map))
|
}
|
||||||
}
|
)
|
||||||
|
|||||||
@@ -2,17 +2,18 @@
|
|||||||
# Constant checks
|
# Constant checks
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Pokérus check
|
# Pokérus check
|
||||||
Events.onMapUpdate += proc { |_sender, _e|
|
EventHandlers.add(:on_frame_update, :pokerus_counter,
|
||||||
next if !$player
|
proc {
|
||||||
last = $PokemonGlobal.pokerusTime
|
next if !$player
|
||||||
now = pbGetTimeNow
|
last = $PokemonGlobal.pokerusTime
|
||||||
if !last || last.year != now.year || last.month != now.month || last.day != now.day
|
next if !last
|
||||||
$player.pokemon_party.each do |i|
|
now = pbGetTimeNow
|
||||||
i.lowerPokerusCount
|
if last.year != now.year || last.month != now.month || last.day != now.day
|
||||||
|
$player.pokemon_party.each { |pkmn| pkmn.lowerPokerusCount }
|
||||||
|
$PokemonGlobal.pokerusTime = now
|
||||||
end
|
end
|
||||||
$PokemonGlobal.pokerusTime = now
|
}
|
||||||
end
|
)
|
||||||
}
|
|
||||||
|
|
||||||
# Returns whether the Poké Center should explain Pokérus to the player, if a
|
# Returns whether the Poké Center should explain Pokérus to the player, if a
|
||||||
# healed Pokémon has it.
|
# healed Pokémon has it.
|
||||||
@@ -46,70 +47,74 @@ def pbBatteryLow?
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapUpdate += proc { |_sender, _e|
|
EventHandlers.add(:on_frame_update, :low_battery_warning,
|
||||||
if !$game_temp.warned_low_battery && pbBatteryLow? &&
|
proc {
|
||||||
!$game_temp.in_menu && !$game_temp.in_battle && !$game_player.move_route_forcing &&
|
next if $game_temp.warned_low_battery || !pbBatteryLow?
|
||||||
!$game_temp.message_window_showing && !pbMapInterpreterRunning? &&
|
next if $game_temp.in_menu || $game_temp.in_battle || $game_player.move_route_forcing ||
|
||||||
pbGetTimeNow.sec == 0
|
$game_temp.message_window_showing || pbMapInterpreterRunning?
|
||||||
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
|
next if pbGetTimeNow.sec != 0
|
||||||
$game_temp.warned_low_battery = true
|
$game_temp.warned_low_battery = true
|
||||||
end
|
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
|
||||||
if $game_temp.cue_bgm_frame_delay
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_frame_update, :cue_bgm_after_delay,
|
||||||
|
proc {
|
||||||
|
next if $game_temp.cue_bgm_frame_delay.nil?
|
||||||
$game_temp.cue_bgm_frame_delay -= 1
|
$game_temp.cue_bgm_frame_delay -= 1
|
||||||
if $game_temp.cue_bgm_frame_delay <= 0
|
next if $game_temp.cue_bgm_frame_delay > 0
|
||||||
$game_temp.cue_bgm_frame_delay = nil
|
$game_temp.cue_bgm_frame_delay = nil
|
||||||
pbBGMPlay($game_temp.cue_bgm) if $game_system.getPlayingBGM.nil?
|
pbBGMPlay($game_temp.cue_bgm) if $game_system.getPlayingBGM.nil?
|
||||||
end
|
}
|
||||||
end
|
)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Checks per step
|
# Checks per step
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Party Pokémon gain happiness from walking
|
# Party Pokémon gain happiness from walking
|
||||||
Events.onStepTaken += proc {
|
EventHandlers.add(:on_player_step_taken, :gain_happiness,
|
||||||
$PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps
|
proc {
|
||||||
$PokemonGlobal.happinessSteps += 1
|
$PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps
|
||||||
if $PokemonGlobal.happinessSteps >= 128
|
$PokemonGlobal.happinessSteps += 1
|
||||||
|
next if $PokemonGlobal.happinessSteps < 128
|
||||||
$player.able_party.each do |pkmn|
|
$player.able_party.each do |pkmn|
|
||||||
pkmn.changeHappiness("walking") if rand(2) == 0
|
pkmn.changeHappiness("walking") if rand(2) == 0
|
||||||
end
|
end
|
||||||
$PokemonGlobal.happinessSteps = 0
|
$PokemonGlobal.happinessSteps = 0
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
# Poison party Pokémon
|
# Poison party Pokémon
|
||||||
Events.onStepTakenTransferPossible += proc { |_sender, e|
|
EventHandlers.add(:on_player_step_taken_can_transfer, :poison_party,
|
||||||
handled = e[0]
|
proc { |handled|
|
||||||
next if handled[0]
|
# handled is an array: [nil]. If [true], a message has already been shown
|
||||||
if $PokemonGlobal.stepcount % 4 == 0 && Settings::POISON_IN_FIELD
|
# because of this step, so don't do anything that might show another one
|
||||||
|
next if handled[0]
|
||||||
|
next if !Settings::POISON_IN_FIELD || $PokemonGlobal.stepcount % 4 != 0
|
||||||
flashed = false
|
flashed = false
|
||||||
$player.able_party.each do |i|
|
$player.able_party.each do |pkmn|
|
||||||
if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
|
next if pkmn.status != :POISON || pkmn.hasAbility?(:IMMUNITY)
|
||||||
if !flashed
|
if !flashed
|
||||||
pbFlash(Color.new(255, 0, 0, 128), 8)
|
pbFlash(Color.new(255, 0, 0, 128), 8)
|
||||||
flashed = true
|
flashed = true
|
||||||
end
|
end
|
||||||
i.hp -= 1 if i.hp > 1 || Settings::POISON_FAINT_IN_FIELD
|
pkmn.hp -= 1 if pkmn.hp > 1 || Settings::POISON_FAINT_IN_FIELD
|
||||||
if i.hp == 1 && !Settings::POISON_FAINT_IN_FIELD
|
if pkmn.hp == 1 && !Settings::POISON_FAINT_IN_FIELD
|
||||||
i.status = :NONE
|
pkmn.status = :NONE
|
||||||
pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1", i.name))
|
pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1", pkmn.name))
|
||||||
next
|
next
|
||||||
elsif i.hp == 0
|
elsif pkmn.hp == 0
|
||||||
i.changeHappiness("faint")
|
pkmn.changeHappiness("faint")
|
||||||
i.status = :NONE
|
pkmn.status = :NONE
|
||||||
pbMessage(_INTL("{1} fainted...", i.name))
|
pbMessage(_INTL("{1} fainted...", pkmn.name))
|
||||||
end
|
end
|
||||||
if $player.able_pokemon_count == 0
|
if $player.able_pokemon_count == 0
|
||||||
handled[0] = true
|
handled[0] = true
|
||||||
pbCheckAllFainted
|
pbCheckAllFainted
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
def pbCheckAllFainted
|
def pbCheckAllFainted
|
||||||
if $player.able_pokemon_count == 0
|
if $player.able_pokemon_count == 0
|
||||||
@@ -122,67 +127,74 @@ def pbCheckAllFainted
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Gather soot from soot grass
|
# Gather soot from soot grass
|
||||||
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
EventHandlers.add(:on_step_taken, :pick_up_soot,
|
||||||
event = e[0] # Get the event affected by field movement
|
proc { |event|
|
||||||
thistile = $map_factory.getRealTilePos(event.map.map_id, event.x, event.y)
|
thistile = $map_factory.getRealTilePos(event.map.map_id, event.x, event.y)
|
||||||
map = $map_factory.getMap(thistile[0])
|
map = $map_factory.getMap(thistile[0])
|
||||||
[2, 1, 0].each do |i|
|
[2, 1, 0].each do |i|
|
||||||
tile_id = map.data[thistile[1], thistile[2], i]
|
tile_id = map.data[thistile[1], thistile[2], i]
|
||||||
next if tile_id.nil?
|
next if tile_id.nil?
|
||||||
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
|
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
|
||||||
if event == $game_player && $bag.has?(:SOOTSACK)
|
if event == $game_player && $bag.has?(:SOOTSACK)
|
||||||
old_soot = $player.soot
|
old_soot = $player.soot
|
||||||
$player.soot += 1
|
$player.soot += 1
|
||||||
$stats.soot_collected += $player.soot - old_soot if $player.soot > old_soot
|
$stats.soot_collected += $player.soot - old_soot if $player.soot > old_soot
|
||||||
|
end
|
||||||
|
map.erase_tile(thistile[1], thistile[2], i)
|
||||||
|
break
|
||||||
end
|
end
|
||||||
map.erase_tile(thistile[1], thistile[2], i)
|
}
|
||||||
break
|
)
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
# Show grass rustle animation, and auto-move the player over waterfalls and ice
|
# Show grass rustle animation
|
||||||
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
EventHandlers.add(:on_step_taken, :grass_rustling,
|
||||||
event = e[0] # Get the event affected by field movement
|
proc { |event|
|
||||||
if $scene.is_a?(Scene_Map)
|
next if !$scene.is_a?(Scene_Map)
|
||||||
event.each_occupied_tile do |x, y|
|
event.each_occupied_tile do |x, y|
|
||||||
if $map_factory.getTerrainTag(event.map.map_id, x, y, true).shows_grass_rustle
|
next if !$map_factory.getTerrainTag(event.map.map_id, x, y, true).shows_grass_rustle
|
||||||
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, x, y, true, 1)
|
$scene.spriteset.addUserAnimation(Settings::GRASS_ANIMATION_ID, x, y, true, 1)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if event == $game_player
|
}
|
||||||
currentTag = $game_player.pbTerrainTag
|
)
|
||||||
if currentTag.waterfall_crest
|
|
||||||
pbDescendWaterfall
|
# Auto-move the player over waterfalls and ice
|
||||||
elsif currentTag.ice && !$PokemonGlobal.sliding
|
EventHandlers.add(:on_step_taken, :auto_move_player,
|
||||||
pbSlideOnIce
|
proc { |event|
|
||||||
end
|
next if !$scene.is_a?(Scene_Map)
|
||||||
|
next if event != $game_player
|
||||||
|
currentTag = $game_player.pbTerrainTag
|
||||||
|
if currentTag.waterfall_crest
|
||||||
|
pbDescendWaterfall
|
||||||
|
elsif currentTag.ice && !$PokemonGlobal.sliding
|
||||||
|
pbSlideOnIce
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
def pbOnStepTaken(eventTriggered)
|
def pbOnStepTaken(eventTriggered)
|
||||||
if $game_player.move_route_forcing || pbMapInterpreterRunning?
|
if $game_player.move_route_forcing || pbMapInterpreterRunning?
|
||||||
Events.onStepTakenFieldMovement.trigger(nil, $game_player)
|
EventHandlers.trigger(:on_step_taken, $game_player)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
$PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
|
$PokemonGlobal.stepcount = 0 if !$PokemonGlobal.stepcount
|
||||||
$PokemonGlobal.stepcount += 1
|
$PokemonGlobal.stepcount += 1
|
||||||
$PokemonGlobal.stepcount &= 0x7FFFFFFF
|
$PokemonGlobal.stepcount &= 0x7FFFFFFF
|
||||||
repel_active = ($PokemonGlobal.repel > 0)
|
repel_active = ($PokemonGlobal.repel > 0)
|
||||||
Events.onStepTaken.trigger(nil)
|
EventHandlers.trigger(:on_player_step_taken)
|
||||||
# Events.onStepTakenFieldMovement.trigger(nil,$game_player)
|
|
||||||
handled = [nil]
|
handled = [nil]
|
||||||
Events.onStepTakenTransferPossible.trigger(nil, handled)
|
EventHandlers.trigger(:on_player_step_taken_can_transfer, handled)
|
||||||
return if handled[0]
|
return if handled[0]
|
||||||
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
|
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
|
||||||
$game_temp.encounter_triggered = false # This info isn't needed here
|
$game_temp.encounter_triggered = false # This info isn't needed here
|
||||||
end
|
end
|
||||||
|
|
||||||
# Start wild encounters while turning on the spot
|
# Start wild encounters while turning on the spot
|
||||||
Events.onChangeDirection += proc {
|
EventHandlers.add(:on_player_change_direction, :trigger_encounter,
|
||||||
repel_active = ($PokemonGlobal.repel > 0)
|
proc {
|
||||||
pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu
|
repel_active = ($PokemonGlobal.repel > 0)
|
||||||
}
|
pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbBattleOnStepTaken(repel_active)
|
def pbBattleOnStepTaken(repel_active)
|
||||||
return if $player.able_pokemon_count == 0
|
return if $player.able_pokemon_count == 0
|
||||||
@@ -192,11 +204,11 @@ def pbBattleOnStepTaken(repel_active)
|
|||||||
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
|
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
|
||||||
$game_temp.encounter_type = encounter_type
|
$game_temp.encounter_type = encounter_type
|
||||||
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||||
encounter = EncounterModifier.trigger(encounter)
|
EventHandlers.trigger(:on_wild_species_chosen, encounter)
|
||||||
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
||||||
if $PokemonEncounters.have_double_wild_battle?
|
if $PokemonEncounters.have_double_wild_battle?
|
||||||
encounter2 = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
encounter2 = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||||
encounter2 = EncounterModifier.trigger(encounter2)
|
EventHandlers.trigger(:on_wild_species_chosen, encounter2)
|
||||||
pbDoubleWildBattle(encounter[0], encounter[1], encounter2[0], encounter2[1])
|
pbDoubleWildBattle(encounter[0], encounter[1], encounter2[0], encounter2[1])
|
||||||
else
|
else
|
||||||
pbWildBattle(encounter[0], encounter[1])
|
pbWildBattle(encounter[0], encounter[1])
|
||||||
@@ -205,7 +217,6 @@ def pbBattleOnStepTaken(repel_active)
|
|||||||
$game_temp.encounter_triggered = true
|
$game_temp.encounter_triggered = true
|
||||||
end
|
end
|
||||||
$game_temp.force_single_battle = false
|
$game_temp.force_single_battle = false
|
||||||
EncounterModifier.triggerEncounterEnd
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -216,67 +227,94 @@ end
|
|||||||
# Clears the weather of the old map, if the old map has defined weather and the
|
# Clears the weather of the old map, if the old map has defined weather and the
|
||||||
# new map either has the same name as the old map or doesn't have defined
|
# new map either has the same name as the old map or doesn't have defined
|
||||||
# weather.
|
# weather.
|
||||||
Events.onMapChanging += proc { |_sender, e|
|
EventHandlers.add(:on_leave_map, :end_weather,
|
||||||
new_map_ID = e[0]
|
proc { |new_map_id, new_map|
|
||||||
next if new_map_ID == 0
|
next if new_map_id == 0
|
||||||
old_map_metadata = $game_map.metadata
|
old_map_metadata = $game_map.metadata
|
||||||
next if !old_map_metadata || !old_map_metadata.weather
|
next if !old_map_metadata || !old_map_metadata.weather
|
||||||
map_infos = pbLoadMapInfos
|
map_infos = pbLoadMapInfos
|
||||||
if $game_map.name == map_infos[new_map_ID].name
|
if $game_map.name == map_infos[new_map_id].name
|
||||||
new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
new_map_metadata = GameData::MapMetadata.try_get(new_map_id)
|
||||||
next if new_map_metadata&.weather
|
next if new_map_metadata&.weather
|
||||||
end
|
end
|
||||||
$game_screen.weather(:None, 0, 0)
|
$game_screen.weather(:None, 0, 0)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# Set up various data related to the new map
|
# Set up various data related to the new map
|
||||||
Events.onMapChange += proc { |_sender, e|
|
EventHandlers.add(:on_enter_map, :setup_new_map,
|
||||||
old_map_ID = e[0] # previous map ID, is 0 if no map ID
|
proc { |old_map_id| # previous map ID, is 0 if no map ID
|
||||||
new_map_metadata = $game_map.metadata
|
# Record new Teleport destination
|
||||||
if new_map_metadata&.teleport_destination
|
new_map_metadata = $game_map.metadata
|
||||||
$PokemonGlobal.healingSpot = new_map_metadata.teleport_destination
|
if new_map_metadata&.teleport_destination
|
||||||
end
|
$PokemonGlobal.healingSpot = new_map_metadata.teleport_destination
|
||||||
$PokemonMap&.clear
|
end
|
||||||
$PokemonEncounters&.setup($game_map.map_id)
|
# End effects that apply only while on the map they were used
|
||||||
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
$PokemonMap&.clear
|
||||||
next if old_map_ID == 0 || old_map_ID == $game_map.map_id
|
# Setup new wild encounter tables
|
||||||
next if !new_map_metadata || !new_map_metadata.weather
|
$PokemonEncounters&.setup($game_map.map_id)
|
||||||
map_infos = pbLoadMapInfos
|
# Record the new map as having been visited
|
||||||
if $game_map.name == map_infos[old_map_ID].name
|
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
||||||
old_map_metadata = GameData::MapMetadata.try_get(old_map_ID)
|
# Set weather if new map has weather
|
||||||
next if old_map_metadata&.weather
|
next if old_map_id == 0 || old_map_id == $game_map.map_id
|
||||||
end
|
next if !new_map_metadata || !new_map_metadata.weather
|
||||||
new_weather = new_map_metadata.weather
|
map_infos = pbLoadMapInfos
|
||||||
$game_screen.weather(new_weather[0], 9, 0) if rand(100) < new_weather[1]
|
if $game_map.name == map_infos[old_map_id].name
|
||||||
}
|
old_map_metadata = GameData::MapMetadata.try_get(old_map_id)
|
||||||
|
next if old_map_metadata&.weather
|
||||||
|
end
|
||||||
|
new_weather = new_map_metadata.weather
|
||||||
|
$game_screen.weather(new_weather[0], 9, 0) if rand(100) < new_weather[1]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
Events.onMapSceneChange += proc { |_sender, e|
|
# Update trail of which maps the player has most recently visited.
|
||||||
scene = e[0]
|
EventHandlers.add(:on_enter_map, :add_to_trail,
|
||||||
mapChanged = e[1]
|
proc { |_old_map_id|
|
||||||
next if !scene || !scene.spriteset
|
next if !$game_map
|
||||||
# Update map trail
|
|
||||||
if $game_map
|
|
||||||
$PokemonGlobal.mapTrail = [] if !$PokemonGlobal.mapTrail
|
$PokemonGlobal.mapTrail = [] if !$PokemonGlobal.mapTrail
|
||||||
if $PokemonGlobal.mapTrail[0] != $game_map.map_id && $PokemonGlobal.mapTrail.length >= 4
|
if $PokemonGlobal.mapTrail[0] != $game_map.map_id && $PokemonGlobal.mapTrail.length >= 4
|
||||||
$PokemonGlobal.mapTrail.pop
|
$PokemonGlobal.mapTrail.pop
|
||||||
end
|
end
|
||||||
$PokemonGlobal.mapTrail = [$game_map.map_id] + $PokemonGlobal.mapTrail
|
$PokemonGlobal.mapTrail = [$game_map.map_id] + $PokemonGlobal.mapTrail
|
||||||
end
|
}
|
||||||
# Display darkness circle on dark maps
|
)
|
||||||
map_metadata = $game_map.metadata
|
|
||||||
if map_metadata&.dark_map
|
# Force cycling/walking.
|
||||||
$game_temp.darkness_sprite = DarknessSprite.new
|
EventHandlers.add(:on_enter_map, :force_cycling,
|
||||||
scene.spriteset.addUserSprite($game_temp.darkness_sprite)
|
proc { |_old_map_id|
|
||||||
if $PokemonGlobal.flashUsed
|
if $game_map.metadata&.always_bicycle
|
||||||
$game_temp.darkness_sprite.radius = $game_temp.darkness_sprite.radiusMax
|
pbMountBike
|
||||||
|
elsif !pbCanUseBike?($game_map.map_id)
|
||||||
|
pbDismountBike
|
||||||
end
|
end
|
||||||
else
|
}
|
||||||
$PokemonGlobal.flashUsed = false
|
)
|
||||||
$game_temp.darkness_sprite&.dispose
|
|
||||||
$game_temp.darkness_sprite = nil
|
# Display darkness circle on dark maps.
|
||||||
end
|
EventHandlers.add(:on_map_or_spriteset_change, :show_darkness,
|
||||||
# Show location signpost
|
proc { |scene, _map_changed|
|
||||||
if mapChanged && map_metadata && map_metadata.announce_location
|
next if !scene || !scene.spriteset
|
||||||
|
map_metadata = $game_map.metadata
|
||||||
|
if map_metadata&.dark_map
|
||||||
|
$game_temp.darkness_sprite = DarknessSprite.new
|
||||||
|
scene.spriteset.addUserSprite($game_temp.darkness_sprite)
|
||||||
|
if $PokemonGlobal.flashUsed
|
||||||
|
$game_temp.darkness_sprite.radius = $game_temp.darkness_sprite.radiusMax
|
||||||
|
end
|
||||||
|
else
|
||||||
|
$PokemonGlobal.flashUsed = false
|
||||||
|
$game_temp.darkness_sprite&.dispose
|
||||||
|
$game_temp.darkness_sprite = nil
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Show location signpost.
|
||||||
|
EventHandlers.add(:on_map_or_spriteset_change, :show_location_window,
|
||||||
|
proc { |scene, map_changed|
|
||||||
|
next if !scene || !scene.spriteset
|
||||||
|
next if !map_changed || !$game_map.metadata&.announce_location
|
||||||
nosignpost = false
|
nosignpost = false
|
||||||
if $PokemonGlobal.mapTrail[1]
|
if $PokemonGlobal.mapTrail[1]
|
||||||
(Settings::NO_SIGNPOSTS.length / 2).times do |i|
|
(Settings::NO_SIGNPOSTS.length / 2).times do |i|
|
||||||
@@ -291,14 +329,8 @@ Events.onMapSceneChange += proc { |_sender, e|
|
|||||||
nosignpost = true if $game_map.name == oldmapname
|
nosignpost = true if $game_map.name == oldmapname
|
||||||
end
|
end
|
||||||
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name)) if !nosignpost
|
scene.spriteset.addUserSprite(LocationWindow.new($game_map.name)) if !nosignpost
|
||||||
end
|
}
|
||||||
# Force cycling/walking
|
)
|
||||||
if map_metadata&.always_bicycle
|
|
||||||
pbMountBike
|
|
||||||
elsif !pbCanUseBike?($game_map.map_id)
|
|
||||||
pbDismountBike
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -683,7 +715,7 @@ def pbRegisterPartner(tr_type, tr_name, tr_id = 0)
|
|||||||
tr_type = GameData::TrainerType.get(tr_type).id
|
tr_type = GameData::TrainerType.get(tr_type).id
|
||||||
pbCancelVehicles
|
pbCancelVehicles
|
||||||
trainer = pbLoadTrainer(tr_type, tr_name, tr_id)
|
trainer = pbLoadTrainer(tr_type, tr_name, tr_id)
|
||||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
EventHandlers.trigger(:on_trainer_load, trainer)
|
||||||
trainer.party.each do |i|
|
trainer.party.each do |i|
|
||||||
i.owner = Pokemon::Owner.new_from_trainer(trainer)
|
i.owner = Pokemon::Owner.new_from_trainer(trainer)
|
||||||
i.calc_stats
|
i.calc_stats
|
||||||
|
|||||||
@@ -188,18 +188,20 @@ def pbGetEnvironment
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onStartBattle += proc { |_sender|
|
# Record current levels of Pokémon in party, to see if they gain a level during
|
||||||
# Record current levels of Pokémon in party, to see if they gain a level
|
# battle and may need to evolve afterwards
|
||||||
# during battle and may need to evolve afterwards
|
EventHandlers.add(:on_start_battle, :record_party_status,
|
||||||
$game_temp.party_levels_before_battle = []
|
proc {
|
||||||
$game_temp.party_critical_hits_dealt = []
|
$game_temp.party_levels_before_battle = []
|
||||||
$game_temp.party_direct_damage_taken = []
|
$game_temp.party_critical_hits_dealt = []
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$game_temp.party_direct_damage_taken = []
|
||||||
$game_temp.party_levels_before_battle[i] = pkmn.level
|
$player.party.each_with_index do |pkmn, i|
|
||||||
$game_temp.party_critical_hits_dealt[i] = 0
|
$game_temp.party_levels_before_battle[i] = pkmn.level
|
||||||
$game_temp.party_direct_damage_taken[i] = 0
|
$game_temp.party_critical_hits_dealt[i] = 0
|
||||||
end
|
$game_temp.party_direct_damage_taken[i] = 0
|
||||||
}
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbCanDoubleBattle?
|
def pbCanDoubleBattle?
|
||||||
return $PokemonGlobal.partner || $player.able_pokemon_count >= 2
|
return $PokemonGlobal.partner || $player.able_pokemon_count >= 2
|
||||||
@@ -230,7 +232,7 @@ def pbWildBattleCore(*args)
|
|||||||
end
|
end
|
||||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||||
# comparing levels for an evolution check)
|
# comparing levels for an evolution check)
|
||||||
Events.onStartBattle.trigger(nil)
|
EventHandlers.trigger(:on_start_battle)
|
||||||
# Generate wild Pokémon based on the species and level
|
# Generate wild Pokémon based on the species and level
|
||||||
foeParty = []
|
foeParty = []
|
||||||
sp = nil
|
sp = nil
|
||||||
@@ -314,8 +316,8 @@ def pbWildBattle(species, level, outcomeVar = 1, canRun = true, canLose = false)
|
|||||||
# Potentially call a different pbWildBattle-type method instead (for roaming
|
# Potentially call a different pbWildBattle-type method instead (for roaming
|
||||||
# Pokémon, Safari battles, Bug Contest battles)
|
# Pokémon, Safari battles, Bug Contest battles)
|
||||||
handled = [nil]
|
handled = [nil]
|
||||||
Events.onWildBattleOverride.trigger(nil, species, level, handled)
|
EventHandlers.trigger(:on_calling_wild_battle, species, level, handled)
|
||||||
return handled[0] if handled[0] != nil
|
return handled[0] if !handled[0].nil?
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
setBattleRule("outcomeVar", outcomeVar) if outcomeVar != 1
|
||||||
setBattleRule("cannotRun") if !canRun
|
setBattleRule("cannotRun") if !canRun
|
||||||
@@ -323,7 +325,7 @@ def pbWildBattle(species, level, outcomeVar = 1, canRun = true, canLose = false)
|
|||||||
# Perform the battle
|
# Perform the battle
|
||||||
decision = pbWildBattleCore(species, level)
|
decision = pbWildBattleCore(species, level)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
@@ -375,7 +377,7 @@ def pbTrainerBattleCore(*args)
|
|||||||
end
|
end
|
||||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||||
# comparing levels for an evolution check)
|
# comparing levels for an evolution check)
|
||||||
Events.onStartBattle.trigger(nil)
|
EventHandlers.trigger(:on_start_battle)
|
||||||
# Generate trainers and their parties based on the arguments given
|
# Generate trainers and their parties based on the arguments given
|
||||||
foeTrainers = []
|
foeTrainers = []
|
||||||
foeItems = []
|
foeItems = []
|
||||||
@@ -394,7 +396,7 @@ def pbTrainerBattleCore(*args)
|
|||||||
trainer = pbLoadTrainer(arg[0], arg[1], arg[2])
|
trainer = pbLoadTrainer(arg[0], arg[1], arg[2])
|
||||||
pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer
|
pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer
|
||||||
return 0 if !trainer
|
return 0 if !trainer
|
||||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
EventHandlers.trigger(:on_trainer_load, trainer)
|
||||||
foeTrainers.push(trainer)
|
foeTrainers.push(trainer)
|
||||||
foePartyStarts.push(foeParty.length)
|
foePartyStarts.push(foeParty.length)
|
||||||
trainer.party.each { |pkmn| foeParty.push(pkmn) }
|
trainer.party.each { |pkmn| foeParty.push(pkmn) }
|
||||||
@@ -495,7 +497,7 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech = nil,
|
|||||||
trainer = pbLoadTrainer(trainerID, trainerName, trainerPartyID)
|
trainer = pbLoadTrainer(trainerID, trainerName, trainerPartyID)
|
||||||
pbMissingTrainer(trainerID, trainerName, trainerPartyID) if !trainer
|
pbMissingTrainer(trainerID, trainerName, trainerPartyID) if !trainer
|
||||||
return false if !trainer
|
return false if !trainer
|
||||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
EventHandlers.trigger(:on_trainer_load, trainer)
|
||||||
# If there is exactly 1 other triggered trainer event, and this trainer has
|
# If there is exactly 1 other triggered trainer event, and this trainer has
|
||||||
# 6 or fewer Pokémon, record this trainer for a double battle caused by the
|
# 6 or fewer Pokémon, record this trainer for a double battle caused by the
|
||||||
# other triggered trainer event
|
# other triggered trainer event
|
||||||
@@ -580,34 +582,34 @@ def pbAfterBattle(decision, canLose)
|
|||||||
$player.party.each { |pkmn| pkmn.heal }
|
$player.party.each { |pkmn| pkmn.heal }
|
||||||
(Graphics.frame_rate / 4).times { Graphics.update }
|
(Graphics.frame_rate / 4).times { Graphics.update }
|
||||||
end
|
end
|
||||||
Events.onEndBattle.trigger(nil, decision, canLose)
|
EventHandlers.trigger(:on_end_battle, decision, canLose)
|
||||||
$game_player.straighten
|
$game_player.straighten
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onEndBattle += proc { |_sender, e|
|
EventHandlers.add(:on_end_battle, :evolve_and_black_out,
|
||||||
decision = e[0]
|
proc { |decision, canLose|
|
||||||
canLose = e[1]
|
# Check for evolutions
|
||||||
# Check for evolutions
|
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
(decision != 2 && decision != 5) # not a loss or a draw
|
||||||
(decision != 2 && decision != 5) # not a loss or a draw
|
$game_temp.party_levels_before_battle = nil
|
||||||
$game_temp.party_levels_before_battle = nil
|
$game_temp.party_critical_hits_dealt = nil
|
||||||
$game_temp.party_critical_hits_dealt = nil
|
$game_temp.party_direct_damage_taken = nil
|
||||||
$game_temp.party_direct_damage_taken = nil
|
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
case decision
|
||||||
case decision
|
when 1, 4 # Win, capture
|
||||||
when 1, 4 # Win, capture
|
$player.pokemon_party.each do |pkmn|
|
||||||
$player.pokemon_party.each do |pkmn|
|
pbPickup(pkmn)
|
||||||
pbPickup(pkmn)
|
pbHoneyGather(pkmn)
|
||||||
pbHoneyGather(pkmn)
|
end
|
||||||
|
when 2, 5 # Lose, draw
|
||||||
|
if !canLose
|
||||||
|
$game_system.bgm_unpause
|
||||||
|
$game_system.bgs_unpause
|
||||||
|
pbStartOver
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when 2, 5 # Lose, draw
|
}
|
||||||
if !canLose
|
)
|
||||||
$game_system.bgm_unpause
|
|
||||||
$game_system.bgs_unpause
|
|
||||||
pbStartOver
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
def pbEvolutionCheck
|
def pbEvolutionCheck
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$player.party.each_with_index do |pkmn, i|
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Trigger events that may alter the generated Pokémon further
|
# Trigger events that may alter the generated Pokémon further
|
||||||
Events.onWildPokemonCreate.trigger(nil, genwildpoke)
|
EventHandlers.trigger(:on_wild_pokemon_created, genwildpoke)
|
||||||
return genwildpoke
|
return genwildpoke
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -455,11 +455,11 @@ end
|
|||||||
def pbEncounter(enc_type)
|
def pbEncounter(enc_type)
|
||||||
$game_temp.encounter_type = enc_type
|
$game_temp.encounter_type = enc_type
|
||||||
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
||||||
encounter1 = EncounterModifier.trigger(encounter1)
|
EventHandlers.trigger(:on_wild_species_chosen, encounter1)
|
||||||
return false if !encounter1
|
return false if !encounter1
|
||||||
if $PokemonEncounters.have_double_wild_battle?
|
if $PokemonEncounters.have_double_wild_battle?
|
||||||
encounter2 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
encounter2 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
||||||
encounter2 = EncounterModifier.trigger(encounter2)
|
EventHandlers.trigger(:on_wild_species_chosen, encounter2)
|
||||||
return false if !encounter2
|
return false if !encounter2
|
||||||
pbDoubleWildBattle(encounter1[0], encounter1[1], encounter2[0], encounter2[1])
|
pbDoubleWildBattle(encounter1[0], encounter1[1], encounter2[0], encounter2[1])
|
||||||
else
|
else
|
||||||
@@ -467,6 +467,5 @@ def pbEncounter(enc_type)
|
|||||||
end
|
end
|
||||||
$game_temp.encounter_type = nil
|
$game_temp.encounter_type = nil
|
||||||
$game_temp.force_single_battle = false
|
$game_temp.force_single_battle = false
|
||||||
EncounterModifier.triggerEncounterEnd
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,35 +6,36 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
|
# Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
|
||||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
EventHandlers.add(:on_wild_pokemon_created, :make_shiny_switch,
|
||||||
pkmn = e[0]
|
proc { |pkmn|
|
||||||
if $game_switches[Settings::SHINY_WILD_POKEMON_SWITCH]
|
pkmn.shiny = true if $game_switches[Settings::SHINY_WILD_POKEMON_SWITCH]
|
||||||
pkmn.shiny = true
|
}
|
||||||
end
|
)
|
||||||
}
|
|
||||||
|
|
||||||
# Used in the random dungeon map. Makes the levels of all wild Pokémon in that
|
# Used in the random dungeon map. Makes the levels of all wild Pokémon in that
|
||||||
# map depend on the levels of Pokémon in the player's party.
|
# map depend on the levels of Pokémon in the player's party.
|
||||||
# This is a simple method, and can/should be modified to account for evolutions
|
# This is a simple method, and can/should be modified to account for evolutions
|
||||||
# and other such details. Of course, you don't HAVE to use this code.
|
# and other such details. Of course, you don't HAVE to use this code.
|
||||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
EventHandlers.add(:on_wild_pokemon_created, :level_depends_on_party,
|
||||||
pkmn = e[0]
|
proc { |pkmn|
|
||||||
if $game_map.map_id == 51
|
next if $game_map.map_id != 51
|
||||||
new_level = pbBalancedLevel($player.party) - 4 + rand(5) # For variety
|
new_level = pbBalancedLevel($player.party) - 4 + rand(5) # For variety
|
||||||
new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
|
new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
|
||||||
pkmn.level = new_level
|
pkmn.level = new_level
|
||||||
pkmn.calc_stats
|
pkmn.calc_stats
|
||||||
pkmn.reset_moves
|
pkmn.reset_moves
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
# This is the basis of a trainer modifier. It works both for trainers loaded
|
# This is the basis of a trainer modifier. It works both for trainers loaded
|
||||||
# when you battle them, and for partner trainers when they are registered.
|
# when you battle them, and for partner trainers when they are registered.
|
||||||
# Note that you can only modify a partner trainer's Pokémon, and not the trainer
|
# Note that you can only modify a partner trainer's Pokémon, and not the trainer
|
||||||
# themselves nor their items this way, as those are generated from scratch
|
# themselves nor their items this way, as those are generated from scratch
|
||||||
# before each battle.
|
# before each battle.
|
||||||
#Events.onTrainerPartyLoad += proc { |_sender, trainer|
|
#EventHandlers.trigger(:on_trainer_load, :put_a_name_here,
|
||||||
# if trainer # An NPCTrainer object containing party/items/lose text, etc.
|
# proc { |trainer|
|
||||||
# YOUR CODE HERE
|
# if trainer # An NPCTrainer object containing party/items/lose text, etc.
|
||||||
# end
|
# YOUR CODE HERE
|
||||||
#}
|
# end
|
||||||
|
# }
|
||||||
|
#)
|
||||||
|
|||||||
@@ -93,16 +93,17 @@ end
|
|||||||
|
|
||||||
# When the player moves to a new map (with a different name), make all roaming
|
# When the player moves to a new map (with a different name), make all roaming
|
||||||
# Pokémon roam.
|
# Pokémon roam.
|
||||||
Events.onMapChange += proc { |_sender, e|
|
EventHandlers.add(:on_enter_map, :move_roaming_pokemon,
|
||||||
oldMapID = e[0]
|
proc { |old_map_id|
|
||||||
# Get and compare map names
|
# Get and compare map names
|
||||||
mapInfos = pbLoadMapInfos
|
mapInfos = pbLoadMapInfos
|
||||||
next if mapInfos && oldMapID > 0 && mapInfos[oldMapID] &&
|
next if mapInfos && old_map_id > 0 && mapInfos[old_map_id] &&
|
||||||
mapInfos[oldMapID].name && $game_map.name == mapInfos[oldMapID].name
|
mapInfos[old_map_id].name && $game_map.name == mapInfos[old_map_id].name
|
||||||
# Make roaming Pokémon roam
|
# Make roaming Pokémon roam
|
||||||
pbRoamPokemon
|
pbRoamPokemon
|
||||||
$PokemonGlobal.roamedAlready = false
|
$PokemonGlobal.roamedAlready = false
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -135,64 +136,69 @@ def pbRoamingMethodAllowed(roamer_method)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
EncounterModifier.register(proc { |encounter|
|
EventHandlers.add(:on_wild_species_chosen, :roaming_pokemon,
|
||||||
$game_temp.roamer_index_for_encounter = nil
|
proc { |encounter|
|
||||||
next nil if !encounter
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
next if !encounter
|
||||||
next encounter if $PokemonGlobal.roamedAlready
|
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
||||||
next encounter if $PokemonGlobal.partner
|
next if $PokemonGlobal.roamedAlready
|
||||||
next encounter if $game_temp.poke_radar_data
|
next if $PokemonGlobal.partner
|
||||||
next encounter if rand(100) < 75 # 25% chance of encountering a roaming Pokémon
|
next if $game_temp.poke_radar_data
|
||||||
# Look at each roaming Pokémon in turn and decide whether it's possible to
|
next if rand(100) < 75 # 25% chance of encountering a roaming Pokémon
|
||||||
# encounter it
|
# Look at each roaming Pokémon in turn and decide whether it's possible to
|
||||||
currentRegion = pbGetCurrentRegion
|
# encounter it
|
||||||
currentMapName = $game_map.name
|
currentRegion = pbGetCurrentRegion
|
||||||
possible_roamers = []
|
currentMapName = $game_map.name
|
||||||
Settings::ROAMING_SPECIES.each_with_index do |data, i|
|
possible_roamers = []
|
||||||
# data = [species, level, Game Switch, roamer method, battle BGM, area maps hash]
|
Settings::ROAMING_SPECIES.each_with_index do |data, i|
|
||||||
next if !GameData::Species.exists?(data[0])
|
# data = [species, level, Game Switch, roamer method, battle BGM, area maps hash]
|
||||||
next if data[2] > 0 && !$game_switches[data[2]] # Isn't roaming
|
next if !GameData::Species.exists?(data[0])
|
||||||
next if $PokemonGlobal.roamPokemon[i] == true # Roaming Pokémon has been caught
|
next if data[2] > 0 && !$game_switches[data[2]] # Isn't roaming
|
||||||
# Get the roamer's current map
|
next if $PokemonGlobal.roamPokemon[i] == true # Roaming Pokémon has been caught
|
||||||
roamerMap = $PokemonGlobal.roamPosition[i]
|
# Get the roamer's current map
|
||||||
if !roamerMap
|
roamerMap = $PokemonGlobal.roamPosition[i]
|
||||||
mapIDs = pbRoamingAreas(i).keys # Hash of area patrolled by the roaming Pokémon
|
if !roamerMap
|
||||||
next if !mapIDs || mapIDs.length == 0 # No roaming area defined somehow
|
mapIDs = pbRoamingAreas(i).keys # Hash of area patrolled by the roaming Pokémon
|
||||||
roamerMap = mapIDs[rand(mapIDs.length)]
|
next if !mapIDs || mapIDs.length == 0 # No roaming area defined somehow
|
||||||
$PokemonGlobal.roamPosition[i] = roamerMap
|
roamerMap = mapIDs[rand(mapIDs.length)]
|
||||||
|
$PokemonGlobal.roamPosition[i] = roamerMap
|
||||||
|
end
|
||||||
|
# If roamer isn't on the current map, check if it's on a map with the same
|
||||||
|
# name and in the same region
|
||||||
|
if roamerMap != $game_map.map_id
|
||||||
|
map_metadata = GameData::MapMetadata.try_get(roamerMap)
|
||||||
|
next if !map_metadata || !map_metadata.town_map_position ||
|
||||||
|
map_metadata.town_map_position[0] != currentRegion
|
||||||
|
next if pbGetMapNameFromId(roamerMap) != currentMapName
|
||||||
|
end
|
||||||
|
# Check whether the roamer's roamer method is currently possible
|
||||||
|
next if !pbRoamingMethodAllowed(data[3])
|
||||||
|
# Add this roaming Pokémon to the list of possible roaming Pokémon to encounter
|
||||||
|
possible_roamers.push([i, data[0], data[1], data[4]]) # [i, species, level, BGM]
|
||||||
end
|
end
|
||||||
# If roamer isn't on the current map, check if it's on a map with the same
|
# No encounterable roaming Pokémon were found, just have the regular encounter
|
||||||
# name and in the same region
|
next if possible_roamers.length == 0
|
||||||
if roamerMap != $game_map.map_id
|
# Pick a roaming Pokémon to encounter out of those available
|
||||||
map_metadata = GameData::MapMetadata.try_get(roamerMap)
|
roamer = possible_roamers.sample
|
||||||
next if !map_metadata || !map_metadata.town_map_position ||
|
$PokemonGlobal.roamEncounter = roamer
|
||||||
map_metadata.town_map_position[0] != currentRegion
|
$game_temp.roamer_index_for_encounter = roamer[0]
|
||||||
next if pbGetMapNameFromId(roamerMap) != currentMapName
|
$PokemonGlobal.nextBattleBGM = roamer[3] if roamer[3] && !roamer[3].empty?
|
||||||
end
|
$game_temp.force_single_battle = true
|
||||||
# Check whether the roamer's roamer method is currently possible
|
encounter[0] = roamer[1] # Species
|
||||||
next if !pbRoamingMethodAllowed(data[3])
|
encounter[1] = roamer[2] # Level
|
||||||
# Add this roaming Pokémon to the list of possible roaming Pokémon to encounter
|
}
|
||||||
possible_roamers.push([i, data[0], data[1], data[4]]) # [i, species, level, BGM]
|
)
|
||||||
end
|
|
||||||
# No encounterable roaming Pokémon were found, just have the regular encounter
|
|
||||||
next encounter if possible_roamers.length == 0
|
|
||||||
# Pick a roaming Pokémon to encounter out of those available
|
|
||||||
roamer = possible_roamers[rand(possible_roamers.length)]
|
|
||||||
$PokemonGlobal.roamEncounter = roamer
|
|
||||||
$game_temp.roamer_index_for_encounter = roamer[0]
|
|
||||||
$PokemonGlobal.nextBattleBGM = roamer[3] if roamer[3] && !roamer[3].empty?
|
|
||||||
$game_temp.force_single_battle = true
|
|
||||||
next [roamer[1], roamer[2]] # Species, level
|
|
||||||
})
|
|
||||||
|
|
||||||
Events.onWildBattleOverride += proc { |_sender, e|
|
EventHandlers.add(:on_calling_wild_battle, :roaming_pokemon,
|
||||||
species = e[0]
|
proc { |species, level, handled|
|
||||||
level = e[1]
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
handled = e[2]
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
next if handled[0] != nil
|
# would override it again
|
||||||
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
next if !handled[0].nil?
|
||||||
handled[0] = pbRoamingPokemonBattle(species, level)
|
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
||||||
}
|
handled[0] = pbRoamingPokemonBattle(species, level)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbRoamingPokemonBattle(species, level)
|
def pbRoamingPokemonBattle(species, level)
|
||||||
# Get the roaming Pokémon to encounter; generate it based on the species and
|
# Get the roaming Pokémon to encounter; generate it based on the species and
|
||||||
@@ -214,12 +220,9 @@ def pbRoamingPokemonBattle(species, level)
|
|||||||
end
|
end
|
||||||
$PokemonGlobal.roamEncounter = nil
|
$PokemonGlobal.roamEncounter = nil
|
||||||
$PokemonGlobal.roamedAlready = true
|
$PokemonGlobal.roamedAlready = true
|
||||||
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
EncounterModifier.registerEncounterEnd(proc {
|
|
||||||
$game_temp.roamer_index_for_encounter = nil
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ end
|
|||||||
|
|
||||||
# Unused
|
# Unused
|
||||||
def pbHiddenMoveEvent
|
def pbHiddenMoveEvent
|
||||||
Events.onAction.trigger(nil)
|
EventHandlers.trigger(:on_player_interact)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCheckHiddenMoveBadge(badge = -1, showmsg = true)
|
def pbCheckHiddenMoveBadge(badge = -1, showmsg = true)
|
||||||
@@ -383,22 +383,24 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onAction += proc { |_sender, _e|
|
EventHandlers.add(:on_player_interact, :diving,
|
||||||
if $PokemonGlobal.diving
|
proc {
|
||||||
surface_map_id = nil
|
if $PokemonGlobal.diving
|
||||||
GameData::MapMetadata.each do |map_data|
|
surface_map_id = nil
|
||||||
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
GameData::MapMetadata.each do |map_data|
|
||||||
surface_map_id = map_data.id
|
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
|
||||||
break
|
surface_map_id = map_data.id
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if surface_map_id &&
|
||||||
|
$map_factory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
|
||||||
|
pbSurfacing
|
||||||
|
end
|
||||||
|
elsif $game_player.terrain_tag.can_dive
|
||||||
|
pbDive
|
||||||
end
|
end
|
||||||
if surface_map_id &&
|
}
|
||||||
$map_factory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
|
)
|
||||||
pbSurfacing
|
|
||||||
end
|
|
||||||
elsif $game_player.terrain_tag.can_dive
|
|
||||||
pbDive
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
HiddenMoveHandlers::CanUseMove.add(:DIVE, proc { |move, pkmn, showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:DIVE, proc { |move, pkmn, showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, showmsg)
|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, showmsg)
|
||||||
@@ -703,10 +705,12 @@ def pbStrength
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onAction += proc { |_sender, _e|
|
EventHandlers.add(:on_player_interact, :strength_event,
|
||||||
facingEvent = $game_player.pbFacingEvent
|
proc {
|
||||||
pbStrength if facingEvent && facingEvent.name[/strengthboulder/i]
|
facingEvent = $game_player.pbFacingEvent
|
||||||
}
|
pbStrength if facingEvent && facingEvent.name[/strengthboulder/i]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
HiddenMoveHandlers::CanUseMove.add(:STRENGTH, proc { |move, pkmn, showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:STRENGTH, proc { |move, pkmn, showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, showmsg)
|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_STRENGTH, showmsg)
|
||||||
@@ -796,13 +800,15 @@ def pbTransferSurfing(mapid, xcoord, ycoord, direction = $game_player.direction)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onAction += proc { |_sender, _e|
|
EventHandlers.add(:on_player_interact, :start_surfing,
|
||||||
next if $PokemonGlobal.surfing
|
proc {
|
||||||
next if $game_map.metadata&.always_bicycle
|
next if $PokemonGlobal.surfing
|
||||||
next if !$game_player.pbFacingTerrainTag.can_surf_freely
|
next if $game_map.metadata&.always_bicycle
|
||||||
next if !$game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player)
|
next if !$game_player.pbFacingTerrainTag.can_surf_freely
|
||||||
pbSurf
|
next if !$game_map.passable?($game_player.x, $game_player.y, $game_player.direction, $game_player)
|
||||||
}
|
pbSurf
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
|
||||||
@@ -1001,14 +1007,16 @@ def pbWaterfall
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onAction += proc { |_sender, _e|
|
EventHandlers.add(:on_player_interact, :waterfall,
|
||||||
terrain = $game_player.pbFacingTerrainTag
|
proc {
|
||||||
if terrain.waterfall
|
terrain = $game_player.pbFacingTerrainTag
|
||||||
pbWaterfall
|
if terrain.waterfall
|
||||||
elsif terrain.waterfall_crest
|
pbWaterfall
|
||||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
elsif terrain.waterfall_crest
|
||||||
end
|
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||||
}
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
HiddenMoveHandlers::CanUseMove.add(:WATERFALL, proc { |move, pkmn, showmsg|
|
HiddenMoveHandlers::CanUseMove.add(:WATERFALL, proc { |move, pkmn, showmsg|
|
||||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, showmsg)
|
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_WATERFALL, showmsg)
|
||||||
|
|||||||
@@ -290,16 +290,16 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
Events.onSpritesetCreate += proc { |_sender, e|
|
EventHandlers.add(:on_new_spriteset_map, :add_berry_plant_graphics,
|
||||||
spriteset = e[0]
|
proc { |spriteset, viewport|
|
||||||
viewport = e[1]
|
map = spriteset.map
|
||||||
map = spriteset.map
|
map.events.each do |event|
|
||||||
map.events.each do |event|
|
next if !event[1].name[/berryplant/i]
|
||||||
next if !event[1].name[/berryplant/i]
|
spriteset.addUserSprite(BerryPlantMoistureSprite.new(event[1], map, viewport))
|
||||||
spriteset.addUserSprite(BerryPlantMoistureSprite.new(event[1], map, viewport))
|
spriteset.addUserSprite(BerryPlantSprite.new(event[1], map, viewport))
|
||||||
spriteset.addUserSprite(BerryPlantSprite.new(event[1], map, viewport))
|
end
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -557,9 +557,11 @@ end
|
|||||||
# With each step taken, add Exp to Pokémon in the Day Care and try to generate
|
# With each step taken, add Exp to Pokémon in the Day Care and try to generate
|
||||||
# an egg.
|
# an egg.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
Events.onStepTaken += proc { |_sender, _e|
|
EventHandlers.add(:on_player_step_taken, :update_day_care,
|
||||||
$PokemonGlobal.day_care.update_on_step_taken
|
proc {
|
||||||
}
|
$PokemonGlobal.day_care.update_on_step_taken
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Deprecated methods
|
# Deprecated methods
|
||||||
|
|||||||
@@ -643,27 +643,27 @@ module RandomDungeonGenerator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapCreate += proc { |_sender, e|
|
EventHandlers.add(:on_game_map_setup, :random_dungeon,
|
||||||
mapID = e[0]
|
proc { |map_id, map, _tileset_data|
|
||||||
map = e[1]
|
next if !GameData::MapMetadata.try_get(map_id)&.random_dungeon
|
||||||
next if !GameData::MapMetadata.try_get(mapID)&.random_dungeon
|
# this map is a randomly generated dungeon
|
||||||
# this map is a randomly generated dungeon
|
dungeon = RandomDungeonGenerator::Dungeon.new(map.width, map.height)
|
||||||
dungeon = RandomDungeonGenerator::Dungeon.new(map.width, map.height)
|
dungeon.generate
|
||||||
dungeon.generate
|
dungeon.generateMapInPlace(map)
|
||||||
dungeon.generateMapInPlace(map)
|
roomtiles = []
|
||||||
roomtiles = []
|
# Reposition events
|
||||||
# Reposition events
|
map.events.values.each do |event|
|
||||||
map.events.values.each do |event|
|
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
||||||
|
if tile
|
||||||
|
event.x = tile[0]
|
||||||
|
event.y = tile[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# Override transfer X and Y
|
||||||
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
||||||
if tile
|
if tile
|
||||||
event.x = tile[0]
|
$game_temp.player_new_x = tile[0]
|
||||||
event.y = tile[1]
|
$game_temp.player_new_y = tile[1]
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
# Override transfer X and Y
|
)
|
||||||
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
|
|
||||||
if tile
|
|
||||||
$game_temp.player_new_x = tile[0]
|
|
||||||
$game_temp.player_new_y = tile[1]
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -134,25 +134,27 @@ ItemHandlers::UseInField.add(:MAXREPEL, proc { |item|
|
|||||||
next pbRepel(item, 250)
|
next pbRepel(item, 250)
|
||||||
})
|
})
|
||||||
|
|
||||||
Events.onStepTaken += proc {
|
EventHandlers.add(:on_player_step_taken, :repel_counter,
|
||||||
next if $PokemonGlobal.repel <= 0 || $game_player.terrain_tag.ice # Shouldn't count down if on ice
|
proc {
|
||||||
$PokemonGlobal.repel -= 1
|
next if $PokemonGlobal.repel <= 0 || $game_player.terrain_tag.ice # Shouldn't count down if on ice
|
||||||
next if $PokemonGlobal.repel > 0
|
$PokemonGlobal.repel -= 1
|
||||||
repels = []
|
next if $PokemonGlobal.repel > 0
|
||||||
GameData::Item.each { |itm| repels.push(itm.id) if itm.has_flag?("Repel") }
|
repels = []
|
||||||
if repels.none? { |item| $bag.has?(item) }
|
GameData::Item.each { |itm| repels.push(itm.id) if itm.has_flag?("Repel") }
|
||||||
pbMessage(_INTL("The repellent's effect wore off!"))
|
if repels.none? { |item| $bag.has?(item) }
|
||||||
next
|
pbMessage(_INTL("The repellent's effect wore off!"))
|
||||||
end
|
next
|
||||||
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
|
end
|
||||||
ret = nil
|
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
|
||||||
pbFadeOutIn {
|
ret = nil
|
||||||
scene = PokemonBag_Scene.new
|
pbFadeOutIn {
|
||||||
screen = PokemonBagScreen.new(scene, $bag)
|
scene = PokemonBag_Scene.new
|
||||||
ret = screen.pbChooseItemScreen(proc { |item| repels.include?(item) })
|
screen = PokemonBagScreen.new(scene, $bag)
|
||||||
|
ret = screen.pbChooseItemScreen(proc { |item| repels.include?(item) })
|
||||||
|
}
|
||||||
|
pbUseItem($bag, ret) if ret
|
||||||
}
|
}
|
||||||
pbUseItem($bag, ret) if ret
|
)
|
||||||
}
|
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|
|
ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|
|
||||||
pbUseItemMessage(item)
|
pbUseItemMessage(item)
|
||||||
|
|||||||
@@ -131,47 +131,48 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Phone-related counters
|
# Phone-related counters
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
Events.onMapUpdate += proc { |_sender, _e|
|
EventHandlers.add(:on_frame_update, :phone_call_counter,
|
||||||
next if !$player || !$player.has_pokegear
|
proc {
|
||||||
# Reset time to next phone call if necessary
|
next if !$player&.has_pokegear
|
||||||
if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime <= 0
|
# Reset time to next phone call if necessary
|
||||||
$PokemonGlobal.phoneTime = 20 * 60 * Graphics.frame_rate
|
if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime <= 0
|
||||||
$PokemonGlobal.phoneTime += rand(20 * 60 * Graphics.frame_rate)
|
$PokemonGlobal.phoneTime = rand(20...40) * 60 * Graphics.frame_rate
|
||||||
end
|
end
|
||||||
# Don't count down various phone times if other things are happening
|
# Don't count down various phone times if other things are happening
|
||||||
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
$PokemonGlobal.phoneNumbers = [] if !$PokemonGlobal.phoneNumbers
|
||||||
next if $game_temp.in_menu || $game_temp.in_battle || $game_temp.message_window_showing
|
next if $game_temp.in_menu || $game_temp.in_battle || $game_temp.message_window_showing
|
||||||
next if $game_player.move_route_forcing || pbMapInterpreterRunning?
|
next if $game_player.move_route_forcing || pbMapInterpreterRunning?
|
||||||
# Count down time to next phone call
|
# Count down time to next phone call
|
||||||
$PokemonGlobal.phoneTime -= 1
|
$PokemonGlobal.phoneTime -= 1
|
||||||
# Count down time to next can-battle for each trainer contact
|
# Count down time to next can-battle for each trainer contact
|
||||||
if $PokemonGlobal.phoneTime % Graphics.frame_rate == 0 # Every second
|
if $PokemonGlobal.phoneTime % Graphics.frame_rate == 0 # Every second
|
||||||
$PokemonGlobal.phoneNumbers.each do |num|
|
$PokemonGlobal.phoneNumbers.each do |num|
|
||||||
next if !num[0] || num.length != 8 # if not visible or not a trainer
|
next if !num[0] || num.length != 8 # if not visible or not a trainer
|
||||||
# Reset time to next can-battle if necessary
|
# Reset time to next can-battle if necessary
|
||||||
if num[4] == 0
|
if num[4] == 0
|
||||||
num[3] = rand(20...40) * 60 # 20-40 minutes
|
num[3] = rand(20...40) * 60 # 20-40 minutes
|
||||||
num[4] = 1
|
num[4] = 1
|
||||||
end
|
end
|
||||||
# Count down time to next can-battle
|
# Count down time to next can-battle
|
||||||
num[3] -= 1
|
num[3] -= 1
|
||||||
# Ready to battle
|
# Ready to battle
|
||||||
if num[3] <= 0 && num[4] == 1
|
if num[3] <= 0 && num[4] == 1
|
||||||
num[4] = 2 # set ready-to-battle flag
|
num[4] = 2 # set ready-to-battle flag
|
||||||
pbSetReadyToBattle(num)
|
pbSetReadyToBattle(num)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
# Time for a random phone call; generate one
|
||||||
# Time for a random phone call; generate one
|
if $PokemonGlobal.phoneTime <= 0
|
||||||
if $PokemonGlobal.phoneTime <= 0
|
# find all trainer phone numbers
|
||||||
# find all trainer phone numbers
|
phonenum = pbRandomPhoneTrainer
|
||||||
phonenum = pbRandomPhoneTrainer
|
if phonenum
|
||||||
if phonenum
|
call = pbPhoneGenerateCall(phonenum)
|
||||||
call = pbPhoneGenerateCall(phonenum)
|
pbPhoneCall(call, phonenum)
|
||||||
pbPhoneCall(call, phonenum)
|
end
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Player calls a contact
|
# Player calls a contact
|
||||||
|
|||||||
@@ -151,90 +151,102 @@ end
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Event handlers
|
# Event handlers
|
||||||
################################################################################
|
################################################################################
|
||||||
EncounterModifier.register(proc { |encounter|
|
EventHandlers.add(:on_wild_species_chosen, :poke_radar_chain,
|
||||||
if GameData::EncounterType.get($game_temp.encounter_type).type != :land ||
|
proc { |encounter|
|
||||||
$PokemonGlobal.bicycle || $PokemonGlobal.partner
|
if GameData::EncounterType.get($game_temp.encounter_type).type != :land ||
|
||||||
pbPokeRadarCancel
|
$PokemonGlobal.bicycle || $PokemonGlobal.partner
|
||||||
next encounter
|
pbPokeRadarCancel
|
||||||
end
|
next
|
||||||
ring = pbPokeRadarGetShakingGrass
|
end
|
||||||
if ring >= 0 # Encounter triggered by stepping into rustling grass
|
ring = pbPokeRadarGetShakingGrass
|
||||||
# Get rarity of shaking grass
|
if ring >= 0 # Encounter triggered by stepping into rustling grass
|
||||||
rarity = 0 # 0 = rustle, 1 = vigorous rustle, 2 = shiny rustle
|
# Get rarity of shaking grass
|
||||||
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
|
rarity = 0 # 0 = rustle, 1 = vigorous rustle, 2 = shiny rustle
|
||||||
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
|
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
|
||||||
if rarity == 2 ||
|
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
|
||||||
rand(100) < 58 + (ring * 10) + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
|
chain_chance = 58 + (ring * 10)
|
||||||
# Continue the chain
|
chain_chance += [$game_temp.poke_radar_data[2], 40].min / 4 # Chain length
|
||||||
encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]]
|
chain_chance += 10 if $game_temp.poke_radar_data[4] # Previous in chain was caught
|
||||||
$game_temp.force_single_battle = true
|
if rarity == 2 || rand(100) < chain_chance
|
||||||
else
|
# Continue the chain
|
||||||
# Break the chain, force an encounter with a different species
|
encounter[0] = $game_temp.poke_radar_data[0] # Species
|
||||||
100.times do
|
encounter[1] = $game_temp.poke_radar_data[1] # Level
|
||||||
break if encounter && encounter[0] != $game_temp.poke_radar_data[0]
|
|
||||||
encounter = $PokemonEncounters.choose_wild_pokemon($PokemonEncounters.encounter_type)
|
|
||||||
end
|
|
||||||
if encounter[0] == $game_temp.poke_radar_data[0] && encounter[1] == $game_temp.poke_radar_data[1]
|
|
||||||
# Chain couldn't be broken somehow; continue it after all
|
|
||||||
$game_temp.force_single_battle = true
|
$game_temp.force_single_battle = true
|
||||||
else
|
else
|
||||||
pbPokeRadarCancel
|
# Break the chain, force an encounter with a different species
|
||||||
|
100.times do
|
||||||
|
break if encounter && encounter[0] != $game_temp.poke_radar_data[0]
|
||||||
|
new_encounter = $PokemonEncounters.choose_wild_pokemon($PokemonEncounters.encounter_type)
|
||||||
|
encounter[0] = new_encounter[0]
|
||||||
|
encounter[1] = new_encounter[1]
|
||||||
|
end
|
||||||
|
if encounter[0] == $game_temp.poke_radar_data[0] && encounter[1] == $game_temp.poke_radar_data[1]
|
||||||
|
# Chain couldn't be broken somehow; continue it after all
|
||||||
|
$game_temp.force_single_battle = true
|
||||||
|
else
|
||||||
|
pbPokeRadarCancel
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else # Not chaining; will start one
|
||||||
|
# Force random wild encounter, vigorous shaking means rarer species
|
||||||
|
new_encounter = pbPokeRadarGetEncounter(rarity)
|
||||||
|
encounter[0] = new_encounter[0]
|
||||||
|
encounter[1] = new_encounter[1]
|
||||||
|
$game_temp.force_single_battle = true
|
||||||
end
|
end
|
||||||
else # Not chaining; will start one
|
elsif encounter # Encounter triggered by stepping in non-rustling grass
|
||||||
# Force random wild encounter, vigorous shaking means rarer species
|
pbPokeRadarCancel
|
||||||
encounter = pbPokeRadarGetEncounter(rarity)
|
|
||||||
$game_temp.force_single_battle = true
|
|
||||||
end
|
end
|
||||||
elsif encounter # Encounter triggered by stepping in non-rustling grass
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_wild_pokemon_created, :poke_radar_shiny,
|
||||||
|
proc { |pkmn|
|
||||||
|
next if !$game_temp.poke_radar_data
|
||||||
|
grasses = $game_temp.poke_radar_data[3]
|
||||||
|
next if !grasses
|
||||||
|
grasses.each do |grass|
|
||||||
|
next if $game_player.x != grass[0] || $game_player.y != grass[1]
|
||||||
|
pkmn.shiny = true if grass[3] == 2
|
||||||
|
break
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_wild_battle_end, :poke_radar_continue_chain,
|
||||||
|
proc { |species, level, decision|
|
||||||
|
if $game_temp.poke_radar_data && [1, 4].include?(decision) # Defeated/caught
|
||||||
|
$game_temp.poke_radar_data[0] = species
|
||||||
|
$game_temp.poke_radar_data[1] = level
|
||||||
|
$game_temp.poke_radar_data[2] += 1
|
||||||
|
$stats.poke_radar_longest_chain = [$game_temp.poke_radar_data[2], $stats.poke_radar_longest_chain].max
|
||||||
|
# Catching makes the next Radar encounter more likely to continue the chain
|
||||||
|
$game_temp.poke_radar_data[4] = (decision == 4)
|
||||||
|
pbPokeRadarHighlightGrass(false)
|
||||||
|
else
|
||||||
|
pbPokeRadarCancel
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_player_step_taken, :poke_radar,
|
||||||
|
proc {
|
||||||
|
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0 &&
|
||||||
|
!$game_temp.poke_radar_data
|
||||||
|
$PokemonGlobal.pokeradarBattery -= 1
|
||||||
|
end
|
||||||
|
terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
|
||||||
|
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
|
||||||
|
pbPokeRadarCancel
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_enter_map, :cancel_poke_radar,
|
||||||
|
proc { |_old_map_id|
|
||||||
pbPokeRadarCancel
|
pbPokeRadarCancel
|
||||||
end
|
}
|
||||||
next encounter
|
)
|
||||||
})
|
|
||||||
|
|
||||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
|
||||||
pokemon = e[0]
|
|
||||||
next if !$game_temp.poke_radar_data
|
|
||||||
grasses = $game_temp.poke_radar_data[3]
|
|
||||||
next if !grasses
|
|
||||||
grasses.each do |grass|
|
|
||||||
next if $game_player.x != grass[0] || $game_player.y != grass[1]
|
|
||||||
pokemon.shiny = true if grass[3] == 2
|
|
||||||
break
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
Events.onWildBattleEnd += proc { |_sender, e|
|
|
||||||
species = e[0]
|
|
||||||
level = e[1]
|
|
||||||
decision = e[2]
|
|
||||||
if $game_temp.poke_radar_data && [1, 4].include?(decision) # Defeated/caught
|
|
||||||
$game_temp.poke_radar_data[0] = species
|
|
||||||
$game_temp.poke_radar_data[1] = level
|
|
||||||
$game_temp.poke_radar_data[2] += 1
|
|
||||||
$stats.poke_radar_longest_chain = [$game_temp.poke_radar_data[2], $stats.poke_radar_longest_chain].max
|
|
||||||
# Catching makes the next Radar encounter more likely to continue the chain
|
|
||||||
$game_temp.poke_radar_data[4] = (decision == 4)
|
|
||||||
pbPokeRadarHighlightGrass(false)
|
|
||||||
else
|
|
||||||
pbPokeRadarCancel
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
Events.onStepTaken += proc { |_sender, _e|
|
|
||||||
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0 &&
|
|
||||||
!$game_temp.poke_radar_data
|
|
||||||
$PokemonGlobal.pokeradarBattery -= 1
|
|
||||||
end
|
|
||||||
terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
|
|
||||||
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
|
|
||||||
pbPokeRadarCancel
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
Events.onMapChange += proc { |_sender, _e|
|
|
||||||
pbPokeRadarCancel
|
|
||||||
}
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Item handlers
|
# Item handlers
|
||||||
|
|||||||
@@ -396,39 +396,43 @@ end
|
|||||||
|
|
||||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
||||||
# during battle and need to say they're ready to be purified afterwards
|
# during battle and need to say they're ready to be purified afterwards
|
||||||
Events.onStartBattle += proc { |_sender|
|
EventHandlers.add(:on_start_battle, :record_party_heart_gauges,
|
||||||
$game_temp.party_heart_gauges_before_battle = []
|
proc {
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$game_temp.party_heart_gauges_before_battle = []
|
||||||
$game_temp.party_heart_gauges_before_battle[i] = pkmn.heart_gauge
|
$player.party.each_with_index do |pkmn, i|
|
||||||
end
|
$game_temp.party_heart_gauges_before_battle[i] = pkmn.heart_gauge
|
||||||
}
|
|
||||||
|
|
||||||
Events.onEndBattle += proc { |_sender, _e|
|
|
||||||
$game_temp.party_heart_gauges_before_battle.each_with_index do |value, i|
|
|
||||||
pkmn = $player.party[i]
|
|
||||||
next if !pkmn || !value || value == 0
|
|
||||||
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
Events.onStepTaken += proc {
|
|
||||||
$player.able_party.each do |pkmn|
|
|
||||||
next if pkmn.heart_gauge == 0
|
|
||||||
pkmn.heart_gauge_step_counter = 0 if !pkmn.heart_gauge_step_counter
|
|
||||||
pkmn.heart_gauge_step_counter += 1
|
|
||||||
if pkmn.heart_gauge_step_counter >= 256
|
|
||||||
old_stage = pkmn.heartStage
|
|
||||||
pkmn.change_heart_gauge("walking")
|
|
||||||
new_stage = pkmn.heartStage
|
|
||||||
if new_stage == 0
|
|
||||||
pkmn.check_ready_to_purify
|
|
||||||
elsif new_stage != old_stage
|
|
||||||
pkmn.update_shadow_moves
|
|
||||||
end
|
|
||||||
pkmn.heart_gauge_step_counter = 0
|
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
if ($PokemonGlobal.purifyChamber rescue nil)
|
)
|
||||||
$PokemonGlobal.purifyChamber.update
|
|
||||||
end
|
EventHandlers.add(:on_end_battle, :check_ready_to_purify,
|
||||||
}
|
proc { |_decision, _canLose|
|
||||||
|
$game_temp.party_heart_gauges_before_battle.each_with_index do |value, i|
|
||||||
|
pkmn = $player.party[i]
|
||||||
|
next if !pkmn || !value || value == 0
|
||||||
|
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
EventHandlers.add(:on_player_step_taken, :lower_heart_gauges,
|
||||||
|
proc {
|
||||||
|
$player.able_party.each do |pkmn|
|
||||||
|
next if pkmn.heart_gauge == 0
|
||||||
|
pkmn.heart_gauge_step_counter = 0 if !pkmn.heart_gauge_step_counter
|
||||||
|
pkmn.heart_gauge_step_counter += 1
|
||||||
|
if pkmn.heart_gauge_step_counter >= 256
|
||||||
|
old_stage = pkmn.heartStage
|
||||||
|
pkmn.change_heart_gauge("walking")
|
||||||
|
new_stage = pkmn.heartStage
|
||||||
|
if new_stage == 0
|
||||||
|
pkmn.check_ready_to_purify
|
||||||
|
elsif new_stage != old_stage
|
||||||
|
pkmn.update_shadow_moves
|
||||||
|
end
|
||||||
|
pkmn.heart_gauge_step_counter = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
$PokemonGlobal.purifyChamber&.update
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
@@ -217,18 +217,20 @@ def pbHatch(pokemon)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onStepTaken += proc { |_sender, _e|
|
EventHandlers.add(:on_player_step_taken, :hatch_eggs,
|
||||||
$player.party.each do |egg|
|
proc {
|
||||||
next if egg.steps_to_hatch <= 0
|
$player.party.each do |egg|
|
||||||
egg.steps_to_hatch -= 1
|
next if egg.steps_to_hatch <= 0
|
||||||
$player.pokemon_party.each do |pkmn|
|
|
||||||
next if !pkmn.ability&.has_flag?("FasterEggHatching")
|
|
||||||
egg.steps_to_hatch -= 1
|
egg.steps_to_hatch -= 1
|
||||||
break
|
$player.pokemon_party.each do |pkmn|
|
||||||
|
next if !pkmn.ability&.has_flag?("FasterEggHatching")
|
||||||
|
egg.steps_to_hatch -= 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if egg.steps_to_hatch <= 0
|
||||||
|
egg.steps_to_hatch = 0
|
||||||
|
pbHatch(egg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if egg.steps_to_hatch <= 0
|
}
|
||||||
egg.steps_to_hatch = 0
|
)
|
||||||
pbHatch(egg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -55,9 +55,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Events.onMapChange += proc { |_sender, *args|
|
EventHandlers.add(:on_enter_map, :end_safari_game,
|
||||||
pbSafariState.pbEnd if !pbInSafari?
|
proc { |_old_map_id|
|
||||||
}
|
pbSafariState.pbEnd if !pbInSafari?
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbInSafari?
|
def pbInSafari?
|
||||||
if pbSafariState.inProgress?
|
if pbSafariState.inProgress?
|
||||||
@@ -75,29 +77,32 @@ def pbSafariState
|
|||||||
return $PokemonGlobal.safariState
|
return $PokemonGlobal.safariState
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onStepTakenTransferPossible += proc { |_sender, e|
|
EventHandlers.add(:on_player_step_taken_can_transfer, :safari_game_counter,
|
||||||
handled = e[0]
|
proc { |handled|
|
||||||
next if handled[0]
|
# handled is an array: [nil]. If [true], a message has already been shown
|
||||||
if pbInSafari? && pbSafariState.decision == 0 && Settings::SAFARI_STEPS > 0
|
# because of this step, so don't do anything that might show another one
|
||||||
|
next if handled[0]
|
||||||
|
next if Settings::SAFARI_STEPS == 0 || !pbInSafari? || pbSafariState.decision != 0
|
||||||
pbSafariState.steps -= 1
|
pbSafariState.steps -= 1
|
||||||
if pbSafariState.steps <= 0
|
next if pbSafariState.steps > 0
|
||||||
pbMessage(_INTL("PA: Ding-dong!\1"))
|
pbMessage(_INTL("PA: Ding-dong!\1"))
|
||||||
pbMessage(_INTL("PA: Your safari game is over!"))
|
pbMessage(_INTL("PA: Your safari game is over!"))
|
||||||
pbSafariState.decision = 1
|
pbSafariState.decision = 1
|
||||||
pbSafariState.pbGoToStart
|
pbSafariState.pbGoToStart
|
||||||
handled[0] = true
|
handled[0] = true
|
||||||
end
|
}
|
||||||
end
|
)
|
||||||
}
|
|
||||||
|
|
||||||
Events.onWildBattleOverride += proc { |_sender, e|
|
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
||||||
species = e[0]
|
proc { |species, level, handled|
|
||||||
level = e[1]
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
handled = e[2]
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
next if handled[0] != nil
|
# would override it again
|
||||||
next if !pbInSafari?
|
next if !handled[0].nil?
|
||||||
handled[0] = pbSafariBattle(species, level)
|
next if !pbInSafari?
|
||||||
}
|
handled[0] = pbSafariBattle(species, level)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbSafariBattle(species, level)
|
def pbSafariBattle(species, level)
|
||||||
# Generate a wild Pokémon based on the species and level
|
# Generate a wild Pokémon based on the species and level
|
||||||
@@ -140,7 +145,7 @@ def pbSafariBattle(species, level)
|
|||||||
end
|
end
|
||||||
pbSet(1, decision)
|
pbSet(1, decision)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
||||||
# Return the outcome of the battle
|
# Return the outcome of the battle
|
||||||
return decision
|
return decision
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -286,36 +286,40 @@ def pbBugContestDecided?
|
|||||||
return pbBugContestState.decided?
|
return pbBugContestState.decided?
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapChange += proc { |_sender, _e|
|
EventHandlers.add(:on_enter_map, :end_bug_contest,
|
||||||
pbBugContestState.pbClearIfEnded
|
proc { |_old_map_id|
|
||||||
}
|
pbBugContestState.pbClearIfEnded
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
Events.onMapSceneChange += proc { |_sender, e|
|
EventHandlers.add(:on_map_or_spriteset_change, :show_bug_contest_timer,
|
||||||
scene = e[0]
|
proc { |scene, _map_changed|
|
||||||
if pbInBugContest? && pbBugContestState.decision == 0 && BugContestState::TIME_ALLOWED > 0
|
next if !pbInBugContest? || pbBugContestState.decision != 0 || BugContestState::TIME_ALLOWED == 0
|
||||||
scene.spriteset.addUserSprite(
|
scene.spriteset.addUserSprite(
|
||||||
TimerDisplay.new(pbBugContestState.timer,
|
TimerDisplay.new(pbBugContestState.timer,
|
||||||
BugContestState::TIME_ALLOWED * Graphics.frame_rate)
|
BugContestState::TIME_ALLOWED * Graphics.frame_rate)
|
||||||
)
|
)
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
Events.onMapUpdate += proc { |_sender, _e|
|
EventHandlers.add(:on_frame_update, :bug_contest_counter,
|
||||||
if !$game_player.move_route_forcing && !pbMapInterpreterRunning? &&
|
proc {
|
||||||
!$game_temp.message_window_showing && pbBugContestState.expired?
|
next if !pbBugContestState.expired?
|
||||||
pbMessage(_INTL("ANNOUNCER: BEEEEEP!"))
|
next if $game_player.move_route_forcing || pbMapInterpreterRunning? ||
|
||||||
|
$game_temp.message_window_showing
|
||||||
|
pbMessage(_INTL("ANNOUNCER: BEEEEEP!"))
|
||||||
pbMessage(_INTL("Time's up!"))
|
pbMessage(_INTL("Time's up!"))
|
||||||
pbBugContestState.pbStartJudging
|
pbBugContestState.pbStartJudging
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
Events.onMapChanging += proc { |_sender, e|
|
EventHandlers.add(:on_leave_map, :end_bug_contest,
|
||||||
newmapID = e[0]
|
proc { |new_map_id, new_map|
|
||||||
if pbInBugContest? && pbBugContestState.pbOffLimits?(newmapID)
|
next if !pbInBugContest? || !pbBugContestState.pbOffLimits?(new_map_id)
|
||||||
# Clear bug contest if player flies/warps/teleports out of the contest
|
# Clear bug contest if player flies/warps/teleports out of the contest
|
||||||
pbBugContestState.pbEnd(true)
|
pbBugContestState.pbEnd(true)
|
||||||
end
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
def pbBugContestStartOver
|
def pbBugContestStartOver
|
||||||
$player.party.each do |pkmn|
|
$player.party.each do |pkmn|
|
||||||
@@ -326,19 +330,21 @@ def pbBugContestStartOver
|
|||||||
pbBugContestState.pbStartJudging
|
pbBugContestState.pbStartJudging
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.onWildBattleOverride += proc { |_sender, e|
|
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
||||||
species = e[0]
|
proc { |species, level, handled|
|
||||||
level = e[1]
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
handled = e[2]
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
next if handled[0] != nil
|
# would override it again
|
||||||
next if !pbInBugContest?
|
next if !handled[0].nil?
|
||||||
handled[0] = pbBugContestBattle(species, level)
|
next if !pbInBugContest?
|
||||||
}
|
handled[0] = pbBugContestBattle(species, level)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def pbBugContestBattle(species, level)
|
def pbBugContestBattle(species, level)
|
||||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||||
# comparing levels for an evolution check)
|
# comparing levels for an evolution check)
|
||||||
Events.onStartBattle.trigger(nil)
|
EventHandlers.trigger(:on_start_battle)
|
||||||
# Generate a wild Pokémon based on the species and level
|
# Generate a wild Pokémon based on the species and level
|
||||||
pkmn = pbGenerateWildPokemon(species, level)
|
pkmn = pbGenerateWildPokemon(species, level)
|
||||||
foeParty = [pkmn]
|
foeParty = [pkmn]
|
||||||
@@ -387,7 +393,7 @@ def pbBugContestBattle(species, level)
|
|||||||
end
|
end
|
||||||
pbSet(1, decision)
|
pbSet(1, decision)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
Events.onWildBattleEnd.trigger(nil, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user