mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-06-14 15:54:13 +00:00
Renamed all move function codes
This commit is contained in:
@@ -36,6 +36,7 @@ module GameData
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
convert_move_data(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@type = hash[:type] || :NONE
|
||||
@@ -45,7 +46,7 @@ module GameData
|
||||
@total_pp = hash[:total_pp] || 5
|
||||
@target = hash[:target] || :None
|
||||
@priority = hash[:priority] || 0
|
||||
@function_code = hash[:function_code] || "000"
|
||||
@function_code = hash[:function_code] || "None"
|
||||
@flags = hash[:flags] || []
|
||||
@flags = [@flags] if !@flags.is_a?(Array)
|
||||
@effect_chance = hash[:effect_chance] || 0
|
||||
@@ -80,5 +81,436 @@ module GameData
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def convert_move_data(data)
|
||||
new_code = data[:function_code]
|
||||
case data[:function_code]
|
||||
when "000" then new_code = "None"
|
||||
when "001" then new_code = "DoesNothingUnusableInGravity"
|
||||
when "002" then new_code = "Struggle"
|
||||
when "003"
|
||||
if data[:id] == :RELICSONG
|
||||
new_code = "SleepTargetChangeUserMeloettaForm"
|
||||
elsif data[:id] == :DARKVOID && Settings::MECHANICS_GENERATION >= 7
|
||||
new_code = "SleepTargetIfUserDarkrai"
|
||||
else
|
||||
new_code = "SleepTarget"
|
||||
end
|
||||
when "004" then new_code = "SleepTargetNextTurn"
|
||||
when "005" then new_code = "PoisonTarget"
|
||||
when "006" then new_code = "BadPoisonTarget"
|
||||
when "007"
|
||||
if data[:id] == :THUNDERWAVE
|
||||
new_code = "ParalyzeTargetIfNotTypeImmune"
|
||||
elsif data[:id] == :BODYSLAM && Settings::MECHANICS_GENERATION >= 6
|
||||
new_code = "ParalyzeTargetTrampleMinimize"
|
||||
else
|
||||
new_code = "ParalyzeTarget"
|
||||
end
|
||||
when "008" then new_code = "ParalyzeTargetAlwaysHitsInRainHitsTargetInSky"
|
||||
when "009" then new_code = "ParalyzeFlinchTarget"
|
||||
when "00A" then new_code = "BurnTarget"
|
||||
when "00B" then new_code = "BurnFlinchTarget"
|
||||
when "00C" then new_code = "FreezeTarget"
|
||||
when "00D" then new_code = "FreezeTargetAlwaysHitsInHail"
|
||||
when "00E" then new_code = "FreezeFlinchTarget"
|
||||
when "00F" then new_code = "FlinchTarget"
|
||||
when "010" then new_code = "FlinchTargetTrampleMinimize"
|
||||
when "011" then new_code = "FlinchTargetFailsIfUserNotAsleep"
|
||||
when "012" then new_code = "FlinchTargetFailsIfNotUserFirstTurn"
|
||||
when "013", "014" then new_code = "ConfuseTarget"
|
||||
when "015" then new_code = "ConfuseTargetAlwaysHitsInRainHitsTargetInSky"
|
||||
when "016" then new_code = "AttractTarget"
|
||||
when "017" then new_code = "ParalyzeBurnOrFreezeTarget"
|
||||
when "018" then new_code = "CureUserBurnPoisonParalysis"
|
||||
when "019" then new_code = "CureUserPartyStatus"
|
||||
when "01A" then new_code = "StartUserSideImmunityToInflictedStatus"
|
||||
when "01B" then new_code = "GiveUserStatusToTarget"
|
||||
when "01C" then new_code = "RaiseUserAttack1"
|
||||
when "01D" then new_code = "RaiseUserDefense1"
|
||||
when "01E" then new_code = "RaiseUserDefense1CurlUpUser"
|
||||
when "01F" then new_code = "RaiseUserSpeed1"
|
||||
when "020" then new_code = "RaiseUserSpAtk1"
|
||||
when "021" then new_code = "RaiseUserSpDef1PowerUpElectricMove"
|
||||
when "022" then new_code = "RaiseUserEvasion1"
|
||||
when "023" then new_code = "RaiseUserCriticalHitRate2"
|
||||
when "024" then new_code = "RaiseUserAtkDef1"
|
||||
when "025" then new_code = "RaiseUserAtkDefAcc1"
|
||||
when "026" then new_code = "RaiseUserAtkSpd1"
|
||||
when "027" then new_code = "RaiseUserAtkSpAtk1"
|
||||
when "028" then new_code = "RaiseUserAtkSpAtk1Or2InSun"
|
||||
when "029" then new_code = "RaiseUserAtkAcc1"
|
||||
when "02A" then new_code = "RaiseUserDefSpDef1"
|
||||
when "02B" then new_code = "RaiseUserSpAtkSpDefSpd1"
|
||||
when "02C" then new_code = "RaiseUserSpAtkSpDef1"
|
||||
when "02D" then new_code = "RaiseUserMainStats1"
|
||||
when "02E" then new_code = "RaiseUserAttack2"
|
||||
when "02F" then new_code = "RaiseUserDefense2"
|
||||
when "030" then new_code = "RaiseUserSpeed2"
|
||||
when "031" then new_code = "RaiseUserSpeed2LowerUserWeight"
|
||||
when "032" then new_code = "RaiseUserSpAtk2"
|
||||
when "033" then new_code = "RaiseUserSpDef2"
|
||||
when "034" then new_code = "RaiseUserEvasion2MinimizeUser"
|
||||
when "035" then new_code = "LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2"
|
||||
when "036" then new_code = "RaiseUserAtk1Spd2"
|
||||
when "037" then new_code = "RaiseTargetRandomStat2"
|
||||
when "038" then new_code = "RaiseUserDefense3"
|
||||
when "039" then new_code = "RaiseUserSpAtk3"
|
||||
when "03A" then new_code = "MaxUserAttackLoseHalfOfTotalHP"
|
||||
when "03B" then new_code = "LowerUserAtkDef1"
|
||||
when "03C" then new_code = "LowerUserDefSpDef1"
|
||||
when "03D" then new_code = "LowerUserDefSpDefSpd1"
|
||||
when "03E" then new_code = "LowerUserSpeed1"
|
||||
when "03F" then new_code = "LowerUserSpAtk2"
|
||||
when "040" then new_code = "RaiseTargetSpAtk1ConfuseTarget"
|
||||
when "041" then new_code = "RaiseTargetAttack2ConfuseTarget"
|
||||
when "042" then new_code = "LowerTargetAttack1"
|
||||
when "043" then new_code = "LowerTargetDefense1"
|
||||
when "044"
|
||||
if data[:id] == :BULLDOZE
|
||||
new_code = "LowerTargetSpeed1WeakerInGrassyTerrain"
|
||||
else
|
||||
new_code = "LowerTargetSpeed1"
|
||||
end
|
||||
when "045" then new_code = "LowerTargetSpAtk1"
|
||||
when "046" then new_code = "LowerTargetSpDef1"
|
||||
when "047" then new_code = "LowerTargetAccuracy1"
|
||||
when "048"
|
||||
if data[:id] == :SWEETSCENT && Settings::MECHANICS_GENERATION >= 6
|
||||
new_code = "LowerTargetEvasion2"
|
||||
else
|
||||
new_code = "LowerTargetEvasion1"
|
||||
end
|
||||
when "049" then new_code = "LowerTargetEvasion1RemoveSideEffects"
|
||||
when "04A" then new_code = "LowerTargetAtkDef1"
|
||||
when "04B" then new_code = "LowerTargetAttack2"
|
||||
when "04C" then new_code = "LowerTargetDefense2"
|
||||
when "04D" then new_code = "LowerTargetSpeed2"
|
||||
when "04E" then new_code = "LowerTargetSpAtk2IfCanAttract"
|
||||
when "04F" then new_code = "LowerTargetSpDef2"
|
||||
when "050" then new_code = "ResetTargetStatStages"
|
||||
when "051" then new_code = "ResetAllBattlersStatStages"
|
||||
when "052" then new_code = "UserTargetSwapAtkSpAtkStages"
|
||||
when "053" then new_code = "UserTargetSwapDefSpDefStages"
|
||||
when "054" then new_code = "UserTargetSwapStatStages"
|
||||
when "055" then new_code = "UserCopyTargetStatStages"
|
||||
when "056" then new_code = "StartUserSideImmunityToStatStageLowering"
|
||||
when "057" then new_code = "UserSwapBaseAtkDef"
|
||||
when "058" then new_code = "UserTargetAverageBaseAtkSpAtk"
|
||||
when "059" then new_code = "UserTargetAverageBaseDefSpDef"
|
||||
when "05A" then new_code = "UserTargetAverageHP"
|
||||
when "05B" then new_code = "StartUserSideDoubleSpeed"
|
||||
when "05C" then new_code = "ReplaceMoveThisBattleWithTargetLastMoveUsed"
|
||||
when "05D" then new_code = "ReplaceMoveWithTargetLastMoveUsed"
|
||||
when "05E" then new_code = "SetUserTypesToUserMoveType"
|
||||
when "05F" then new_code = "SetUserTypesToResistLastAttack"
|
||||
when "060" then new_code = "SetUserTypesBasedOnEnvironment"
|
||||
when "061" then new_code = "SetTargetTypesToWater"
|
||||
when "062" then new_code = "SetUserTypesToTargetTypes"
|
||||
when "063" then new_code = "SetTargetAbilityToSimple"
|
||||
when "064" then new_code = "SetTargetAbilityToInsomnia"
|
||||
when "065" then new_code = "SetUserAbilityToTargetAbility"
|
||||
when "066" then new_code = "SetTargetAbilityToUserAbility"
|
||||
when "067" then new_code = "UserTargetSwapAbilities"
|
||||
when "068" then new_code = "NegateTargetAbility"
|
||||
when "069" then new_code = "TransformUserIntoTarget"
|
||||
when "06A" then new_code = "FixedDamage20"
|
||||
when "06B" then new_code = "FixedDamage40"
|
||||
when "06C" then new_code = "FixedDamageHalfTargetHP"
|
||||
when "06D" then new_code = "FixedDamageUserLevel"
|
||||
when "06E" then new_code = "LowerTargetHPToUserHP"
|
||||
when "06F" then new_code = "FixedDamageUserLevelRandom"
|
||||
when "070"
|
||||
if data[:id] == :FISSURE
|
||||
new_code = "OHKOHitsTargetUnderground"
|
||||
elsif data[:id] == :SHEERCOLD && Settings::MECHANICS_GENERATION >= 7
|
||||
new_code = "OHKOIce"
|
||||
else
|
||||
new_code = "OHKO"
|
||||
end
|
||||
when "071" then new_code = "CounterPhysicalDamage"
|
||||
when "072" then new_code = "CounterSpecialDamage"
|
||||
when "073" then new_code = "CounterDamagePlusHalf"
|
||||
when "074" then new_code = "DamageTargetAlly"
|
||||
when "075" then new_code = "DoublePowerIfTargetUnderwater"
|
||||
when "076" then new_code = "DoublePowerIfTargetUnderground"
|
||||
when "077" then new_code = "DoublePowerIfTargetInSky"
|
||||
when "078" then new_code = "FlinchTargetDoublePowerIfTargetInSky"
|
||||
when "079" then new_code = "DoublePowerAfterFusionFlare"
|
||||
when "07A" then new_code = "DoublePowerAfterFusionBolt"
|
||||
when "07B" then new_code = "DoublePowerIfTargetPoisoned"
|
||||
when "07C" then new_code = "DoublePowerIfTargetParalyzedCureTarget"
|
||||
when "07D" then new_code = "DoublePowerIfTargetAsleepCureTarget"
|
||||
when "07E" then new_code = "DoublePowerIfUserPoisonedBurnedParalyzed"
|
||||
when "07F" then new_code = "DoublePowerIfTargetStatusProblem"
|
||||
when "080" then new_code = "DoublePowerIfTargetHPLessThanHalf"
|
||||
when "081" then new_code = "DoublePowerIfUserLostHPThisTurn"
|
||||
when "082" then new_code = "DoublePowerIfTargetLostHPThisTurn"
|
||||
when "083" then new_code = "UsedAfterAllyRoundWithDoublePower"
|
||||
when "084" then new_code = "DoublePowerIfTargetActed"
|
||||
when "085" then new_code = "DoublePowerIfAllyFaintedLastTurn"
|
||||
when "086" then new_code = "DoublePowerIfUserHasNoItem"
|
||||
when "087" then new_code = "TypeAndPowerDependOnWeather"
|
||||
when "088" then new_code = "PursueSwitchingFoe"
|
||||
when "089" then new_code = "PowerHigherWithUserHappiness"
|
||||
when "08A" then new_code = "PowerLowerWithUserHappiness"
|
||||
when "08B" then new_code = "PowerHigherWithUserHP"
|
||||
when "08C" then new_code = "PowerHigherWithTargetHP"
|
||||
when "08D" then new_code = "PowerHigherWithTargetFasterThanUser"
|
||||
when "08E" then new_code = "PowerHigherWithUserPositiveStatStages"
|
||||
when "08F" then new_code = "PowerHigherWithTargetPositiveStatStages"
|
||||
when "090" then new_code = "TypeDependsOnUserIVs"
|
||||
when "091" then new_code = "PowerHigherWithConsecutiveUse"
|
||||
when "092" then new_code = "PowerHigherWithConsecutiveUseOnUserSide"
|
||||
when "093" then new_code = "StartRaiseUserAtk1WhenDamaged"
|
||||
when "094" then new_code = "RandomlyDamageOrHealTarget"
|
||||
when "095" then new_code = "RandomPowerDoublePowerIfTargetUnderground"
|
||||
when "096" then new_code = "TypeAndPowerDependOnUserBerry"
|
||||
when "097" then new_code = "PowerHigherWithLessPP"
|
||||
when "098" then new_code = "PowerLowerWithUserHP"
|
||||
when "099" then new_code = "PowerHigherWithUserFasterThanTarget"
|
||||
when "09A" then new_code = "PowerHigherWithTargetWeight"
|
||||
when "09B" then new_code = "PowerHigherWithUserHeavierThanTarget"
|
||||
when "09C" then new_code = "PowerUpAllyMove"
|
||||
when "09D" then new_code = "StartWeakenElectricMoves"
|
||||
when "09E" then new_code = "StartWeakenFireMoves"
|
||||
when "09F"
|
||||
if data[:id] == :MULTIATTACK
|
||||
new_code = "TypeDependsOnUserMemory"
|
||||
elsif data[:id] == :TECHNOBLAST
|
||||
new_code = "TypeDependsOnUserDrive"
|
||||
else
|
||||
new_code = "TypeDependsOnUserPlate"
|
||||
end
|
||||
when "0A0" then new_code = "AlwaysCriticalHit"
|
||||
when "0A1" then new_code = "StartPreventCriticalHitsAgainstUserSide"
|
||||
when "0A2" then new_code = "StartWeakenPhysicalDamageAgainstUserSide"
|
||||
when "0A3" then new_code = "StartWeakenSpecialDamageAgainstUserSide"
|
||||
when "0A4" then new_code = "EffectDependsOnEnvironment"
|
||||
when "0A5"
|
||||
new_code = "None"
|
||||
data[:accuracy] = 0
|
||||
when "0A6" then new_code = "EnsureNextMoveAlwaysHits"
|
||||
when "0A7" then new_code = "StartNegateTargetEvasionStatStageAndGhostImmunity"
|
||||
when "0A8" then new_code = "StartNegateTargetEvasionStatStageAndDarkImmunity"
|
||||
when "0A9" then new_code = "IgnoreTargetDefSpDefEvaStatStages"
|
||||
when "0AA" then new_code = "ProtectUser"
|
||||
when "0AB" then new_code = "ProtectUserSideFromPriorityMoves"
|
||||
when "0AC" then new_code = "ProtectUserSideFromMultiTargetDamagingMoves"
|
||||
when "0AD" then new_code = "RemoveProtections"
|
||||
when "0AE" then new_code = "UseLastMoveUsedByTarget"
|
||||
when "0AF" then new_code = "UseLastMoveUsed"
|
||||
when "0B0" then new_code = "UseMoveTargetIsAboutToUse"
|
||||
when "0B1" then new_code = "BounceBackProblemCausingStatusMoves"
|
||||
when "0B2" then new_code = "StealAndUseBeneficialStatusMove"
|
||||
when "0B3" then new_code = "UseMoveDependingOnEnvironment"
|
||||
when "0B4" then new_code = "UseRandomUserMoveIfAsleep"
|
||||
when "0B5" then new_code = "UseRandomMoveFromUserParty"
|
||||
when "0B6" then new_code = "UseRandomMove"
|
||||
when "0B7" then new_code = "DisableTargetUsingSameMoveConsecutively"
|
||||
when "0B8" then new_code = "DisableTargetMovesKnownByUser"
|
||||
when "0B9" then new_code = "DisableTargetLastMoveUsed"
|
||||
when "0BA" then new_code = "DisableTargetStatusMoves"
|
||||
when "0BB" then new_code = "DisableTargetHealingMoves"
|
||||
when "0BC" then new_code = "DisableTargetUsingDifferentMove"
|
||||
when "0BD" then new_code = "HitTwoTimes"
|
||||
when "0BE" then new_code = "HitTwoTimesPoisonTarget"
|
||||
when "0BF" then new_code = "HitThreeTimesPowersUpWithEachHit"
|
||||
when "0C0"
|
||||
if data[:id] == :WATERSHURIKEN
|
||||
new_code = "HitTwoToFiveTimesOrThreeForAshGreninja"
|
||||
else
|
||||
new_code = "HitTwoToFiveTimes"
|
||||
end
|
||||
when "0C1" then new_code = "HitOncePerUserTeamMember"
|
||||
when "0C2" then new_code = "AttackAndSkipNextTurn"
|
||||
when "0C3" then new_code = "TwoTurnAttack"
|
||||
when "0C4" then new_code = "TwoTurnAttackOneTurnInSun"
|
||||
when "0C5" then new_code = "TwoTurnAttackParalyzeTarget"
|
||||
when "0C6" then new_code = "TwoTurnAttackBurnTarget"
|
||||
when "0C7" then new_code = "TwoTurnAttackFlinchTarget"
|
||||
when "0C8" then new_code = "TwoTurnAttackChargeRaiseUserDefense1"
|
||||
when "0C9" then new_code = "TwoTurnAttackInvulnerableInSky"
|
||||
when "0CA" then new_code = "TwoTurnAttackInvulnerableUnderground"
|
||||
when "0CB" then new_code = "TwoTurnAttackInvulnerableUnderwater"
|
||||
when "0CC" then new_code = "TwoTurnAttackInvulnerableInSkyParalyzeTarget"
|
||||
when "0CD" then new_code = "TwoTurnAttackInvulnerableRemoveProtections"
|
||||
when "0CE" then new_code = "TwoTurnAttackInvulnerableInSkyTargetCannotAct"
|
||||
when "0CF" then new_code = "BindTarget"
|
||||
when "0D0" then new_code = "BindTargetDoublePowerIfTargetUnderwater"
|
||||
when "0D1" then new_code = "MultiTurnAttackPreventSleeping"
|
||||
when "0D2" then new_code = "MultiTurnAttackConfuseUserAtEnd"
|
||||
when "0D3" then new_code = "MultiTurnAttackPowersUpEachTurn"
|
||||
when "0D4" then new_code = "MultiTurnAttackBideThenReturnDoubleDamage"
|
||||
when "0D5" then new_code = "HealUserHalfOfTotalHP"
|
||||
when "0D6" then new_code = "HealUserHalfOfTotalHPLoseFlyingTypeThisTurn"
|
||||
when "0D7" then new_code = "HealUserPositionNextTurn"
|
||||
when "0D8" then new_code = "HealUserDependingOnWeather"
|
||||
when "0D9" then new_code = "HealUserFullyAndFallAsleep"
|
||||
when "0DA" then new_code = "StartHealUserEachTurn"
|
||||
when "0DB" then new_code = "StartHealUserEachTurnTrapUserInBattle"
|
||||
when "0DC" then new_code = "StartLeechSeedTarget"
|
||||
when "0DD" then new_code = "HealUserByHalfOfDamageDone"
|
||||
when "0DE" then new_code = "HealUserByHalfOfDamageDoneIfTargetAsleep"
|
||||
when "0DF" then new_code = "HealTargetHalfOfTotalHP"
|
||||
when "0E0" then new_code = "UserFaintsExplosive"
|
||||
when "0E1" then new_code = "UserFaintsFixedDamageUserHP"
|
||||
when "0E2" then new_code = "UserFaintsLowerTargetAtkSpAtk2"
|
||||
when "0E3" then new_code = "UserFaintsHealAndCureReplacement"
|
||||
when "0E4" then new_code = "UserFaintsHealAndCureReplacementRestorePP"
|
||||
when "0E5" then new_code = "StartPerishCountsForAllBattlers"
|
||||
when "0E6" then new_code = "SetAttackerMovePPTo0IfUserFaints"
|
||||
when "0E7" then new_code = "AttackerFaintsIfUserFaints"
|
||||
when "0E8" then new_code = "UserEnduresFaintingThisTurn"
|
||||
when "0E9" then new_code = "CannotMakeTargetFaint"
|
||||
when "0EA"
|
||||
if Settings::MECHANICS_GENERATION >= 8
|
||||
new_code = "SwitchOutUserStatusMove"
|
||||
else
|
||||
new_code = "FleeFromBattle"
|
||||
end
|
||||
when "0EB" then new_code = "SwitchOutTargetStatusMove"
|
||||
when "0EC" then new_code = "SwitchOutTargetDamagingMove"
|
||||
when "0ED" then new_code = "SwitchOutUserPassOnEffects"
|
||||
when "0EE" then new_code = "SwitchOutUserDamagingMove"
|
||||
when "0EF" then new_code = "TrapTargetInBattle"
|
||||
when "0F0" then new_code = "RemoveTargetItem"
|
||||
when "0F1" then new_code = "UserTakesTargetItem"
|
||||
when "0F2" then new_code = "UserTargetSwapItems"
|
||||
when "0F3" then new_code = "TargetTakesUserItem"
|
||||
when "0F4" then new_code = "UserConsumeTargetBerry"
|
||||
when "0F5" then new_code = "DestroyTargetBerryOrGem"
|
||||
when "0F6" then new_code = "RestoreUserConsumedItem"
|
||||
when "0F7" then new_code = "ThrowUserItemAtTarget"
|
||||
when "0F8" then new_code = "StartTargetCannotUseItem"
|
||||
when "0F9" then new_code = "StartNegateHeldItems"
|
||||
when "0FA" then new_code = "RecoilQuarterOfDamageDealt"
|
||||
when "0FB" then new_code = "RecoilThirdOfDamageDealt"
|
||||
when "0FC" then new_code = "RecoilHalfOfDamageDealt"
|
||||
when "0FD" then new_code = "RecoilThirdOfDamageDealtParalyzeTarget"
|
||||
when "0FE" then new_code = "RecoilThirdOfDamageDealtBurnTarget"
|
||||
when "0FF" then new_code = "StartSunWeather"
|
||||
when "100" then new_code = "StartRainWeather"
|
||||
when "101" then new_code = "StartSandstormWeather"
|
||||
when "102" then new_code = "StartHailWeather"
|
||||
when "103" then new_code = "AddSpikesToFoeSide"
|
||||
when "104" then new_code = "AddToxicSpikesToFoeSide"
|
||||
when "105" then new_code = "AddStealthRocksToFoeSide"
|
||||
when "106" then new_code = "GrassPledge"
|
||||
when "107" then new_code = "FirePledge"
|
||||
when "108" then new_code = "WaterPledge"
|
||||
when "109" then new_code = "AddMoneyGainedFromBattle"
|
||||
when "10A" then new_code = "RemoveScreens"
|
||||
when "10B" then new_code = "CrashDamageIfFailsUnusableInGravity"
|
||||
when "10C" then new_code = "UserMakeSubstitute"
|
||||
when "10D" then new_code = "CurseTargetOrLowerUserSpd1RaiseUserAtkDef1"
|
||||
when "10E" then new_code = "LowerPPOfTargetLastMoveBy4"
|
||||
when "10F" then new_code = "StartDamageTargetEachTurnIfTargetAsleep"
|
||||
when "110" then new_code = "RemoveUserBindingAndEntryHazards"
|
||||
when "111" then new_code = "AttackTwoTurnsLater"
|
||||
when "112" then new_code = "UserAddStockpileRaiseDefSpDef1"
|
||||
when "113" then new_code = "PowerDependsOnUserStockpile"
|
||||
when "114" then new_code = "HealUserDependingOnUserStockpile"
|
||||
when "115" then new_code = "FailsIfUserDamagedThisTurn"
|
||||
when "116" then new_code = "FailsIfTargetActed"
|
||||
when "117" then new_code = "RedirectAllMovesToUser"
|
||||
when "118" then new_code = "StartGravity"
|
||||
when "119" then new_code = "StartUserAirborne"
|
||||
when "11A" then new_code = "StartTargetAirborneAndAlwaysHitByMoves"
|
||||
when "11B" then new_code = "HitsTargetInSky"
|
||||
when "11C" then new_code = "HitsTargetInSkyGroundsTarget"
|
||||
when "11D" then new_code = "TargetActsNext"
|
||||
when "11E" then new_code = "TargetActsLast"
|
||||
when "11F" then new_code = "StartSlowerBattlersActFirst"
|
||||
when "120" then new_code = "UserSwapsPositionsWithAlly"
|
||||
when "121" then new_code = "UseTargetAttackInsteadOfUserAttack"
|
||||
when "122" then new_code = "UseTargetDefenseInsteadOfTargetSpDef"
|
||||
when "123" then new_code = "FailsUnlessTargetSharesTypeWithUser"
|
||||
when "124" then new_code = "StartSwapAllBattlersBaseDefensiveStats"
|
||||
when "125" then new_code = "FailsIfUserHasUnusedMove"
|
||||
when "126" then new_code = "None"
|
||||
when "127" then new_code = "ParalyzeTarget"
|
||||
when "128" then new_code = "BurnTarget"
|
||||
when "129" then new_code = "FreezeTarget"
|
||||
when "12A" then new_code = "ConfuseTarget"
|
||||
when "12B" then new_code = "LowerTargetDefense2"
|
||||
when "12C" then new_code = "LowerTargetEvasion2"
|
||||
when "12D" then new_code = "DoublePowerIfTargetUnderwater"
|
||||
when "12E" then new_code = "AllBattlersLoseHalfHPUserSkipsNextTurn"
|
||||
when "12F" then new_code = "TrapTargetInBattle"
|
||||
when "130" then new_code = "UserLosesHalfHP"
|
||||
when "131" then new_code = "StartShadowSkyWeather"
|
||||
when "132" then new_code = "RemoveAllScreens"
|
||||
when "133" then new_code = "DoesNothingFailsIfNoAlly"
|
||||
when "134" then new_code = "DoesNothingCongratuations"
|
||||
when "135" then new_code = "FreezeTargetSuperEffectiveAgainstWater"
|
||||
when "136" then new_code = "RaiseUserDefense2"
|
||||
when "137" then new_code = "RaisePlusMinusUserAndAlliesDefSpDef1"
|
||||
when "138" then new_code = "RaiseAllySpDef1"
|
||||
when "139" then new_code = "LowerTargetAttack1BypassSubstitute"
|
||||
when "13A" then new_code = "LowerTargetAtkSpAtk1"
|
||||
when "13B" then new_code = "HoopaRemoveProtectionsBypassSubstituteLowerUserDef1"
|
||||
when "13C" then new_code = "LowerTargetSpAtk1"
|
||||
when "13D" then new_code = "LowerTargetSpAtk2"
|
||||
when "13E" then new_code = "RaiseGroundedGrassBattlersAtkSpAtk1"
|
||||
when "13F" then new_code = "RaiseGrassBattlersDef1"
|
||||
when "140" then new_code = "LowerPoisonedTargetAtkSpAtkSpd1"
|
||||
when "141" then new_code = "InvertTargetStatStages"
|
||||
when "142" then new_code = "AddGhostTypeToTarget"
|
||||
when "143" then new_code = "AddGrassTypeToTarget"
|
||||
when "144" then new_code = "EffectivenessIncludesFlyingType"
|
||||
when "145" then new_code = "TargetMovesBecomeElectric"
|
||||
when "146" then new_code = "NormalMovesBecomeElectric"
|
||||
when "147" then new_code = "RemoveProtectionsBypassSubstitute"
|
||||
when "148" then new_code = "TargetNextFireMoveDamagesTarget"
|
||||
when "149" then new_code = "ProtectUserSideFromDamagingMovesIfUserFirstTurn"
|
||||
when "14A" then new_code = "ProtectUserSideFromStatusMoves"
|
||||
when "14B" then new_code = "ProtectUserFromDamagingMovesKingsShield"
|
||||
when "14C" then new_code = "ProtectUserFromTargetingMovesSpikyShield"
|
||||
when "14D" then new_code = "TwoTurnAttackInvulnerableRemoveProtections"
|
||||
when "14E" then new_code = "TwoTurnAttackRaiseUserSpAtkSpDefSpd2"
|
||||
when "14F" then new_code = "HealUserByThreeQuartersOfDamageDone"
|
||||
when "150" then new_code = "RaiseUserAttack3IfTargetFaints"
|
||||
when "151" then new_code = "LowerTargetAtkSpAtk1SwitchOutUser"
|
||||
when "152" then new_code = "TrapAllBattlersInBattleForOneTurn"
|
||||
when "153" then new_code = "AddStickyWebToFoeSide"
|
||||
when "154" then new_code = "StartElectricTerrain"
|
||||
when "155" then new_code = "StartGrassyTerrain"
|
||||
when "156" then new_code = "StartMistyTerrain"
|
||||
when "157" then new_code = "DoubleMoneyGainedFromBattle"
|
||||
when "158" then new_code = "FailsIfUserNotConsumedBerry"
|
||||
when "159" then new_code = "PoisonTargetLowerTargetSpeed1"
|
||||
when "15A" then new_code = "CureTargetBurn"
|
||||
when "15B" then new_code = "CureTargetStatusHealUserHalfOfTotalHP"
|
||||
when "15C" then new_code = "RaisePlusMinusUserAndAlliesAtkSpAtk1"
|
||||
when "15D" then new_code = "UserStealTargetPositiveStatStages"
|
||||
when "15E" then new_code = "EnsureNextCriticalHit"
|
||||
when "15F" then new_code = "LowerUserDefense1"
|
||||
when "160" then new_code = "HealUserByTargetAttackLowerTargetAttack1"
|
||||
when "161" then new_code = "UserTargetSwapBaseSpeed"
|
||||
when "162" then new_code = "UserLosesFireType"
|
||||
when "163" then new_code = "IgnoreTargetAbility"
|
||||
when "164" then new_code = "CategoryDependsOnHigherDamageIgnoreTargetAbility"
|
||||
when "165" then new_code = "NegateTargetAbilityIfTargetActed"
|
||||
when "166" then new_code = "DoublePowerIfUserLastMoveFailed"
|
||||
when "167" then new_code = "StartWeakenDamageAgainstUserSideIfHail"
|
||||
when "168" then new_code = "ProtectUserBanefulBunker"
|
||||
when "169" then new_code = "TypeIsUserFirstType"
|
||||
when "16A" then new_code = "RedirectAllMovesToTarget"
|
||||
when "16B" then new_code = "TargetUsesItsLastUsedMoveAgain"
|
||||
when "16C" then new_code = "DisableTargetSoundMoves"
|
||||
when "16D" then new_code = "HealUserDependingOnSandstorm"
|
||||
when "16E" then new_code = "HealTargetDependingOnGrassyTerrain"
|
||||
when "16F" then new_code = "HealAllyOrDamageFoe"
|
||||
when "170" then new_code = "UserLosesHalfOfTotalHPExplosive"
|
||||
when "171" then new_code = "UsedAfterUserTakesPhysicalDamage"
|
||||
when "172" then new_code = "BurnAttackerBeforeUserActs"
|
||||
when "173" then new_code = "StartPsychicTerrain"
|
||||
when "174" then new_code = "FailsIfNotUserFirstTurn"
|
||||
when "175" then new_code = "HitTwoTimesFlinchTarget"
|
||||
end
|
||||
data[:function_code] = new_code
|
||||
return data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -522,7 +522,8 @@ class PokeBattle_Battler
|
||||
def takesSandstormDamage?
|
||||
return false if !takesIndirectDamage?
|
||||
return false if pbHasType?(:GROUND) || pbHasType?(:ROCK) || pbHasType?(:STEEL)
|
||||
return false if inTwoTurnAttack?("0CA","0CB") # Dig, Dive
|
||||
return false if inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground",
|
||||
"TwoTurnAttackInvulnerableUnderwater")
|
||||
return false if hasActiveAbility?([:OVERCOAT,:SANDFORCE,:SANDRUSH,:SANDVEIL])
|
||||
return false if hasActiveItem?(:SAFETYGOGGLES)
|
||||
return true
|
||||
@@ -531,7 +532,8 @@ class PokeBattle_Battler
|
||||
def takesHailDamage?
|
||||
return false if !takesIndirectDamage?
|
||||
return false if pbHasType?(:ICE)
|
||||
return false if inTwoTurnAttack?("0CA","0CB") # Dig, Dive
|
||||
return false if inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground",
|
||||
"TwoTurnAttackInvulnerableUnderwater")
|
||||
return false if hasActiveAbility?([:OVERCOAT,:ICEBODY,:SNOWCLOAK])
|
||||
return false if hasActiveItem?(:SAFETYGOGGLES)
|
||||
return true
|
||||
@@ -627,7 +629,12 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def semiInvulnerable?
|
||||
return inTwoTurnAttack?("0C9","0CA","0CB","0CC","0CD","0CE","14D")
|
||||
return inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
||||
"TwoTurnAttackInvulnerableUnderground",
|
||||
"TwoTurnAttackInvulnerableUnderwater",
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||
"TwoTurnAttackInvulnerableRemoveProtections",
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
|
||||
end
|
||||
|
||||
def pbEncoredMoveIndex
|
||||
|
||||
@@ -372,7 +372,7 @@ class PokeBattle_Battler
|
||||
# Pokémon which becomes Ghost-type because of Protean, it should
|
||||
# target and curse itself. I think this is silly, so I'm making it
|
||||
# choose a random opponent to curse instead.
|
||||
if move.function=="10D" && targets.length==0 # Curse
|
||||
if move.function=="CurseTargetOrLowerUserSpd1RaiseUserAtkDef1" && targets.length==0
|
||||
choice[3] = -1
|
||||
targets = pbFindTargets(choice,move,user)
|
||||
end
|
||||
@@ -658,7 +658,7 @@ class PokeBattle_Battler
|
||||
if move.pbDamagingMove?
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
# NOTE: This method is also used for the OKHO special message.
|
||||
# NOTE: This method is also used for the OHKO special message.
|
||||
move.pbHitEffectivenessMessages(user,b,targets.length)
|
||||
# Record data about the hit for various effects' purposes
|
||||
move.pbRecordDamageLost(user,b)
|
||||
|
||||
@@ -535,17 +535,19 @@ class PokeBattle_Battler
|
||||
# Future Sight
|
||||
hitsInvul = true if @battle.futureSight
|
||||
# Helping Hand
|
||||
hitsInvul = true if move.function=="09C"
|
||||
hitsInvul = true if move.function=="PowerUpAllyMove"
|
||||
if !hitsInvul
|
||||
# Semi-invulnerable moves
|
||||
if target.effects[PBEffects::TwoTurnAttack]
|
||||
if target.inTwoTurnAttack?("0C9","0CC","0CE") # Fly, Bounce, Sky Drop
|
||||
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
|
||||
miss = true if !move.hitsFlyingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CA") # Dig
|
||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground")
|
||||
miss = true if !move.hitsDiggingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CB") # Dive
|
||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
|
||||
miss = true if !move.hitsDivingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CD","14D") # Shadow Force, Phantom Force
|
||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableRemoveProtections")
|
||||
miss = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -145,7 +145,7 @@ class PokeBattle_Battler
|
||||
user.pbConsumeItem
|
||||
end
|
||||
# Room Service
|
||||
if move.function == "11F" && @battle.field.effects[PBEffects::TrickRoom] > 0 # Trick Room
|
||||
if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
|
||||
@battle.battlers.each do |b|
|
||||
next if !b.hasActiveItem?(:ROOMSERVICE)
|
||||
next if !b.pbCanLowerStatStage?(:SPEED, b)
|
||||
|
||||
@@ -49,7 +49,7 @@ class PokeBattle_Move
|
||||
# function code (found in the script section PokeBattle_MoveEffect).
|
||||
def PokeBattle_Move.from_pokemon_move(battle, move)
|
||||
validate move => Pokemon::Move
|
||||
moveFunction = move.function_code || "000"
|
||||
moveFunction = move.function_code || "None"
|
||||
className = sprintf("PokeBattle_Move_%s", moveFunction)
|
||||
if Object.const_defined?(className)
|
||||
return Object.const_get(className).new(battle, move)
|
||||
|
||||
@@ -347,7 +347,7 @@ class PokeBattle_Move
|
||||
# regardless of its calculated type. Hence the following two lines of
|
||||
# code.
|
||||
moveType = nil
|
||||
moveType = :NORMAL if @function=="090" # Hidden Power
|
||||
moveType = :NORMAL if @function=="TypeDependsOnUserIVs" # Hidden Power
|
||||
if physicalMove?(moveType)
|
||||
target.effects[PBEffects::Counter] = damage
|
||||
target.effects[PBEffects::CounterTarget] = user.index
|
||||
|
||||
@@ -88,8 +88,7 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbBaseAccuracy(user,target); return @accuracy; end
|
||||
|
||||
# Accuracy calculations for one-hit KO moves and "always hit" moves are
|
||||
# handled elsewhere.
|
||||
# Accuracy calculations for one-hit KO moves are handled elsewhere.
|
||||
def pbAccuracyCheck(user,target)
|
||||
# "Always hit" effects and "always hit" accuracy
|
||||
return true if target.effects[PBEffects::Telekinesis]>0
|
||||
@@ -396,7 +395,7 @@ class PokeBattle_Move
|
||||
multipliers[:final_damage_multiplier] *= 1.5
|
||||
end
|
||||
when :Sandstorm
|
||||
if target.pbHasType?(:ROCK) && specialMove? && @function != "122" # Psyshock
|
||||
if target.pbHasType?(:ROCK) && specialMove? && @function != "UseTargetDefenseInsteadOfTargetSpDef"
|
||||
multipliers[:defense_multiplier] *= 1.5
|
||||
end
|
||||
end
|
||||
@@ -467,7 +466,7 @@ class PokeBattle_Move
|
||||
def pbAdditionalEffectChance(user,target,effectChance=0)
|
||||
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
|
||||
ret = (effectChance>0) ? effectChance : @addlEffect
|
||||
if Settings::MECHANICS_GENERATION >= 6 || @function != "0A4" # Secret Power
|
||||
if Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment"
|
||||
ret *= 2 if user.hasActiveAbility?(:SERENEGRACE) ||
|
||||
user.pbOwnSide.effects[PBEffects::Rainbow]>0
|
||||
end
|
||||
|
||||
+9
-4
@@ -22,9 +22,9 @@ class PokeBattle_Confusion < PokeBattle_Move
|
||||
def initialize(battle,move)
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = 0
|
||||
@id = :CONFUSEDAMAGE
|
||||
@name = ""
|
||||
@function = "000"
|
||||
@function = "None"
|
||||
@baseDamage = 40
|
||||
@type = nil
|
||||
@category = 0
|
||||
@@ -56,7 +56,7 @@ class PokeBattle_Struggle < PokeBattle_Move
|
||||
@realMove = nil # Not associated with a move
|
||||
@id = (move) ? move.id : :STRUGGLE
|
||||
@name = (move) ? move.name : _INTL("Struggle")
|
||||
@function = "002"
|
||||
@function = "Struggle"
|
||||
@baseDamage = 50
|
||||
@type = nil
|
||||
@category = 0
|
||||
@@ -466,7 +466,12 @@ class PokeBattle_TwoTurnMove < PokeBattle_Move
|
||||
# Moves that would make the user semi-invulnerable will hide the user
|
||||
# after the charging animation, so the "UseItem" animation shouldn't show
|
||||
# for it
|
||||
if !["0C9","0CA","0CB","0CC","0CD","0CE","14D"].include?(@function)
|
||||
if !["TwoTurnAttackInvulnerableInSky",
|
||||
"TwoTurnAttackInvulnerableUnderground",
|
||||
"TwoTurnAttackInvulnerableUnderwater",
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||
"TwoTurnAttackInvulnerableRemoveProtections",
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function)
|
||||
@battle.pbCommonAnimation("UseItem",user)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",user.pbThis))
|
||||
@@ -0,0 +1,702 @@
|
||||
#===============================================================================
|
||||
# No additional effect.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_None < PokeBattle_Move
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Does absolutely nothing. Shows a special message. (Celebrate)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DoesNothingCongratuations < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
if @battle.wildBattle? && user.opposes?
|
||||
@battle.pbDisplay(_INTL("Congratulations from {1}!",user.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwnerName(user.index)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Does absolutely nothing. (Hold Hands)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DoesNothingFailsIfNoAlly < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
hasAlly = false
|
||||
user.eachAlly do |_b|
|
||||
hasAlly = true
|
||||
break
|
||||
end
|
||||
if !hasAlly
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Does absolutely nothing. (Splash)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DoesNothingUnusableInGravity < PokeBattle_Move
|
||||
def unusableInGravity?; return true; end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbDisplay(_INTL("But nothing happened!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Struggle, if defined as a move in moves.txt. Typically it won't be.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_Struggle < PokeBattle_Struggle
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Scatters coins that the player picks up after winning the battle. (Pay Day)
|
||||
# NOTE: In Gen 6+, if the user levels up after this move is used, the amount of
|
||||
# money picked up depends on the user's new level rather than its level
|
||||
# when it used the move. I think this is silly, so I haven't coded this
|
||||
# effect.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AddMoneyGainedFromBattle < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
if user.pbOwnedByPlayer?
|
||||
@battle.field.effects[PBEffects::PayDay] += 5*user.level
|
||||
end
|
||||
@battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Doubles the prize money the player gets after winning the battle. (Happy Hour)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DoubleMoneyGainedFromBattle < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
@battle.field.effects[PBEffects::HappyHour] = true if !user.opposes?
|
||||
@battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if this isn't the user's first turn. (First Impression)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfNotUserFirstTurn < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.turnCount > 1
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails unless user has already used all other moves it knows. (Last Resort)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfUserHasUnusedMove < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
hasThisMove = false
|
||||
hasOtherMoves = false
|
||||
hasUnusedMoves = false
|
||||
user.eachMove do |m|
|
||||
hasThisMove = true if m.id==@id
|
||||
hasOtherMoves = true if m.id!=@id
|
||||
hasUnusedMoves = true if m.id!=@id && !user.movesUsed.include?(m.id)
|
||||
end
|
||||
if !hasThisMove || !hasOtherMoves || hasUnusedMoves
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails unless user has consumed a berry at some point. (Belch)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfUserNotConsumedBerry < PokeBattle_Move
|
||||
def pbCanChooseMove?(user,commandPhase,showMessages)
|
||||
if !user.belched?
|
||||
if showMessages
|
||||
msg = _INTL("{1} hasn't eaten any held berry, so it can't possibly belch!",user.pbThis)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
end
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !user.belched?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if the target is not holding an item, or if the target is affected by
|
||||
# Magic Room/Klutz. (Poltergeist)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfTargetHasNoItem < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.item || !target.itemActive?
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} is about to be attacked by its {2}!", target.pbThis, target.itemName))
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Only damages Pokémon that share a type with the user. (Synchronoise)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsUnlessTargetSharesTypeWithUser < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
userTypes = user.pbTypes(true)
|
||||
targetTypes = target.pbTypes(true)
|
||||
sharesType = false
|
||||
userTypes.each do |t|
|
||||
next if !targetTypes.include?(t)
|
||||
sharesType = true
|
||||
break
|
||||
end
|
||||
if !sharesType
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if user was hit by a damaging move this round. (Focus Punch)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfUserDamagedThisTurn < PokeBattle_Move
|
||||
def pbDisplayChargeMessage(user)
|
||||
user.effects[PBEffects::FocusPunch] = true
|
||||
@battle.pbCommonAnimation("FocusPunch",user)
|
||||
@battle.pbDisplay(_INTL("{1} is tightening its focus!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbDisplayUseMessage(user)
|
||||
super if !user.effects[PBEffects::FocusPunch] || user.lastHPLost==0
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.effects[PBEffects::FocusPunch] && user.lastHPLost>0
|
||||
@battle.pbDisplay(_INTL("{1} lost its focus and couldn't move!",user.pbThis))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if the target didn't chose a damaging move to use this round, or has
|
||||
# already moved. (Sucker Punch)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FailsIfTargetActed < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if @battle.choices[target.index][0]!=:UseMove
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove ||
|
||||
(oppMove.function!="UseMoveTargetIsAboutToUse" &&
|
||||
(target.movedThisRound? || oppMove.statusMove?))
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If attack misses, user takes crash damage of 1/2 of max HP.
|
||||
# (High Jump Kick, Jump Kick)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_CrashDamageIfFailsUnusableInGravity < PokeBattle_Move
|
||||
def recoilMove?; return true; end
|
||||
def unusableInGravity?; return true; end
|
||||
|
||||
def pbCrashDamage(user)
|
||||
return if !user.takesIndirectDamage?
|
||||
@battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
|
||||
@battle.scene.pbDamageAnimation(user)
|
||||
user.pbReduceHP(user.totalhp/2,false)
|
||||
user.pbItemHPHealCheck
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Starts sunny weather. (Sunny Day)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartSunWeather < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :Sun
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Starts rainy weather. (Rain Dance)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartRainWeather < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :Rain
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Starts sandstorm weather. (Sandstorm)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartSandstormWeather < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :Sandstorm
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Starts hail weather. (Hail)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartHailWeather < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :Hail
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, creates an electric terrain which boosts Electric-type moves and
|
||||
# prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
|
||||
# (Electric Terrain)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartElectricTerrain < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.field.terrain == :Electric
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbStartTerrain(user, :Electric)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
|
||||
# Pokémon at the end of each round. Affects non-airborne Pokémon only.
|
||||
# (Grassy Terrain)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartGrassyTerrain < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.field.terrain == :Grassy
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbStartTerrain(user, :Grassy)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
|
||||
# protects Pokémon from status problems. Affects non-airborne Pokémon only.
|
||||
# (Misty Terrain)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartMistyTerrain < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.field.terrain == :Misty
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbStartTerrain(user, :Misty)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, creates a psychic terrain which boosts Psychic-type moves and
|
||||
# prevents Pokémon from being hit by >0 priority moves. Affects non-airborne
|
||||
# Pokémon only. (Psychic Terrain)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartPsychicTerrain < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.field.terrain == :Psychic
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbStartTerrain(user, :Psychic)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Removes the current terrain. Fails if there is no terrain in effect.
|
||||
# (Steel Roller)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_RemoveTerrain < PokeBattle_Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
if @battle.field.terrain == :None
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
case @battle.field.terrain
|
||||
when :Electric
|
||||
@battle.pbDisplay(_INTL("The electricity disappeared from the battlefield."))
|
||||
when :Grassy
|
||||
@battle.pbDisplay(_INTL("The grass disappeared from the battlefield."))
|
||||
when :Misty
|
||||
@battle.pbDisplay(_INTL("The mist disappeared from the battlefield."))
|
||||
when :Psychic
|
||||
@battle.pbDisplay(_INTL("The weirdness disappeared from the battlefield."))
|
||||
end
|
||||
@battle.field.terrain = :None
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AddSpikesToFoeSide < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.pbOpposingSide.effects[PBEffects::Spikes]>=3
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
|
||||
@battle.pbDisplay(_INTL("Spikes were scattered all around {1}'s feet!",
|
||||
user.pbOpposingTeam(true)))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
|
||||
# (Toxic Spikes)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AddToxicSpikesToFoeSide < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbOpposingSide.effects[PBEffects::ToxicSpikes] += 1
|
||||
@battle.pbDisplay(_INTL("Poison spikes were scattered all around {1}'s feet!",
|
||||
user.pbOpposingTeam(true)))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AddStealthRocksToFoeSide < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.pbOpposingSide.effects[PBEffects::StealthRock]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbOpposingSide.effects[PBEffects::StealthRock] = true
|
||||
@battle.pbDisplay(_INTL("Pointed stones float in the air around {1}!",
|
||||
user.pbOpposingTeam(true)))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AddStickyWebToFoeSide < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.pbOpposingSide.effects[PBEffects::StickyWeb]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbOpposingSide.effects[PBEffects::StickyWeb] = true
|
||||
@battle.pbDisplay(_INTL("A sticky web has been laid out beneath {1}'s feet!",
|
||||
user.pbOpposingTeam(true)))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# All effects that apply to one side of the field are swapped to the opposite
|
||||
# side. (Court Change)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwapSideEffects < PokeBattle_Move
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@number_effects = [
|
||||
PBEffects::AuroraVeil,
|
||||
PBEffects::LightScreen,
|
||||
PBEffects::Mist,
|
||||
PBEffects::Rainbow,
|
||||
PBEffects::Reflect,
|
||||
PBEffects::Safeguard,
|
||||
PBEffects::SeaOfFire,
|
||||
PBEffects::Spikes,
|
||||
PBEffects::Swamp,
|
||||
PBEffects::Tailwind,
|
||||
PBEffects::ToxicSpikes
|
||||
]
|
||||
@boolean_effects = [
|
||||
PBEffects::StealthRock,
|
||||
PBEffects::StickyWeb
|
||||
]
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
has_effect = false
|
||||
for side in 0...2
|
||||
effects = @battle.sides[side].effects
|
||||
@number_effects.each do |e|
|
||||
next if effects[e] == 0
|
||||
has_effect = true
|
||||
break
|
||||
end
|
||||
break if has_effect
|
||||
@boolean_effects.each do |e|
|
||||
next if !effects[e]
|
||||
has_effect = true
|
||||
break
|
||||
end
|
||||
break if has_effect
|
||||
end
|
||||
if !has_effect
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
side0 = @battle.sides[0]
|
||||
side1 = @battle.sides[1]
|
||||
@number_effects.each do |e|
|
||||
side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e]
|
||||
end
|
||||
@boolean_effects.each do |e|
|
||||
side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e]
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} swapped the battle effects affecting each side of the field!", user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User turns 1/4 of max HP into a substitute. (Substitute)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserMakeSubstitute < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.effects[PBEffects::Substitute]>0
|
||||
@battle.pbDisplay(_INTL("{1} already has a substitute!",user.pbThis))
|
||||
return true
|
||||
end
|
||||
@subLife = user.totalhp/4
|
||||
@subLife = 1 if @subLife<1
|
||||
if user.hp<=@subLife
|
||||
@battle.pbDisplay(_INTL("But it does not have enough HP left to make a substitute!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbOnStartUse(user,targets)
|
||||
user.pbReduceHP(@subLife,false,false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::Trapping] = 0
|
||||
user.effects[PBEffects::TrappingMove] = nil
|
||||
user.effects[PBEffects::Substitute] = @subLife
|
||||
@battle.pbDisplay(_INTL("{1} put in a substitute!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Removes trapping moves, entry hazards and Leech Seed on user/user's side.
|
||||
# Raises user's Speed by 1 stage (Gen 8+). (Rapid Spin)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_RemoveUserBindingAndEntryHazards < PokeBattle_StatUpMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statUp = [:SPEED, 1]
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if user.fainted? || target.damageState.unaffected
|
||||
if user.effects[PBEffects::Trapping]>0
|
||||
trapMove = GameData::Move.get(user.effects[PBEffects::TrappingMove]).name
|
||||
trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
|
||||
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",user.pbThis,trapUser.pbThis(true),trapMove))
|
||||
user.effects[PBEffects::Trapping] = 0
|
||||
user.effects[PBEffects::TrappingMove] = nil
|
||||
user.effects[PBEffects::TrappingUser] = -1
|
||||
end
|
||||
if user.effects[PBEffects::LeechSeed]>=0
|
||||
user.effects[PBEffects::LeechSeed] = -1
|
||||
@battle.pbDisplay(_INTL("{1} shed Leech Seed!",user.pbThis))
|
||||
end
|
||||
if user.pbOwnSide.effects[PBEffects::StealthRock]
|
||||
user.pbOwnSide.effects[PBEffects::StealthRock] = false
|
||||
@battle.pbDisplay(_INTL("{1} blew away stealth rocks!",user.pbThis))
|
||||
end
|
||||
if user.pbOwnSide.effects[PBEffects::Spikes]>0
|
||||
user.pbOwnSide.effects[PBEffects::Spikes] = 0
|
||||
@battle.pbDisplay(_INTL("{1} blew away spikes!",user.pbThis))
|
||||
end
|
||||
if user.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
|
||||
user.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
|
||||
@battle.pbDisplay(_INTL("{1} blew away poison spikes!",user.pbThis))
|
||||
end
|
||||
if user.pbOwnSide.effects[PBEffects::StickyWeb]
|
||||
user.pbOwnSide.effects[PBEffects::StickyWeb] = false
|
||||
@battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
super if Settings::MECHANICS_GENERATION >= 8
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Attacks 2 rounds in the future. (Doom Desire, Future Sight)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AttackTwoTurnsLater < PokeBattle_Move
|
||||
def targetsPosition?; return true; end
|
||||
|
||||
def pbDamagingMove? # Stops damage being dealt in the setting-up turn
|
||||
return false if !@battle.futureSight
|
||||
return super
|
||||
end
|
||||
|
||||
def pbAccuracyCheck(user,target)
|
||||
return true if !@battle.futureSight
|
||||
return super
|
||||
end
|
||||
|
||||
def pbDisplayUseMessage(user)
|
||||
super if !@battle.futureSight
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !@battle.futureSight &&
|
||||
@battle.positions[target.index].effects[PBEffects::FutureSightCounter]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if @battle.futureSight # Attack is hitting
|
||||
effects = @battle.positions[target.index].effects
|
||||
effects[PBEffects::FutureSightCounter] = 3
|
||||
effects[PBEffects::FutureSightMove] = @id
|
||||
effects[PBEffects::FutureSightUserIndex] = user.index
|
||||
effects[PBEffects::FutureSightUserPartyIndex] = user.pokemonIndex
|
||||
if @id == :DOOMDESIRE
|
||||
@battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",user.pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} foresaw an attack!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
hitNum = 1 if !@battle.futureSight # Charging anim
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User switches places with its ally. (Ally Switch)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserSwapsPositionsWithAlly < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
numTargets = 0
|
||||
@idxAlly = -1
|
||||
idxUserOwner = @battle.pbGetOwnerIndexFromBattlerIndex(user.index)
|
||||
user.eachAlly do |b|
|
||||
next if @battle.pbGetOwnerIndexFromBattlerIndex(b.index)!=idxUserOwner
|
||||
next if !b.near?(user)
|
||||
numTargets += 1
|
||||
@idxAlly = b.index
|
||||
end
|
||||
if numTargets!=1
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
idxA = user.index
|
||||
idxB = @idxAlly
|
||||
if @battle.pbSwapBattlers(idxA,idxB)
|
||||
@battle.pbDisplay(_INTL("{1} and {2} switched places!",
|
||||
@battle.battlers[idxB].pbThis,@battle.battlers[idxA].pbThis(true)))
|
||||
[idxA, idxB].each { |idx| @battle.battlers[idx].pbEffectsOnEnteringPosition }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If a Pokémon makes contact with the user before it uses this move, the
|
||||
# attacker is burned. (Beak Blast)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_BurnAttackerBeforeUserActs < PokeBattle_Move
|
||||
def pbDisplayChargeMessage(user)
|
||||
user.effects[PBEffects::BeakBlast] = true
|
||||
@battle.pbCommonAnimation("BeakBlast",user)
|
||||
@battle.pbDisplay(_INTL("{1} started heating up its beak!",user.pbThis))
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,926 +0,0 @@
|
||||
#===============================================================================
|
||||
# Poisons the target. This move becomes physical or special, whichever will deal
|
||||
# more damage (only considers stats, stat stages and Wonder Room). Makes contact
|
||||
# if it is a physical move. Has a different animation depending on the move's
|
||||
# category. (Shell Side Arm)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_176 < PokeBattle_PoisonMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@calcCategory = 1
|
||||
end
|
||||
|
||||
def physicalMove?(thisType = nil); return (@calcCategory == 0); end
|
||||
def specialMove?(thisType = nil); return (@calcCategory == 1); end
|
||||
def contactMove?; return physicalMove?; end
|
||||
|
||||
def pbOnStartUse(user, targets)
|
||||
target = targets[0]
|
||||
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
|
||||
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
|
||||
# Calculate user's effective attacking values
|
||||
attack_stage = user.stages[:ATTACK] + 6
|
||||
real_attack = (user.attack.to_f * stageMul[attack_stage] / stageDiv[attack_stage]).floor
|
||||
special_attack_stage = user.stages[:SPECIAL_ATTACK] + 6
|
||||
real_special_attack = (user.spatk.to_f * stageMul[special_attack_stage] / stageDiv[special_attack_stage]).floor
|
||||
# Calculate target's effective defending values
|
||||
defense_stage = target.stages[:DEFENSE] + 6
|
||||
real_defense = (target.defense.to_f * stageMul[defense_stage] / stageDiv[defense_stage]).floor
|
||||
special_defense_stage = target.stages[:SPECIAL_DEFENSE] + 6
|
||||
real_special_defense = (target.spdef.to_f * stageMul[special_defense_stage] / stageDiv[special_defense_stage]).floor
|
||||
# Perform simple damage calculation
|
||||
physical_damage = real_attack.to_f / real_defense
|
||||
special_damage = real_special_attack.to_f / real_special_defense
|
||||
# Determine move's category
|
||||
if physical_damage == special_damage
|
||||
@calcCategry = @battle.pbRandom(2)
|
||||
else
|
||||
@calcCategory = (physical_damage > special_damage) ? 0 : 1
|
||||
end
|
||||
end
|
||||
|
||||
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
|
||||
hitNum = 1 if physicalMove?
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Burns the target if any of its stats were increased this round.
|
||||
# (Burning Jealousy)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_177 < PokeBattle_BurnMove
|
||||
def pbAdditionalEffect(user, target)
|
||||
super if target.statsRaised
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Increases the user's Speed by 1 stage. This move's type depends on the user's
|
||||
# form (Electric if Full Belly, Dark if Hangry). Fails if the user is not
|
||||
# Morpeko (works if transformed into Morpeko). (Aura Wheel)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_178 < PokeBattle_Move_01F
|
||||
def pbMoveFailed?(user, targets)
|
||||
if !user.isSpecies?(:MORPEKO) && user.effects[PBEffects::TransformSpecies] != :MORPEKO
|
||||
@battle.pbDisplay(_INTL("But {1} can't use the move!", user.pbThis))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
return :DARK if user.form == 1 && GameData::Type.exists?(:DARK)
|
||||
return @type
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Increases the user's Attack, Defense, Speed, Special Attack and Special
|
||||
# Defense by 1 stage each. The user cannot switch out or flee. Fails if the user
|
||||
# is already affected by the second effect of this move, but can be used if the
|
||||
# user is prevented from switching out or fleeing by another effect (in which
|
||||
# case, the second effect of this move is not applied to the user). The user may
|
||||
# still switch out if holding Shed Shell or Eject Button, or if affected by a
|
||||
# Red Card. (No Retreat)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_179 < PokeBattle_Move_02D
|
||||
def pbMoveFailed?(user, targets)
|
||||
if user.effects[PBEffects::NoRetreat]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
super
|
||||
if !user.trappedInBattle?
|
||||
user.effects[PBEffects::NoRetreat] = true
|
||||
@battle.pbDisplay(_INTL("{1} can no longer escape because it used {2}!", user.pbThis, @name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Increases the user's Attack, Defense, Special Attack, Special Defense and
|
||||
# Speed by 1 stage each, and reduces the user's HP by a third of its total HP.
|
||||
# Fails if it can't do either effect. (Clangorous Soul)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17A < PokeBattle_MultiStatUpMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@statUp = [
|
||||
:ATTACK, 1,
|
||||
:DEFENSE, 1,
|
||||
:SPECIAL_ATTACK, 1,
|
||||
:SPECIAL_DEFENSE, 1,
|
||||
:SPEED, 1
|
||||
]
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
if user.hp <= [user.totalhp / 3, 1].max
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
super
|
||||
user.pbReduceHP([user.totalhp / 3, 1].max, false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Raises the Attack and Defense of all user's allies by 1 stage each. Bypasses
|
||||
# protections, including Crafty Shield. Fails if there is no ally. (Coaching)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17B < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
@validTargets = []
|
||||
@battle.eachSameSideBattler(user) do |b|
|
||||
next if b.index == user.index
|
||||
next if !b.pbCanRaiseStatStage?(:ATTACK, user, self) &&
|
||||
!b.pbCanRaiseStatStage?(:DEFENSE, user, self)
|
||||
@validTargets.push(b)
|
||||
end
|
||||
if @validTargets.length == 0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if @validTargets.any? { |b| b.index == target.index }
|
||||
@battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
showAnim = true
|
||||
if target.pbCanRaiseStatStage?(:ATTACK, user, self)
|
||||
if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
|
||||
showAnim = false
|
||||
end
|
||||
end
|
||||
if target.pbCanRaiseStatStage?(:DEFENSE, user, self)
|
||||
target.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Increases the target's Attack and Special Attack by 2 stages each. (Decorate)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17C < PokeBattle_Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
targets.each do |b|
|
||||
next if !b.pbCanRaiseStatStage?(:ATTACK, user, self) &&
|
||||
!b.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
if target.pbCanRaiseStatStage?(:ATTACK, user, self)
|
||||
target.pbRaiseStatStage(:ATTACK, 2, user)
|
||||
end
|
||||
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
|
||||
target.pbRaiseStatStage(:SPECIAL_ATTACK, 2, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Defense by 1 stage. Power is doubled if Gravity is in
|
||||
# effect. (Grav Apple)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17D < PokeBattle_Move_043
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg *= 2 if @battle.field.effects[PBEffects::Gravity] > 0
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Speed by 1 stage. Doubles the effectiveness of damaging
|
||||
# Fire moves used against the target (this effect does not stack). Fails if
|
||||
# neither of these effects can be applied. (Tar Shot)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17E < PokeBattle_Move_044
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return super if target.effects[PBEffects::TarShot]
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
super
|
||||
if !target.effects[PBEffects::TarShot]
|
||||
target.effects[PBEffects::TarShot] = true
|
||||
@battle.pbDisplay(_INTL("{1} became weaker to fire!", target.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The target's types become Psychic. Fails if the target has the ability
|
||||
# Multitype/RKS System or has a substitute. (Magic Powder)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_17F < 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
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if Electric Terrain applies. (Rising Voltage)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_180 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg *= 2 if @battle.field.terrain == :Electric && target.affectedByTerrain?
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If Psychic Terrain applies and the user is grounded, power is multiplied by
|
||||
# 1.5 (in addition to Psychic Terrain's multiplier) and it targets all opposing
|
||||
# Pokémon. (Expanding Force)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_181 < PokeBattle_Move
|
||||
def pbTarget(user)
|
||||
if @battle.field.terrain == :Psychic && user.affectedByTerrain?
|
||||
return GameData::Target.get(:AllNearFoes)
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
if @battle.field.terrain == :Psychic && user.affectedByTerrain?
|
||||
baseDmg = baseDmg * 3 / 2
|
||||
end
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if a terrain applies and user is grounded; also, this move's
|
||||
# type and animation depends on the terrain. (Terrain Pulse)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_182 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg *= 2 if @battle.field.terrain != :None && user.affectedByTerrain?
|
||||
return baseDmg
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = :NORMAL
|
||||
case @battle.field.terrain
|
||||
when :Electric
|
||||
ret = :ELECTRIC if GameData::Type.exists?(:ELECTRIC)
|
||||
when :Grassy
|
||||
ret = :GRASS if GameData::Type.exists?(:GRASS)
|
||||
when :Misty
|
||||
ret = :FAIRY if GameData::Type.exists?(:FAIRY)
|
||||
when :Psychic
|
||||
ret = :PSYCHIC if GameData::Type.exists?(:PSYCHIC)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
|
||||
t = pbBaseType(user)
|
||||
hitNum = 1 if t == :ELECTRIC # Type-specific anims
|
||||
hitNum = 2 if t == :GRASS
|
||||
hitNum = 3 if t == :FAIRY
|
||||
hitNum = 4 if t == :PSYCHIC
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if the user moves before the target, or if the target
|
||||
# switched in this round. (Bolt Beak, Fishious Rend)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_183 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
if @battle.choices[target.index][0] == :None || # Switched in
|
||||
([:UseMove, :Shift].include?(@battle.choices[target.index][0]) && !target.movedThisRound?)
|
||||
baseDmg *= 2
|
||||
end
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if any of the user's stats were lowered this round. (Lash Out)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_184 < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg *= 2 if user.statsLowered
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If Grassy Terrain applies, priority is increased by 1. (Grassy Glide)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_185 < PokeBattle_Move
|
||||
def pbPriority(user)
|
||||
ret = super
|
||||
ret += 1 if @battle.field.terrain == :Grass && user.affectedByTerrain?
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For the rest of this round, the user avoids all damaging moves that would hit
|
||||
# it. If a move that makes contact is stopped by this effect, decreases the
|
||||
# Defense of the Pokémon using that move by 2 stages. Contributes to Protect's
|
||||
# counter. (Obstruct)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_186 < PokeBattle_ProtectMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@effect = PBEffects::Obstruct
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Unaffected by moves and abilities that would redirect this move. (Snipe Shot)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_187 < PokeBattle_Move
|
||||
def cannotRedirect?; return true; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits in 2 volleys. The second volley targets the original target's ally if it
|
||||
# has one (that can be targeted), or the original target if not. A battler
|
||||
# cannot be targeted if it is is immune to or protected from this move somehow,
|
||||
# or if this move will miss it. (Dragon Darts)
|
||||
# NOTE: This move sometimes shows a different failure message compared to the
|
||||
# official games. This is because of the order in which failure checks are
|
||||
# done (all checks for each target in turn, versus all targets for each
|
||||
# check in turn). This is considered unimportant, and since correcting it
|
||||
# would involve extensive code rewrites, it is being ignored.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_188 < PokeBattle_Move
|
||||
def pbNumHits(user, targets); return 1; end
|
||||
def pbRepeatHit?; return true; end
|
||||
|
||||
def pbModifyTargets(targets, user)
|
||||
return if targets.length != 1
|
||||
choices = []
|
||||
targets[0].eachAlly { |b| user.pbAddTarget(choices, user, b, self) }
|
||||
return if choices.length == 0
|
||||
idxChoice = (choices.length > 1) ? @battle.pbRandom(choices.length) : 0
|
||||
user.pbAddTarget(targets, user, choices[idxChoice], self, !pbTarget(user).can_choose_distant_target?)
|
||||
end
|
||||
|
||||
def pbShowFailMessages?(targets)
|
||||
if targets.length > 1
|
||||
valid_targets = targets.select { |b| !b.fainted? && !b.damageState.unaffected }
|
||||
return valid_targets.length <= 1
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbDesignateTargetsForHit(targets, hitNum)
|
||||
valid_targets = []
|
||||
targets.each { |b| valid_targets.push(b) if !b.damageState.unaffected }
|
||||
return [valid_targets[1]] if valid_targets[1] && hitNum == 1
|
||||
return [valid_targets[0]]
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 3 times in a row. If each hit could be a critical hit, it will definitely
|
||||
# be a critical hit. (Surging Strikes)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_189 < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user, targets); return 3; end
|
||||
def pbCritialOverride(user, target); return 1; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 2-5 times in a row. If the move does not fail, increases the user's Speed
|
||||
# by 1 stage and decreases the user's Defense by 1 stage. (Scale Shot)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18A < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
|
||||
def pbNumHits(user, targets)
|
||||
hitChances = [
|
||||
2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3,
|
||||
4, 4, 4,
|
||||
5, 5, 5]
|
||||
r = @battle.pbRandom(hitChances.length)
|
||||
r = hitChances.length - 1 if user.hasActiveAbility?(:SKILLLINK)
|
||||
return hitChances[r]
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user, target)
|
||||
return if target.damageState.unaffected
|
||||
if user.pbCanLowerStatStage?(:DEFENSE, user, self)
|
||||
user.pbLowerStatStage(:DEFENSE, 1, user)
|
||||
end
|
||||
if user.pbCanRaiseStatStage?(:SPEED, user, self)
|
||||
user.pbRaiseStatStage(:SPEED, 1, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two-turn attack. On the first turn, increases the user's Special Attack by 1
|
||||
# stage. On the second turn, does damage. (Meteor Beam)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18B < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user, targets)
|
||||
@battle.pbDisplay(_INTL("{1} is overflowing with space power!", user.pbThis))
|
||||
end
|
||||
|
||||
def pbChargingTurnEffect(user, target)
|
||||
if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
|
||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user and its allies gain 25% of their total HP. (Life Dew)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18C < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
@battle.eachSameSideBattler(user) do |b|
|
||||
next if !b.canHeal?
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return !target.canHeal?
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.pbRecoverHP(target.totalhp / 4)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user and its allies gain 25% of their total HP and are cured of their
|
||||
# permanent status problems. (Jungle Healing)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18D < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
@battle.eachSameSideBattler(user) do |b|
|
||||
next if b.status == :NONE && !b.canHeal?
|
||||
failed = false
|
||||
break
|
||||
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 && !target.canHeal?
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
if target.canHeal?
|
||||
target.pbRecoverHP(target.totalhp / 4)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
|
||||
end
|
||||
if target.status != :NONE
|
||||
old_status = target.status
|
||||
target.pbCureStatus(false)
|
||||
case old_status
|
||||
when :SLEEP
|
||||
@battle.pbDisplay(_INTL("{1} was woken from sleep.", target.pbThis))
|
||||
when :POISON
|
||||
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.", target.pbThis))
|
||||
when :BURN
|
||||
@battle.pbDisplay(_INTL("{1}'s burn was healed.", target.pbThis))
|
||||
when :PARALYSIS
|
||||
@battle.pbDisplay(_INTL("{1} was cured of paralysis.", target.pbThis))
|
||||
when :FROZEN
|
||||
@battle.pbDisplay(_INTL("{1} was thawed out.", target.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User faints. If Misty Terrain applies, base power is multiplied by 1.5.
|
||||
# (Misty Explosion)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18E < PokeBattle_Move_0E0
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg = baseDmg * 3 / 2 if @battle.field.terrain == :Misty
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The target can no longer switch out or flee, while the user remains in battle.
|
||||
# At the end of each round, the target's Defense and Special Defense are lowered
|
||||
# by 1 stage each. (Octolock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_18F < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if damagingMove?
|
||||
if target.effects[PBEffects::Octolock] >= 0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.effects[PBEffects::Octolock] = user.index
|
||||
@battle.pbDisplay(_INTL("{1} can no longer escape because of {2}!", target.pbThis, @name))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Prevents the user and the target from switching out or fleeing. This effect
|
||||
# isn't applied if either Pokémon is already prevented from switching out or
|
||||
# fleeing. (Jaw Lock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_190 < PokeBattle_Move
|
||||
def pbAdditionalEffect(user, target)
|
||||
return if user.fainted? || target.fainted? || target.damageState.substitute
|
||||
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
return if user.trappedInBattle? || target.trappedInBattle?
|
||||
target.effects[PBEffects::JawLock] = user.index
|
||||
@battle.pbDisplay(_INTL("Neither Pokémon can run away!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user consumes its held berry and gains its effect. Also, increases the
|
||||
# user's Defense by 2 stages. The berry can be consumed even if Unnerve/Magic
|
||||
# Room apply. Fails if the user is not holding a berry. This move cannot be
|
||||
# chosen to be used if the user is not holding a berry. (Stuff Cheeks)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_191 < PokeBattle_StatUpMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@statUp = [:DEFENSE, 2]
|
||||
end
|
||||
|
||||
def pbCanChooseMove?(user, commandPhase, showMessages)
|
||||
item = user.item
|
||||
if !item || !item.is_berry? || !user.itemActive?
|
||||
if showMessages
|
||||
msg = _INTL("{1} can't use that move because it doesn't have a Berry!", user.pbThis)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
end
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
# NOTE: Unnerve does not stop a Pokémon using this move.
|
||||
item = user.item
|
||||
if !item || !item.is_berry? || !user.itemActive?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
super
|
||||
@battle.pbDisplay(_INTL("{1} ate its {2}!", user.pbThis, user.itemName))
|
||||
item = user.item
|
||||
user.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
user.pbHeldItemTriggerCheck(item, false)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# All Pokémon (except semi-invulnerable ones) consume their held berries and
|
||||
# gain their effects. Berries can be consumed even if Unnerve/Magic Room apply.
|
||||
# Fails if no Pokémon have a held berry. If this move would trigger an ability
|
||||
# that negates the move, e.g. Lightning Rod, the bearer of that ability will
|
||||
# have their ability triggered regardless of whether they are holding a berry,
|
||||
# and they will not consume their berry. (Teatime)
|
||||
# TODO: This isn't quite right for the messages shown when a berry is consumed.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_192 < PokeBattle_Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
targets.each do |b|
|
||||
next if !b.item || !b.item.is_berry?
|
||||
next if b.semiInvulnerable?
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But nothing happened!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbOnStartUse(user, targets)
|
||||
@battle.pbDisplay(_INTL("It's teatime! Everyone dug in to their Berries!"))
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return true if !target.item || !target.item.is_berry? || target.semiInvulnerable?
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
@battle.pbCommonAnimation("EatBerry", target)
|
||||
item = target.item
|
||||
target.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
target.pbHeldItemTriggerCheck(item, false)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Negates the effect and usability of the target's held item for the rest of the
|
||||
# battle (even if it is switched out). Fails if the target doesn't have a held
|
||||
# item, the item is unlosable, the target has Sticky Hold, or the target is
|
||||
# behind a substitute. (Corrosive Gas)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_193 < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.item || target.unlosableItem?(target.item) ||
|
||||
target.effects[PBEffects::Substitute] > 0
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
if show_message
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected because of its {2}!",
|
||||
target.pbThis(true), target.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
end
|
||||
return true
|
||||
end
|
||||
if @battle.corrosiveGas[target.index % 2][target.pokemonIndex]
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
@battle.corrosiveGas[target.index % 2][target.pokemonIndex] = true
|
||||
@battle.pbDisplay(_INTL("{1} corroded {2}'s {3}!",
|
||||
user.pbThis, target.pbThis(true), target.itemName))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user takes damage equal to 1/2 of its total HP, even if the target is
|
||||
# unaffected (this is not recoil damage). (Steel Beam)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_194 < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user, target)
|
||||
return if !user.takesIndirectDamage?
|
||||
amt = (user.totalhp / 2.0).ceil
|
||||
amt = 1 if amt < 1
|
||||
user.pbReduceHP(amt, false)
|
||||
@battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis))
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the PP of the last attack used by the target by 3 (or as much as
|
||||
# possible). (Eerie Spell)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_195 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
reduction = [3, last_move.pp].min
|
||||
target.pbSetPP(last_move, last_move.pp - reduction)
|
||||
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
|
||||
target.pbThis(true), last_move.name, reduction))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if the target is not holding an item, or if the target is affected by
|
||||
# Magic Room/Klutz. (Poltergeist)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_196 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.item || !target.itemActive?
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} is about to be attacked by its {2}!", target.pbThis, target.itemName))
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user's Defense (and its Defense stat stages) are used instead of the
|
||||
# user's Attack (and Attack stat stages) to calculate damage. All other effects
|
||||
# are applied normally, applying the user's Attack modifiers and not the user's
|
||||
# Defence modifiers. (Body Press)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_197 < PokeBattle_Move
|
||||
def pbGetAttackStats(user, target)
|
||||
return user.defense, user.stages[:DEFENSE] + 6
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# All effects that apply to one side of the field are swapped to the opposite
|
||||
# side. (Court Change)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_198 < PokeBattle_Move
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@number_effects = [
|
||||
PBEffects::AuroraVeil,
|
||||
PBEffects::LightScreen,
|
||||
PBEffects::Mist,
|
||||
PBEffects::Rainbow,
|
||||
PBEffects::Reflect,
|
||||
PBEffects::Safeguard,
|
||||
PBEffects::SeaOfFire,
|
||||
PBEffects::Spikes,
|
||||
PBEffects::Swamp,
|
||||
PBEffects::Tailwind,
|
||||
PBEffects::ToxicSpikes
|
||||
]
|
||||
@boolean_effects = [
|
||||
PBEffects::StealthRock,
|
||||
PBEffects::StickyWeb
|
||||
]
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
has_effect = false
|
||||
for side in 0...2
|
||||
effects = @battle.sides[side].effects
|
||||
@number_effects.each do |e|
|
||||
next if effects[e] == 0
|
||||
has_effect = true
|
||||
break
|
||||
end
|
||||
break if has_effect
|
||||
@boolean_effects.each do |e|
|
||||
next if !effects[e]
|
||||
has_effect = true
|
||||
break
|
||||
end
|
||||
break if has_effect
|
||||
end
|
||||
if !has_effect
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
side0 = @battle.sides[0]
|
||||
side1 = @battle.sides[1]
|
||||
@number_effects.each do |e|
|
||||
side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e]
|
||||
end
|
||||
@boolean_effects.each do |e|
|
||||
side0.effects[e], side1.effects[e] = side1.effects[e], side0.effects[e]
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} swapped the battle effects affecting each side of the field!", user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Removes the current terrain. Fails if there is no terrain in effect.
|
||||
# (Steel Roller)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_199 < PokeBattle_Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
if @battle.field.terrain == :None
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
case @battle.field.terrain
|
||||
when :Electric
|
||||
@battle.pbDisplay(_INTL("The electricity disappeared from the battlefield."))
|
||||
when :Grassy
|
||||
@battle.pbDisplay(_INTL("The grass disappeared from the battlefield."))
|
||||
when :Misty
|
||||
@battle.pbDisplay(_INTL("The mist disappeared from the battlefield."))
|
||||
when :Psychic
|
||||
@battle.pbDisplay(_INTL("The weirdness disappeared from the battlefield."))
|
||||
end
|
||||
@battle.field.terrain = :None
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Increases the user's and allies' Attack by 1 stage. (Howl in Gen 8+)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_19A < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
return false if damagingMove?
|
||||
failed = true
|
||||
targets.each do |b|
|
||||
next if b.pbCanRaiseStatStage?(:ATTACK, user, self)
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if damagingMove?
|
||||
return !target.pbCanRaiseStatStage?(:ATTACK, user, self, show_message)
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
return if damagingMove?
|
||||
target.pbRaiseStatStage(:ATTACK, 1, user)
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user, target)
|
||||
return if !target.pbCanRaiseStatStage?(:ATTACK, user, self)
|
||||
target.pbRaiseStatStage(:ATTACK, 1, user)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,621 @@
|
||||
#===============================================================================
|
||||
# Hits twice.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoTimes < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user,targets); return 2; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits twice. May poison the target on each hit. (Twineedle)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoTimesPoisonTarget < PokeBattle_PoisonMove
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user,targets); return 2; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits twice. Causes the target to flinch. Does double damage and has perfect
|
||||
# accuracy if the target is Minimized. (Double Iron Bash)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoTimesFlinchTarget < PokeBattle_FlinchMove
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user,targets); return 2; end
|
||||
def tramplesMinimize?(param=1); return Settings::MECHANICS_GENERATION <= 7; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits in 2 volleys. The second volley targets the original target's ally if it
|
||||
# has one (that can be targeted), or the original target if not. A battler
|
||||
# cannot be targeted if it is is immune to or protected from this move somehow,
|
||||
# or if this move will miss it. (Dragon Darts)
|
||||
# NOTE: This move sometimes shows a different failure message compared to the
|
||||
# official games. This is because of the order in which failure checks are
|
||||
# done (all checks for each target in turn, versus all targets for each
|
||||
# check in turn). This is considered unimportant, and since correcting it
|
||||
# would involve extensive code rewrites, it is being ignored.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoTimesTargetThenTargetAlly < PokeBattle_Move
|
||||
def pbNumHits(user, targets); return 1; end
|
||||
def pbRepeatHit?; return true; end
|
||||
|
||||
def pbModifyTargets(targets, user)
|
||||
return if targets.length != 1
|
||||
choices = []
|
||||
targets[0].eachAlly { |b| user.pbAddTarget(choices, user, b, self) }
|
||||
return if choices.length == 0
|
||||
idxChoice = (choices.length > 1) ? @battle.pbRandom(choices.length) : 0
|
||||
user.pbAddTarget(targets, user, choices[idxChoice], self, !pbTarget(user).can_choose_distant_target?)
|
||||
end
|
||||
|
||||
def pbShowFailMessages?(targets)
|
||||
if targets.length > 1
|
||||
valid_targets = targets.select { |b| !b.fainted? && !b.damageState.unaffected }
|
||||
return valid_targets.length <= 1
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbDesignateTargetsForHit(targets, hitNum)
|
||||
valid_targets = []
|
||||
targets.each { |b| valid_targets.push(b) if !b.damageState.unaffected }
|
||||
return [valid_targets[1]] if valid_targets[1] && hitNum == 1
|
||||
return [valid_targets[0]]
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
|
||||
# An accuracy check is performed for each hit.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitThreeTimesPowersUpWithEachHit < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user,targets); return 3; end
|
||||
|
||||
def successCheckPerHit?
|
||||
return @accCheckPerHit
|
||||
end
|
||||
|
||||
def pbOnStartUse(user,targets)
|
||||
@calcBaseDmg = 0
|
||||
@accCheckPerHit = !user.hasActiveAbility?(:SKILLLINK)
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
@calcBaseDmg += baseDmg
|
||||
return @calcBaseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 3 times in a row. If each hit could be a critical hit, it will definitely
|
||||
# be a critical hit. (Surging Strikes)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitThreeTimesAlwaysCriticalHit < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
def pbNumHits(user, targets); return 3; end
|
||||
def pbCritialOverride(user, target); return 1; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 2-5 times.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoToFiveTimes < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
|
||||
def pbNumHits(user,targets)
|
||||
hitChances = [
|
||||
2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3,
|
||||
4, 4, 4,
|
||||
5, 5, 5
|
||||
]
|
||||
r = @battle.pbRandom(hitChances.length)
|
||||
r = hitChances.length-1 if user.hasActiveAbility?(:SKILLLINK)
|
||||
return hitChances[r]
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 2-5 times. If the user is Ash Greninja, powers up and hits 3 times.
|
||||
# (Water Shuriken)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoToFiveTimesOrThreeForAshGreninja < PokeBattle_Move_HitTwoToFiveTimes
|
||||
def pbNumHits(user,targets)
|
||||
return 3 if user.isSpecies?(:GRENINJA) && user.form == 2
|
||||
return super
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
return 20 if user.isSpecies?(:GRENINJA) && user.form == 2
|
||||
return super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits 2-5 times in a row. If the move does not fail, increases the user's Speed
|
||||
# by 1 stage and decreases the user's Defense by 1 stage. (Scale Shot)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitTwoToFiveTimesRaiseUserSpd1LowerUserDef1 < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
|
||||
def pbNumHits(user, targets)
|
||||
hitChances = [
|
||||
2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3,
|
||||
4, 4, 4,
|
||||
5, 5, 5]
|
||||
r = @battle.pbRandom(hitChances.length)
|
||||
r = hitChances.length - 1 if user.hasActiveAbility?(:SKILLLINK)
|
||||
return hitChances[r]
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user, target)
|
||||
return if target.damageState.unaffected
|
||||
if user.pbCanLowerStatStage?(:DEFENSE, user, self)
|
||||
user.pbLowerStatStage(:DEFENSE, 1, user)
|
||||
end
|
||||
if user.pbCanRaiseStatStage?(:SPEED, user, self)
|
||||
user.pbRaiseStatStage(:SPEED, 1, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Hits X times, where X is the number of non-user unfainted status-free Pokémon
|
||||
# in the user's party (not including partner trainers). Fails if X is 0.
|
||||
# Base power of each hit depends on the base Attack stat for the species of that
|
||||
# hit's participant. (Beat Up)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HitOncePerUserTeamMember < PokeBattle_Move
|
||||
def multiHitMove?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
@beatUpList = []
|
||||
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i|
|
||||
next if !pkmn.able? || pkmn.status != :NONE
|
||||
@beatUpList.push(i)
|
||||
end
|
||||
if @beatUpList.length==0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbNumHits(user,targets)
|
||||
return @beatUpList.length
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
i = @beatUpList.shift # First element in array, and removes it from array
|
||||
atk = @battle.pbParty(user.index)[i].baseStats[:ATTACK]
|
||||
return 5+(atk/10)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Attacks first turn, skips second turn (if successful).
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AttackAndSkipNextTurn < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::HyperBeam] = 2
|
||||
user.currentMove = @id
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttack < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Solar Beam, Solar Blade)
|
||||
# Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackOneTurnInSun < PokeBattle_TwoTurnMove
|
||||
def pbIsChargingTurn?(user)
|
||||
ret = super
|
||||
if !user.effects[PBEffects::TwoTurnAttack]
|
||||
if [:Sun, :HarshSun].include?(user.effectiveWeather)
|
||||
@powerHerb = false
|
||||
@chargingTurn = true
|
||||
@damagingTurn = true
|
||||
return false
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} took in sunlight!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbBaseDamageMultiplier(damageMult,user,target)
|
||||
damageMult /= 2 if ![:None, :Sun, :HarshSun].include?(user.effectiveWeather)
|
||||
return damageMult
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
|
||||
# May paralyze the target.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackParalyzeTarget < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.damageState.substitute
|
||||
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
|
||||
# May burn the target.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackBurnTarget < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.damageState.substitute
|
||||
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
|
||||
# May make the target flinch.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackFlinchTarget < PokeBattle_TwoTurnMove
|
||||
def flinchingMove?; return true; end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.damageState.substitute
|
||||
target.pbFlinch(user)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, and increases the user's Special Attack,
|
||||
# Special Defense and Speed by 2 stages each in the second turn. (Geomancy)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackRaiseUserSpAtkSpDefSpd2 < PokeBattle_TwoTurnMove
|
||||
def pbMoveFailed?(user,targets)
|
||||
return false if user.effects[PBEffects::TwoTurnAttack] # Charging turn
|
||||
if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self) &&
|
||||
!user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self) &&
|
||||
!user.pbCanRaiseStatStage?(:SPEED,user,self)
|
||||
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} is absorbing power!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
return if !@damagingTurn
|
||||
showAnim = true
|
||||
[:SPECIAL_ATTACK,:SPECIAL_DEFENSE,:SPEED].each do |s|
|
||||
next if !user.pbCanRaiseStatStage?(s,user,self)
|
||||
if user.pbRaiseStatStage(s,2,user,showAnim)
|
||||
showAnim = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
|
||||
# (Skull Bash)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackChargeRaiseUserDefense1 < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} tucked in its head!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbChargingTurnEffect(user,target)
|
||||
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
|
||||
user.pbRaiseStatStage(:DEFENSE,1,user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two-turn attack. On the first turn, increases the user's Special Attack by 1
|
||||
# stage. On the second turn, does damage. (Meteor Beam)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackChargeRaiseUserSpAtk1 < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user, targets)
|
||||
@battle.pbDisplay(_INTL("{1} is overflowing with space power!", user.pbThis))
|
||||
end
|
||||
|
||||
def pbChargingTurnEffect(user, target)
|
||||
if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
|
||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Dig)
|
||||
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableUnderground < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Dive)
|
||||
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableUnderwater < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} hid underwater!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Fly)
|
||||
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableInSky < PokeBattle_TwoTurnMove
|
||||
def unusableInGravity?; return true; end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} flew up high!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Bounce)
|
||||
# May paralyze the target.
|
||||
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableInSkyParalyzeTarget < PokeBattle_TwoTurnMove
|
||||
def unusableInGravity?; return true; end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} sprang up!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.damageState.substitute
|
||||
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
|
||||
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
|
||||
# Target is also semi-invulnerable during use, and can't take any action.
|
||||
# Doesn't damage airborne Pokémon (but still makes them unable to move during).
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableInSkyTargetCannotAct < PokeBattle_TwoTurnMove
|
||||
def unusableInGravity?; return true; end
|
||||
|
||||
def pbIsChargingTurn?(user)
|
||||
# NOTE: Sky Drop doesn't benefit from Power Herb, probably because it works
|
||||
# differently (i.e. immobilises the target during use too).
|
||||
@powerHerb = false
|
||||
@chargingTurn = (user.effects[PBEffects::TwoTurnAttack].nil?)
|
||||
@damagingTurn = (!user.effects[PBEffects::TwoTurnAttack].nil?)
|
||||
return !@damagingTurn
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.opposes?(user)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(user)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if Settings::MECHANICS_GENERATION >= 6 && target.pbWeight>=2000 # 200.0kg
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.semiInvulnerable? ||
|
||||
(target.effects[PBEffects::SkyDrop]>=0 && @chargingTurn)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.effects[PBEffects::SkyDrop]!=user.index && @damagingTurn
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(movetype,user,target)
|
||||
return Effectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return super
|
||||
end
|
||||
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} took {2} into the sky!",user.pbThis,targets[0].pbThis(true)))
|
||||
end
|
||||
|
||||
def pbAttackingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",targets[0].pbThis))
|
||||
end
|
||||
|
||||
def pbChargingTurnEffect(user,target)
|
||||
target.effects[PBEffects::SkyDrop] = user.index
|
||||
end
|
||||
|
||||
def pbAttackingTurnEffect(user,target)
|
||||
target.effects[PBEffects::SkyDrop] = -1
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. Skips first turn, attacks second turn. Is invulnerable during
|
||||
# use. Ends target's protections upon hit. (Shadow Force, Phantom Force)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TwoTurnAttackInvulnerableRemoveProtections < PokeBattle_TwoTurnMove
|
||||
def pbChargingTurnMessage(user,targets)
|
||||
@battle.pbDisplay(_INTL("{1} vanished instantly!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbAttackingTurnEffect(user,target)
|
||||
target.effects[PBEffects::BanefulBunker] = false
|
||||
target.effects[PBEffects::KingsShield] = false
|
||||
target.effects[PBEffects::Obstruct] = false
|
||||
target.effects[PBEffects::Protect] = false
|
||||
target.effects[PBEffects::SpikyShield] = false
|
||||
target.pbOwnSide.effects[PBEffects::CraftyShield] = false
|
||||
target.pbOwnSide.effects[PBEffects::MatBlock] = false
|
||||
target.pbOwnSide.effects[PBEffects::QuickGuard] = false
|
||||
target.pbOwnSide.effects[PBEffects::WideGuard] = false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
|
||||
# NOTE: Bulbapedia claims that an uproar will wake up Pokémon even if they have
|
||||
# Soundproof, and will not allow Pokémon to fall asleep even if they have
|
||||
# Soundproof. I think this is an oversight, so I've let Soundproof Pokémon
|
||||
# be unaffected by Uproar waking/non-sleeping effects.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_MultiTurnAttackPreventSleeping < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
return if user.effects[PBEffects::Uproar]>0
|
||||
user.effects[PBEffects::Uproar] = 3
|
||||
user.currentMove = @id
|
||||
@battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis))
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if b.fainted? || b.status != :SLEEP
|
||||
next if b.hasActiveAbility?(:SOUNDPROOF)
|
||||
b.pbCureStatus
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User must use this move for 1 or 2 more rounds. At end, user becomes confused.
|
||||
# (Outrage, Petal Dange, Thrash)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_MultiTurnAttackConfuseUserAtEnd < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
if !target.damageState.unaffected && user.effects[PBEffects::Outrage]==0
|
||||
user.effects[PBEffects::Outrage] = 2+@battle.pbRandom(2)
|
||||
user.currentMove = @id
|
||||
end
|
||||
if user.effects[PBEffects::Outrage]>0
|
||||
user.effects[PBEffects::Outrage] -= 1
|
||||
if user.effects[PBEffects::Outrage]==0 && user.pbCanConfuseSelf?(false)
|
||||
user.pbConfuse(_INTL("{1} became confused due to fatigue!",user.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User must use this move for 4 more rounds. Power doubles each round.
|
||||
# Power is also doubled if user has curled up. (Ice Ball, Rollout)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_MultiTurnAttackPowersUpEachTurn < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
shift = (5 - user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
|
||||
shift = 0 if user.effects[PBEffects::Rollout] == 0 # For first turn
|
||||
shift += 1 if user.effects[PBEffects::DefenseCurl]
|
||||
baseDmg *= 2**shift
|
||||
return baseDmg
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
if !target.damageState.unaffected && user.effects[PBEffects::Rollout] == 0
|
||||
user.effects[PBEffects::Rollout] = 5
|
||||
user.currentMove = @id
|
||||
end
|
||||
user.effects[PBEffects::Rollout] -= 1 if user.effects[PBEffects::Rollout] > 0
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User bides its time this round and next round. The round after, deals 2x the
|
||||
# total direct damage it took while biding to the last battler that damaged it.
|
||||
# (Bide)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_MultiTurnAttackBideThenReturnDoubleDamage < PokeBattle_FixedDamageMove
|
||||
def pbAddTarget(targets,user)
|
||||
return if user.effects[PBEffects::Bide]!=1 # Not the attack turn
|
||||
idxTarget = user.effects[PBEffects::BideTarget]
|
||||
t = (idxTarget>=0) ? @battle.battlers[idxTarget] : nil
|
||||
if !user.pbAddTarget(targets,user,t,self,false)
|
||||
user.pbAddTargetRandomFoe(targets,user,self,false)
|
||||
end
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
return false if user.effects[PBEffects::Bide]!=1 # Not the attack turn
|
||||
if user.effects[PBEffects::BideDamage]==0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
user.effects[PBEffects::Bide] = 0 # No need to reset other Bide variables
|
||||
return true
|
||||
end
|
||||
if targets.length==0
|
||||
@battle.pbDisplay(_INTL("But there was no target..."))
|
||||
user.effects[PBEffects::Bide] = 0 # No need to reset other Bide variables
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbOnStartUse(user,targets)
|
||||
@damagingTurn = (user.effects[PBEffects::Bide]==1) # If attack turn
|
||||
end
|
||||
|
||||
def pbDisplayUseMessage(user)
|
||||
if @damagingTurn # Attack turn
|
||||
@battle.pbDisplayBrief(_INTL("{1} unleashed energy!",user.pbThis))
|
||||
elsif user.effects[PBEffects::Bide]>1 # Charging turns
|
||||
@battle.pbDisplayBrief(_INTL("{1} is storing energy!",user.pbThis))
|
||||
else
|
||||
super # Start using Bide
|
||||
end
|
||||
end
|
||||
|
||||
def pbDamagingMove? # Stops damage being dealt in the charging turns
|
||||
return false if !@damagingTurn
|
||||
return super
|
||||
end
|
||||
|
||||
def pbFixedDamage(user,target)
|
||||
return user.effects[PBEffects::BideDamage]*2
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
if user.effects[PBEffects::Bide]==0 # Starting using Bide
|
||||
user.effects[PBEffects::Bide] = 3
|
||||
user.effects[PBEffects::BideDamage] = 0
|
||||
user.effects[PBEffects::BideTarget] = -1
|
||||
user.currentMove = @id
|
||||
end
|
||||
user.effects[PBEffects::Bide] -= 1
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
hitNum = 1 if !@damagingTurn # Charging anim
|
||||
super
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,698 @@
|
||||
#===============================================================================
|
||||
# Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserFullyAndFallAsleep < PokeBattle_HealingMove
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.asleep?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return true if !user.pbCanSleep?(user,true,self,true)
|
||||
return true if super
|
||||
return false
|
||||
end
|
||||
|
||||
def pbHealAmount(user)
|
||||
return user.totalhp-user.hp
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbSleepSelf(_INTL("{1} slept and became healthy!",user.pbThis),3)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals user by 1/2 of its max HP.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserHalfOfTotalHP < PokeBattle_HealingMove
|
||||
def pbHealAmount(user)
|
||||
return (user.totalhp/2.0).round
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
|
||||
# Synthesis)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserDependingOnWeather < PokeBattle_HealingMove
|
||||
def pbOnStartUse(user,targets)
|
||||
case user.effectiveWeather
|
||||
when :Sun, :HarshSun
|
||||
@healAmount = (user.totalhp*2/3.0).round
|
||||
when :None, :StrongWinds
|
||||
@healAmount = (user.totalhp/2.0).round
|
||||
else
|
||||
@healAmount = (user.totalhp/4.0).round
|
||||
end
|
||||
end
|
||||
|
||||
def pbHealAmount(user)
|
||||
return @healAmount
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals user by 1/2 of its max HP, or 2/3 of its max HP in a sandstorm. (Shore Up)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserDependingOnSandstorm < PokeBattle_HealingMove
|
||||
def pbHealAmount(user)
|
||||
return (user.totalhp * 2 / 3.0).round if user.effectiveWeather == :Sandstorm
|
||||
return (user.totalhp / 2.0).round
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals user by 1/2 of its max HP. (Roost)
|
||||
# User roosts, and its Flying type is ignored for attacks used against it.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserHalfOfTotalHPLoseFlyingTypeThisTurn < PokeBattle_HealingMove
|
||||
def pbHealAmount(user)
|
||||
return (user.totalhp/2.0).round
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
super
|
||||
user.effects[PBEffects::Roost] = true
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Cures the target's permanent status problems. Heals user by 1/2 of its max HP.
|
||||
# (Purify)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_CureTargetStatusHealUserHalfOfTotalHP < PokeBattle_HealingMove
|
||||
def canSnatch?; return false; end # Because it affects a target
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.status == :NONE
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbHealAmount(user)
|
||||
return (user.totalhp/2.0).round
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.pbCureStatus
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Attack by 1 stage. Heals user by an amount equal to the
|
||||
# target's Attack stat (after applying stat stages, before this move decreases
|
||||
# it). (Strength Sap)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserByTargetAttackLowerTargetAttack1 < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
# NOTE: The official games appear to just check whether the target's Attack
|
||||
# stat stage is -6 and fail if so, but I've added the "fail if target
|
||||
# has Contrary and is at +6" check too for symmetry. This move still
|
||||
# works even if the stat stage cannot be changed due to an ability or
|
||||
# other effect.
|
||||
if !@battle.moldBreaker && target.hasActiveAbility?(:CONTRARY) &&
|
||||
target.statStageAtMax?(:ATTACK)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
elsif target.statStageAtMin?(:ATTACK)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
# Calculate target's effective attack value
|
||||
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
|
||||
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
|
||||
atk = target.attack
|
||||
atkStage = target.stages[:ATTACK]+6
|
||||
healAmt = (atk.to_f*stageMul[atkStage]/stageDiv[atkStage]).floor
|
||||
# Reduce target's Attack stat
|
||||
if target.pbCanLowerStatStage?(:ATTACK,user,self)
|
||||
target.pbLowerStatStage(:ATTACK,1,user)
|
||||
end
|
||||
# Heal user
|
||||
if target.hasActiveAbility?(:LIQUIDOOZE)
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
user.pbReduceHP(healAmt)
|
||||
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",user.pbThis))
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
user.pbItemHPHealCheck
|
||||
elsif user.canHeal?
|
||||
healAmt = (healAmt*1.3).floor if user.hasActiveItem?(:BIGROOT)
|
||||
user.pbRecoverHP(healAmt)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.",user.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User gains half the HP it inflicts as damage.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserByHalfOfDamageDone < PokeBattle_Move
|
||||
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if target.damageState.hpLost<=0
|
||||
hpGain = (target.damageState.hpLost/2.0).round
|
||||
user.pbRecoverHPFromDrain(hpGain,target)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User gains half the HP it inflicts as damage. Fails if target is not asleep.
|
||||
# (Dream Eater)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserByHalfOfDamageDoneIfTargetAsleep < PokeBattle_Move
|
||||
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.asleep?
|
||||
@battle.pbDisplay(_INTL("{1} wasn't affected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if target.damageState.hpLost<=0
|
||||
hpGain = (target.damageState.hpLost/2.0).round
|
||||
user.pbRecoverHPFromDrain(hpGain,target)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserByThreeQuartersOfDamageDone < PokeBattle_Move
|
||||
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if target.damageState.hpLost<=0
|
||||
hpGain = (target.damageState.hpLost*0.75).round
|
||||
user.pbRecoverHPFromDrain(hpGain,target)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user and its allies gain 25% of their total HP. (Life Dew)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserAndAlliesQuarterOfTotalHP < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
@battle.eachSameSideBattler(user) do |b|
|
||||
next if !b.canHeal?
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return !target.canHeal?
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.pbRecoverHP(target.totalhp / 4)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user and its allies gain 25% of their total HP and are cured of their
|
||||
# permanent status problems. (Jungle Healing)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserAndAlliesQuarterOfTotalHPCureStatus < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
@battle.eachSameSideBattler(user) do |b|
|
||||
next if b.status == :NONE && !b.canHeal?
|
||||
failed = false
|
||||
break
|
||||
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 && !target.canHeal?
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
if target.canHeal?
|
||||
target.pbRecoverHP(target.totalhp / 4)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
|
||||
end
|
||||
if target.status != :NONE
|
||||
old_status = target.status
|
||||
target.pbCureStatus(false)
|
||||
case old_status
|
||||
when :SLEEP
|
||||
@battle.pbDisplay(_INTL("{1} was woken from sleep.", target.pbThis))
|
||||
when :POISON
|
||||
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.", target.pbThis))
|
||||
when :BURN
|
||||
@battle.pbDisplay(_INTL("{1}'s burn was healed.", target.pbThis))
|
||||
when :PARALYSIS
|
||||
@battle.pbDisplay(_INTL("{1} was cured of paralysis.", target.pbThis))
|
||||
when :FROZEN
|
||||
@battle.pbDisplay(_INTL("{1} was thawed out.", target.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals target by 1/2 of its max HP. (Heal Pulse)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealTargetHalfOfTotalHP < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.hp==target.totalhp
|
||||
@battle.pbDisplay(_INTL("{1}'s HP is full!", target.pbThis)) if show_message
|
||||
return true
|
||||
elsif !target.canHeal?
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
hpGain = (target.totalhp/2.0).round
|
||||
if pulseMove? && user.hasActiveAbility?(:MEGALAUNCHER)
|
||||
hpGain = (target.totalhp*3/4.0).round
|
||||
end
|
||||
target.pbRecoverHP(hpGain)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Heals target by 1/2 of its max HP, or 2/3 of its max HP in Grassy Terrain.
|
||||
# (Floral Healing)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealTargetDependingOnGrassyTerrain < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.hp==target.totalhp
|
||||
@battle.pbDisplay(_INTL("{1}'s HP is full!", target.pbThis)) if show_message
|
||||
return true
|
||||
elsif !target.canHeal?
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
hpGain = (target.totalhp/2.0).round
|
||||
hpGain = (target.totalhp*2/3.0).round if @battle.field.terrain == :Grassy
|
||||
target.pbRecoverHP(hpGain)
|
||||
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Battler in user's position is healed by 1/2 of its max HP, at the end of the
|
||||
# next round. (Wish)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HealUserPositionNextTurn < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.positions[user.index].effects[PBEffects::Wish]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.positions[user.index].effects[PBEffects::Wish] = 2
|
||||
@battle.positions[user.index].effects[PBEffects::WishAmount] = (user.totalhp/2.0).round
|
||||
@battle.positions[user.index].effects[PBEffects::WishMaker] = user.pokemonIndex
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
|
||||
# (Aqua Ring)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartHealUserEachTurn < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.effects[PBEffects::AquaRing]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::AquaRing] = true
|
||||
@battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
|
||||
# round, and cannot flee or switch out. (Ingrain)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartHealUserEachTurnTrapUserInBattle < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.effects[PBEffects::Ingrain]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::Ingrain] = true
|
||||
@battle.pbDisplay(_INTL("{1} planted its roots!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartDamageTargetEachTurnIfTargetAsleep < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.asleep? || target.effects[PBEffects::Nightmare]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Nightmare] = true
|
||||
@battle.pbDisplay(_INTL("{1} began having a nightmare!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
|
||||
# and the Pokémon in the user's position gains the same amount. (Leech Seed)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartLeechSeedTarget < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::LeechSeed]>=0
|
||||
@battle.pbDisplay(_INTL("{1} evaded the attack!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
if target.pbHasType?(:GRASS)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbMissMessage(user,target)
|
||||
@battle.pbDisplay(_INTL("{1} evaded the attack!",target.pbThis))
|
||||
return true
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::LeechSeed] = user.index
|
||||
@battle.pbDisplay(_INTL("{1} was seeded!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user takes damage equal to 1/2 of its total HP, even if the target is
|
||||
# unaffected (this is not recoil damage). (Steel Beam)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserLosesHalfOfTotalHP < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user, target)
|
||||
return if !user.takesIndirectDamage?
|
||||
amt = (user.totalhp / 2.0).ceil
|
||||
amt = 1 if amt < 1
|
||||
user.pbReduceHP(amt, false)
|
||||
@battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis))
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Damages user by 1/2 of its max HP, even if this move misses. (Mind Blown)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserLosesHalfOfTotalHPExplosive < PokeBattle_Move
|
||||
def worksWithNoTargets?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.moldBreaker
|
||||
bearer = @battle.pbCheckGlobalAbility(:DAMP)
|
||||
if bearer!=nil
|
||||
@battle.pbShowAbilitySplash(bearer)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,@name))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
|
||||
user.pbThis,@name,bearer.pbThis(true),bearer.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(bearer)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if !user.takesIndirectDamage?
|
||||
user.pbReduceHP((user.totalhp/2.0).round,false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User faints, even if the move does nothing else. (Explosion, Self-Destruct)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsExplosive < PokeBattle_Move
|
||||
def worksWithNoTargets?; return true; end
|
||||
def pbNumHits(user,targets); return 1; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.moldBreaker
|
||||
bearer = @battle.pbCheckGlobalAbility(:DAMP)
|
||||
if bearer!=nil
|
||||
@battle.pbShowAbilitySplash(bearer)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,@name))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
|
||||
user.pbThis,@name,bearer.pbThis(true),bearer.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(bearer)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if user.fainted?
|
||||
user.pbReduceHP(user.hp,false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User faints. If Misty Terrain applies, base power is multiplied by 1.5.
|
||||
# (Misty Explosion)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsPowersUpInMistyTerrainExplosive < PokeBattle_Move_UserFaintsExplosive
|
||||
def pbBaseDamage(baseDmg, user, target)
|
||||
baseDmg = baseDmg * 3 / 2 if @battle.field.terrain == :Misty
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Inflicts fixed damage equal to user's current HP. (Final Gambit)
|
||||
# User faints (if successful).
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsFixedDamageUserHP < PokeBattle_FixedDamageMove
|
||||
def pbNumHits(user,targets); return 1; end
|
||||
|
||||
def pbOnStartUse(user,targets)
|
||||
@finalGambitDamage = user.hp
|
||||
end
|
||||
|
||||
def pbFixedDamage(user,target)
|
||||
return @finalGambitDamage
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if user.fainted?
|
||||
user.pbReduceHP(user.hp,false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
|
||||
# User faints (if successful).
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsLowerTargetAtkSpAtk2 < PokeBattle_TargetMultiStatDownMove
|
||||
def canMagicCoat?; return false; end
|
||||
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statDown = [:ATTACK,2,:SPECIAL_ATTACK,2]
|
||||
end
|
||||
|
||||
# NOTE: The user faints even if the target's stats cannot be changed, so this
|
||||
# method must always return false to allow the move's usage to continue.
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if user.fainted?
|
||||
user.pbReduceHP(user.hp,false)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User faints. The Pokémon that replaces the user is fully healed (HP and
|
||||
# status). Fails if user won't be replaced. (Healing Wish)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsHealAndCureReplacement < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if user.fainted?
|
||||
user.pbReduceHP(user.hp,false)
|
||||
user.pbItemHPHealCheck
|
||||
@battle.positions[user.index].effects[PBEffects::HealingWish] = true
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User faints. The Pokémon that replaces the user is fully healed (HP, PP and
|
||||
# status). Fails if user won't be replaced. (Lunar Dance)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserFaintsHealAndCureReplacementRestorePP < PokeBattle_Move
|
||||
def healingMove?; return true; end
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSelfKO(user)
|
||||
return if user.fainted?
|
||||
user.pbReduceHP(user.hp,false)
|
||||
user.pbItemHPHealCheck
|
||||
@battle.positions[user.index].effects[PBEffects::LunarDance] = true
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# All current battlers will perish after 3 more rounds. (Perish Song)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartPerishCountsForAllBattlers < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
failed = true
|
||||
targets.each do |b|
|
||||
next if b.effects[PBEffects::PerishSong]>0 # Heard it before
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return target.effects[PBEffects::PerishSong]>0 # Heard it before
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::PerishSong] = 4
|
||||
target.effects[PBEffects::PerishSongUser] = user.index
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
super
|
||||
@battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If user is KO'd before it next moves, the battler that caused it also faints.
|
||||
# (Destiny Bond)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AttackerFaintsIfUserFaints < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if Settings::MECHANICS_GENERATION >= 7 && user.effects[PBEffects::DestinyBondPrevious]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::DestinyBond] = true
|
||||
@battle.pbDisplay(_INTL("{1} is hoping to take its attacker down with it!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If user is KO'd before it next moves, the attack that caused it loses all PP.
|
||||
# (Grudge)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SetAttackerMovePPTo0IfUserFaints < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::Grudge] = true
|
||||
@battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",user.pbThis))
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,603 @@
|
||||
#===============================================================================
|
||||
# User steals the target's item, if the user has none itself. (Covet, Thief)
|
||||
# Items stolen from wild Pokémon are kept after the battle.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserTakesTargetItem < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if @battle.wildBattle? && user.opposes? # Wild Pokémon can't thieve
|
||||
return if user.fainted?
|
||||
return if target.damageState.unaffected || target.damageState.substitute
|
||||
return if !target.item || user.item
|
||||
return if target.unlosableItem?(target.item)
|
||||
return if user.unlosableItem?(target.item)
|
||||
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
itemName = target.itemName
|
||||
user.item = target.item
|
||||
# Permanently steal the item from wild Pokémon
|
||||
if @battle.wildBattle? && target.opposes? && !user.initialItem &&
|
||||
target.item == target.initialItem
|
||||
user.setInitialItem(target.item)
|
||||
target.pbRemoveItem
|
||||
else
|
||||
target.pbRemoveItem(false)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",user.pbThis,target.pbThis(true),itemName))
|
||||
user.pbHeldItemTriggerCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User gives its item to the target. The item remains given after wild battles.
|
||||
# (Bestow)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TargetTakesUserItem < PokeBattle_Move
|
||||
def ignoresSubstitute?(user)
|
||||
return true if Settings::MECHANICS_GENERATION >= 6
|
||||
return super
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !user.item || user.unlosableItem?(user.item)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.item || target.unlosableItem?(user.item)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
itemName = user.itemName
|
||||
target.item = user.item
|
||||
# Permanently steal the item from wild Pokémon
|
||||
if @battle.wildBattle? && user.opposes? && !target.initialItem &&
|
||||
user.item == user.initialItem
|
||||
target.setInitialItem(user.item)
|
||||
user.pbRemoveItem
|
||||
else
|
||||
user.pbRemoveItem(false)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} received {2} from {3}!",target.pbThis,itemName,user.pbThis(true)))
|
||||
target.pbHeldItemTriggerCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User and target swap items. They remain swapped after wild battles.
|
||||
# (Switcheroo, Trick)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserTargetSwapItems < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.wildBattle? && user.opposes?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !user.item && !target.item
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.unlosableItem?(target.item) ||
|
||||
target.unlosableItem?(user.item) ||
|
||||
user.unlosableItem?(user.item) ||
|
||||
user.unlosableItem?(target.item)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
if show_message
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("But it failed to affect {1}!", target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("But it failed to affect {1} because of its {2}!",
|
||||
target.pbThis(true), target.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
oldUserItem = user.item
|
||||
oldUserItemName = user.itemName
|
||||
oldTargetItem = target.item
|
||||
oldTargetItemName = target.itemName
|
||||
user.item = oldTargetItem
|
||||
user.effects[PBEffects::ChoiceBand] = nil if user.ability_id != :GORILLATACTICS
|
||||
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
|
||||
target.item = oldUserItem
|
||||
target.effects[PBEffects::ChoiceBand] = nil if target.ability_id != :GORILLATACTICS
|
||||
target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem)
|
||||
# Permanently steal the item from wild Pokémon
|
||||
if @battle.wildBattle? && target.opposes? && !user.initialItem &&
|
||||
oldTargetItem == target.initialItem
|
||||
user.setInitialItem(oldTargetItem)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} switched items with its opponent!",user.pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} obtained {2}.",user.pbThis,oldTargetItemName)) if oldTargetItem
|
||||
@battle.pbDisplay(_INTL("{1} obtained {2}.",target.pbThis,oldUserItemName)) if oldUserItem
|
||||
user.pbHeldItemTriggerCheck
|
||||
target.pbHeldItemTriggerCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User recovers the last item it held and consumed. (Recycle)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_RestoreUserConsumedItem < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !user.recycleItem
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
item = user.recycleItem
|
||||
user.item = item
|
||||
user.setInitialItem(item) if @battle.wildBattle? && !user.initialItem
|
||||
user.setRecycleItem(nil)
|
||||
user.effects[PBEffects::PickupItem] = nil
|
||||
user.effects[PBEffects::PickupUse] = 0
|
||||
itemName = GameData::Item.get(item).name
|
||||
if itemName.starts_with_vowel?
|
||||
@battle.pbDisplay(_INTL("{1} found an {2}!",user.pbThis,itemName))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} found a {2}!",user.pbThis,itemName))
|
||||
end
|
||||
user.pbHeldItemTriggerCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target drops its item. It regains the item at the end of the battle. (Knock Off)
|
||||
# If target has a losable item, damage is multiplied by 1.5.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_RemoveTargetItem < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
if Settings::MECHANICS_GENERATION >= 6 &&
|
||||
target.item && !target.unlosableItem?(target.item)
|
||||
# NOTE: Damage is still boosted even if target has Sticky Hold or a
|
||||
# substitute.
|
||||
baseDmg = (baseDmg*1.5).round
|
||||
end
|
||||
return baseDmg
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if @battle.wildBattle? && user.opposes? # Wild Pokémon can't knock off
|
||||
return if user.fainted?
|
||||
return if target.damageState.unaffected || target.damageState.substitute
|
||||
return if !target.item || target.unlosableItem?(target.item)
|
||||
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
itemName = target.itemName
|
||||
target.pbRemoveItem(false)
|
||||
@battle.pbDisplay(_INTL("{1} dropped its {2}!",target.pbThis,itemName))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target's berry/Gem is destroyed. (Incinerate)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DestroyTargetBerryOrGem < PokeBattle_Move
|
||||
def pbEffectWhenDealingDamage(user,target)
|
||||
return if target.damageState.substitute || target.damageState.berryWeakened
|
||||
return if !target.item || (!target.item.is_berry? &&
|
||||
!(Settings::MECHANICS_GENERATION >= 6 && target.item.is_gem?))
|
||||
target.pbRemoveItem
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",target.pbThis,target.itemName))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Negates the effect and usability of the target's held item for the rest of the
|
||||
# battle (even if it is switched out). Fails if the target doesn't have a held
|
||||
# item, the item is unlosable, the target has Sticky Hold, or the target is
|
||||
# behind a substitute. (Corrosive Gas)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_CorrodeTargetItem < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.item || target.unlosableItem?(target.item) ||
|
||||
target.effects[PBEffects::Substitute] > 0
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
if show_message
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected because of its {2}!",
|
||||
target.pbThis(true), target.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
end
|
||||
return true
|
||||
end
|
||||
if @battle.corrosiveGas[target.index % 2][target.pokemonIndex]
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
@battle.corrosiveGas[target.index % 2][target.pokemonIndex] = true
|
||||
@battle.pbDisplay(_INTL("{1} corroded {2}'s {3}!",
|
||||
user.pbThis, target.pbThis(true), target.itemName))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, the target cannnot use its held item, its held item has no
|
||||
# effect, and no items can be used on it. (Embargo)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartTargetCannotUseItem < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::Embargo]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Embargo] = 5
|
||||
@battle.pbDisplay(_INTL("{1} can't use items anymore!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, all held items cannot be used in any way and have no effect.
|
||||
# Held items can still change hands, but can't be thrown. (Magic Room)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartNegateHeldItems < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
if @battle.field.effects[PBEffects::MagicRoom]>0
|
||||
@battle.field.effects[PBEffects::MagicRoom] = 0
|
||||
@battle.pbDisplay(_INTL("The area returned to normal!"))
|
||||
else
|
||||
@battle.field.effects[PBEffects::MagicRoom] = 5
|
||||
@battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
|
||||
end
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
return if @battle.field.effects[PBEffects::MagicRoom]>0 # No animation
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The user consumes its held berry and gains its effect. Also, increases the
|
||||
# user's Defense by 2 stages. The berry can be consumed even if Unnerve/Magic
|
||||
# Room apply. Fails if the user is not holding a berry. This move cannot be
|
||||
# chosen to be used if the user is not holding a berry. (Stuff Cheeks)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserConsumeBerryRaiseDefense2 < PokeBattle_StatUpMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@statUp = [:DEFENSE, 2]
|
||||
end
|
||||
|
||||
def pbCanChooseMove?(user, commandPhase, showMessages)
|
||||
item = user.item
|
||||
if !item || !item.is_berry? || !user.itemActive?
|
||||
if showMessages
|
||||
msg = _INTL("{1} can't use that move because it doesn't have a Berry!", user.pbThis)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
end
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
# NOTE: Unnerve does not stop a Pokémon using this move.
|
||||
item = user.item
|
||||
if !item || !item.is_berry? || !user.itemActive?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return super
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
super
|
||||
@battle.pbDisplay(_INTL("{1} ate its {2}!", user.pbThis, user.itemName))
|
||||
item = user.item
|
||||
user.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
user.pbHeldItemTriggerCheck(item, false)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# All Pokémon (except semi-invulnerable ones) consume their held berries and
|
||||
# gain their effects. Berries can be consumed even if Unnerve/Magic Room apply.
|
||||
# Fails if no Pokémon have a held berry. If this move would trigger an ability
|
||||
# that negates the move, e.g. Lightning Rod, the bearer of that ability will
|
||||
# have their ability triggered regardless of whether they are holding a berry,
|
||||
# and they will not consume their berry. (Teatime)
|
||||
# TODO: This isn't quite right for the messages shown when a berry is consumed.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_AllBattlersConsumeBerry < PokeBattle_Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
targets.each do |b|
|
||||
next if !b.item || !b.item.is_berry?
|
||||
next if b.semiInvulnerable?
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But nothing happened!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbOnStartUse(user, targets)
|
||||
@battle.pbDisplay(_INTL("It's teatime! Everyone dug in to their Berries!"))
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return true if !target.item || !target.item.is_berry? || target.semiInvulnerable?
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
@battle.pbCommonAnimation("EatBerry", target)
|
||||
item = target.item
|
||||
target.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
target.pbHeldItemTriggerCheck(item, false)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User consumes target's berry and gains its effect. (Bug Bite, Pluck)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UserConsumeTargetBerry < PokeBattle_Move
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if user.fainted? || target.fainted?
|
||||
return if target.damageState.unaffected || target.damageState.substitute
|
||||
return if !target.item || !target.item.is_berry?
|
||||
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
item = target.item
|
||||
itemName = target.itemName
|
||||
target.pbRemoveItem
|
||||
@battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",user.pbThis,itemName))
|
||||
user.pbHeldItemTriggerCheck(item,false)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User flings its item at the target. Power/effect depend on the item. (Fling)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_ThrowUserItemAtTarget < PokeBattle_Move
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# 80 => all Mega Stones
|
||||
# 10 => all Berries
|
||||
@flingPowers = {
|
||||
130 => [:IRONBALL
|
||||
],
|
||||
100 => [:HARDSTONE,:RAREBONE,
|
||||
# Fossils
|
||||
:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HELIXFOSSIL,
|
||||
:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:ROOTFOSSIL,:SAILFOSSIL,
|
||||
:SKULLFOSSIL
|
||||
],
|
||||
90 => [:DEEPSEATOOTH,:GRIPCLAW,:THICKCLUB,
|
||||
# Plates
|
||||
:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,:FLAMEPLATE,
|
||||
:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,:MEADOWPLATE,:MINDPLATE,
|
||||
:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,:STONEPLATE,
|
||||
:TOXICPLATE,:ZAPPLATE
|
||||
],
|
||||
80 => [:ASSAULTVEST,:CHIPPEDPOT,:CRACKEDPOT,:DAWNSTONE,:DUSKSTONE,
|
||||
:ELECTIRIZER,:HEAVYDUTYBOOTS,:MAGMARIZER,:ODDKEYSTONE,:OVALSTONE,
|
||||
:PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SACHET,:SAFETYGOGGLES,
|
||||
:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY,:WHIPPEDDREAM
|
||||
],
|
||||
70 => [:DRAGONFANG,:POISONBARB,
|
||||
# EV-training items (Macho Brace is 60)
|
||||
:POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
|
||||
:POWERWEIGHT,
|
||||
# Drives
|
||||
:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:SHOCKDRIVE
|
||||
],
|
||||
60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LEEK,:LUSTROUSORB,
|
||||
:MACHOBRACE,:ROCKYHELMET,:STICK,:TERRAINEXTENDER
|
||||
],
|
||||
50 => [:DUBIOUSDISC,:SHARPBEAK,
|
||||
# Memories
|
||||
:BUGMEMORY,:DARKMEMORY,:DRAGONMEMORY,:ELECTRICMEMORY,:FAIRYMEMORY,
|
||||
:FIGHTINGMEMORY,:FIREMEMORY,:FLYINGMEMORY,:GHOSTMEMORY,
|
||||
:GRASSMEMORY,:GROUNDMEMORY,:ICEMEMORY,:POISONMEMORY,
|
||||
:PSYCHICMEMORY,:ROCKMEMORY,:STEELMEMORY,:WATERMEMORY
|
||||
],
|
||||
40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH
|
||||
],
|
||||
30 => [:ABSORBBULB,:ADRENALINEORB,:AMULETCOIN,:BINDINGBAND,:BLACKBELT,
|
||||
:BLACKGLASSES,:BLACKSLUDGE,:BOTTLECAP,:CELLBATTERY,:CHARCOAL,
|
||||
:CLEANSETAG,:DEEPSEASCALE,:DRAGONSCALE,:EJECTBUTTON,:ESCAPEROPE,
|
||||
:EXPSHARE,:FLAMEORB,:FLOATSTONE,:FLUFFYTAIL,:GOLDBOTTLECAP,
|
||||
:HEARTSCALE,:HONEY,:KINGSROCK,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,
|
||||
:LUCKYEGG,:LUMINOUSMOSS,:MAGNET,:METALCOAT,:METRONOME,
|
||||
:MIRACLESEED,:MYSTICWATER,:NEVERMELTICE,:PASSORB,:POKEDOLL,
|
||||
:POKETOY,:PRISMSCALE,:PROTECTIVEPADS,:RAZORFANG,:SACREDASH,
|
||||
:SCOPELENS,:SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
|
||||
:SOULDEW,:SPELLTAG,:TOXICORB,:TWISTEDSPOON,:UPGRADE,
|
||||
# Healing items
|
||||
:ANTIDOTE,:AWAKENING,:BERRYJUICE,:BIGMALASADA,:BLUEFLUTE,
|
||||
:BURNHEAL,:CASTELIACONE,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ETHER,
|
||||
:FRESHWATER,:FULLHEAL,:FULLRESTORE,:HEALPOWDER,:HYPERPOTION,
|
||||
:ICEHEAL,:LAVACOOKIE,:LEMONADE,:LUMIOSEGALETTE,:MAXELIXIR,
|
||||
:MAXETHER,:MAXHONEY,:MAXPOTION,:MAXREVIVE,:MOOMOOMILK,:OLDGATEAU,
|
||||
:PARALYZEHEAL,:PARLYZHEAL,:PEWTERCRUNCHIES,:POTION,:RAGECANDYBAR,
|
||||
:REDFLUTE,:REVIVALHERB,:REVIVE,:SHALOURSABLE,:SODAPOP,
|
||||
:SUPERPOTION,:SWEETHEART,:YELLOWFLUTE,
|
||||
# Battle items
|
||||
:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6,
|
||||
:XATTACK,:XATTACK2,:XATTACK3,:XATTACK6,
|
||||
:XDEFEND,:XDEFEND2,:XDEFEND3,:XDEFEND6,
|
||||
:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
|
||||
:XSPATK,:XSPATK2,:XSPATK3,:XSPATK6,
|
||||
:XSPECIAL,:XSPECIAL2,:XSPECIAL3,:XSPECIAL6,
|
||||
:XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,
|
||||
:XSPEED,:XSPEED2,:XSPEED3,:XSPEED6,
|
||||
:DIREHIT,:DIREHIT2,:DIREHIT3,
|
||||
:ABILITYURGE,:GUARDSPEC,:ITEMDROP,:ITEMURGE,:RESETURGE,
|
||||
:MAXMUSHROOMS,
|
||||
# Vitamins
|
||||
:CALCIUM,:CARBOS,:HPUP,:IRON,:PPUP,:PPMAX,:PROTEIN,:ZINC,
|
||||
:RARECANDY,
|
||||
# Most evolution stones (see also 80)
|
||||
:EVERSTONE,:FIRESTONE,:ICESTONE,:LEAFSTONE,:MOONSTONE,:SUNSTONE,
|
||||
:THUNDERSTONE,:WATERSTONE,:SWEETAPPLE,:TARTAPPLE, :GALARICACUFF,
|
||||
:GALARICAWREATH,
|
||||
# Repels
|
||||
:MAXREPEL,:REPEL,:SUPERREPEL,
|
||||
# Mulches
|
||||
:AMAZEMULCH,:BOOSTMULCH,:DAMPMULCH,:GOOEYMULCH,:GROWTHMULCH,
|
||||
:RICHMULCH,:STABLEMULCH,:SURPRISEMULCH,
|
||||
# Shards
|
||||
:BLUESHARD,:GREENSHARD,:REDSHARD,:YELLOWSHARD,
|
||||
# Valuables
|
||||
:BALMMUSHROOM,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,:COMETSHARD,
|
||||
:NUGGET,:PEARL,:PEARLSTRING,:RELICBAND,:RELICCOPPER,:RELICCROWN,
|
||||
:RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:STARDUST,
|
||||
:STARPIECE,:STRANGESOUVENIR,:TINYMUSHROOM,
|
||||
# Exp Candies
|
||||
:EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL
|
||||
],
|
||||
20 => [# Feathers
|
||||
:CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER,
|
||||
:PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER,
|
||||
:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
|
||||
:RESISTWING,:SWIFTWING
|
||||
],
|
||||
10 => [:AIRBALLOON,:BIGROOT,:BRIGHTPOWDER,:CHOICEBAND,:CHOICESCARF,
|
||||
:CHOICESPECS,:DESTINYKNOT,:DISCOUNTCOUPON,:EXPERTBELT,:FOCUSBAND,
|
||||
:FOCUSSASH,:LAGGINGTAIL,:LEFTOVERS,:MENTALHERB,:METALPOWDER,
|
||||
:MUSCLEBAND,:POWERHERB,:QUICKPOWDER,:REAPERCLOTH,:REDCARD,
|
||||
:RINGTARGET,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,:SMOOTHROCK,
|
||||
:SOFTSAND,:SOOTHEBELL,:WHITEHERB,:WIDELENS,:WISEGLASSES,:ZOOMLENS,
|
||||
# Terrain seeds
|
||||
:ELECTRICSEED,:GRASSYSEED,:MISTYSEED,:PSYCHICSEED,
|
||||
# Nectar
|
||||
:PINKNECTAR,:PURPLENECTAR,:REDNECTAR,:YELLOWNECTAR,
|
||||
# Incenses
|
||||
:FULLINCENSE,:LAXINCENSE,:LUCKINCENSE,:ODDINCENSE,:PUREINCENSE,
|
||||
:ROCKINCENSE,:ROSEINCENSE,:SEAINCENSE,:WAVEINCENSE,
|
||||
# Scarves
|
||||
:BLUESCARF,:GREENSCARF,:PINKSCARF,:REDSCARF,:YELLOWSCARF,
|
||||
# Mints
|
||||
:LONELYMINT, :ADAMANTMINT, :NAUGHTYMINT, :BRAVEMINT, :BOLDMINT,
|
||||
:IMPISHMINT, :LAXMINT, :RELAXEDMINT, :MODESTMINT, :MILDMINT,
|
||||
:RASHMINT, :QUIETMINT, :CALMMINT, :GENTLEMINT, :CAREFULMINT,
|
||||
:SASSYMINT, :TIMIDMINT, :HASTYMINT, :JOLLYMINT, :NAIVEMINT,
|
||||
:SERIOUSMINT,
|
||||
# Sweets
|
||||
:STRAWBERRYSWEET, :LOVESWEET, :BERRYSWEET, :CLOVERSWEET,
|
||||
:FLOWERSWEET, :STARSWEET, :RIBBONSWEET
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
def pbCheckFlingSuccess(user)
|
||||
@willFail = false
|
||||
@willFail = true if !user.item || !user.itemActive? || user.unlosableItem?(user.item)
|
||||
return if @willFail
|
||||
@willFail = true if user.item.is_berry? && !user.canConsumeBerry?
|
||||
return if @willFail
|
||||
return if user.item.is_mega_stone? || user.item.is_TR?
|
||||
flingableItem = false
|
||||
@flingPowers.each do |_power, items|
|
||||
next if !items.include?(user.item_id)
|
||||
flingableItem = true
|
||||
break
|
||||
end
|
||||
@willFail = true if !flingableItem
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @willFail
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbDisplayUseMessage(user)
|
||||
super
|
||||
pbCheckFlingSuccess(user)
|
||||
if !@willFail
|
||||
@battle.pbDisplay(_INTL("{1} flung its {2}!",user.pbThis,user.itemName))
|
||||
end
|
||||
end
|
||||
|
||||
def pbNumHits(user,targets); return 1; end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
return 0 if !user.item
|
||||
return 10 if user.item.is_berry?
|
||||
return 80 if user.item.is_mega_stone?
|
||||
if user.item.is_TR?
|
||||
ret = GameData::Move.get(user.item.move).base_damage
|
||||
ret = 10 if ret < 10
|
||||
return ret
|
||||
end
|
||||
@flingPowers.each do |power,items|
|
||||
return power if items.include?(user.item_id)
|
||||
end
|
||||
return 10
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if target.damageState.substitute
|
||||
return if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
|
||||
case user.item_id
|
||||
when :POISONBARB
|
||||
target.pbPoison(user) if target.pbCanPoison?(user,false,self)
|
||||
when :TOXICORB
|
||||
target.pbPoison(user,nil,true) if target.pbCanPoison?(user,false,self)
|
||||
when :FLAMEORB
|
||||
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
|
||||
when :LIGHTBALL
|
||||
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
|
||||
when :KINGSROCK, :RAZORFANG
|
||||
target.pbFlinch(user)
|
||||
else
|
||||
target.pbHeldItemTriggerCheck(user.item,true)
|
||||
end
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
# NOTE: The item is consumed even if this move was Protected against or it
|
||||
# missed. The item is not consumed if the target was switched out by
|
||||
# an effect like a target's Red Card.
|
||||
# NOTE: There is no item consumption animation.
|
||||
user.pbConsumeItem(true,true,false) if user.item
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,936 @@
|
||||
#===============================================================================
|
||||
# User flees from battle. (Teleport (Gen 7-))
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_FleeFromBattle < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.pbCanRun?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User switches out. If user is a wild Pokémon, ends the battle instead.
|
||||
# (Teleport (Gen 8+))
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwitchOutUserStatusMove < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.wildBattle? && user.opposes?
|
||||
if !@battle.pbCanRun?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
elsif !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
return if @battle.wildBattle? && user.opposes?
|
||||
@battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis,
|
||||
@battle.pbGetOwnerName(user.index)))
|
||||
@battle.pbPursuit(user.index)
|
||||
return if user.fainted?
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
|
||||
return if newPkmn<0
|
||||
@battle.pbRecallAndReplace(user.index,newPkmn)
|
||||
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
|
||||
@battle.moldBreaker = false
|
||||
switchedBattlers.push(user.index)
|
||||
user.pbEffectsOnSwitchIn(true)
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
if @battle.wildBattle? && user.opposes?
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# After inflicting damage, user switches out. Ignores trapping moves.
|
||||
# (U-turn, Volt Switch)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwitchOutUserDamagingMove < PokeBattle_Move
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
return if user.fainted? || numHits==0 || @battle.pbAllFainted?(user.idxOpposingSide)
|
||||
targetSwitched = true
|
||||
targets.each do |b|
|
||||
targetSwitched = false if !switchedBattlers.include?(b.index)
|
||||
end
|
||||
return if targetSwitched
|
||||
return if !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis,
|
||||
@battle.pbGetOwnerName(user.index)))
|
||||
@battle.pbPursuit(user.index)
|
||||
return if user.fainted?
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
|
||||
return if newPkmn<0
|
||||
@battle.pbRecallAndReplace(user.index,newPkmn)
|
||||
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
|
||||
@battle.moldBreaker = false
|
||||
switchedBattlers.push(user.index)
|
||||
user.pbEffectsOnSwitchIn(true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Attack and Special Attack by 1 stage each. Then, user
|
||||
# switches out. Ignores trapping moves. (Parting Shot)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_LowerTargetAtkSpAtk1SwitchOutUser < PokeBattle_TargetMultiStatDownMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statDown = [:ATTACK,1,:SPECIAL_ATTACK,1]
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
switcher = user
|
||||
targets.each do |b|
|
||||
next if switchedBattlers.include?(b.index)
|
||||
switcher = b if b.effects[PBEffects::MagicCoat] || b.effects[PBEffects::MagicBounce]
|
||||
end
|
||||
return if switcher.fainted? || numHits==0
|
||||
return if !@battle.pbCanChooseNonActive?(switcher.index)
|
||||
@battle.pbDisplay(_INTL("{1} went back to {2}!",switcher.pbThis,
|
||||
@battle.pbGetOwnerName(switcher.index)))
|
||||
@battle.pbPursuit(switcher.index)
|
||||
return if switcher.fainted?
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(switcher.index) # Owner chooses
|
||||
return if newPkmn<0
|
||||
@battle.pbRecallAndReplace(switcher.index,newPkmn)
|
||||
@battle.pbClearChoice(switcher.index) # Replacement Pokémon does nothing this round
|
||||
@battle.moldBreaker = false if switcher.index==user.index
|
||||
switchedBattlers.push(switcher.index)
|
||||
switcher.pbEffectsOnSwitchIn(true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# User switches out. Various effects affecting the user are passed to the
|
||||
# replacement. (Baton Pass)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwitchOutUserPassOnEffects < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
|
||||
return if user.fainted? || numHits==0
|
||||
return if !@battle.pbCanChooseNonActive?(user.index)
|
||||
@battle.pbPursuit(user.index)
|
||||
return if user.fainted?
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
|
||||
return if newPkmn<0
|
||||
@battle.pbRecallAndReplace(user.index, newPkmn, false, true)
|
||||
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
|
||||
@battle.moldBreaker = false
|
||||
switchedBattlers.push(user.index)
|
||||
user.pbEffectsOnSwitchIn(true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# In wild battles, makes target flee. Fails if target is a higher level than the
|
||||
# user.
|
||||
# In trainer battles, target switches out.
|
||||
# For status moves. (Roar, Whirlwind)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwitchOutTargetStatusMove < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.hasActiveAbility?(:SUCTIONCUPS) && !@battle.moldBreaker
|
||||
if show_message
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} anchors itself!", target.pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} anchors itself with {2}!", target.pbThis, target.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
end
|
||||
return true
|
||||
end
|
||||
if target.effects[PBEffects::Ingrain]
|
||||
@battle.pbDisplay(_INTL("{1} anchored itself with its roots!", target.pbThis)) if show_message
|
||||
return true
|
||||
end
|
||||
if !@battle.canRun
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if @battle.wildBattle? && target.level>user.level
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if @battle.trainerBattle?
|
||||
canSwitch = false
|
||||
@battle.eachInTeamFromBattlerIndex(target.index) do |_pkmn,i|
|
||||
next if !@battle.pbCanSwitchLax?(target.index,i)
|
||||
canSwitch = true
|
||||
break
|
||||
end
|
||||
if !canSwitch
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.decision = 3 if @battle.wildBattle? # Escaped from battle
|
||||
end
|
||||
|
||||
def pbSwitchOutTargetsEffect(user,targets,numHits,switchedBattlers)
|
||||
return if @battle.wildBattle?
|
||||
return if user.fainted? || numHits==0
|
||||
roarSwitched = []
|
||||
targets.each do |b|
|
||||
next if b.fainted? || b.damageState.unaffected || switchedBattlers.include?(b.index)
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index,true) # Random
|
||||
next if newPkmn<0
|
||||
@battle.pbRecallAndReplace(b.index, newPkmn, true)
|
||||
@battle.pbDisplay(_INTL("{1} was dragged out!",b.pbThis))
|
||||
@battle.pbClearChoice(b.index) # Replacement Pokémon does nothing this round
|
||||
switchedBattlers.push(b.index)
|
||||
roarSwitched.push(b.index)
|
||||
end
|
||||
if roarSwitched.length>0
|
||||
@battle.moldBreaker = false if roarSwitched.include?(user.index)
|
||||
@battle.pbPriority(true).each do |b|
|
||||
b.pbEffectsOnSwitchIn(true) if roarSwitched.include?(b.index)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# In wild battles, makes target flee. Fails if target is a higher level than the
|
||||
# user.
|
||||
# In trainer battles, target switches out.
|
||||
# For damaging moves. (Circle Throw, Dragon Tail)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_SwitchOutTargetDamagingMove < PokeBattle_Move
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
if @battle.wildBattle? && target.level<=user.level && @battle.canRun &&
|
||||
(target.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(user))
|
||||
@battle.decision = 3
|
||||
end
|
||||
end
|
||||
|
||||
def pbSwitchOutTargetsEffect(user,targets,numHits,switchedBattlers)
|
||||
return if @battle.wildBattle?
|
||||
return if user.fainted? || numHits==0
|
||||
roarSwitched = []
|
||||
targets.each do |b|
|
||||
next if b.fainted? || b.damageState.unaffected || b.damageState.substitute
|
||||
next if switchedBattlers.include?(b.index)
|
||||
next if b.effects[PBEffects::Ingrain]
|
||||
next if b.hasActiveAbility?(:SUCTIONCUPS) && !@battle.moldBreaker
|
||||
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index,true) # Random
|
||||
next if newPkmn<0
|
||||
@battle.pbRecallAndReplace(b.index, newPkmn, true)
|
||||
@battle.pbDisplay(_INTL("{1} was dragged out!",b.pbThis))
|
||||
@battle.pbClearChoice(b.index) # Replacement Pokémon does nothing this round
|
||||
switchedBattlers.push(b.index)
|
||||
roarSwitched.push(b.index)
|
||||
end
|
||||
if roarSwitched.length>0
|
||||
@battle.moldBreaker = false if roarSwitched.include?(user.index)
|
||||
@battle.pbPriority(true).each do |b|
|
||||
b.pbEffectsOnSwitchIn(true) if roarSwitched.include?(b.index)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
|
||||
# at end of each round.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_BindTarget < PokeBattle_Move
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if target.fainted? || target.damageState.substitute
|
||||
return if target.effects[PBEffects::Trapping]>0
|
||||
# Set trapping effect duration and info
|
||||
if user.hasActiveItem?(:GRIPCLAW)
|
||||
target.effects[PBEffects::Trapping] = (Settings::MECHANICS_GENERATION >= 5) ? 8 : 6
|
||||
else
|
||||
target.effects[PBEffects::Trapping] = 5+@battle.pbRandom(2)
|
||||
end
|
||||
target.effects[PBEffects::TrappingMove] = @id
|
||||
target.effects[PBEffects::TrappingUser] = user.index
|
||||
# Message
|
||||
msg = _INTL("{1} was trapped in the vortex!",target.pbThis)
|
||||
case @id
|
||||
when :BIND
|
||||
msg = _INTL("{1} was squeezed by {2}!",target.pbThis,user.pbThis(true))
|
||||
when :CLAMP
|
||||
msg = _INTL("{1} clamped {2}!",user.pbThis,target.pbThis(true))
|
||||
when :FIRESPIN
|
||||
msg = _INTL("{1} was trapped in the fiery vortex!",target.pbThis)
|
||||
when :INFESTATION
|
||||
msg = _INTL("{1} has been afflicted with an infestation by {2}!",target.pbThis,user.pbThis(true))
|
||||
when :MAGMASTORM
|
||||
msg = _INTL("{1} became trapped by Magma Storm!",target.pbThis)
|
||||
when :SANDTOMB
|
||||
msg = _INTL("{1} became trapped by Sand Tomb!",target.pbThis)
|
||||
when :WHIRLPOOL
|
||||
msg = _INTL("{1} became trapped in the vortex!",target.pbThis)
|
||||
when :WRAP
|
||||
msg = _INTL("{1} was wrapped by {2}!",target.pbThis,user.pbThis(true))
|
||||
end
|
||||
@battle.pbDisplay(msg)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
|
||||
# at end of each round. (Whirlpool)
|
||||
# Power is doubled if target is using Dive. Hits some semi-invulnerable targets.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_BindTargetDoublePowerIfTargetUnderwater < PokeBattle_Move_BindTarget
|
||||
def hitsDivingTargets?; return true; end
|
||||
|
||||
def pbModifyDamage(damageMult,user,target)
|
||||
damageMult *= 2 if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
|
||||
return damageMult
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target can no longer switch out or flee, as long as the user remains active.
|
||||
# (Anchor Shot, Block, Mean Look, Spider Web, Spirit Shackle, Thousand Waves)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TrapTargetInBattle < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if damagingMove?
|
||||
if target.effects[PBEffects::MeanLook]>=0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
return if damagingMove?
|
||||
target.effects[PBEffects::MeanLook] = user.index
|
||||
@battle.pbDisplay(_INTL("{1} can no longer escape!",target.pbThis))
|
||||
end
|
||||
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.fainted? || target.damageState.substitute
|
||||
return if target.effects[PBEffects::MeanLook]>=0
|
||||
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
target.effects[PBEffects::MeanLook] = user.index
|
||||
@battle.pbDisplay(_INTL("{1} can no longer escape!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The target can no longer switch out or flee, while the user remains in battle.
|
||||
# At the end of each round, the target's Defense and Special Defense are lowered
|
||||
# by 1 stage each. (Octolock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TrapTargetInBattleLowerTargetDefSpDef1EachTurn < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if damagingMove?
|
||||
if target.effects[PBEffects::Octolock] >= 0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.effects[PBEffects::Octolock] = user.index
|
||||
@battle.pbDisplay(_INTL("{1} can no longer escape because of {2}!", target.pbThis, @name))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Prevents the user and the target from switching out or fleeing. This effect
|
||||
# isn't applied if either Pokémon is already prevented from switching out or
|
||||
# fleeing. (Jaw Lock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TrapUserAndTargetInBattle < PokeBattle_Move
|
||||
def pbAdditionalEffect(user, target)
|
||||
return if user.fainted? || target.fainted? || target.damageState.substitute
|
||||
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
|
||||
return if user.trappedInBattle? || target.trappedInBattle?
|
||||
target.effects[PBEffects::JawLock] = user.index
|
||||
@battle.pbDisplay(_INTL("Neither Pokémon can run away!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# No Pokémon can switch out or flee until the end of the next round, as long as
|
||||
# the user remains active. (Fairy Lock)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TrapAllBattlersInBattleForOneTurn < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
if @battle.field.effects[PBEffects::FairyLock]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.field.effects[PBEffects::FairyLock] = 2
|
||||
@battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Interrupts a foe switching out or using U-turn/Volt Switch/Parting Shot. Power
|
||||
# is doubled in that case. (Pursuit)
|
||||
# (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_PursueSwitchingFoe < PokeBattle_Move
|
||||
def pbAccuracyCheck(user,target)
|
||||
return true if @battle.switching
|
||||
return super
|
||||
end
|
||||
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
baseDmg *= 2 if @battle.switching
|
||||
return baseDmg
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fails if user has not been hit by an opponent's physical move this round.
|
||||
# (Shell Trap)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UsedAfterUserTakesPhysicalDamage < PokeBattle_Move
|
||||
def pbDisplayChargeMessage(user)
|
||||
user.effects[PBEffects::ShellTrap] = true
|
||||
@battle.pbCommonAnimation("ShellTrap",user)
|
||||
@battle.pbDisplay(_INTL("{1} set a shell trap!",user.pbThis))
|
||||
end
|
||||
|
||||
def pbDisplayUseMessage(user)
|
||||
super if user.tookPhysicalHit
|
||||
end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if !user.effects[PBEffects::ShellTrap]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
if !user.tookPhysicalHit
|
||||
@battle.pbDisplay(_INTL("{1}'s shell trap didn't work!",user.pbThis))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if a user's ally has already used this move this round. (Round)
|
||||
# If an ally is about to use the same move, make it go next, ignoring priority.
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_UsedAfterAllyRoundWithDoublePower < PokeBattle_Move
|
||||
def pbBaseDamage(baseDmg,user,target)
|
||||
baseDmg *= 2 if user.pbOwnSide.effects[PBEffects::Round]
|
||||
return baseDmg
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbOwnSide.effects[PBEffects::Round] = true
|
||||
user.eachAlly do |b|
|
||||
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
||||
next if @battle.choices[b.index][2].function!=@function
|
||||
b.effects[PBEffects::MoveNext] = true
|
||||
b.effects[PBEffects::Quash] = 0
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target moves immediately after the user, ignoring priority/speed. (After You)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TargetActsNext < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
# Target has already moved this round
|
||||
return true if pbMoveFailedTargetAlreadyMoved?(target, show_message)
|
||||
# Target was going to move next anyway (somehow)
|
||||
if target.effects[PBEffects::MoveNext]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
# Target didn't choose to use a move this round
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::MoveNext] = true
|
||||
target.effects[PBEffects::Quash] = 0
|
||||
@battle.pbDisplay(_INTL("{1} took the kind offer!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target moves last this round, ignoring priority/speed. (Quash)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TargetActsLast < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return true if pbMoveFailedTargetAlreadyMoved?(target, show_message)
|
||||
# Target isn't going to use a move
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
# Target is already maximally Quashed and will move last anyway
|
||||
highestQuash = 0
|
||||
@battle.battlers.each do |b|
|
||||
next if b.effects[PBEffects::Quash]<=highestQuash
|
||||
highestQuash = b.effects[PBEffects::Quash]
|
||||
end
|
||||
if highestQuash>0 && target.effects[PBEffects::Quash]==highestQuash
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
# Target was already going to move last
|
||||
if highestQuash==0 && @battle.pbPriority.last.index==target.index
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
highestQuash = 0
|
||||
@battle.battlers.each do |b|
|
||||
next if b.effects[PBEffects::Quash]<=highestQuash
|
||||
highestQuash = b.effects[PBEffects::Quash]
|
||||
end
|
||||
target.effects[PBEffects::Quash] = highestQuash+1
|
||||
target.effects[PBEffects::MoveNext] = false
|
||||
@battle.pbDisplay(_INTL("{1}'s move was postponed!",target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The target uses its most recent move again. (Instruct)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_TargetUsesItsLastUsedMoveAgain < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@moveBlacklist = [
|
||||
"MultiTurnAttackBideThenReturnDoubleDamage", # Bide
|
||||
"ProtectUserFromDamagingMovesKingsShield", # King's Shield
|
||||
"TargetUsesItsLastUsedMoveAgain", # Instruct (this move)
|
||||
# Struggle
|
||||
"Struggle", # Struggle
|
||||
# Moves that affect the moveset
|
||||
"ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic
|
||||
"ReplaceMoveWithTargetLastMoveUsed", # Sketch
|
||||
"TransformUserIntoTarget", # Transform
|
||||
# Moves that call other moves
|
||||
"UseLastMoveUsedByTarget", # Mirror Move
|
||||
"UseLastMoveUsed", # Copycat
|
||||
"UseMoveTargetIsAboutToUse", # Me First
|
||||
"UseMoveDependingOnEnvironment", # Nature Power
|
||||
"UseRandomUserMoveIfAsleep", # Sleep Talk
|
||||
"UseRandomMoveFromUserParty", # Assist
|
||||
"UseRandomMove", # Metronome
|
||||
# Moves that require a recharge turn
|
||||
"AttackAndSkipNextTurn", # Hyper Beam
|
||||
# Two-turn attacks
|
||||
"TwoTurnAttack", # Razor Wind
|
||||
"TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade
|
||||
"TwoTurnAttackParalyzeTarget", # Freeze Shock
|
||||
"TwoTurnAttackBurnTarget", # Ice Burn
|
||||
"TwoTurnAttackFlinchTarget", # Sky Attack
|
||||
"TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash
|
||||
"TwoTurnAttackInvulnerableInSky", # Fly
|
||||
"TwoTurnAttackInvulnerableUnderground", # Dig
|
||||
"TwoTurnAttackInvulnerableUnderwater", # Dive
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce
|
||||
"TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force, Phantom Force
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop
|
||||
"AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half
|
||||
"TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy
|
||||
# Moves that start focussing at the start of the round
|
||||
"FailsIfUserDamagedThisTurn", # Focus Punch
|
||||
"UsedAfterUserTakesPhysicalDamage", # Shell Trap
|
||||
"BurnAttackerBeforeUserActs" # Beak Blast
|
||||
]
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.usingMultiTurnAttack?
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
targetMove = @battle.choices[target.index][2]
|
||||
if targetMove && (targetMove.function=="FailsIfUserDamagedThisTurn" || # Focus Punch
|
||||
targetMove.function=="UsedAfterUserTakesPhysicalDamage" || # Shell Trap
|
||||
targetMove.function=="BurnAttackerBeforeUserActs") # Beak Blast
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if @moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
idxMove = -1
|
||||
target.eachMoveWithIndex do |m,i|
|
||||
idxMove = i if m.id==target.lastRegularMoveUsed
|
||||
end
|
||||
if target.moves[idxMove].pp==0 && target.moves[idxMove].total_pp>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Instruct] = true
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
|
||||
# (Trick Room)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_StartSlowerBattlersActFirst < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
if @battle.field.effects[PBEffects::TrickRoom]>0
|
||||
@battle.field.effects[PBEffects::TrickRoom] = 0
|
||||
@battle.pbDisplay(_INTL("{1} reverted the dimensions!",user.pbThis))
|
||||
else
|
||||
@battle.field.effects[PBEffects::TrickRoom] = 5
|
||||
@battle.pbDisplay(_INTL("{1} twisted the dimensions!",user.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
return if @battle.field.effects[PBEffects::TrickRoom]>0 # No animation
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# If Grassy Terrain applies, priority is increased by 1. (Grassy Glide)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_HigherPriorityInGrassyTerrain < PokeBattle_Move
|
||||
def pbPriority(user)
|
||||
ret = super
|
||||
ret += 1 if @battle.field.terrain == :Grass && user.affectedByTerrain?
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the PP of the last attack used by the target by 3 (or as much as
|
||||
# possible). (Eerie Spell)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_LowerPPOfTargetLastMoveBy3 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
reduction = [3, last_move.pp].min
|
||||
target.pbSetPP(last_move, last_move.pp - reduction)
|
||||
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
|
||||
target.pbThis(true), last_move.name, reduction))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target's last move used loses 4 PP. (Spite)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_LowerPPOfTargetLastMoveBy4 < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
|
||||
reduction = [4, last_move.pp].min
|
||||
target.pbSetPP(last_move, last_move.pp - reduction)
|
||||
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
|
||||
target.pbThis(true), last_move.name, reduction))
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, disables the last move the target used. (Disable)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetLastMoveUsed < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return true if pbMoveFailedAromaVeil?(user, target, show_message)
|
||||
canDisable = false
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
next if m.pp==0 && m.total_pp>0
|
||||
canDisable = true
|
||||
break
|
||||
end
|
||||
if !canDisable
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Disable] = 5
|
||||
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
|
||||
GameData::Move.get(target.lastRegularMoveUsed).name))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The target can no longer use the same move twice in a row. (Torment)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetUsingSameMoveConsecutively < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::Torment]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return true if pbMoveFailedAromaVeil?(user, target, show_message)
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Torment] = true
|
||||
@battle.pbDisplay(_INTL("{1} was subjected to torment!",target.pbThis))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 4 rounds, the target must use the same move each round. (Encore)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetUsingDifferentMove < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@moveBlacklist = [
|
||||
"DisableTargetUsingDifferentMove", # Encore
|
||||
# Struggle
|
||||
"Struggle", # Struggle
|
||||
# Moves that affect the moveset
|
||||
"ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic
|
||||
"ReplaceMoveWithTargetLastMoveUsed", # Sketch
|
||||
"TransformUserIntoTarget", # Transform
|
||||
# Moves that call other moves (see also below)
|
||||
"UseLastMoveUsedByTarget" # Mirror Move
|
||||
]
|
||||
if Settings::MECHANICS_GENERATION >= 7
|
||||
@moveBlacklist += [
|
||||
# Moves that call other moves
|
||||
# "UseLastMoveUsedByTarget", # Mirror Move # See above
|
||||
"UseLastMoveUsed", # Copycat
|
||||
"UseMoveTargetIsAboutToUse", # Me First
|
||||
"UseMoveDependingOnEnvironment", # Nature Power
|
||||
"UseRandomUserMoveIfAsleep", # Sleep Talk
|
||||
"UseRandomMoveFromUserParty", # Assist
|
||||
"UseRandomMove" # Metronome
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::Encore]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if !target.lastRegularMoveUsed ||
|
||||
@moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
if target.effects[PBEffects::ShellTrap]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return true if pbMoveFailedAromaVeil?(user, target, show_message)
|
||||
canEncore = false
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
next if m.pp==0 && m.total_pp>0
|
||||
canEncore = true
|
||||
break
|
||||
end
|
||||
if !canEncore
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Encore] = 4
|
||||
target.effects[PBEffects::EncoreMove] = target.lastRegularMoveUsed
|
||||
@battle.pbDisplay(_INTL("{1} received an encore!",target.pbThis))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 4 rounds, disables the target's non-damaging moves. (Taunt)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetStatusMoves < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::Taunt]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return true if pbMoveFailedAromaVeil?(user, target, show_message)
|
||||
if Settings::MECHANICS_GENERATION >= 6 && target.hasActiveAbility?(:OBLIVIOUS) &&
|
||||
!@battle.moldBreaker
|
||||
if show_message
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
|
||||
target.pbThis(true), target.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::Taunt] = 4
|
||||
@battle.pbDisplay(_INTL("{1} fell for the taunt!",target.pbThis))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# For 5 rounds, disables the target's healing moves. (Heal Block)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetHealingMoves < PokeBattle_Move
|
||||
def canMagicCoat?; return true; end
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if target.effects[PBEffects::HealBlock]>0
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return true if pbMoveFailedAromaVeil?(user, target, show_message)
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
target.effects[PBEffects::HealBlock] = 5
|
||||
@battle.pbDisplay(_INTL("{1} was prevented from healing!",target.pbThis))
|
||||
target.pbItemStatusCureCheck
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Target cannot use sound-based moves for 2 more rounds. (Throat Chop)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetSoundMoves < PokeBattle_Move
|
||||
def pbAdditionalEffect(user,target)
|
||||
return if target.fainted? || target.damageState.substitute
|
||||
@battle.pbDisplay(_INTL("The effects of {1} prevent {2} from using certain moves!",
|
||||
@name,target.pbThis(true))) if target.effects[PBEffects::ThroatChop]==0
|
||||
target.effects[PBEffects::ThroatChop] = 3
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Disables all target's moves that the user also knows. (Imprison)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_DisableTargetMovesKnownByUser < PokeBattle_Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
if user.effects[PBEffects::Imprison]
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.effects[PBEffects::Imprison] = true
|
||||
@battle.pbDisplay(_INTL("{1} sealed any moves its target shares with it!",user.pbThis))
|
||||
end
|
||||
end
|
||||
@@ -25,7 +25,7 @@ class PokeBattle_Battle
|
||||
@switching = true
|
||||
pbPriority.each do |b|
|
||||
next if b.fainted? || !b.opposes?(idxSwitcher) # Shouldn't hit an ally
|
||||
next if b.movedThisRound? || !pbChoseMoveFunctionCode?(b.index,"088") # Pursuit
|
||||
next if b.movedThisRound? || !pbChoseMoveFunctionCode?(b.index,"PursueSwitchingFoe")
|
||||
# Check whether Pursuit can be used
|
||||
next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].pbTarget(b))
|
||||
next unless pbCanChooseMove?(b.index,@choices[b.index][1],false)
|
||||
@@ -182,7 +182,7 @@ class PokeBattle_Battle
|
||||
b.effects[PBEffects::DestinyBond] = false
|
||||
b.effects[PBEffects::Grudge] = false
|
||||
end
|
||||
b.effects[PBEffects::Rage] = false if !pbChoseMoveFunctionCode?(i,"093") # Rage
|
||||
b.effects[PBEffects::Rage] = false if !pbChoseMoveFunctionCode?(i,"StartRaiseUserAtk1WhenDamaged")
|
||||
end
|
||||
PBDebug.log("")
|
||||
# Calculate move order for this round
|
||||
|
||||
@@ -72,7 +72,8 @@ BattleHandlers::WeightCalcAbility.add(:LIGHTMETAL,
|
||||
|
||||
BattleHandlers::AbilityOnHPDroppedBelowHalf.add(:EMERGENCYEXIT,
|
||||
proc { |ability,battler,battle|
|
||||
next false if battler.effects[PBEffects::SkyDrop]>=0 || battler.inTwoTurnAttack?("0CE") # Sky Drop
|
||||
next false if battler.effects[PBEffects::SkyDrop]>=0 ||
|
||||
battler.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
|
||||
# In wild battles
|
||||
if battle.wildBattle?
|
||||
next false if battler.opposes? && battle.pbSideBattlerCount(battler.index)>1
|
||||
@@ -1174,7 +1175,8 @@ BattleHandlers::DamageCalcTargetAbility.add(:FLUFFY,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:FURCOAT,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[:defense_multiplier] *= 2 if move.physicalMove? || move.function == "122" # Psyshock
|
||||
mults[:defense_multiplier] *= 2 if move.physicalMove? ||
|
||||
move.function == "UseTargetDefenseInsteadOfTargetSpDef" # Psyshock
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2096,14 +2098,15 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
next if m.statusMove?
|
||||
if type1
|
||||
moveType = m.type
|
||||
if Settings::MECHANICS_GENERATION >= 6 && m.function == "090" # Hidden Power
|
||||
if Settings::MECHANICS_GENERATION >= 6 && m.function == "TypeDependsOnUserIVs" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = Effectiveness.calculate(moveType,type1,type2,type3)
|
||||
next if Effectiveness.ineffective?(eff)
|
||||
next if !Effectiveness.super_effective?(eff) && m.function != "070" # OHKO
|
||||
next if !Effectiveness.super_effective?(eff) &&
|
||||
!["OHKO", "OHKOIce", "OHKOHitsTargetUnderground"].include?(m.function)
|
||||
else
|
||||
next if m.function != "070" # OHKO
|
||||
next if !["OHKO", "OHKOIce", "OHKOHitsTargetUnderground"].include?(m.function)
|
||||
end
|
||||
found = true
|
||||
break
|
||||
@@ -2203,16 +2206,29 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
power = m.baseDamage
|
||||
power = 160 if ["070"].include?(m.function) # OHKO
|
||||
power = 150 if ["08B"].include?(m.function) # Eruption
|
||||
power = 160 if ["OHKO", "OHKOIce", "OHKOHitsTargetUnderground"].include?(m.function)
|
||||
power = 150 if ["PowerHigherWithUserHP"].include?(m.function) # Eruption
|
||||
# Counter, Mirror Coat, Metal Burst
|
||||
power = 120 if ["071","072","073"].include?(m.function)
|
||||
power = 120 if ["CounterPhysicalDamage",
|
||||
"CounterSpecialDamage",
|
||||
"CounterDamagePlusHalf"].include?(m.function)
|
||||
# Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave,
|
||||
# Return, Frustration, Crush Grip, Gyro Ball, Hidden Power,
|
||||
# Natural Gift, Trump Card, Flail, Grass Knot
|
||||
power = 80 if ["06A","06B","06D","06E","06F",
|
||||
"089","08A","08C","08D","090",
|
||||
"096","097","098","09A"].include?(m.function)
|
||||
power = 80 if ["FixedDamage20",
|
||||
"FixedDamage40",
|
||||
"FixedDamageUserLevel",
|
||||
"LowerTargetHPToUserHP",
|
||||
"FixedDamageUserLevelRandom",
|
||||
"PowerHigherWithUserHappiness",
|
||||
"PowerLowerWithUserHappiness",
|
||||
"PowerHigherWithUserHP",
|
||||
"PowerHigherWithTargetFasterThanUser",
|
||||
"TypeDependsOnUserIVs",
|
||||
"TypeAndPowerDependOnUserBerry",
|
||||
"PowerHigherWithLessPP",
|
||||
"PowerLowerWithUserHP",
|
||||
"PowerHigherWithTargetWeight"].include?(m.function)
|
||||
next if power<highestPower
|
||||
forewarnMoves = [] if power>highestPower
|
||||
forewarnMoves.push(m.name)
|
||||
|
||||
@@ -36,7 +36,7 @@ class PokeBattle_AI
|
||||
# Pokémon is Perish Songed and has Baton Pass
|
||||
if skill>=PBTrainerAI.highSkill && battler.effects[PBEffects::PerishSong]==1
|
||||
battler.eachMoveWithIndex do |m,i|
|
||||
next if m.function!="0ED" # Baton Pass
|
||||
next if m.function!="SwitchOutUserPassOnEffects" # Baton Pass
|
||||
next if !@battle.pbCanChooseMove?(idxBattler,i,false)
|
||||
batonPass = i
|
||||
break
|
||||
|
||||
@@ -179,11 +179,13 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::SkyDrop]>=0
|
||||
miss = false if move.hitsFlyingTargets?
|
||||
else
|
||||
if target.inTwoTurnAttack?("0C9","0CC","0CE") # Fly, Bounce, Sky Drop
|
||||
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
|
||||
miss = false if move.hitsFlyingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CA") # Dig
|
||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground")
|
||||
miss = false if move.hitsDiggingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CB") # Dive
|
||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
|
||||
miss = false if move.hitsDivingTargets?
|
||||
end
|
||||
end
|
||||
@@ -197,7 +199,7 @@ class PokeBattle_AI
|
||||
score += 60
|
||||
elsif move.damagingMove?
|
||||
score += 30
|
||||
elsif move.function=="0F2"
|
||||
elsif move.function=="UserTargetSwapItems"
|
||||
score += 70 # Trick
|
||||
else
|
||||
score -= 60
|
||||
@@ -262,7 +264,7 @@ class PokeBattle_AI
|
||||
accuracy = pbRoughAccuracy(move,user,target,skill)
|
||||
realDamage *= accuracy/100.0
|
||||
# Two-turn attacks waste 2 turns to deal one lot of damage
|
||||
if move.chargingTurnMove? || move.function=="0C2" # Hyper Beam
|
||||
if move.chargingTurnMove? || move.function=="AttackAndSkipNextTurn" # Hyper Beam
|
||||
realDamage *= 2/3 # Not halved because semi-invulnerable during use or hits first turn
|
||||
end
|
||||
# Prefer flinching external effects (note that move effects which cause
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -172,69 +172,101 @@ class PokeBattle_AI
|
||||
return baseDmg if skill<PBTrainerAI.mediumSkill
|
||||
# Covers all function codes which have their own def pbBaseDamage
|
||||
case move.function
|
||||
when "010" # Stomp
|
||||
when "FlinchTargetTrampleMinimize" # Stomp
|
||||
baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
# Sonic Boom, Dragon Rage, Super Fang, Night Shade, Endeavor
|
||||
when "06A", "06B", "06C", "06D", "06E"
|
||||
when "FixedDamage20", "FixedDamage40", "FixedDamageHalfTargetHP",
|
||||
"FixedDamageUserLevel", "LowerTargetHPToUserHP"
|
||||
baseDmg = move.pbFixedDamage(user,target)
|
||||
when "06F" # Psywave
|
||||
when "FixedDamageUserLevelRandom" # Psywave
|
||||
baseDmg = user.level
|
||||
when "070" # OHKO
|
||||
when "OHKO", "OHKOIce", "OHKOHitsTargetUnderground"
|
||||
baseDmg = 200
|
||||
when "071", "072", "073" # Counter, Mirror Coat, Metal Burst
|
||||
when "CounterPhysicalDamage", "CounterSpecialDamage", "CounterDamagePlusHalf"
|
||||
baseDmg = 60
|
||||
when "075", "076", "0D0", "12D" # Surf, Earthquake, Whirlpool, Shadow Storm
|
||||
when "DoublePowerIfTargetUnderwater", "DoublePowerIfTargetUnderground",
|
||||
"BindTargetDoublePowerIfTargetUnderwater"
|
||||
baseDmg = move.pbModifyDamage(baseDmg,user,target)
|
||||
# Gust, Twister, Venoshock, Smelling Salts, Wake-Up Slap, Facade, Hex, Brine,
|
||||
# Retaliate, Weather Ball, Return, Frustration, Eruption, Crush Grip,
|
||||
# Stored Power, Punishment, Hidden Power, Fury Cutter, Echoed Voice,
|
||||
# Trump Card, Flail, Electro Ball, Low Kick, Fling, Spit Up
|
||||
when "077", "078", "07B", "07C", "07D", "07E", "07F", "080", "085", "087",
|
||||
"089", "08A", "08B", "08C", "08E", "08F", "090", "091", "092", "097",
|
||||
"098", "099", "09A", "0F7", "113"
|
||||
when "DoublePowerIfTargetInSky",
|
||||
"FlinchTargetDoublePowerIfTargetInSky",
|
||||
"DoublePowerIfTargetPoisoned",
|
||||
"DoublePowerIfTargetParalyzedCureTarget",
|
||||
"DoublePowerIfTargetAsleepCureTarget",
|
||||
"DoublePowerIfUserPoisonedBurnedParalyzed",
|
||||
"DoublePowerIfTargetStatusProblem",
|
||||
"DoublePowerIfTargetHPLessThanHalf",
|
||||
"DoublePowerIfAllyFaintedLastTurn",
|
||||
"TypeAndPowerDependOnWeather",
|
||||
"PowerHigherWithUserHappiness",
|
||||
"PowerLowerWithUserHappiness",
|
||||
"PowerHigherWithUserHP",
|
||||
"PowerHigherWithTargetHP",
|
||||
"PowerHigherWithUserPositiveStatStages",
|
||||
"PowerHigherWithTargetPositiveStatStages",
|
||||
"TypeDependsOnUserIVs",
|
||||
"PowerHigherWithConsecutiveUse",
|
||||
"PowerHigherWithConsecutiveUseOnUserSide",
|
||||
"PowerHigherWithLessPP",
|
||||
"PowerLowerWithUserHP",
|
||||
"PowerHigherWithUserFasterThanTarget",
|
||||
"PowerHigherWithTargetWeight",
|
||||
"ThrowUserItemAtTarget",
|
||||
"PowerDependsOnUserStockpile"
|
||||
baseDmg = move.pbBaseDamage(baseDmg,user,target)
|
||||
when "086" # Acrobatics
|
||||
when "DoublePowerIfUserHasNoItem" # Acrobatics
|
||||
baseDmg *= 2 if !user.item || user.hasActiveItem?(:FLYINGGEM)
|
||||
when "08D" # Gyro Ball
|
||||
when "PowerHigherWithTargetFasterThanUser" # Gyro Ball
|
||||
targetSpeed = pbRoughStat(target,:SPEED,skill)
|
||||
userSpeed = pbRoughStat(user,:SPEED,skill)
|
||||
baseDmg = [[(25*targetSpeed/userSpeed).floor,150].min,1].max
|
||||
when "094" # Present
|
||||
when "RandomlyDamageOrHealTarget" # Present
|
||||
baseDmg = 50
|
||||
when "095" # Magnitude
|
||||
when "RandomPowerDoublePowerIfTargetUnderground" # Magnitude
|
||||
baseDmg = 71
|
||||
baseDmg *= 2 if target.inTwoTurnAttack?("0CA") # Dig
|
||||
when "096" # Natural Gift
|
||||
baseDmg *= 2 if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground") # Dig
|
||||
when "TypeAndPowerDependOnUserBerry" # Natural Gift
|
||||
baseDmg = move.pbNaturalGiftBaseDamage(user.item_id)
|
||||
when "09B" # Heavy Slam
|
||||
when "PowerHigherWithUserHeavierThanTarget" # Heavy Slam
|
||||
baseDmg = move.pbBaseDamage(baseDmg,user,target)
|
||||
baseDmg *= 2 if Settings::MECHANICS_GENERATION >= 7 && skill>=PBTrainerAI.mediumSkill &&
|
||||
target.effects[PBEffects::Minimize]
|
||||
when "0A0", "0BD", "0BE" # Frost Breath, Double Kick, Twineedle
|
||||
when "AlwaysCriticalHit", "HitTwoTimes", "HitTwoTimesPoisonTarget" # Frost Breath, Double Kick, Twineedle
|
||||
baseDmg *= 2
|
||||
when "0BF" # Triple Kick
|
||||
when "HitThreeTimesPowersUpWithEachHit" # Triple Kick
|
||||
baseDmg *= 6 # Hits do x1, x2, x3 baseDmg in turn, for x6 in total
|
||||
when "0C0" # Fury Attack
|
||||
when "HitTwoToFiveTimes" # Fury Attack
|
||||
if user.hasActiveAbility?(:SKILLLINK)
|
||||
baseDmg *= 5
|
||||
else
|
||||
baseDmg = (baseDmg * 31 / 10).floor # Average damage dealt
|
||||
end
|
||||
when "0C1" # Beat Up
|
||||
when "HitTwoToFiveTimesOrThreeForAshGreninja"
|
||||
if user.isSpecies?(:GRENINJA) && user.form == 2
|
||||
baseDmg *= 4 # 3 hits at 20 power = 4 hits at 15 power
|
||||
elsif user.hasActiveAbility?(:SKILLLINK)
|
||||
baseDmg *= 5
|
||||
else
|
||||
baseDmg = (baseDmg * 31 / 10).floor # Average damage dealt
|
||||
end
|
||||
when "HitOncePerUserTeamMember" # Beat Up
|
||||
mult = 0
|
||||
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i|
|
||||
mult += 1 if pkmn && pkmn.able? && pkmn.status == :NONE
|
||||
end
|
||||
baseDmg *= mult
|
||||
when "0C4" # Solar Beam
|
||||
when "TwoTurnAttackOneTurnInSun" # Solar Beam
|
||||
baseDmg = move.pbBaseDamageMultiplier(baseDmg,user,target)
|
||||
when "0D3" # Rollout
|
||||
when "MultiTurnAttackPowersUpEachTurn" # Rollout
|
||||
baseDmg *= 2 if user.effects[PBEffects::DefenseCurl]
|
||||
when "0D4" # Bide
|
||||
when "MultiTurnAttackBideThenReturnDoubleDamage" # Bide
|
||||
baseDmg = 40
|
||||
when "0E1" # Final Gambit
|
||||
when "UserFaintsFixedDamageUserHP" # Final Gambit
|
||||
baseDmg = user.hp
|
||||
when "144" # Flying Press
|
||||
when "EffectivenessIncludesFlyingType" # Flying Press
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
targetTypes = target.pbTypes(true)
|
||||
@@ -248,9 +280,9 @@ class PokeBattle_AI
|
||||
end
|
||||
end
|
||||
baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
when "166" # Stomping Tantrum
|
||||
when "DoublePowerIfUserLastMoveFailed" # Stomping Tantrum
|
||||
baseDmg *= 2 if user.lastRoundMoveFailed
|
||||
when "175" # Double Iron Bash
|
||||
when "HitTwoTimesFlinchTarget" # Double Iron Bash
|
||||
baseDmg *= 2
|
||||
baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
end
|
||||
@@ -267,12 +299,12 @@ class PokeBattle_AI
|
||||
type = pbRoughType(move,user,skill)
|
||||
##### Calculate user's attack stat #####
|
||||
atk = pbRoughStat(user,:ATTACK,skill)
|
||||
if move.function=="121" # Foul Play
|
||||
if move.function=="UseTargetAttackInsteadOfUserAttack" # Foul Play
|
||||
atk = pbRoughStat(target,:ATTACK,skill)
|
||||
elsif move.function=="197" # Body Press
|
||||
elsif move.function=="UseUserBaseDefenseInsteadOfUserBaseAttack" # Body Press
|
||||
atk = pbRoughStat(user,:DEFENSE,skill)
|
||||
elsif move.specialMove?(type)
|
||||
if move.function=="121" # Foul Play
|
||||
if move.function=="UseTargetAttackInsteadOfUserAttack" # Foul Play
|
||||
atk = pbRoughStat(target,:SPECIAL_ATTACK,skill)
|
||||
else
|
||||
atk = pbRoughStat(user,:SPECIAL_ATTACK,skill)
|
||||
@@ -280,7 +312,7 @@ class PokeBattle_AI
|
||||
end
|
||||
##### Calculate target's defense stat #####
|
||||
defense = pbRoughStat(target,:DEFENSE,skill)
|
||||
if move.specialMove?(type) && move.function!="122" # Psyshock
|
||||
if move.specialMove?(type) && move.function!="UseTargetDefenseInsteadOfTargetSpDef" # Psyshock
|
||||
defense = pbRoughStat(target,:SPECIAL_DEFENSE,skill)
|
||||
end
|
||||
##### Calculate all multiplier effects #####
|
||||
@@ -455,7 +487,8 @@ class PokeBattle_AI
|
||||
multipliers[:final_damage_multiplier] *= 1.5
|
||||
end
|
||||
when :Sandstorm
|
||||
if target.pbHasType?(:ROCK) && move.specialMove?(type) && move.function != "122" # Psyshock
|
||||
if target.pbHasType?(:ROCK) && move.specialMove?(type) &&
|
||||
move.function != "UseTargetDefenseInsteadOfTargetSpDef" # Psyshock
|
||||
multipliers[:defense_multiplier] *= 1.5
|
||||
end
|
||||
end
|
||||
@@ -481,7 +514,7 @@ class PokeBattle_AI
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
if user.status == :BURN && move.physicalMove?(type) &&
|
||||
!user.hasActiveAbility?(:GUTS) &&
|
||||
!(Settings::MECHANICS_GENERATION >= 6 && move.function == "07E") # Facade
|
||||
!(Settings::MECHANICS_GENERATION >= 6 && move.function == "DoublePowerIfUserPoisonedBurnedParalyzed") # Facade
|
||||
multipliers[:final_damage_multiplier] /= 2
|
||||
end
|
||||
end
|
||||
@@ -650,18 +683,16 @@ class PokeBattle_AI
|
||||
end
|
||||
# "AI-specific calculations below"
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
modifiers[:evasion_stage] = 0 if move.function == "0A9" # Chip Away
|
||||
modifiers[:base_accuracy] = 0 if ["0A5", "139", "13A", "13B", "13C", # "Always hit"
|
||||
"147"].include?(move.function)
|
||||
modifiers[:evasion_stage] = 0 if move.function == "IgnoreTargetDefSpDefEvaStatStages" # Chip Away
|
||||
modifiers[:base_accuracy] = 0 if user.effects[PBEffects::LockOn]>0 &&
|
||||
user.effects[PBEffects::LockOnPos]==target.index
|
||||
end
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
if move.function=="006" # Toxic
|
||||
if move.function=="BadPoisonTarget" # Toxic
|
||||
modifiers[:base_accuracy] = 0 if Settings::MORE_TYPE_EFFECTS && move.statusMove? &&
|
||||
user.pbHasType?(:POISON)
|
||||
end
|
||||
if move.function=="070" # OHKO moves
|
||||
if ["OHKO", "OHKOIce", "OHKOHitsTargetUnderground"].include?(move.function)
|
||||
modifiers[:base_accuracy] = move.accuracy + user.level - target.level
|
||||
modifiers[:accuracy_multiplier] = 0 if target.level > user.level
|
||||
if skill>=PBTrainerAI.bestSkill
|
||||
|
||||
@@ -65,10 +65,10 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
end
|
||||
|
||||
def pbMoveCategory(move)
|
||||
if move.target == :User || move.function == "0D4" # Bide
|
||||
if move.target == :User || move.function == "MultiTurnAttackBideThenReturnDoubleDamage"
|
||||
return 1
|
||||
elsif move.statusMove? ||
|
||||
move.function == "071" || move.function == "072" # Counter, Mirror Coat
|
||||
move.function == "CounterPhysicalDamage" || move.function == "CounterSpecialDamage"
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -98,14 +98,14 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
end
|
||||
|
||||
def pbMindScore(move)
|
||||
if move.function=="0AA" || # Detect/Protect
|
||||
move.function=="0E8" || # Endure
|
||||
move.function=="012" # Fake Out
|
||||
if move.function=="ProtectUser" || # Detect/Protect
|
||||
move.function=="UserEnduresFaintingThisTurn" || # Endure
|
||||
move.function=="FlinchTargetFailsIfNotUserFirstTurn" # Fake Out
|
||||
return -1
|
||||
end
|
||||
if move.function=="071" || # Counter
|
||||
move.function=="072" || # Mirror Coat
|
||||
move.function=="0D4" # Bide
|
||||
if move.function=="CounterPhysicalDamage" || # Counter
|
||||
move.function=="CounterSpecialDamage" || # Mirror Coat
|
||||
move.function=="MultiTurnAttackBideThenReturnDoubleDamage" # Bide
|
||||
return 0
|
||||
end
|
||||
return 0 if move.statusMove?
|
||||
|
||||
@@ -25,11 +25,12 @@ class PokeBattle_Battle
|
||||
def pbJudgeCheckpoint(user,move=nil)
|
||||
if pbAllFainted?(0) && pbAllFainted?(1)
|
||||
if @rules["drawclause"] # NOTE: Also includes Life Orb (not implemented)
|
||||
if !(move && move.function=="0DD") # Not a draw if fainting occurred due to Liquid Ooze
|
||||
if !(move && move.function=="HealUserByHalfOfDamageDone")
|
||||
# Not a draw if fainting occurred due to Liquid Ooze
|
||||
@decision = (user.opposes?) ? 1 : 2 # win / loss
|
||||
end
|
||||
elsif @rules["modifiedselfdestructclause"]
|
||||
if move && move.function=="0E0" # Self-Destruct
|
||||
if move && move.function=="UserFaintsExplosive" # Self-Destruct
|
||||
@decision = (user.opposes?) ? 1 : 2 # win / loss
|
||||
end
|
||||
end
|
||||
@@ -101,7 +102,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_022 # Double Team
|
||||
class PokeBattle_Move_RaiseUserEvasion1 # Double Team
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
@@ -115,7 +116,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_034 # Minimize
|
||||
class PokeBattle_Move_RaiseUserEvasion2MinimizeUser # Minimize
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
@@ -129,7 +130,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_067 # Skill Swap
|
||||
class PokeBattle_Move_UserTargetSwapAbilities # Skill Swap
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
@@ -143,7 +144,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_06A # Sonic Boom
|
||||
class PokeBattle_Move_FixedDamage20 # Sonic Boom
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
@@ -157,7 +158,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_06B # Dragon Rage
|
||||
class PokeBattle_Move_FixedDamage40 # Dragon Rage
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
@@ -171,7 +172,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_070 # OHKO moves
|
||||
class PokeBattle_Move_OHKO
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
@@ -185,7 +186,35 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_0E0 # Self-Destruct
|
||||
class PokeBattle_Move_OHKOIce
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if @battle.rules["ohkoclause"]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return __clauses__pbFailsAgainstTarget?(user, target, show_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_OHKOHitsTargetUnderground
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
if @battle.rules["ohkoclause"]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
return __clauses__pbFailsAgainstTarget?(user, target, show_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_UserFaintsExplosive # Self-Destruct
|
||||
unless @__clauses__aliased
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
@__clauses__aliased = true
|
||||
@@ -217,7 +246,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_0E5 # Perish Song
|
||||
class PokeBattle_Move_StartPerishCountsForAllBattlers # Perish Song
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
@@ -232,7 +261,7 @@ end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Move_0E7 # Destiny Bond
|
||||
class PokeBattle_Move_AttackerFaintsIfUserFaints # Destiny Bond
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
|
||||
@@ -311,80 +311,11 @@ ItemHandlers::BattleUseOnBattler.add(:VIVIDSCENT,proc { |item,battler,scene|
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# No additional effect. (Shadow Blast, Shadow Blitz, Shadow Break, Shadow Rave,
|
||||
# Shadow Rush, Shadow Wave)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_126 < PokeBattle_Move_000
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Paralyzes the target. (Shadow Bolt)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_127 < PokeBattle_Move_007
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Burns the target. (Shadow Fire)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_128 < PokeBattle_Move_00A
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Freezes the target. (Shadow Chill)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_129 < PokeBattle_Move_00C
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Confuses the target. (Shadow Panic)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12A < PokeBattle_Move_013
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Defense by 2 stages. (Shadow Down)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12B < PokeBattle_Move_04C
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's evasion by 2 stages. (Shadow Mist)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12C < PokeBattle_TargetStatDownMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statDown = [:EVASION,2]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if the target is using Dive. (Shadow Storm)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12D < PokeBattle_Move_075
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. On first turn, halves the HP of all active Pokémon.
|
||||
# Skips second turn (if successful). (Shadow Half)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12E < PokeBattle_Move
|
||||
class PokeBattle_Move_AllBattlersLoseHalfHPUserSkipsNextTurn < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
failed = true
|
||||
@battle.eachBattler do |b|
|
||||
@@ -413,19 +344,10 @@ end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Target can no longer switch out or flee, as long as the user remains active.
|
||||
# (Shadow Hold)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12F < PokeBattle_Move_0EF
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# User takes recoil damage equal to 1/2 of its current HP. (Shadow End)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_130 < PokeBattle_RecoilMove
|
||||
class PokeBattle_Move_UserLosesHalfHP < PokeBattle_RecoilMove
|
||||
def pbRecoilDamage(user,target)
|
||||
return (target.damageState.totalHPLost/2.0).round
|
||||
end
|
||||
@@ -446,7 +368,7 @@ end
|
||||
#===============================================================================
|
||||
# Starts shadow weather. (Shadow Sky)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_131 < PokeBattle_WeatherMove
|
||||
class PokeBattle_Move_StartShadowSkyWeather < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :ShadowSky
|
||||
@@ -459,7 +381,7 @@ end
|
||||
# Ends the effects of Light Screen, Reflect and Safeguard on both sides.
|
||||
# (Shadow Shed)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_132 < PokeBattle_Move
|
||||
class PokeBattle_Move_RemoveAllScreens < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
for i in @battle.sides
|
||||
i.effects[PBEffects::AuroraVeil] = 0
|
||||
|
||||
+3
-3
@@ -76,7 +76,7 @@ def pbGetLegalMoves2(species, maxlevel)
|
||||
for move2 in movedatas
|
||||
# If we have a move that always hits, remove all other moves with no
|
||||
# effect of the same type and <= base power
|
||||
if md.function_code == "0A5" && move2[1].function_code == "000" && # Always hits
|
||||
if md.accuracy == 0 && move2[1].function_code == "None" &&
|
||||
md.type == move2[1].type && md.base_damage >= move2[1].base_damage
|
||||
deleteAll.call(moves, move2[0])
|
||||
# If we have two status moves that have the same function code, delete the
|
||||
@@ -85,7 +85,7 @@ def pbGetLegalMoves2(species, maxlevel)
|
||||
move2[1].base_damage == 0 && md.accuracy > move2[1].accuracy
|
||||
deleteAll.call(moves, move2[0])
|
||||
# Delete poison-causing moves if we have a move that causes toxic
|
||||
elsif md.function_code == "006" && move2[1].function_code == "005"
|
||||
elsif md.function_code == "BadPoisonTarget" && move2[1].function_code == "PoisonTarget"
|
||||
deleteAll.call(moves, move2[0])
|
||||
# If we have two moves with the same function code and type, and one of
|
||||
# them is damaging and has 10/15/the same PP as the other move and EITHER
|
||||
@@ -108,7 +108,7 @@ def addMove(moves, move, base)
|
||||
return if moves.include?(data.id)
|
||||
return if [:BUBBLE, :BUBBLEBEAM].include?(data.id) # Never add these moves
|
||||
count = base + 1 # Number of times to add move to moves
|
||||
count = base if data.function_code == "000" && data.base_damage <= 40
|
||||
count = base if data.function_code == "None" && data.base_damage <= 40
|
||||
if data.base_damage <= 30 || [:GROWL, :TAILWHIP, :LEER].include?(data.id)
|
||||
count = base
|
||||
end
|
||||
|
||||
+559
-559
File diff suppressed because it is too large
Load Diff
+677
-677
File diff suppressed because it is too large
Load Diff
+741
-741
File diff suppressed because it is too large
Load Diff
+741
-741
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user