ability ball & incubators fix

This commit is contained in:
infinitefusion
2022-09-05 14:17:25 -04:00
parent d58c71781d
commit 3bf6a1e2ba
6 changed files with 48 additions and 31 deletions

View File

@@ -59,7 +59,7 @@ class PokeBattle_Battle
end end
def pbReturnUnusedItemToBag(item,idxBattler) def pbReturnUnusedItemToBag(item,idxBattler)
return if item! return if !item
useType = GameData::Item.get(item).battle_use useType = GameData::Item.get(item).battle_use
return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
if pbOwnedByPlayer?(idxBattler) if pbOwnedByPlayer?(idxBattler)

View File

@@ -537,7 +537,8 @@ def pbUseItem(bag, item, bagscene = nil)
break break
end end
pkmn = $Trainer.party[chosen] pkmn = $Trainer.party[chosen]
if pbCheckUseOnPokemon(item, pkmn, screen) if
pbCheckUseOnPokemon(item, pkmn, screen)
ret = ItemHandlers.triggerUseOnPokemon(item, pkmn, screen) ret = ItemHandlers.triggerUseOnPokemon(item, pkmn, screen)
if ret && useType == 1 # Usable on Pokémon, consumed if ret && useType == 1 # Usable on Pokémon, consumed
bag.pbDeleteItem(item) bag.pbDeleteItem(item)
@@ -633,7 +634,7 @@ def pbUseItemMessage(item)
end end
def pbCheckUseOnPokemon(_item, pkmn, _screen) def pbCheckUseOnPokemon(_item, pkmn, _screen)
return pkmn && !pkmn.egg? return pkmn #&& !pkmn.egg?
end end
#=============================================================================== #===============================================================================

View File

@@ -2155,6 +2155,10 @@ class PokemonStorageScreen
pbDisplay(_INTL("{1} is already fused!", heldpoke.name)) pbDisplay(_INTL("{1} is already fused!", heldpoke.name))
return return
end end
if(selected.egg? || heldpoke.egg?)
pbDisplay(_INTL("It's impossible to fuse an egg!"))
return
end
end end
splicerItem = selectSplicer() splicerItem = selectSplicer()

View File

@@ -29,7 +29,8 @@ BallHandlers::ModifyCatchRate.add(:ABILITYBALL,proc{|ball,catchRate,battle,pokem
next catchRate next catchRate
}) })
BallHandlers::OnCatch.add(:ABILITYBALL,proc{|ball,battle,pokemon| BallHandlers::OnCatch.add(:ABILITYBALL,proc{|ball,battle,pokemon|
#pokemon.ability=2 species = getSpecies(dexNum(pokemon))
pokemon.ability= species.hidden_abilities[-1]
}) })
#VIRUS BALL 27 - give pokerus #VIRUS BALL 27 - give pokerus

View File

@@ -319,7 +319,7 @@ ItemHandlers::UseOnPokemon.add(:RAGECANDYBAR, proc { |item, pokemon, scene|
}) })
ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene| ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene|
if pokemon.isEgg? if pokemon.egg?
if pokemon.eggsteps <= 1 if pokemon.eggsteps <= 1
scene.pbDisplay(_INTL("The egg is already ready to hatch!")) scene.pbDisplay(_INTL("The egg is already ready to hatch!"))
next false next false
@@ -1115,8 +1115,8 @@ ItemHandlers::UseOnPokemon.add(:RAGECANDYBAR, proc { |item, pokemon, scene|
}) })
ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene| ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene|
if pokemon.isEgg? if pokemon.egg?
if pokemon.eggsteps <= 1 if pokemon.steps_to_hatch <= 1
scene.pbDisplay(_INTL("The egg is already ready to hatch!")) scene.pbDisplay(_INTL("The egg is already ready to hatch!"))
next false next false
else else
@@ -1124,7 +1124,7 @@ ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene|
scene.pbDisplay(_INTL("...")) scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("...")) scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("Your egg is ready to hatch!")) scene.pbDisplay(_INTL("Your egg is ready to hatch!"))
pokemon.eggsteps = 1 pokemon.steps_to_hatch = 1
next true next true
end end
else else
@@ -1134,32 +1134,38 @@ ItemHandlers::UseOnPokemon.add(:INCUBATOR, proc { |item, pokemon, scene|
}) })
ItemHandlers::UseOnPokemon.add(:INCUBATOR_NORMAL, proc { |item, pokemon, scene| ItemHandlers::UseOnPokemon.add(:INCUBATOR_NORMAL, proc { |item, pokemon, scene|
if pokemon.isEgg? if pokemon.egg?
steps = pokemon.eggsteps steps = pokemon.steps_to_hatch
steps -= 2000 / (pokemon.nbIncubatorsUsed + 1).ceil steps = (steps / 1.5).ceil
# steps -= 2000 / (pokemon.nbIncubatorsUsed + 1).ceil
if steps <= 1 if steps <= 1
pokemon.eggsteps = 1 pokemon.steps_to_hatch = 1
else else
pokemon.eggsteps = steps pokemon.steps_to_hatch = steps
end
if pokemon.eggsteps <= 1
scene.pbDisplay(_INTL("Incubating..."))
scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("The egg is ready to hatch!"))
next false
else
scene.pbDisplay(_INTL("Incubating..."))
scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("..."))
if pokemon.nbIncubatorsUsed >= 10
scene.pbDisplay(_INTL("The egg is a bit closer to hatching"))
else
scene.pbDisplay(_INTL("The egg is closer to hatching"))
end
pokemon.incrIncubator()
next true
end end
scene.pbDisplay(_INTL("Incubating..."))
scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("..."))
scene.pbDisplay(_INTL("The egg is closer to hatching!"))
# if pokemon.steps_to_hatch <= 1
# scene.pbDisplay(_INTL("Incubating..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("The egg is ready to hatch!"))
# next false
# else
# scene.pbDisplay(_INTL("Incubating..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("..."))
# if pokemon.nbIncubatorsUsed >= 10
# scene.pbDisplay(_INTL("The egg is a bit closer to hatching"))
# else
# scene.pbDisplay(_INTL("The egg is closer to hatching"))
# end
# pokemon.incrIncubator()
# next true
# end
else else
scene.pbDisplay(_INTL("It won't have any effect.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
@@ -1260,6 +1266,11 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false)
poke2 = $Trainer.party[chosen] poke2 = $Trainer.party[chosen]
if (poke2.species_data.id_number <= NB_POKEMON) && poke2 != pokemon if (poke2.species_data.id_number <= NB_POKEMON) && poke2 != pokemon
#check if fainted #check if fainted
if pokemon.egg? || poke2.egg?
scene.pbDisplay(_INTL("It's impossible to fuse an egg!"))
return false
end
if pokemon.hp == 0 || poke2.hp == 0 if pokemon.hp == 0 || poke2.hp == 0
scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!")) scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!"))
return false return false

Binary file not shown.