mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Moved Gen 8 item code to its proper places
This commit is contained in:
@@ -221,6 +221,35 @@ BattleHandlers::HPHealItem.add(:WIKIBERRY,
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# ItemOnStatDropped handlers
|
||||
#===============================================================================
|
||||
BattleHandlers::ItemOnStatDropped.add(:EJECTPACK,
|
||||
proc { |item, battler, move_user, battle|
|
||||
next false if battler.effects[PBEffects::SkyDrop] >= 0 ||
|
||||
battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
|
||||
next false if battle.pbAllFainted?(battler.idxOpposingSide)
|
||||
next false if battle.wildBattle? && battler.opposes? # Wild Pokémon can't eject
|
||||
next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out
|
||||
next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in
|
||||
battle.pbCommonAnimation("UseItem", battler)
|
||||
battle.pbDisplay(_INTL("{1} is switched out by the {2}!", battler.pbThis, battler.itemName))
|
||||
battler.pbConsumeItem(true, false)
|
||||
if battle.endOfRound # Just switch out
|
||||
battle.scene.pbRecall(battler.index) if !battler.fainted?
|
||||
battler.pbAbilitiesOnSwitchOut # Inc. primordial weather check
|
||||
next true
|
||||
end
|
||||
newPkmn = battle.pbGetReplacementPokemonIndex(battler.index) # Owner chooses
|
||||
next false if newPkmn < 0 # Shouldn't ever do this
|
||||
battle.pbRecallAndReplace(battler.index, newPkmn)
|
||||
battle.pbClearChoice(battler.index) # Replacement Pokémon does nothing this round
|
||||
battle.moldBreaker = false if move_user && battler.index == move_user.index
|
||||
battle.pbOnBattlerEnteringBattle(battler.index)
|
||||
next true
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# StatusCureItem handlers
|
||||
#===============================================================================
|
||||
@@ -1367,6 +1396,18 @@ BattleHandlers::UserItemAfterMoveUse.add(:SHELLBELL,
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::UserItemAfterMoveUse.add(:THROATSPRAY,
|
||||
proc { |item, user, targets, move, numHits, battle|
|
||||
next if battle.pbAllFainted?(user.idxOwnSide) ||
|
||||
battle.pbAllFainted?(user.idxOpposingSide)
|
||||
next if !move.soundMove? || numHits == 0
|
||||
next if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
|
||||
battle.pbCommonAnimation("UseItem", user)
|
||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||
user.pbConsumeItem
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# EndOfMoveItem handlers
|
||||
#===============================================================================
|
||||
@@ -1650,7 +1691,6 @@ BattleHandlers::CertainSwitchingUserItem.add(:SHEDSHELL,
|
||||
|
||||
# There aren't any!
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# ItemOnSwitchIn handlers
|
||||
#===============================================================================
|
||||
@@ -1662,6 +1702,16 @@ BattleHandlers::ItemOnSwitchIn.add(:AIRBALLOON,
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::ItemOnSwitchIn.add(:ROOMSERVICE,
|
||||
proc { |item, battler, battle|
|
||||
next if battle.field.effects[PBEffects::TrickRoom] == 0
|
||||
next if !battler.pbCanLowerStatStage?(:SPEED)
|
||||
battle.pbCommonAnimation("UseItem", battler)
|
||||
battler.pbLowerStatStage(:SPEED, 1, nil)
|
||||
battler.pbConsumeItem
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# ItemOnIntimidated handlers
|
||||
#===============================================================================
|
||||
|
||||
@@ -407,6 +407,25 @@ def pbRaiseHappinessAndLowerEV(pkmn,scene,stat,messages)
|
||||
return true
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Change nature
|
||||
#===============================================================================
|
||||
def pbNatureChangingMint(new_nature, item, pkmn, scene)
|
||||
if pkmn.nature_for_stats == new_nature
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
return false
|
||||
end
|
||||
if !scene.pbConfirm(_INTL("It might affect {1}'s stats. Are you sure you want to use it?", pkmn.name))
|
||||
return false
|
||||
end
|
||||
pkmn.nature_for_stats = new_nature
|
||||
pkmn.calc_stats
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s stats may have changed due to the effects of the {2}!",
|
||||
pkmn.name, GameData::Item.get(item).name))
|
||||
return true
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Battle items
|
||||
#===============================================================================
|
||||
|
||||
@@ -521,6 +521,8 @@ ItemHandlers::UseOnPokemon.add(:MAXREVIVE,proc { |item,pkmn,scene|
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.copy(:MAXREVIVE, :MAXHONEY)
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ENERGYPOWDER,proc { |item,pkmn,scene|
|
||||
if pbHPItem(pkmn, (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, scene)
|
||||
pkmn.changeHappiness("powder")
|
||||
@@ -776,6 +778,90 @@ ItemHandlers::UseOnPokemon.add(:SWIFTFEATHER,proc { |item,pkmn,scene|
|
||||
|
||||
ItemHandlers::UseOnPokemon.copy(:SWIFTFEATHER,:SWIFTWING)
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:LONELYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:LONELY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ADAMANTMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:ADAMANT, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NAUGHTYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:NAUGHTY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:BRAVEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:BRAVE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:BOLDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:BOLD, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:IMPISHMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:IMPISH, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:LAXMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:LAX, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RELAXEDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:RELAXED, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:MODESTMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:MODEST, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:MILDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:MILD, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RASHMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:RASH, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:QUIETMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:QUIET, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:CALMMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:CALM, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:GENTLEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:GENTLE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:CAREFULMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:CAREFUL, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SASSYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:SASSY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:TIMIDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:TIMID, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:HASTYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:HASTY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:JOLLYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:JOLLY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NAIVEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:NAIVE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SERIOUSMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:SERIOUS, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene|
|
||||
if pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
@@ -803,6 +889,96 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene|
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYXS, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 100
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYS, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 800
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYM, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 3_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYL, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 10_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYXL, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 30_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:POMEGBERRY,proc { |item,pkmn,scene|
|
||||
next pbRaiseHappinessAndLowerEV(pkmn,scene,:HP,[
|
||||
_INTL("{1} adores you! Its base HP fell!",pkmn.name),
|
||||
@@ -851,6 +1027,50 @@ ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene|
|
||||
])
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene|
|
||||
if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name))
|
||||
abils = pkmn.getAbilityList
|
||||
abil1 = nil
|
||||
abil2 = nil
|
||||
for i in abils
|
||||
abil1 = i[0] if i[1] == 0
|
||||
abil2 = i[0] if i[1] == 1
|
||||
end
|
||||
if abil1.nil? || abil2.nil? || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
newabil = (pkmn.ability_index + 1) % 2
|
||||
newabilname = GameData::Ability.get((newabil == 0) ? abil1 : abil2).name
|
||||
pkmn.ability_index = newabil
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, newabilname))
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ABILITYPATCH, proc { |item, pkmn, scene|
|
||||
if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name))
|
||||
abils = pkmn.getAbilityList
|
||||
new_ability_id = nil
|
||||
abils.each { |a| new_ability_id = a[0] if a[1] == 2 }
|
||||
if !new_ability_id || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
new_ability_name = GameData::Ability.get(new_ability_id).name
|
||||
pkmn.ability_index = 2
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!",
|
||||
pkmn.name, new_ability_name))
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene|
|
||||
if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form != 0 ||
|
||||
pkmn.status == :FROZEN || PBDayNight.isNight?
|
||||
@@ -961,6 +1181,66 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE,proc { |item,pkmn,scene|
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ROTOMCATALOG, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:ROTOM)
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
choices = [
|
||||
_INTL("Light bulb"),
|
||||
_INTL("Microwave oven"),
|
||||
_INTL("Washing machine"),
|
||||
_INTL("Refrigerator"),
|
||||
_INTL("Electric fan"),
|
||||
_INTL("Lawn mower"),
|
||||
_INTL("Cancel")
|
||||
]
|
||||
new_form = scene.pbShowCommands(_INTL("Which appliance would you like to order?"),
|
||||
commands, pkmn.form)
|
||||
if new_form == pkmn.form
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
elsif new_form > 0 && new_form < choices.length - 1
|
||||
pkmn.setForm(new_form) {
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
|
||||
}
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
case scene.pbShowCommands(_INTL("What will you do with {1}?", pkmn.name),
|
||||
[_INTL("Change form"), _INTL("Change Ability"), _INTL("Cancel")])
|
||||
when 0 # Change form
|
||||
newForm = (pkmn.form == 0) ? 1 : 0
|
||||
pkmn.setForm(newForm) {
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
|
||||
}
|
||||
next true
|
||||
when 1 # Change ability
|
||||
new_abil = (pkmn.ability_index + 1) % 2
|
||||
pkmn.ability_index = new_abil
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, pkmn.ability.name))
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
|
||||
if !pkmn.isSpecies?(:KYUREM) || !pkmn.fused.nil?
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
@@ -1135,26 +1415,63 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZERUSED,proc { |item,pkmn,scene|
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene|
|
||||
if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name))
|
||||
abils = pkmn.getAbilityList
|
||||
abil1 = nil
|
||||
abil2 = nil
|
||||
for i in abils
|
||||
abil1 = i[0] if i[1] == 0
|
||||
abil2 = i[0] if i[1] == 1
|
||||
end
|
||||
if abil1.nil? || abil2.nil? || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
newabil = (pkmn.ability_index + 1) % 2
|
||||
newabilname = GameData::Ability.get((newabil == 0) ? abil1 : abil2).name
|
||||
pkmn.ability_index = newabil
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, newabilname))
|
||||
next true
|
||||
ItemHandlers::UseOnPokemon.add(:REINSOFUNITY, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:CALYREX) || !pkmn.fused.nil?
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
next false
|
||||
# Fusing
|
||||
chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?"))
|
||||
next false if chosen < 0
|
||||
other_pkmn = $Trainer.party[chosen]
|
||||
if pkmn == other_pkmn
|
||||
scene.pbDisplay(_INTL("It cannot be fused with itself."))
|
||||
next false
|
||||
elsif other_pkmn.egg?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
|
||||
next false
|
||||
elsif other_pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
|
||||
next false
|
||||
elsif !other_pkmn.isSpecies?(:GLASTRIER) &&
|
||||
!other_pkmn.isSpecies?(:SPECTRIER)
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
|
||||
next false
|
||||
end
|
||||
newForm = 0
|
||||
newForm = 1 if other_pkmn.isSpecies?(:GLASTRIER)
|
||||
newForm = 2 if other_pkmn.isSpecies?(:SPECTRIER)
|
||||
pkmn.setForm(newForm) {
|
||||
pkmn.fused = other_pkmn
|
||||
$Trainer.remove_pokemon_at_index(chosen)
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
|
||||
}
|
||||
$PokemonBag.pbChangeItem(:REINSOFUNITY, :REINSOFUNITYUSED)
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:REINSOFUNITYUSED, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:CALYREX) || pkmn.fused.nil?
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
elsif $Trainer.party_full?
|
||||
scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Unfusing
|
||||
pkmn.setForm(0) {
|
||||
$Trainer.party[$Trainer.party.length] = pkmn.fused
|
||||
pkmn.fused = nil
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
|
||||
}
|
||||
$PokemonBag.pbChangeItem(:REINSOFUNITYUSED, :REINSOFUNITY)
|
||||
next true
|
||||
})
|
||||
|
||||
@@ -143,7 +143,7 @@ ItemHandlers::CanUseInBattle.add(:REVIVE,proc { |item,pokemon,battler,move,first
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.copy(:REVIVE,:MAXREVIVE,:REVIVALHERB)
|
||||
ItemHandlers::CanUseInBattle.copy(:REVIVE, :MAXREVIVE, :REVIVALHERB, :MAXHONEY)
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:ETHER,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||
if !pokemon.able? || move<0 ||
|
||||
@@ -242,6 +242,18 @@ ItemHandlers::CanUseInBattle.add(:XACCURACY,proc { |item,pokemon,battler,move,fi
|
||||
|
||||
ItemHandlers::CanUseInBattle.copy(:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6)
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:MAXMUSHROOMS, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
|
||||
if !pbBattleItemCanRaiseStat?(:ATTACK, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:DEFENSE, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPECIAL_ATTACK, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPECIAL_DEFENSE, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPEED, battler, scene, false)
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:DIREHIT,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||
if !battler || battler.effects[PBEffects::FocusEnergy]>=1
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
@@ -450,6 +462,8 @@ ItemHandlers::BattleUseOnPokemon.add(:MAXREVIVE,proc { |item,pokemon,battler,cho
|
||||
scene.pbDisplay(_INTL("{1} recovered from fainting!",pokemon.name))
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnPokemon.copy(:MAXREVIVE, :MAXHONEY)
|
||||
|
||||
ItemHandlers::BattleUseOnPokemon.add(:ENERGYPOWDER,proc { |item,pokemon,battler,choices,scene|
|
||||
if pbBattleHPItem(pokemon, battler, (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, scene)
|
||||
pokemon.changeHappiness("powder")
|
||||
@@ -661,6 +675,15 @@ ItemHandlers::BattleUseOnBattler.add(:XACCURACY6,proc { |item,battler,scene|
|
||||
battler.pokemon.changeHappiness("battleitem")
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:MAXMUSHROOMS,proc { |item, battler, scene|
|
||||
battler.pbRaiseStatStage(:ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:ATTACK, battler)
|
||||
battler.pbRaiseStatStage(:DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:DEFENSE, battler)
|
||||
battler.pbRaiseStatStage(:SPECIAL_ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_ATTACK, battler)
|
||||
battler.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, battler)
|
||||
battler.pbRaiseStatStage(:SPEED, 1, battler) if battler.pbCanRaiseStatStage?(:SPEED, battler)
|
||||
battler.pokemon.changeHappiness("battleitem")
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:DIREHIT,proc { |item,battler,scene|
|
||||
battler.effects[PBEffects::FocusEnergy] = 2
|
||||
scene.pbDisplay(_INTL("{1} is getting pumped!",battler.pbThis))
|
||||
|
||||
@@ -1,406 +0,0 @@
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYXS, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 100
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYS, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 800
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYM, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 3_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYL, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 10_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXPCANDYXL, proc { |item, pkmn, scene|
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
gain_amount = 30_000
|
||||
maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil
|
||||
maximum = [maximum, $PokemonBag.pbQuantity(item)].min
|
||||
qty = scene.scene.pbChooseNumber(
|
||||
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum)
|
||||
next false if qty == 0
|
||||
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
|
||||
pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene)
|
||||
$PokemonBag.pbDeleteItem(item, qty - 1)
|
||||
scene.pbHardRefresh
|
||||
next true
|
||||
})
|
||||
|
||||
def pbNatureChangingMint(new_nature, item, pkmn, scene)
|
||||
if pkmn.nature_for_stats == new_nature
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
return false
|
||||
end
|
||||
if !scene.pbConfirm(_INTL("It might affect {1}'s stats. Are you sure you want to use it?", pkmn.name))
|
||||
return false
|
||||
end
|
||||
pkmn.nature_for_stats = new_nature
|
||||
pkmn.calc_stats
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s stats may have changed due to the effects of the {2}!",
|
||||
pkmn.name, GameData::Item.get(item).name))
|
||||
return true
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:LONELYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:LONELY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ADAMANTMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:ADAMANT, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NAUGHTYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:NAUGHTY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:BRAVEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:BRAVE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:BOLDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:BOLD, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:IMPISHMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:IMPISH, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:LAXMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:LAX, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RELAXEDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:RELAXED, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:MODESTMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:MODEST, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:MILDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:MILD, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RASHMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:RASH, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:QUIETMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:QUIET, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:CALMMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:CALM, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:GENTLEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:GENTLE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:CAREFULMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:CAREFUL, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SASSYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:SASSY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:TIMIDMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:TIMID, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:HASTYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:HASTY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:JOLLYMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:JOLLY, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:NAIVEMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:NAIVE, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SERIOUSMINT, proc { |item, pkmn, scene|
|
||||
pbNatureChangingMint(:SERIOUS, item, pkmn, scene)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.copy(:MAXREVIVE, :MAXHONEY)
|
||||
|
||||
ItemHandlers::CanUseInBattle.copy(:REVIVE, :MAXHONEY)
|
||||
|
||||
ItemHandlers::BattleUseOnPokemon.copy(:MAXREVIVE, :MAXHONEY)
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:MAXMUSHROOMS, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
|
||||
if !pbBattleItemCanRaiseStat?(:ATTACK, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:DEFENSE, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPECIAL_ATTACK, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPECIAL_DEFENSE, battler, scene, false) &&
|
||||
!pbBattleItemCanRaiseStat?(:SPEED, battler, scene, false)
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:MAXMUSHROOMS,proc { |item, battler, scene|
|
||||
battler.pbRaiseStatStage(:ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:ATTACK, battler)
|
||||
battler.pbRaiseStatStage(:DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:DEFENSE, battler)
|
||||
battler.pbRaiseStatStage(:SPECIAL_ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_ATTACK, battler)
|
||||
battler.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, battler)
|
||||
battler.pbRaiseStatStage(:SPEED, 1, battler) if battler.pbCanRaiseStatStage?(:SPEED, battler)
|
||||
battler.pokemon.changeHappiness("battleitem")
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:REINSOFUNITY, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:CALYREX) || !pkmn.fused.nil?
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Fusing
|
||||
chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?"))
|
||||
next false if chosen < 0
|
||||
other_pkmn = $Trainer.party[chosen]
|
||||
if pkmn == other_pkmn
|
||||
scene.pbDisplay(_INTL("It cannot be fused with itself."))
|
||||
next false
|
||||
elsif other_pkmn.egg?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
|
||||
next false
|
||||
elsif other_pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon."))
|
||||
next false
|
||||
elsif !other_pkmn.isSpecies?(:GLASTRIER) &&
|
||||
!other_pkmn.isSpecies?(:SPECTRIER)
|
||||
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
|
||||
next false
|
||||
end
|
||||
newForm = 0
|
||||
newForm = 1 if other_pkmn.isSpecies?(:GLASTRIER)
|
||||
newForm = 2 if other_pkmn.isSpecies?(:SPECTRIER)
|
||||
pkmn.setForm(newForm) {
|
||||
pkmn.fused = other_pkmn
|
||||
$Trainer.remove_pokemon_at_index(chosen)
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
|
||||
}
|
||||
$PokemonBag.pbChangeItem(:REINSOFUNITY, :REINSOFUNITYUSED)
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:REINSOFUNITYUSED, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:CALYREX) || pkmn.fused.nil?
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
elsif $Trainer.party_full?
|
||||
scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
|
||||
next false
|
||||
end
|
||||
# Unfusing
|
||||
pkmn.setForm(0) {
|
||||
$Trainer.party[$Trainer.party.length] = pkmn.fused
|
||||
pkmn.fused = nil
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
|
||||
}
|
||||
$PokemonBag.pbChangeItem(:REINSOFUNITYUSED, :REINSOFUNITY)
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ABILITYPATCH, proc { |item, pkmn, scene|
|
||||
if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name))
|
||||
abils = pkmn.getAbilityList
|
||||
new_ability_id = nil
|
||||
abils.each { |a| new_ability_id = a[0] if a[1] == 2 }
|
||||
if !new_ability_id || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
new_ability_name = GameData::Ability.get(new_ability_id).name
|
||||
pkmn.ability_index = 2
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!",
|
||||
pkmn.name, new_ability_name))
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ROTOMCATALOG, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:ROTOM)
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
choices = [
|
||||
_INTL("Light bulb"),
|
||||
_INTL("Microwave oven"),
|
||||
_INTL("Washing machine"),
|
||||
_INTL("Refrigerator"),
|
||||
_INTL("Electric fan"),
|
||||
_INTL("Lawn mower"),
|
||||
_INTL("Cancel")
|
||||
]
|
||||
new_form = scene.pbShowCommands(_INTL("Which appliance would you like to order?"),
|
||||
commands, pkmn.form)
|
||||
if new_form == pkmn.form
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
elsif new_form > 0 && new_form < choices.length - 1
|
||||
pkmn.setForm(new_form) {
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
|
||||
}
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
BattleHandlers::UserItemAfterMoveUse.add(:THROATSPRAY,
|
||||
proc { |item, user, targets, move, numHits, battle|
|
||||
next if battle.pbAllFainted?(user.idxOwnSide) ||
|
||||
battle.pbAllFainted?(user.idxOpposingSide)
|
||||
next if !move.soundMove? || numHits == 0
|
||||
next if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
|
||||
battle.pbCommonAnimation("UseItem", user)
|
||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||
user.pbConsumeItem
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::ItemOnStatDropped.add(:EJECTPACK,
|
||||
proc { |item, battler, move_user, battle|
|
||||
next false if battler.effects[PBEffects::SkyDrop] >= 0 ||
|
||||
battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
|
||||
next false if battle.pbAllFainted?(battler.idxOpposingSide)
|
||||
next false if battle.wildBattle? && battler.opposes? # Wild Pokémon can't eject
|
||||
next false if !battle.pbCanSwitch?(battler.index) # Battler can't switch out
|
||||
next false if !battle.pbCanChooseNonActive?(battler.index) # No Pokémon can switch in
|
||||
battle.pbCommonAnimation("UseItem", battler)
|
||||
battle.pbDisplay(_INTL("{1} is switched out by the {2}!", battler.pbThis, battler.itemName))
|
||||
battler.pbConsumeItem(true, false)
|
||||
if battle.endOfRound # Just switch out
|
||||
battle.scene.pbRecall(battler.index) if !battler.fainted?
|
||||
battler.pbAbilitiesOnSwitchOut # Inc. primordial weather check
|
||||
next true
|
||||
end
|
||||
newPkmn = battle.pbGetReplacementPokemonIndex(battler.index) # Owner chooses
|
||||
next false if newPkmn < 0 # Shouldn't ever do this
|
||||
battle.pbRecallAndReplace(battler.index, newPkmn)
|
||||
battle.pbClearChoice(battler.index) # Replacement Pokémon does nothing this round
|
||||
battle.moldBreaker = false if move_user && battler.index == move_user.index
|
||||
battle.pbOnBattlerEnteringBattle(battler.index)
|
||||
next true
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
BattleHandlers::ItemOnSwitchIn.add(:ROOMSERVICE,
|
||||
proc { |item, battler, battle|
|
||||
next if battle.field.effects[PBEffects::TrickRoom] == 0
|
||||
next if !battler.pbCanLowerStatStage?(:SPEED)
|
||||
battle.pbCommonAnimation("UseItem", battler)
|
||||
battler.pbLowerStatStage(:SPEED, 1, nil)
|
||||
battler.pbConsumeItem
|
||||
}
|
||||
)
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE, proc { |item, pkmn, scene|
|
||||
if !pkmn.isSpecies?(:ZYGARDE)
|
||||
scene.pbDisplay(_INTL("It had no effect."))
|
||||
next false
|
||||
elsif pkmn.fainted?
|
||||
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
|
||||
next false
|
||||
end
|
||||
case scene.pbShowCommands(_INTL("What will you do with {1}?", pkmn.name),
|
||||
[_INTL("Change form"), _INTL("Change Ability"), _INTL("Cancel")])
|
||||
when 0 # Change form
|
||||
newForm = (pkmn.form == 0) ? 1 : 0
|
||||
pkmn.setForm(newForm) {
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
|
||||
}
|
||||
next true
|
||||
when 1 # Change ability
|
||||
new_abil = (pkmn.ability_index + 1) % 2
|
||||
pkmn.ability_index = new_abil
|
||||
pkmn.ability = nil
|
||||
scene.pbRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, pkmn.ability.name))
|
||||
next true
|
||||
end
|
||||
next false
|
||||
})
|
||||
Reference in New Issue
Block a user