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
def pbReturnUnusedItemToBag(item,idxBattler)
return if item!
return if !item
useType = GameData::Item.get(item).battle_use
return if useType==0 || (useType>=6 && useType<=10) # Not consumed upon use
if pbOwnedByPlayer?(idxBattler)

View File

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

View File

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

View File

@@ -29,7 +29,8 @@ BallHandlers::ModifyCatchRate.add(:ABILITYBALL,proc{|ball,catchRate,battle,pokem
next catchRate
})
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

View File

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

Binary file not shown.