Repels now have a flag in items.txt which determines if they can be reused when one runs out

This commit is contained in:
Maruno17
2021-12-29 22:07:10 +00:00
parent ca9df4177a
commit f3c4893dbb
5 changed files with 31 additions and 22 deletions

View File

@@ -135,26 +135,23 @@ ItemHandlers::UseInField.add(:MAXREPEL, proc { |item|
})
Events.onStepTaken += proc {
if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
if $PokemonGlobal.repel <= 0
if $bag.has?(:REPEL) || $bag.has?(:SUPERREPEL) || $bag.has?(:MAXREPEL)
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|
[:REPEL, :SUPERREPEL, :MAXREPEL].include?(item)
})
}
pbUseItem($bag, ret) if ret
end
else
pbMessage(_INTL("The repellent's effect wore off!"))
end
end
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
}
ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|