mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +00:00
Merged Events and EncounterModifier into module EventHandlers
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user