Merged Events and EncounterModifier into module EventHandlers

This commit is contained in:
Maruno17
2021-12-30 18:59:35 +00:00
parent a6c092a574
commit 7da449aec3
28 changed files with 812 additions and 807 deletions

View File

@@ -134,25 +134,27 @@ ItemHandlers::UseInField.add(:MAXREPEL, proc { |item|
next pbRepel(item, 250)
})
Events.onStepTaken += proc {
next if $PokemonGlobal.repel <= 0 || $game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
next if $PokemonGlobal.repel > 0
repels = []
GameData::Item.each { |itm| repels.push(itm.id) if itm.has_flag?("Repel") }
if repels.none? { |item| $bag.has?(item) }
pbMessage(_INTL("The repellent's effect wore off!"))
next
end
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| repels.include?(item) })
EventHandlers.add(:on_player_step_taken, :repel_counter,
proc {
next if $PokemonGlobal.repel <= 0 || $game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
next if $PokemonGlobal.repel > 0
repels = []
GameData::Item.each { |itm| repels.push(itm.id) if itm.has_flag?("Repel") }
if repels.none? { |item| $bag.has?(item) }
pbMessage(_INTL("The repellent's effect wore off!"))
next
end
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
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|
pbUseItemMessage(item)