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

@@ -217,18 +217,20 @@ def pbHatch(pokemon)
end
end
Events.onStepTaken += proc { |_sender, _e|
$player.party.each do |egg|
next if egg.steps_to_hatch <= 0
egg.steps_to_hatch -= 1
$player.pokemon_party.each do |pkmn|
next if !pkmn.ability&.has_flag?("FasterEggHatching")
EventHandlers.add(:on_player_step_taken, :hatch_eggs,
proc {
$player.party.each do |egg|
next if egg.steps_to_hatch <= 0
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
if egg.steps_to_hatch <= 0
egg.steps_to_hatch = 0
pbHatch(egg)
end
end
}
}
)