Files
infinitefusion-e18/Data/Scripts/011_Battle/002_Move/007_MoveEffects_BattlerOther.rb
2021-09-19 23:04:29 +01:00

1293 lines
46 KiB
Ruby

#===============================================================================
# Puts the target to sleep.
#===============================================================================
class PokeBattle_Move_SleepTarget < PokeBattle_SleepMove
end
#===============================================================================
# Puts the target to sleep. Fails if user is not Darkrai. (Dark Void (Gen 7+))
#===============================================================================
class PokeBattle_Move_SleepTargetIfUserDarkrai < PokeBattle_SleepMove
def pbMoveFailed?(user,targets)
if !user.isSpecies?(:DARKRAI) && user.effects[PBEffects::TransformSpecies] != :DARKRAI
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
return true
end
return false
end
end
#===============================================================================
# Puts the target to sleep. Changes the user's form if the user is Meloetta.
# (Relic Song)
#===============================================================================
class PokeBattle_Move_SleepTargetChangeUserMeloettaForm < PokeBattle_SleepMove
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
return if numHits==0
return if user.fainted? || user.effects[PBEffects::Transform]
return if !user.isSpecies?(:MELOETTA)
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect>0
newForm = (user.form+1)%2
user.pbChangeForm(newForm,_INTL("{1} transformed!",user.pbThis))
end
end
#===============================================================================
# Makes the target drowsy; it falls asleep at the end of the next turn. (Yawn)
#===============================================================================
class PokeBattle_Move_SleepTargetNextTurn < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Yawn]>0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return true if !target.pbCanSleep?(user,true,self)
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Yawn] = 2
@battle.pbDisplay(_INTL("{1} made {2} drowsy!",user.pbThis,target.pbThis(true)))
end
end
#===============================================================================
# Poisons the target.
#===============================================================================
class PokeBattle_Move_PoisonTarget < PokeBattle_PoisonMove
end
#===============================================================================
# Poisons the target and decreases its Speed by 1 stage. (Toxic Thread)
#===============================================================================
class PokeBattle_Move_PoisonTargetLowerTargetSpeed1 < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.pbCanPoison?(user,false,self) &&
!target.pbCanLowerStatStage?(:SPEED,user,self)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.pbPoison(user) if target.pbCanPoison?(user,false,self)
if target.pbCanLowerStatStage?(:SPEED,user,self)
target.pbLowerStatStage(:SPEED,1,user)
end
end
end
#===============================================================================
# Badly poisons the target. (Poison Fang, Toxic)
#===============================================================================
class PokeBattle_Move_BadPoisonTarget < PokeBattle_PoisonMove
def initialize(battle,move)
super
@toxic = true
end
def pbOverrideSuccessCheckPerHit(user,target)
return (Settings::MORE_TYPE_EFFECTS && statusMove? && user.pbHasType?(:POISON))
end
end
#===============================================================================
# Paralyzes the target.
#===============================================================================
class PokeBattle_Move_ParalyzeTarget < PokeBattle_ParalysisMove
end
#===============================================================================
# Paralyzes the target. Doesn't affect target if move's type has no effect on
# it. (Thunder Wave)
#===============================================================================
class PokeBattle_Move_ParalyzeTargetIfNotTypeImmune < PokeBattle_ParalysisMove
def pbFailsAgainstTarget?(user, target, show_message)
if Effectiveness.ineffective?(target.damageState.typeMod)
@battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message
return true
end
return super
end
end
#===============================================================================
# Paralyzes the target. Does double damage and has perfect accuracy if target is
# Minimized. (Body Slam (Gen 6+))
#===============================================================================
class PokeBattle_Move_ParalyzeTargetTrampleMinimize < PokeBattle_ParalysisMove
def tramplesMinimize?(param=1)
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param==2 # Double damage
return super
end
end
#===============================================================================
# Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. Hits some
# semi-invulnerable targets. (Thunder)
#===============================================================================
class PokeBattle_Move_ParalyzeTargetAlwaysHitsInRainHitsTargetInSky < PokeBattle_ParalysisMove
def hitsFlyingTargets?; return true; end
def pbBaseAccuracy(user,target)
case target.effectiveWeather
when :Sun, :HarshSun
return 50
when :Rain, :HeavyRain
return 0
end
return super
end
end
#===============================================================================
# Paralyzes the target. May cause the target to flinch. (Thunder Fang)
#===============================================================================
class PokeBattle_Move_ParalyzeFlinchTarget < PokeBattle_Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
end
end
#===============================================================================
# Burns the target.
#===============================================================================
class PokeBattle_Move_BurnTarget < PokeBattle_BurnMove
end
#===============================================================================
# Burns the target if any of its stats were increased this round.
# (Burning Jealousy)
#===============================================================================
class PokeBattle_Move_BurnTargetIfTargetStatsRaisedThisTurn < PokeBattle_BurnMove
def pbAdditionalEffect(user, target)
super if target.statsRaisedThisRound
end
end
#===============================================================================
# Burns the target. May cause the target to flinch. (Fire Fang)
#===============================================================================
class PokeBattle_Move_BurnFlinchTarget < PokeBattle_Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
end
end
#===============================================================================
# Freezes the target.
#===============================================================================
class PokeBattle_Move_FreezeTarget < PokeBattle_FreezeMove
end
#===============================================================================
# Freezes the target. Effectiveness against Water-type is 2x. (Freeze-Dry)
#===============================================================================
class PokeBattle_Move_FreezeTargetSuperEffectiveAgainstWater < PokeBattle_FreezeMove
def pbCalcTypeModSingle(moveType,defType,user,target)
return Effectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
return super
end
end
#===============================================================================
# Freezes the target. Accuracy perfect in hail. (Blizzard)
#===============================================================================
class PokeBattle_Move_FreezeTargetAlwaysHitsInHail < PokeBattle_FreezeMove
def pbBaseAccuracy(user,target)
return 0 if target.effectiveWeather == :Hail
return super
end
end
#===============================================================================
# Freezes the target. May cause the target to flinch. (Ice Fang)
#===============================================================================
class PokeBattle_Move_FreezeFlinchTarget < PokeBattle_Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbFreeze if target.pbCanFreeze?(user,false,self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
end
end
#===============================================================================
# Burns, freezes or paralyzes the target. (Tri Attack)
#===============================================================================
class PokeBattle_Move_ParalyzeBurnOrFreezeTarget < PokeBattle_Move
def pbAdditionalEffect(user,target)
return if target.damageState.substitute
case @battle.pbRandom(3)
when 0 then target.pbBurn(user) if target.pbCanBurn?(user, false, self)
when 1 then target.pbFreeze if target.pbCanFreeze?(user, false, self)
when 2 then target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end
end
end
#===============================================================================
# User passes its status problem to the target. (Psycho Shift)
#===============================================================================
class PokeBattle_Move_GiveUserStatusToTarget < PokeBattle_Move
def pbMoveFailed?(user,targets)
if user.status == :NONE
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.pbCanInflictStatus?(user.status,user,false,self)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
msg = ""
case user.status
when :SLEEP
target.pbSleep
msg = _INTL("{1} woke up.",user.pbThis)
when :POISON
target.pbPoison(user,nil,user.statusCount!=0)
msg = _INTL("{1} was cured of its poisoning.",user.pbThis)
when :BURN
target.pbBurn(user)
msg = _INTL("{1}'s burn was healed.",user.pbThis)
when :PARALYSIS
target.pbParalyze(user)
msg = _INTL("{1} was cured of paralysis.",user.pbThis)
when :FROZEN
target.pbFreeze
msg = _INTL("{1} was thawed out.",user.pbThis)
end
if msg!=""
user.pbCureStatus(false)
@battle.pbDisplay(msg)
end
end
end
#===============================================================================
# Cures user of burn, poison and paralysis. (Refresh)
#===============================================================================
class PokeBattle_Move_CureUserBurnPoisonParalysis < PokeBattle_Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if ![:BURN, :POISON, :PARALYSIS].include?(user.status)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
old_status = user.status
user.pbCureStatus(false)
case old_status
when :BURN
@battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis))
when :POISON
@battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis))
when :PARALYSIS
@battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis))
end
end
end
#===============================================================================
# Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
#===============================================================================
# NOTE: In Gen 5, this move should have a target of UserSide, while in Gen 6+ it
# should have a target of UserAndAllies. This is because, in Gen 5, this
# move shouldn't call def pbSuccessCheckAgainstTarget for each Pokémon
# currently in battle that will be affected by this move (i.e. allies
# aren't protected by their substitute/ability/etc., but they are in Gen
# 6+). We achieve this by not targeting any battlers in Gen 5, since
# pbSuccessCheckAgainstTarget is only called for targeted battlers.
class PokeBattle_Move_CureUserPartyStatus < PokeBattle_Move
def canSnatch?; return true; end
def worksWithNoTargets?; return true; end
def pbMoveFailed?(user,targets)
failed = true
@battle.eachSameSideBattler(user) do |b|
next if b.status == :NONE
failed = false
break
end
if failed
@battle.pbParty(user.index).each do |pkmn|
next if !pkmn || !pkmn.able? || pkmn.status == :NONE
failed = false
break
end
end
if failed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
return target.status == :NONE
end
def pbAromatherapyHeal(pkmn,battler=nil)
oldStatus = (battler) ? battler.status : pkmn.status
curedName = (battler) ? battler.pbThis : pkmn.name
if battler
battler.pbCureStatus(false)
else
pkmn.status = :NONE
pkmn.statusCount = 0
end
case oldStatus
when :SLEEP
@battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName))
when :POISON
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName))
when :BURN
@battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName))
when :PARALYSIS
@battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName))
when :FROZEN
@battle.pbDisplay(_INTL("{1} was thawed out.",curedName))
end
end
def pbEffectAgainstTarget(user,target)
# Cure all Pokémon in battle on the user's side.
pbAromatherapyHeal(target.pokemon,target)
end
def pbEffectGeneral(user)
# Cure all Pokémon in battle on the user's side. For the benefit of the Gen
# 5 version of this move, to make Pokémon out in battle get cured first.
if pbTarget(user) == :UserSide
@battle.eachSameSideBattler(user) do |b|
next if b.status == :NONE
pbAromatherapyHeal(b.pokemon,b)
end
end
# Cure all Pokémon in the user's and partner trainer's party.
# NOTE: This intentionally affects the partner trainer's inactive Pokémon
# too.
@battle.pbParty(user.index).each_with_index do |pkmn,i|
next if !pkmn || !pkmn.able? || pkmn.status == :NONE
next if @battle.pbFindBattler(i,user) # Skip Pokémon in battle
pbAromatherapyHeal(pkmn)
end
end
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
super
if @id == :AROMATHERAPY
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
elsif @id == :HEALBELL
@battle.pbDisplay(_INTL("A bell chimed!"))
end
end
end
#===============================================================================
# Cures the target's burn. (Sparkling Aria)
#===============================================================================
class PokeBattle_Move_CureTargetBurn < PokeBattle_Move
def pbAdditionalEffect(user,target)
return if target.fainted? || target.damageState.substitute
return if target.status != :BURN
target.pbCureStatus
end
end
#===============================================================================
# Safeguards the user's side from being inflicted with status problems.
# (Safeguard)
#===============================================================================
class PokeBattle_Move_StartUserSideImmunityToInflictedStatus < PokeBattle_Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.pbOwnSide.effects[PBEffects::Safeguard]>0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
user.pbOwnSide.effects[PBEffects::Safeguard] = 5
@battle.pbDisplay(_INTL("{1} became cloaked in a mystical veil!",user.pbTeam))
end
end
#===============================================================================
# Causes the target to flinch.
#===============================================================================
class PokeBattle_Move_FlinchTarget < PokeBattle_FlinchMove
end
#===============================================================================
# Causes the target to flinch. Does double damage and has perfect accuracy if
# the target is Minimized. (Dragon Rush (Gen 6+), Steamroller, Stomp)
#===============================================================================
class PokeBattle_Move_FlinchTargetTrampleMinimize < PokeBattle_FlinchMove
def tramplesMinimize?(param=1)
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param==2 # Double damage
return super
end
end
#===============================================================================
# Causes the target to flinch. Fails if the user is not asleep. (Snore)
#===============================================================================
class PokeBattle_Move_FlinchTargetFailsIfUserNotAsleep < PokeBattle_FlinchMove
def usableWhenAsleep?; return true; end
def pbMoveFailed?(user,targets)
if !user.asleep?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
end
#===============================================================================
# Causes the target to flinch. Fails if this isn't the user's first turn.
# (Fake Out)
#===============================================================================
class PokeBattle_Move_FlinchTargetFailsIfNotUserFirstTurn < PokeBattle_FlinchMove
def pbMoveFailed?(user,targets)
if user.turnCount > 1
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
end
#===============================================================================
# Power is doubled if the target is using Bounce, Fly or Sky Drop. Hits some
# semi-invulnerable targets. May make the target flinch. (Twister)
#===============================================================================
class PokeBattle_Move_FlinchTargetDoublePowerIfTargetInSky < PokeBattle_FlinchMove
def hitsFlyingTargets?; return true; end
def pbBaseDamage(baseDmg,user,target)
baseDmg *= 2 if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct") ||
target.effects[PBEffects::SkyDrop]>=0
return baseDmg
end
end
#===============================================================================
# Confuses the target.
#===============================================================================
class PokeBattle_Move_ConfuseTarget < PokeBattle_ConfuseMove
end
#===============================================================================
# Confuses the target. Accuracy perfect in rain, 50% in sunshine. Hits some
# semi-invulnerable targets. (Hurricane)
#===============================================================================
class PokeBattle_Move_ConfuseTargetAlwaysHitsInRainHitsTargetInSky < PokeBattle_ConfuseMove
def hitsFlyingTargets?; return true; end
def pbBaseAccuracy(user,target)
case target.effectiveWeather
when :Sun, :HarshSun
return 50
when :Rain, :HeavyRain
return 0
end
return super
end
end
#===============================================================================
# Attracts the target. (Attract)
#===============================================================================
class PokeBattle_Move_AttractTarget < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
return false if damagingMove?
return true if !target.pbCanAttract?(user, show_message)
return true if pbMoveFailedAromaVeil?(user, target, show_message)
return false
end
def pbEffectAgainstTarget(user,target)
return if damagingMove?
target.pbAttract(user)
end
def pbAdditionalEffect(user,target)
return if target.damageState.substitute
target.pbAttract(user) if target.pbCanAttract?(user,false)
end
end
#===============================================================================
# Changes user's type depending on the environment. (Camouflage)
#===============================================================================
class PokeBattle_Move_SetUserTypesBasedOnEnvironment < PokeBattle_Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@newType = :NORMAL
checkedTerrain = false
case @battle.field.terrain
when :Electric
if GameData::Type.exists?(:ELECTRIC)
@newType = :ELECTRIC
checkedTerrain = true
end
when :Grassy
if GameData::Type.exists?(:GRASS)
@newType = :GRASS
checkedTerrain = true
end
when :Misty
if GameData::Type.exists?(:FAIRY)
@newType = :FAIRY
checkedTerrain = true
end
when :Psychic
if GameData::Type.exists?(:PSYCHIC)
@newType = :PSYCHIC
checkedTerrain = true
end
end
if !checkedTerrain
case @battle.environment
when :Grass, :TallGrass
@newType = :GRASS
when :MovingWater, :StillWater, :Puddle, :Underwater
@newType = :WATER
when :Cave
@newType = :ROCK
when :Rock, :Sand
@newType = :GROUND
when :Forest, :ForestGrass
@newType = :BUG
when :Snow, :Ice
@newType = :ICE
when :Volcano
@newType = :FIRE
when :Graveyard
@newType = :GHOST
when :Sky
@newType = :FLYING
when :Space
@newType = :DRAGON
when :UltraSpace
@newType = :PSYCHIC
end
end
@newType = :NORMAL if !GameData::Type.exists?(@newType)
if !GameData::Type.exists?(@newType) || !user.pbHasOtherType?(@newType)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
user.pbChangeTypes(@newType)
typeName = GameData::Type.get(@newType).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
end
end
#===============================================================================
# Changes user's type to a random one that resists/is immune to the last move
# used by the target. (Conversion 2)
#===============================================================================
class PokeBattle_Move_SetUserTypesToResistLastAttack < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user, targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.lastMoveUsed || !target.lastMoveUsedType ||
GameData::Type.get(target.lastMoveUsedType).pseudo_type
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@newTypes = []
GameData::Type.each do |t|
next if t.pseudo_type || user.pbHasType?(t.id) ||
!Effectiveness.resistant_type?(target.lastMoveUsedType, t.id)
@newTypes.push(t.id)
end
if @newTypes.length == 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectGeneral(user)
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
user.pbChangeTypes(newType)
typeName = GameData::Type.get(newType).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
end
end
#===============================================================================
# User copes target's types. (Reflect Type)
#===============================================================================
class PokeBattle_Move_SetUserTypesToTargetTypes < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
newTypes = target.pbTypes(true)
if newTypes.length==0 # Target has no type to copy
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if user.pbTypes==target.pbTypes &&
user.effects[PBEffects::Type3]==target.effects[PBEffects::Type3]
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
user.pbChangeTypes(target)
@battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",
user.pbThis,target.pbThis(true)))
end
end
#===============================================================================
# Changes user's type to that of a random user's move, except a type the user
# already has (even partially), OR changes to the user's first move's type.
# (Conversion)
#===============================================================================
class PokeBattle_Move_SetUserTypesToUserMoveType < PokeBattle_Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
userTypes = user.pbTypes(true)
@newTypes = []
user.eachMoveWithIndex do |m,i|
break if Settings::MECHANICS_GENERATION >= 6 && i>0
next if GameData::Type.get(m.type).pseudo_type
next if userTypes.include?(m.type)
@newTypes.push(m.type) if !@newTypes.include?(m.type)
end
if @newTypes.length==0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
user.pbChangeTypes(newType)
typeName = GameData::Type.get(newType).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
end
end
#===============================================================================
# The target's types become Psychic. (Magic Powder)
#===============================================================================
class PokeBattle_Move_SetTargetTypesToPsychic < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.canChangeType? || !GameData::Type.exists?(:PSYCHIC) ||
!target.pbHasOtherType?(:PSYCHIC) || !target.affectedByPowder?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user, target)
target.pbChangeTypes(:PSYCHIC)
typeName = GameData::Type.get(:PSYCHIC).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", target.pbThis, typeName))
end
end
#===============================================================================
# Target becomes Water type. (Soak)
#===============================================================================
class PokeBattle_Move_SetTargetTypesToWater < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.canChangeType? || !GameData::Type.exists?(:WATER) ||
!target.pbHasOtherType?(:WATER)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.pbChangeTypes(:WATER)
typeName = GameData::Type.get(:WATER).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typeName))
end
end
#===============================================================================
# Gives target the Ghost type. (Trick-or-Treat)
#===============================================================================
class PokeBattle_Move_AddGhostTypeToTarget < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !GameData::Type.exists?(:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Type3] = :GHOST
typeName = GameData::Type.get(:GHOST).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
end
end
#===============================================================================
# Gives target the Grass type. (Forest's Curse)
#===============================================================================
class PokeBattle_Move_AddGrassTypeToTarget < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !GameData::Type.exists?(:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Type3] = :GRASS
typeName = GameData::Type.get(:GRASS).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
end
end
#===============================================================================
# User loses their Fire type. Fails if user is not Fire-type. (Burn Up)
#===============================================================================
class PokeBattle_Move_UserLosesFireType < PokeBattle_Move
def pbMoveFailed?(user,targets)
if !user.pbHasType?(:FIRE)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectAfterAllHits(user,target)
if !user.effects[PBEffects::BurnUp]
user.effects[PBEffects::BurnUp] = true
@battle.pbDisplay(_INTL("{1} burned itself out!",user.pbThis))
end
end
end
#===============================================================================
# Target's ability becomes Simple. (Simple Beam)
#===============================================================================
class PokeBattle_Move_SetTargetAbilityToSimple < PokeBattle_Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
if !GameData::Ability.exists?(:SIMPLE)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if target.unstoppableAbility? || [:TRUANT, :SIMPLE].include?(target.ability)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
oldAbil = target.ability
target.ability = :SIMPLE
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
end
end
#===============================================================================
# Target's ability becomes Insomnia. (Worry Seed)
#===============================================================================
class PokeBattle_Move_SetTargetAbilityToInsomnia < PokeBattle_Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
if !GameData::Ability.exists?(:INSOMNIA)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
oldAbil = target.ability
target.ability = :INSOMNIA
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
end
end
#===============================================================================
# User copies target's ability. (Role Play)
#===============================================================================
class PokeBattle_Move_SetUserAbilityToTargetAbility < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
if user.unstoppableAbility?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.ability || user.ability==target.ability
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.ungainableAbility? ||
[:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability_id)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(user,true,false)
oldAbil = user.ability
user.ability = target.ability
@battle.pbReplaceAbilitySplash(user)
@battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",
user.pbThis,target.pbThis(true),target.abilityName))
@battle.pbHideAbilitySplash(user)
user.pbOnLosingAbility(oldAbil)
user.pbTriggerAbilityOnGainingIt
end
end
#===============================================================================
# Target copies user's ability. (Entrainment)
#===============================================================================
class PokeBattle_Move_SetTargetAbilityToUserAbility < PokeBattle_Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
if !user.ability
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if user.ungainableAbility? ||
[:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(user.ability_id)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if target.unstoppableAbility? || target.ability == :TRUANT
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
oldAbil = target.ability
target.ability = user.ability
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
end
end
#===============================================================================
# User and target swap abilities. (Skill Swap)
#===============================================================================
class PokeBattle_Move_UserTargetSwapAbilities < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
if !user.ability
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if user.unstoppableAbility?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if user.ungainableAbility? || user.ability == :WONDERGUARD
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.ability ||
(user.ability == target.ability && Settings::MECHANICS_GENERATION <= 5)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.unstoppableAbility?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.ungainableAbility? || target.ability == :WONDERGUARD
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
if user.opposes?(target)
@battle.pbShowAbilitySplash(user,false,false)
@battle.pbShowAbilitySplash(target,true,false)
end
oldUserAbil = user.ability
oldTargetAbil = target.ability
user.ability = oldTargetAbil
target.ability = oldUserAbil
if user.opposes?(target)
@battle.pbReplaceAbilitySplash(user)
@battle.pbReplaceAbilitySplash(target)
end
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} swapped Abilities with its target!",user.pbThis))
else
@battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
user.pbThis,target.abilityName,user.abilityName))
end
if user.opposes?(target)
@battle.pbHideAbilitySplash(user)
@battle.pbHideAbilitySplash(target)
end
user.pbOnLosingAbility(oldUserAbil)
target.pbOnLosingAbility(oldTargetAbil)
user.pbTriggerAbilityOnGainingIt
target.pbTriggerAbilityOnGainingIt
end
end
#===============================================================================
# Target's ability is negated. (Gastro Acid)
#===============================================================================
class PokeBattle_Move_NegateTargetAbility < PokeBattle_Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.unstoppableAbility?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::GastroAcid] = true
target.effects[PBEffects::Truant] = false
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
target.pbOnLosingAbility(target.ability)
end
end
#===============================================================================
# Negates the target's ability while it remains on the field, if it has already
# performed its action this round. (Core Enforcer)
#===============================================================================
class PokeBattle_Move_NegateTargetAbilityIfTargetActed < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
return if target.damageState.substitute || target.effects[PBEffects::GastroAcid]
return if target.unstoppableAbility?
return if @battle.choices[target.index][0]!=:UseItem &&
!((@battle.choices[target.index][0]==:UseMove ||
@battle.choices[target.index][0]==:Shift) && target.movedThisRound?)
target.effects[PBEffects::GastroAcid] = true
target.effects[PBEffects::Truant] = false
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
target.pbOnLosingAbility(target.ability)
end
end
#===============================================================================
# Ignores all abilities that alter this move's success or damage.
# (Moongeist Beam, Sunsteel Strike)
#===============================================================================
class PokeBattle_Move_IgnoreTargetAbility < PokeBattle_Move
def pbChangeUsageCounters(user,specialUsage)
super
@battle.moldBreaker = true if !specialUsage
end
end
#===============================================================================
# For 5 rounds, user becomes airborne. (Magnet Rise)
#===============================================================================
class PokeBattle_Move_StartUserAirborne < PokeBattle_Move
def unusableInGravity?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Ingrain] ||
user.effects[PBEffects::SmackDown] ||
user.effects[PBEffects::MagnetRise]>0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
user.effects[PBEffects::MagnetRise] = 5
@battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",user.pbThis))
end
end
#===============================================================================
# For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
#===============================================================================
class PokeBattle_Move_StartTargetAirborneAndAlwaysHitByMoves < PokeBattle_Move
def unusableInGravity?; return true; end
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Ingrain] ||
target.effects[PBEffects::SmackDown] ||
target.effects[PBEffects::Telekinesis]>0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.isSpecies?(:DIGLETT) ||
target.isSpecies?(:DUGTRIO) ||
target.isSpecies?(:SANDYGAST) ||
target.isSpecies?(:PALOSSAND) ||
(target.isSpecies?(:GENGAR) && target.mega?)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Telekinesis] = 3
@battle.pbDisplay(_INTL("{1} was hurled into the air!",target.pbThis))
end
end
#===============================================================================
# Hits airborne semi-invulnerable targets. (Sky Uppercut)
#===============================================================================
class PokeBattle_Move_HitsTargetInSky < PokeBattle_Move
def hitsFlyingTargets?; return true; end
end
#===============================================================================
# Grounds the target while it remains active. Hits some semi-invulnerable
# targets. (Smack Down, Thousand Arrows)
#===============================================================================
class PokeBattle_Move_HitsTargetInSkyGroundsTarget < PokeBattle_Move
def hitsFlyingTargets?; return true; end
def pbCalcTypeModSingle(moveType,defType,user,target)
return Effectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
return super
end
def pbEffectAfterAllHits(user,target)
return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute
return if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") ||
target.effects[PBEffects::SkyDrop]>=0 # Sky Drop
return if !target.airborne? && !target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget")
target.effects[PBEffects::SmackDown] = true
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget") # NOTE: Not Sky Drop.
target.effects[PBEffects::TwoTurnAttack] = nil
@battle.pbClearChoice(target.index) if !target.movedThisRound?
end
target.effects[PBEffects::MagnetRise] = 0
target.effects[PBEffects::Telekinesis] = 0
@battle.pbDisplay(_INTL("{1} fell straight down!",target.pbThis))
end
end
#===============================================================================
# For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
# (Gravity)
#===============================================================================
class PokeBattle_Move_StartGravity < PokeBattle_Move
def pbMoveFailed?(user,targets)
if @battle.field.effects[PBEffects::Gravity]>0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectGeneral(user)
@battle.field.effects[PBEffects::Gravity] = 5
@battle.pbDisplay(_INTL("Gravity intensified!"))
@battle.eachBattler do |b|
showMessage = false
if b.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
b.effects[PBEffects::TwoTurnAttack] = nil
@battle.pbClearChoice(b.index) if !b.movedThisRound?
showMessage = true
end
if b.effects[PBEffects::MagnetRise]>0 ||
b.effects[PBEffects::Telekinesis]>0 ||
b.effects[PBEffects::SkyDrop]>=0
b.effects[PBEffects::MagnetRise] = 0
b.effects[PBEffects::Telekinesis] = 0
b.effects[PBEffects::SkyDrop] = -1
showMessage = true
end
@battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!",
b.pbThis)) if showMessage
end
end
end
#===============================================================================
# User transforms into the target. (Transform)
#===============================================================================
class PokeBattle_Move_TransformUserIntoTarget < PokeBattle_Move
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Transform]
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Transform] ||
target.effects[PBEffects::Illusion]
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
user.pbTransform(target)
end
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
super
@battle.scene.pbChangePokemon(user,targets[0].pokemon)
end
end