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|

View File

@@ -6,6 +6,7 @@ NamePlural = Repels
Pocket = 1
Price = 350
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 100 steps after its use.
#-------------------------------
[SUPERREPEL]
@@ -14,6 +15,7 @@ NamePlural = Super Repels
Pocket = 1
Price = 500
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 200 steps after its use.
#-------------------------------
[MAXREPEL]
@@ -22,6 +24,7 @@ NamePlural = Max Repels
Pocket = 1
Price = 700
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 250 steps after its use.
#-------------------------------
[BLACKFLUTE]

View File

@@ -6,6 +6,7 @@ NamePlural = Repels
Pocket = 1
Price = 400
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 100 steps after its use.
#-------------------------------
[SUPERREPEL]
@@ -14,6 +15,7 @@ NamePlural = Super Repels
Pocket = 1
Price = 700
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 200 steps after its use.
#-------------------------------
[MAXREPEL]
@@ -22,6 +24,7 @@ NamePlural = Max Repels
Pocket = 1
Price = 900
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 250 steps after its use.
#-------------------------------
[BLACKFLUTE]

View File

@@ -6,6 +6,7 @@ NamePlural = Repels
Pocket = 1
Price = 400
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 100 steps after its use.
#-------------------------------
[SUPERREPEL]
@@ -14,6 +15,7 @@ NamePlural = Super Repels
Pocket = 1
Price = 700
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 200 steps after its use.
#-------------------------------
[MAXREPEL]
@@ -22,6 +24,7 @@ NamePlural = Max Repels
Pocket = 1
Price = 900
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 250 steps after its use.
#-------------------------------
[BLACKFLUTE]
@@ -5623,7 +5626,7 @@ Name = Mega Ring
NamePlural = Mega Rings
Pocket = 8
Price = 0
Flags = KeyItem
Flags = KeyItem, MegaRing
Description = This ring contains an untold power that somehow enables Pokémon carrying Mega Stones to Mega Evolve.
#-------------------------------
[POKEMONBOXLINK]

View File

@@ -1,4 +1,4 @@
# See the documentation on the wiki to learn how to edit this file.
# See the documentation on the wiki to learn how to edit this file.
#-------------------------------
[REPEL]
Name = Repel
@@ -6,6 +6,7 @@ NamePlural = Repels
Pocket = 1
Price = 400
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 100 steps after its use.
#-------------------------------
[SUPERREPEL]
@@ -14,6 +15,7 @@ NamePlural = Super Repels
Pocket = 1
Price = 700
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 200 steps after its use.
#-------------------------------
[MAXREPEL]
@@ -22,6 +24,7 @@ NamePlural = Max Repels
Pocket = 1
Price = 900
FieldUse = Direct
Flags = Repel
Description = An item that prevents weak wild Pokémon from appearing for 250 steps after its use.
#-------------------------------
[BLACKFLUTE]
@@ -5648,4 +5651,4 @@ NamePlural = Old Sea Maps
Pocket = 8
Price = 0
Flags = KeyItem
Description = A faded sea chart that shows the way to a certain island.
Description = A faded sea chart that shows the way to a certain island.