From c7fd14704032967da616548002cb1af5fe1900d5 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 4 Sep 2021 20:53:43 +0100 Subject: [PATCH] Added effect of Dragon Darts, fixed incorrect status icon being used in battle --- .../001_Battler/007_Battler_UseMove.rb | 24 ++- .../008_Battler_UseMove_Targeting.rb | 16 +- .../009_Battler_UseMove_SuccessChecks.rb | 103 ++++++----- Data/Scripts/011_Battle/002_BattleHandlers.rb | 73 ++++---- .../011_Battle/002_Move/002_Move_Usage.rb | 14 +- .../002_Move/004_Move_Effects_Generic.rb | 36 ++-- .../002_Move/005_Move_Effects_000-07F.rb | 128 +++++++------- .../002_Move/006_Move_Effects_080-0FF.rb | 166 +++++++++--------- .../002_Move/007_Move_Effects_100-17F.rb | 134 +++++++------- .../002_Move/008_Move_Effects_Gen8.rb | 108 +++++++----- .../003_BattleHandlers_Abilities.rb | 127 +++++++------- .../004_PokeBattle_SceneElements.rb | 2 +- .../009_PokeBattle_Clauses.rb | 36 ++-- .../011_Battle/007_PokeBattle_DamageState.rb | 2 +- 14 files changed, 528 insertions(+), 441 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb b/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb index 8607a08d6..a1412e31e 100644 --- a/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/011_Battle/001_Battler/007_Battler_UseMove.rb @@ -393,7 +393,7 @@ class PokeBattle_Battler targets.each do |b| b.damageState.reset b.damageState.initialHP = b.hp - if !pbSuccessCheckAgainstTarget(move,user,b) + if !pbSuccessCheckAgainstTarget(move, user, b, targets) b.damageState.unaffected = true end end @@ -583,12 +583,12 @@ class PokeBattle_Battler # For two-turn attacks being used in a single turn move.pbInitialEffect(user,targets,hitNum) numTargets = 0 # Number of targets that are affected by this hit - targets.each { |b| b.damageState.resetPerHit } # Count a hit for Parental Bond (if it applies) user.effects[PBEffects::ParentalBond] -= 1 if user.effects[PBEffects::ParentalBond]>0 # Accuracy check (accuracy/evasion calc) if hitNum==0 || move.successCheckPerHit? targets.each do |b| + b.damageState.missed = false next if b.damageState.unaffected if pbSuccessCheckPerHit(move,user,b,skipAccuracyCheck) numTargets += 1 @@ -602,6 +602,7 @@ class PokeBattle_Battler targets.each do |b| next if !b.damageState.missed || b.damageState.magicCoat pbMissMessage(move,user,b) + break if move.pbRepeatHit? # Dragon Darts only shows one failure message end move.pbCrashDamage(user) user.pbItemHPHealCheck @@ -610,6 +611,9 @@ class PokeBattle_Battler end end # If we get here, this hit will happen and do something + all_targets = targets + targets = move.pbDesignateTargetsForHit(targets, hitNum) # For Dragon Darts + targets.each { |b| b.damageState.resetPerHit } #--------------------------------------------------------------------------- # Calculate damage to deal if move.pbDamagingMove? @@ -637,18 +641,14 @@ class PokeBattle_Battler GameData::Item.get(user.effects[PBEffects::GemConsumed]).name,move.name)) end # Messages about missed target(s) (relevant for multi-target moves only) - targets.each do |b| - next if !b.damageState.missed - pbMissMessage(move,user,b) + if !move.pbRepeatHit? + targets.each { |b| pbMissMessage(move, user, b) if b.damageState.missed } end # Deal the damage (to all allies first simultaneously, then all foes # simultaneously) if move.pbDamagingMove? # This just changes the HP amounts and does nothing else - targets.each do |b| - next if b.damageState.unaffected - move.pbInflictHPDamage(b) - end + targets.each { |b| move.pbInflictHPDamage(b) if !b.damageState.unaffected } # Animate the hit flashing and HP bar changes move.pbAnimateHitAndHPLost(user,targets) end @@ -740,6 +740,12 @@ class PokeBattle_Battler # Fainting targets.each { |b| b.pbFaint if b && b.fainted? } user.pbFaint if user.fainted? + # Dragon Darts' second half of attack + if move.pbRepeatHit? && hitNum == 0 + if targets.any? { |b| !b.fainted? && !b.damageState.unaffected } + pbProcessMoveHit(move, user, all_targets, 1, skipAccuracyCheck) + end + end return true end end diff --git a/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb b/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb index d1562f56b..ab02c29f9 100644 --- a/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb +++ b/Data/Scripts/011_Battle/001_Battler/008_Battler_UseMove_Targeting.rb @@ -98,6 +98,7 @@ class PokeBattle_Battler return targets if @battle.switching # For Pursuit interrupting a switch return targets if move.cannotRedirect? || move.targetsPosition? return targets if !target_data.can_target_one_foe? || targets.length != 1 + move.pbModifyTargets(targets, user) # For Dragon Darts return targets if user.hasActiveAbility?([:PROPELLERTAIL, :STALWART]) priority = @battle.pbPriority(true) nearOnly = !target_data.can_choose_distant_target? @@ -171,31 +172,32 @@ class PokeBattle_Battler #============================================================================= def pbAddTarget(targets,user,target,move,nearOnly=true,allowUser=false) return false if !target || (target.fainted? && !move.targetsPosition?) - return false if !(allowUser && user==target) && nearOnly && !user.near?(target) + return false if !allowUser && target == user + return false if nearOnly && !user.near?(target) && target != user targets.each { |b| return true if b.index==target.index } # Already added targets.push(target) return true end - def pbAddTargetRandomAlly(targets,user,_move,nearOnly=true) + def pbAddTargetRandomAlly(targets, user, move, nearOnly = true) choices = [] user.eachAlly do |b| next if nearOnly && !user.near?(b) - pbAddTarget(choices,user,b,nearOnly) + pbAddTarget(choices, user, b, move, nearOnly) end if choices.length>0 - pbAddTarget(targets,user,choices[@battle.pbRandom(choices.length)],nearOnly) + pbAddTarget(targets, user, choices[@battle.pbRandom(choices.length)], move, nearOnly) end end - def pbAddTargetRandomFoe(targets,user,_move,nearOnly=true) + def pbAddTargetRandomFoe(targets, user, move, nearOnly =true) choices = [] user.eachOpposing do |b| next if nearOnly && !user.near?(b) - pbAddTarget(choices,user,b,nearOnly) + pbAddTarget(choices, user, b, move, nearOnly) end if choices.length>0 - pbAddTarget(targets,user,choices[@battle.pbRandom(choices.length)],nearOnly) + pbAddTarget(targets, user, choices[@battle.pbRandom(choices.length)], move, nearOnly) end end end diff --git a/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb b/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb index 44e03f2bd..b224988a1 100644 --- a/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb +++ b/Data/Scripts/011_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb @@ -292,24 +292,27 @@ class PokeBattle_Battler # Initial success check against the target. Done once before the first hit. # Includes move-specific failure conditions, protections and type immunities. #============================================================================= - def pbSuccessCheckAgainstTarget(move,user,target) + def pbSuccessCheckAgainstTarget(move, user, target, targets) + show_message = move.pbShowFailMessages?(targets) typeMod = move.pbCalcTypeMod(move.calcType,user,target) target.damageState.typeMod = typeMod # Two-turn attacks can't fail here in the charging turn return true if user.effects[PBEffects::TwoTurnAttack] # Move-specific failures - return false if move.pbFailsAgainstTarget?(user,target) + return false if move.pbFailsAgainstTarget?(user, target, show_message) # Immunity to priority moves because of Psychic Terrain if @battle.field.terrain == :Psychic && target.affectedByTerrain? && target.opposes?(user) && @battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority - @battle.pbDisplay(_INTL("{1} surrounds itself with psychic terrain!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} surrounds itself with psychic terrain!", target.pbThis)) if show_message return false end # Crafty Shield if target.pbOwnSide.effects[PBEffects::CraftyShield] && user.index!=target.index && move.statusMove? && !move.pbTarget(user).targets_all - @battle.pbCommonAnimation("CraftyShield",target) - @battle.pbDisplay(_INTL("Crafty Shield protected {1}!",target.pbThis(true))) + if show_message + @battle.pbCommonAnimation("CraftyShield", target) + @battle.pbDisplay(_INTL("Crafty Shield protected {1}!", target.pbThis(true))) + end target.damageState.protected = true @battle.successStates[user.index].protected = true return false @@ -319,8 +322,10 @@ class PokeBattle_Battler if target.pbOwnSide.effects[PBEffects::WideGuard] && user.index!=target.index && move.pbTarget(user).num_targets > 1 && (Settings::MECHANICS_GENERATION >= 7 || move.damagingMove?) - @battle.pbCommonAnimation("WideGuard",target) - @battle.pbDisplay(_INTL("Wide Guard protected {1}!",target.pbThis(true))) + if show_message + @battle.pbCommonAnimation("WideGuard", target) + @battle.pbDisplay(_INTL("Wide Guard protected {1}!", target.pbThis(true))) + end target.damageState.protected = true @battle.successStates[user.index].protected = true return false @@ -329,24 +334,30 @@ class PokeBattle_Battler # Quick Guard if target.pbOwnSide.effects[PBEffects::QuickGuard] && @battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority - @battle.pbCommonAnimation("QuickGuard",target) - @battle.pbDisplay(_INTL("Quick Guard protected {1}!",target.pbThis(true))) + if show_message + @battle.pbCommonAnimation("QuickGuard", target) + @battle.pbDisplay(_INTL("Quick Guard protected {1}!", target.pbThis(true))) + end target.damageState.protected = true @battle.successStates[user.index].protected = true return false end # Protect if target.effects[PBEffects::Protect] - @battle.pbCommonAnimation("Protect",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + if show_message + @battle.pbCommonAnimation("Protect", target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + end target.damageState.protected = true @battle.successStates[user.index].protected = true return false end # King's Shield if target.effects[PBEffects::KingsShield] && move.damagingMove? - @battle.pbCommonAnimation("KingsShield",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + if show_message + @battle.pbCommonAnimation("KingsShield", target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + end target.damageState.protected = true @battle.successStates[user.index].protected = true if move.pbContactMove?(user) && user.affectedByContactEffect? @@ -358,8 +369,10 @@ class PokeBattle_Battler end # Spiky Shield if target.effects[PBEffects::SpikyShield] - @battle.pbCommonAnimation("SpikyShield",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + if show_message + @battle.pbCommonAnimation("SpikyShield", target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + end target.damageState.protected = true @battle.successStates[user.index].protected = true if move.pbContactMove?(user) && user.affectedByContactEffect? @@ -372,8 +385,10 @@ class PokeBattle_Battler end # Baneful Bunker if target.effects[PBEffects::BanefulBunker] - @battle.pbCommonAnimation("BanefulBunker",target) - @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis)) + if show_message + @battle.pbCommonAnimation("BanefulBunker", target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + end target.damageState.protected = true @battle.successStates[user.index].protected = true if move.pbContactMove?(user) && user.affectedByContactEffect? @@ -383,8 +398,10 @@ class PokeBattle_Battler end # Obstruct if target.effects[PBEffects::Obstruct] && move.damagingMove? - @battle.pbCommonAnimation("Obstruct",target) - @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + if show_message + @battle.pbCommonAnimation("Obstruct",target) + @battle.pbDisplay(_INTL("{1} protected itself!", target.pbThis)) + end target.damageState.protected = true @battle.successStates[user.index].protected = true if move.pbContactMove?(user) && user.affectedByContactEffect? @@ -397,7 +414,7 @@ class PokeBattle_Battler # Mat Block if target.pbOwnSide.effects[PBEffects::MatBlock] && move.damagingMove? # NOTE: Confirmed no common animation for this effect. - @battle.pbDisplay(_INTL("{1} was blocked by the kicked-up mat!",move.name)) + @battle.pbDisplay(_INTL("{1} was blocked by the kicked-up mat!", move.name)) if show_message target.damageState.protected = true @battle.successStates[user.index].protected = true return false @@ -419,43 +436,45 @@ class PokeBattle_Battler end end # Immunity because of ability (intentionally before type immunity check) - return false if move.pbImmunityByAbility(user,target) + return false if move.pbImmunityByAbility(user, target, show_message) # Type immunity if move.pbDamagingMove? && Effectiveness.ineffective?(typeMod) PBDebug.log("[Target immune] #{target.pbThis}'s type immunity") - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return false end # Dark-type immunity to moves made faster by Prankster if Settings::MECHANICS_GENERATION >= 7 && user.effects[PBEffects::Prankster] && target.pbHasType?(:DARK) && target.opposes?(user) PBDebug.log("[Target immune] #{target.pbThis} is Dark-type and immune to Prankster-boosted moves") - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return false end # Airborne-based immunity to Ground moves if move.damagingMove? && move.calcType == :GROUND && target.airborne? && !move.hitsFlyingTargets? if target.hasActiveAbility?(:LEVITATE) && !@battle.moldBreaker - @battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - @battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis)) - else - @battle.pbDisplay(_INTL("{1} avoided the attack with {2}!",target.pbThis,target.abilityName)) + if show_message + @battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + @battle.pbDisplay(_INTL("{1} avoided the attack!", target.pbThis)) + else + @battle.pbDisplay(_INTL("{1} avoided the attack with {2}!", target.pbThis, target.abilityName)) + end + @battle.pbHideAbilitySplash(target) end - @battle.pbHideAbilitySplash(target) return false end if target.hasActiveItem?(:AIRBALLOON) - @battle.pbDisplay(_INTL("{1}'s {2} makes Ground moves miss!",target.pbThis,target.itemName)) + @battle.pbDisplay(_INTL("{1}'s {2} makes Ground moves miss!", target.pbThis, target.itemName)) if show_message return false end if target.effects[PBEffects::MagnetRise]>0 - @battle.pbDisplay(_INTL("{1} makes Ground moves miss with Magnet Rise!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} makes Ground moves miss with Magnet Rise!", target.pbThis)) if show_message return false end if target.effects[PBEffects::Telekinesis]>0 - @battle.pbDisplay(_INTL("{1} makes Ground moves miss with Telekinesis!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} makes Ground moves miss with Telekinesis!", target.pbThis)) if show_message return false end end @@ -463,23 +482,25 @@ class PokeBattle_Battler if move.powderMove? if target.pbHasType?(:GRASS) && Settings::MORE_TYPE_EFFECTS PBDebug.log("[Target immune] #{target.pbThis} is Grass-type and immune to powder-based moves") - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return false end if Settings::MECHANICS_GENERATION >= 6 if target.hasActiveAbility?(:OVERCOAT) && !@battle.moldBreaker - @battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - @battle.pbDisplay(_INTL("It doesn't affect {1} because of its {2}.",target.pbThis(true),target.abilityName)) + if show_message + @battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + @battle.pbDisplay(_INTL("It doesn't affect {1} because of its {2}.", target.pbThis(true), target.abilityName)) + end + @battle.pbHideAbilitySplash(target) end - @battle.pbHideAbilitySplash(target) return false end if target.hasActiveItem?(:SAFETYGOGGLES) PBDebug.log("[Item triggered] #{target.pbThis} has Safety Goggles and is immune to powder-based moves") - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return false end end @@ -488,7 +509,7 @@ class PokeBattle_Battler if target.effects[PBEffects::Substitute]>0 && move.statusMove? && !move.ignoresSubstitute?(user) && user.index!=target.index PBDebug.log("[Target immune] #{target.pbThis} is protected by its Substitute") - @battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis(true))) + @battle.pbDisplay(_INTL("{1} avoided the attack!", target.pbThis(true))) if show_message return false end return true diff --git a/Data/Scripts/011_Battle/002_BattleHandlers.rb b/Data/Scripts/011_Battle/002_BattleHandlers.rb index 0aa4fa477..f8d9cb0b5 100644 --- a/Data/Scripts/011_Battle/002_BattleHandlers.rb +++ b/Data/Scripts/011_Battle/002_BattleHandlers.rb @@ -229,8 +229,8 @@ module BattleHandlers return (ret!=nil) ? ret : false end - def self.triggerMoveImmunityTargetAbility(ability,user,target,move,type,battle) - ret = MoveImmunityTargetAbility.trigger(ability,user,target,move,type,battle) + def self.triggerMoveImmunityTargetAbility(ability, user, target, move, type, battle, show_message) + ret = MoveImmunityTargetAbility.trigger(ability, user, target, move, type, battle, show_message) return (ret!=nil) ? ret : false end @@ -545,49 +545,62 @@ end # For abilities that grant immunity to moves of a particular type, and raises # one of the ability's bearer's stats instead. -def pbBattleMoveImmunityStatAbility(user,target,move,moveType,immuneType,stat,increment,battle) +def pbBattleMoveImmunityStatAbility(user, target, move, moveType, immuneType, + stat, increment, battle, show_message) return false if user.index==target.index return false if moveType != immuneType - battle.pbShowAbilitySplash(target) - if target.pbCanRaiseStatStage?(stat,target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - target.pbRaiseStatStage(stat,increment,target) + # NOTE: If show_message is false (Dragon Darts only), the stat will not be + # raised. This is not how the official games work, but I'm considering + # that a bug because Dragon Darts won't be fired at target in the first + # place if it's immune, so why would this ability be triggered by them? + if show_message + battle.pbShowAbilitySplash(target) + if target.pbCanRaiseStatStage?(stat, target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + target.pbRaiseStatStage(stat, increment, target) + else + target.pbRaiseStatStageByCause(stat, increment, target, target.abilityName) + end else - target.pbRaiseStatStageByCause(stat,increment,target,target.abilityName) - end - else - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - target.pbThis,target.abilityName,move.name)) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", + target.pbThis, target.abilityName, move.name)) + end end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) return true end # For abilities that grant immunity to moves of a particular type, and heals the # ability's bearer by 1/4 of its total HP instead. -def pbBattleMoveImmunityHealAbility(user,target,move,moveType,immuneType,battle) +def pbBattleMoveImmunityHealAbility(user, target, move, moveType, immuneType, battle, show_message) return false if user.index==target.index return false if moveType != immuneType - battle.pbShowAbilitySplash(target) - if target.canHeal? && target.pbRecoverHP(target.totalhp/4)>0 - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis)) + # NOTE: If show_message is false (Dragon Darts only), HP will not be healed. + # This is not how the official games work, but I'm considering that a + # bug because Dragon Darts won't be fired at target in the first place + # if it's immune, so why would this ability be triggered by them? + if show_message + battle.pbShowAbilitySplash(target) + if target.canHeal? && target.pbRecoverHP(target.totalhp / 4) > 0 + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis)) + else + battle.pbDisplay(_INTL("{1}'s {2} restored its HP.", target.pbThis, target.abilityName)) + end else - battle.pbDisplay(_INTL("{1}'s {2} restored its HP.",target.pbThis,target.abilityName)) - end - else - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - target.pbThis,target.abilityName,move.name)) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", + target.pbThis, target.abilityName, move.name)) + end end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) return true end diff --git a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb index 43af99782..e1e6eafee 100644 --- a/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb +++ b/Data/Scripts/011_Battle/002_Move/002_Move_Usage.rb @@ -6,6 +6,7 @@ class PokeBattle_Move def pbDisplayChargeMessage(user); end # For Focus Punch/shell Trap/Beak Blast def pbOnStartUse(user,targets); end def pbAddTarget(targets,user); end # For Counter, etc. and Bide + def pbModifyTargets(targets, user); end # For Dragon Darts # Reset move usage counters (child classes can increment them). def pbChangeUsageCounters(user,specialUsage) @@ -20,6 +21,7 @@ class PokeBattle_Move @battle.pbDisplayBrief(_INTL("{1} used {2}!",user.pbThis,@name)) end + def pbShowFailMessages?(targets); return true; end def pbMissMessage(user,target); return false; end #============================================================================= @@ -56,6 +58,8 @@ class PokeBattle_Move def pbOverrideSuccessCheckPerHit(user,target); return false; end def pbCrashDamage(user); end def pbInitialEffect(user,targets,hitNum); end + def pbDesignateTargetsForHit(targets, hitNum); return targets; end # For Dragon Darts + def pbRepeatHit?; return false; end # For Dragon Darts def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true) return if !showAnimation @@ -78,12 +82,12 @@ class PokeBattle_Move #============================================================================= # Check if target is immune to the move because of its ability #============================================================================= - def pbImmunityByAbility(user,target) + def pbImmunityByAbility(user, target, show_message) return false if @battle.moldBreaker ret = false if target.abilityActive? ret = BattleHandlers.triggerMoveImmunityTargetAbility(target.ability, - user,target,self,@calcType,@battle) + user, target, self, @calcType, @battle, show_message) end return ret end @@ -94,7 +98,7 @@ class PokeBattle_Move # Check whether the move fails completely due to move-specific requirements. def pbMoveFailed?(user,targets); return false; end # Checks whether the move will be ineffective against the target. - def pbFailsAgainstTarget?(user,target); return false; end + def pbFailsAgainstTarget?(user, target, show_message); return false; end def pbMoveFailedLastInRound?(user) unmoved = false @@ -112,10 +116,10 @@ class PokeBattle_Move return false end - def pbMoveFailedTargetAlreadyMoved?(target) + def pbMoveFailedTargetAlreadyMoved?(target, showMessage = true) if (@battle.choices[target.index][0]!=:UseMove && @battle.choices[target.index][0]!=:Shift) || target.movedThisRound? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if showMessage return true end return false diff --git a/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb b/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb index a9f644367..b58a70b53 100644 --- a/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb +++ b/Data/Scripts/011_Battle/002_Move/004_Move_Effects_Generic.rb @@ -90,9 +90,9 @@ end class PokeBattle_SleepMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanSleep?(user,true,self) + return !target.pbCanSleep?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -116,9 +116,9 @@ class PokeBattle_PoisonMove < PokeBattle_Move @toxic = false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanPoison?(user,true,self) + return !target.pbCanPoison?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -137,9 +137,9 @@ end class PokeBattle_ParalysisMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanParalyze?(user,true,self) + return !target.pbCanParalyze?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -158,9 +158,9 @@ end class PokeBattle_BurnMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanBurn?(user,true,self) + return !target.pbCanBurn?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -179,9 +179,9 @@ end class PokeBattle_FreezeMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanFreeze?(user,true,self) + return !target.pbCanFreeze?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -219,9 +219,9 @@ end class PokeBattle_ConfuseMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanConfuse?(user,true,self) + return !target.pbCanConfuse?(user, show_message, self) end def pbEffectAgainstTarget(user,target) @@ -326,9 +326,9 @@ end class PokeBattle_TargetStatDownMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanLowerStatStage?(@statDown[0],user,self,true) + return !target.pbCanLowerStatStage?(@statDown[0], user, self, show_message) end def pbEffectAgainstTarget(user,target) @@ -348,7 +348,7 @@ end class PokeBattle_TargetMultiStatDownMove < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? failed = true for i in 0...@statDown.length/2 @@ -366,17 +366,17 @@ class PokeBattle_TargetMultiStatDownMove < PokeBattle_Move canLower = true break end - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis)) if !canLower + @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis)) if !canLower && show_message else for i in 0...@statDown.length/2 next if target.statStageAtMin?(@statDown[i*2]) canLower = true break end - @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",user.pbThis)) if !canLower + @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",user.pbThis)) if !canLower && show_message end if canLower - target.pbCanLowerStatStage?(@statDown[0],user,self,true) + target.pbCanLowerStatStage?(@statDown[0], user, self, show_message) end return true end diff --git a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb index 5a0f6d711..711738a24 100644 --- a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb +++ b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb @@ -60,9 +60,9 @@ end class PokeBattle_Move_004 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Yawn]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return true if !target.pbCanSleep?(user,true,self) @@ -113,9 +113,9 @@ class PokeBattle_Move_007 < PokeBattle_ParalysisMove return super end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @id == :THUNDERWAVE && Effectiveness.ineffective?(target.damageState.typeMod) - @battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return true end return super @@ -328,10 +328,10 @@ class PokeBattle_Move_016 < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return true if !target.pbCanAttract?(user) - return true if pbMoveFailedAromaVeil?(user,target) + return true if !target.pbCanAttract?(user, show_message) + return true if pbMoveFailedAromaVeil?(user, target, show_message) return false end @@ -429,7 +429,7 @@ class PokeBattle_Move_019 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return target.status == :NONE end @@ -527,9 +527,9 @@ class PokeBattle_Move_01B < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.pbCanInflictStatus?(user.status,user,false,self) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -980,13 +980,13 @@ end # Increases one random stat of the target by 2 stages (except HP). (Acupressure) #=============================================================================== class PokeBattle_Move_037 < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) @statArray = [] GameData::Stat.each_battle do |s| @statArray.push(s.id) if target.pbCanRaiseStatStage?(s.id,user,self) end if @statArray.length==0 - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",target.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!", target.pbThis)) if show_message return true end return false @@ -1287,7 +1287,7 @@ class PokeBattle_Move_049 < PokeBattle_TargetStatDownMove @statDown = [:EVASION,1] end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) targetSide = target.pbOwnSide targetOpposingSide = target.pbOpposingSide return false if targetSide.effects[PBEffects::AuroraVeil]>0 || @@ -1438,21 +1438,23 @@ class PokeBattle_Move_04E < PokeBattle_TargetStatDownMove @statDown = [:SPECIAL_ATTACK,2] end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return true if super return false if damagingMove? if user.gender==2 || target.gender==2 || user.gender==target.gender - @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) if show_message return true end if target.hasActiveAbility?(:OBLIVIOUS) && !@battle.moldBreaker - @battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) - else - @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",target.pbThis,target.abilityName)) + 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}'s {2} prevents romance!", target.pbThis, target.abilityName)) + end + @battle.pbHideAbilitySplash(target) end - @battle.pbHideAbilitySplash(target) return true end return false @@ -1757,13 +1759,13 @@ class PokeBattle_Move_05C < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed) if !lastMoveData || user.pbHasMove?(target.lastRegularMoveUsed) || @moveBlacklist.include?(lastMoveData.function_code) || lastMoveData.type == :SHADOW - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1807,13 +1809,13 @@ class PokeBattle_Move_05D < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed) if !lastMoveData || user.pbHasMove?(target.lastRegularMoveUsed) || @moveBlacklist.include?(lastMoveData.function_code) || lastMoveData.type == :SHADOW - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1887,10 +1889,10 @@ class PokeBattle_Move_05F < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.lastMoveUsed || !target.lastMoveUsedType || GameData::Type.get(target.lastMoveUsedType).pseudo_type - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end @newTypes = [] @@ -1900,7 +1902,7 @@ class PokeBattle_Move_05F < PokeBattle_Move @newTypes.push(t.id) end if @newTypes.length == 0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2000,10 +2002,10 @@ end class PokeBattle_Move_061 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.canChangeType? || !GameData::Type.exists?(:WATER) || !target.pbHasOtherType?(:WATER) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2032,15 +2034,15 @@ class PokeBattle_Move_062 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) newTypes = target.pbTypes(true) if newTypes.length==0 # Target has no type to copy - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if user.pbTypes==target.pbTypes && user.effects[PBEffects::Type3]==target.effects[PBEffects::Type3] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2069,9 +2071,9 @@ class PokeBattle_Move_063 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.unstoppableAbility? || [:TRUANT, :SIMPLE].include?(target.ability) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2104,9 +2106,9 @@ class PokeBattle_Move_064 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2139,14 +2141,14 @@ class PokeBattle_Move_065 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.ability || user.ability==target.ability - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.ungainableAbility? || [:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability_id) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2186,9 +2188,9 @@ class PokeBattle_Move_066 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.unstoppableAbility? || target.ability == :TRUANT - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2230,18 +2232,18 @@ class PokeBattle_Move_067 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.ability || (user.ability == target.ability && Settings::MECHANICS_GENERATION <= 5) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.unstoppableAbility? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.ungainableAbility? || target.ability == :WONDERGUARD - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2285,9 +2287,9 @@ end class PokeBattle_Move_068 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.unstoppableAbility? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2315,10 +2317,10 @@ class PokeBattle_Move_069 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Transform] || target.effects[PBEffects::Illusion] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2384,9 +2386,9 @@ end # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor) #=============================================================================== class PokeBattle_Move_06E < PokeBattle_FixedDamageMove - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if user.hp>=target.hp - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2420,24 +2422,26 @@ end class PokeBattle_Move_070 < PokeBattle_FixedDamageMove def hitsDiggingTargets?; return @id == :FISSURE; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.level>user.level - @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message return true end if target.hasActiveAbility?(:STURDY) && !@battle.moldBreaker - @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)) + 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 - @battle.pbHideAbilitySplash(target) return true end if Settings::MECHANICS_GENERATION >= 7 && @id == :SHEERCOLD && target.pbHasType?(:ICE) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false diff --git a/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb index 6e9734fb5..62510c606 100644 --- a/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -365,10 +365,10 @@ class PokeBattle_Move_094 < PokeBattle_Move end end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if @presentDmg>0 if !target.canHeal? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -650,12 +650,12 @@ end class PokeBattle_Move_09C < PokeBattle_Move def ignoresSubstitute?(user); return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.fainted? || target.effects[PBEffects::HelpingHand] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedTargetAlreadyMoved?(target) + return true if pbMoveFailedTargetAlreadyMoved?(target, show_message) return false end @@ -1148,10 +1148,10 @@ class PokeBattle_Move_0AE < PokeBattle_Move def ignoresSubstitute?(user); return true; end def callsAnotherMove?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.lastRegularMoveUsed || !GameData::Move.get(target.lastRegularMoveUsed).flags.any? { |f| f[/^CanMirrorMove$/i] } - @battle.pbDisplay(_INTL("The mirror move failed!")) + @battle.pbDisplay(_INTL("The mirror move failed!")) if show_message return true end return false @@ -1287,11 +1287,11 @@ class PokeBattle_Move_0B0 < PokeBattle_Move ] end - def pbFailsAgainstTarget?(user,target) - return true if pbMoveFailedTargetAlreadyMoved?(target) + def pbFailsAgainstTarget?(user, target, show_message) + return true if pbMoveFailedTargetAlreadyMoved?(target, show_message) oppMove = @battle.choices[target.index][2] if !oppMove || oppMove.statusMove? || @moveBlacklist.include?(oppMove.function) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1715,12 +1715,12 @@ class PokeBattle_Move_0B7 < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Torment] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedAromaVeil?(user,target) + return true if pbMoveFailedAromaVeil?(user, target, show_message) return false end @@ -1762,12 +1762,12 @@ class PokeBattle_Move_0B9 < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedAromaVeil?(user,target) + return true if pbMoveFailedAromaVeil?(user, target, show_message) canDisable = false target.eachMove do |m| next if m.id!=target.lastRegularMoveUsed @@ -1776,7 +1776,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move break end if !canDisable - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1800,22 +1800,24 @@ class PokeBattle_Move_0BA < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Taunt]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedAromaVeil?(user,target) + return true if pbMoveFailedAromaVeil?(user, target, show_message) if Settings::MECHANICS_GENERATION >= 6 && target.hasActiveAbility?(:OBLIVIOUS) && !@battle.moldBreaker - @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)) + 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 - @battle.pbHideAbilitySplash(target) return true end return false @@ -1836,12 +1838,12 @@ end class PokeBattle_Move_0BB < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::HealBlock]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedAromaVeil?(user,target) + return true if pbMoveFailedAromaVeil?(user, target, show_message) return false end @@ -1888,21 +1890,21 @@ class PokeBattle_Move_0BC < PokeBattle_Move end end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Encore]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.effects[PBEffects::ShellTrap] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedAromaVeil?(user,target) + return true if pbMoveFailedAromaVeil?(user, target, show_message) canEncore = false target.eachMove do |m| next if m.id!=target.lastRegularMoveUsed @@ -1911,7 +1913,7 @@ class PokeBattle_Move_0BC < PokeBattle_Move break end if !canEncore - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2262,26 +2264,26 @@ class PokeBattle_Move_0CE < PokeBattle_TwoTurnMove return !@damagingTurn end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.opposes?(user) - @battle.pbDisplay(_INTL("But it failed!")) + @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!")) + @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!")) + @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!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2663,13 +2665,13 @@ end class PokeBattle_Move_0DC < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::LeechSeed]>=0 - @battle.pbDisplay(_INTL("{1} evaded the attack!",target.pbThis)) + @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))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return true end return false @@ -2710,9 +2712,9 @@ end class PokeBattle_Move_0DE < PokeBattle_Move def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.asleep? - @battle.pbDisplay(_INTL("{1} wasn't affected!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} wasn't affected!", target.pbThis)) if show_message return true end return false @@ -2734,12 +2736,12 @@ class PokeBattle_Move_0DF < PokeBattle_Move def healingMove?; return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.hp==target.totalhp - @battle.pbDisplay(_INTL("{1}'s HP is full!",target.pbThis)) + @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)) + @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message return true end return false @@ -2829,7 +2831,7 @@ class PokeBattle_Move_0E2 < PokeBattle_TargetMultiStatDownMove # 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) + def pbFailsAgainstTarget?(user, target, show_message) return false end @@ -2912,7 +2914,7 @@ class PokeBattle_Move_0E5 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return target.effects[PBEffects::PerishSong]>0 # Heard it before end @@ -3042,27 +3044,29 @@ class PokeBattle_Move_0EB < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.hasActiveAbility?(:SUCTIONCUPS) && !@battle.moldBreaker - @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)) + 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 - @battle.pbHideAbilitySplash(target) return true end if target.effects[PBEffects::Ingrain] - @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",target.pbThis)) + @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!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if @battle.trainerBattle? @@ -3073,7 +3077,7 @@ class PokeBattle_Move_0EB < PokeBattle_Move break end if !canSwitch - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end end @@ -3217,14 +3221,14 @@ end class PokeBattle_Move_0EF < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? if target.effects[PBEffects::MeanLook]>=0 - @battle.pbDisplay(_INTL("But it failed!")) + @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))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return true end return false @@ -3319,27 +3323,29 @@ class PokeBattle_Move_0F2 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !user.item && !target.item - @battle.pbDisplay(_INTL("But it failed!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker - @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)) + 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 - @battle.pbHideAbilitySplash(target) return true end return false @@ -3389,9 +3395,9 @@ class PokeBattle_Move_0F3 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.item || target.unlosableItem?(user.item) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -3703,9 +3709,9 @@ end class PokeBattle_Move_0F8 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Embargo]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false diff --git a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb index 59f47adf8..83af75acd 100644 --- a/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb +++ b/Data/Scripts/011_Battle/002_Move/007_Move_Effects_100-17F.rb @@ -287,9 +287,9 @@ class PokeBattle_Move_10D < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if user.pbHasType?(:GHOST) && target.effects[PBEffects::Curse] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -336,10 +336,10 @@ class PokeBattle_Move_10E < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user, target) + 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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -360,9 +360,9 @@ end # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare) #=============================================================================== class PokeBattle_Move_10F < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.asleep? || target.effects[PBEffects::Nightmare] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -445,10 +445,10 @@ class PokeBattle_Move_111 < PokeBattle_Move super if !@battle.futureSight end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !@battle.futureSight && @battle.positions[target.index].effects[PBEffects::FutureSightCounter]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -635,16 +635,16 @@ end # already moved. (Sucker Punch) #=============================================================================== class PokeBattle_Move_116 < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.choices[target.index][0]!=:UseMove - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end oppMove = @battle.choices[target.index][2] if !oppMove || (oppMove.function!="0B0" && # Me First (target.movedThisRound? || oppMove.statusMove?)) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -742,11 +742,11 @@ class PokeBattle_Move_11A < PokeBattle_Move def unusableInGravity?; return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Ingrain] || target.effects[PBEffects::SmackDown] || target.effects[PBEffects::Telekinesis]>0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.isSpecies?(:DIGLETT) || @@ -754,7 +754,7 @@ class PokeBattle_Move_11A < PokeBattle_Move target.isSpecies?(:SANDYGAST) || target.isSpecies?(:PALOSSAND) || (target.isSpecies?(:GENGAR) && target.mega?) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -813,18 +813,18 @@ end class PokeBattle_Move_11D < PokeBattle_Move def ignoresSubstitute?(user); return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) # Target has already moved this round - return true if pbMoveFailedTargetAlreadyMoved?(target) + 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!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -843,12 +843,12 @@ end # Target moves last this round, ignoring priority/speed. (Quash) #=============================================================================== class PokeBattle_Move_11E < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) - return true if pbMoveFailedTargetAlreadyMoved?(target) + 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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end # Target is already maximally Quashed and will move last anyway @@ -858,12 +858,12 @@ class PokeBattle_Move_11E < PokeBattle_Move highestQuash = b.effects[PBEffects::Quash] end if highestQuash>0 && target.effects[PBEffects::Quash]==highestQuash - @battle.pbDisplay(_INTL("But it failed!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -971,7 +971,7 @@ end # Only damages Pokémon that share a type with the user. (Synchronoise) #=============================================================================== class PokeBattle_Move_123 < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) userTypes = user.pbTypes(true) targetTypes = target.pbTypes(true) sharesType = false @@ -981,7 +981,7 @@ class PokeBattle_Move_123 < PokeBattle_Move break end if !sharesType - @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) + @battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) if show_message return true end return false @@ -1017,7 +1017,7 @@ end # Fails unless user has already used all other moves it knows. (Last Resort) #=============================================================================== class PokeBattle_Move_125 < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) hasThisMove = false hasOtherMoves = false hasUnusedMoves = false @@ -1027,7 +1027,7 @@ class PokeBattle_Move_125 < PokeBattle_Move hasUnusedMoves = true if m.id!=@id && !user.movesUsed.include?(m.id) end if !hasThisMove || !hasOtherMoves || hasUnusedMoves - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1132,10 +1132,10 @@ class PokeBattle_Move_137 < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if @validTargets.any? { |b| b.index==target.index } return true if !target.hasActiveAbility?([:MINUS,:PLUS]) - @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!",target.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) if show_message return true end @@ -1165,8 +1165,8 @@ end class PokeBattle_Move_138 < PokeBattle_Move def ignoresSubstitute?(user); return true; end - def pbFailsAgainstTarget?(user,target) - return true if !target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self,true) + def pbFailsAgainstTarget?(user, target, show_message) + return true if !target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user, self, show_message) return false end @@ -1299,11 +1299,11 @@ class PokeBattle_Move_13E < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if @validTargets.include?(target.index) return true if !target.pbHasType?(:GRASS) return true if target.airborne? || target.semiInvulnerable? - @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!",target.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) if show_message return true end @@ -1342,10 +1342,10 @@ class PokeBattle_Move_13F < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if @validTargets.include?(target.index) return true if !target.pbHasType?(:GRASS) || target.semiInvulnerable? - return !target.pbCanRaiseStatStage?(:DEFENSE,user,self,true) + return !target.pbCanRaiseStatStage?(:DEFENSE, user, self, show_message) end def pbEffectAgainstTarget(user,target) @@ -1399,9 +1399,9 @@ end class PokeBattle_Move_141 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.hasAlteredStatStages? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1428,9 +1428,9 @@ end class PokeBattle_Move_142 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !GameData::Type.exists?(:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1451,9 +1451,9 @@ end class PokeBattle_Move_143 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !GameData::Type.exists?(:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1496,12 +1496,12 @@ end # Target's moves become Electric-type for the rest of the round. (Electrify) #=============================================================================== class PokeBattle_Move_145 < PokeBattle_Move - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Electrify] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return true if pbMoveFailedTargetAlreadyMoved?(target) + return true if pbMoveFailedTargetAlreadyMoved?(target, show_message) return false end @@ -1567,9 +1567,9 @@ class PokeBattle_Move_148 < PokeBattle_Move def ignoresSubstitute?(user); return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.effects[PBEffects::Powder] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1911,10 +1911,10 @@ end class PokeBattle_Move_159 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.pbCanPoison?(user,false,self) && !target.pbCanLowerStatStage?(:SPEED,user,self) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -1951,9 +1951,9 @@ class PokeBattle_Move_15B < PokeBattle_HealingMove def canSnatch?; return false; end # Because it affects a target def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.status == :NONE - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2001,10 +2001,10 @@ class PokeBattle_Move_15C < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if @validTargets.any? { |b| b.index==target.index } return true if !target.hasActiveAbility?([:MINUS,:PLUS]) - @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!",target.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) if show_message return true end @@ -2094,7 +2094,7 @@ class PokeBattle_Move_160 < PokeBattle_Move def healingMove?; return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + 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 @@ -2102,10 +2102,10 @@ class PokeBattle_Move_160 < PokeBattle_Move # other effect. if !@battle.moldBreaker && target.hasActiveAbility?(:CONTRARY) && target.statStageAtMax?(:ATTACK) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true elsif target.statStageAtMin?(:ATTACK) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2376,24 +2376,24 @@ class PokeBattle_Move_16B < PokeBattle_Move ] end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if target.usingMultiTurnAttack? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end targetMove = @battle.choices[target.index][2] if targetMove && (targetMove.function=="115" || # Focus Punch targetMove.function=="171" || # Shell Trap targetMove.function=="172") # Beak Blast - @battle.pbDisplay(_INTL("But it failed!")) + @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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end idxMove = -1 @@ -2401,7 +2401,7 @@ class PokeBattle_Move_16B < PokeBattle_Move 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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -2448,12 +2448,12 @@ class PokeBattle_Move_16E < PokeBattle_Move def healingMove?; return true; end def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if target.hp==target.totalhp - @battle.pbDisplay(_INTL("{1}'s HP is full!",target.pbThis)) + @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)) + @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message return true end return false @@ -2484,14 +2484,14 @@ class PokeBattle_Move_16F < PokeBattle_Move @healing = !user.opposes?(targets[0]) if targets.length>0 end - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) return false if !@healing if target.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(user) - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end if !target.canHeal? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false diff --git a/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb b/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb index 5d19a19d4..b6cd869ab 100644 --- a/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb +++ b/Data/Scripts/011_Battle/002_Move/008_Move_Effects_Gen8.rb @@ -157,9 +157,9 @@ class PokeBattle_Move_17B < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user, target) + 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)) + @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!", target.pbThis)) if show_message return true end @@ -222,7 +222,7 @@ end # neither of these effects can be applied. (Tar Shot) #=============================================================================== class PokeBattle_Move_17E < PokeBattle_Move_044 - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return super if target.effects[PBEffects::TarShot] return false end @@ -243,10 +243,10 @@ end class PokeBattle_Move_17F < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.canChangeType? || !GameData::Type.exists?(:PSYCHIC) || !target.pbHasOtherType?(:PSYCHIC) || !target.affectedByPowder? - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -381,23 +381,43 @@ class PokeBattle_Move_187 < PokeBattle_Move end #=============================================================================== -# Hits 2 times in a row. The second hit targets the original target's ally if it -# had one (that can be targeted), or the original target if not. If the original -# target cannot be targeted, both hits target its ally. In a triple battle, the -# second hit will (try to) target one adjacent ally (how does it decide which -# one?). -# -# A Pokémon cannot be targeted if: -# * It is the user. -# * It would be immune due to its type or ability. -# * It is protected by a protection move (which ones?). -# * It is semi-invulnerable, or the move fails an accuracy check against it. -# * An ally is the centre of attention (e.g. because of Follow Me). -# -# All Pokémon hit by this move will apply their Pressure ability to it. -# (Dragon Darts) +# 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_UnimplementedMove +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 #=============================================================================== @@ -475,7 +495,7 @@ class PokeBattle_Move_18C < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return !target.canHeal? end @@ -506,7 +526,7 @@ class PokeBattle_Move_18D < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return target.status == :NONE && !target.canHeal? end @@ -551,14 +571,14 @@ end # by 1 stage each. (Octolock) #=============================================================================== class PokeBattle_Move_18F < PokeBattle_Move - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? if target.effects[PBEffects::Octolock] >= 0 - @battle.pbDisplay(_INTL("But it failed!")) + @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))) + @battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) if show_message return true end return false @@ -657,7 +677,7 @@ class PokeBattle_Move_192 < PokeBattle_Move @battle.pbDisplay(_INTL("It's teatime! Everyone dug in to their Berries!")) end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return true if !target.item || !target.item.is_berry? || target.semiInvulnerable? return false end @@ -679,25 +699,27 @@ end class PokeBattle_Move_193 < PokeBattle_Move def canMagicCoat?; return true; end - def pbFailsAgainstTarget?(user, target) + 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)) + @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message return true end if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker - @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)) + 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 - @battle.pbHideAbilitySplash(target) return true end if @battle.corrosiveGas[target.index % 2][target.pokemonIndex] - @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) + @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message return true end return false @@ -730,10 +752,10 @@ end # possible). (Eerie Spell) #=============================================================================== class PokeBattle_Move_195 < PokeBattle_Move - def pbFailsAgainstTarget?(user, target) + 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!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end return false @@ -753,9 +775,9 @@ end # Magic Room/Klutz. (Poltergeist) #=============================================================================== class PokeBattle_Move_196 < PokeBattle_Move - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) if !target.item || !target.itemActive? - @battle.pbDisplay(_INTL("But it failed!")) + @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)) @@ -887,9 +909,9 @@ class PokeBattle_Move_19A < PokeBattle_Move return false end - def pbFailsAgainstTarget?(user, target) + def pbFailsAgainstTarget?(user, target, show_message) return false if damagingMove? - return !target.pbCanRaiseStatStage?(:ATTACK, user, self, true) + return !target.pbCanRaiseStatStage?(:ATTACK, user, self, show_message) end def pbEffectAgainstTarget(user, target) diff --git a/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb b/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb index b52f540be..1fe266d0e 100644 --- a/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb +++ b/Data/Scripts/011_Battle/003_BattleHandlers_Abilities.rb @@ -583,127 +583,136 @@ BattleHandlers::MoveBlockingAbility.copy(:DAZZLING,:QUEENLYMAJESTY) #=============================================================================== BattleHandlers::MoveImmunityTargetAbility.add(:BULLETPROOF, - proc { |ability,user,target,move,type,battle| + proc { |ability, user, target, move, type, battle, show_message| next false if !move.bombMove? - battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - target.pbThis,target.abilityName,move.name)) + if show_message + battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", + target.pbThis, target.abilityName, move.name)) + end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) next true } ) BattleHandlers::MoveImmunityTargetAbility.add(:FLASHFIRE, - proc { |ability,user,target,move,type,battle| + proc { |ability, user, target, move, type, battle, show_message| next false if user.index==target.index next false if type != :FIRE - battle.pbShowAbilitySplash(target) - if !target.effects[PBEffects::FlashFire] - target.effects[PBEffects::FlashFire] = true - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose!",target.pbThis(true))) + if show_message + battle.pbShowAbilitySplash(target) + if !target.effects[PBEffects::FlashFire] + target.effects[PBEffects::FlashFire] = true + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose!", target.pbThis(true))) + else + battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose because of its {2}!", + target.pbThis(true), target.abilityName)) + end else - battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose because of its {2}!", - target.pbThis(true),target.abilityName)) - end - else - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - target.pbThis,target.abilityName,move.name)) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", + target.pbThis, target.abilityName, move.name)) + end end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) next true } ) BattleHandlers::MoveImmunityTargetAbility.add(:LIGHTNINGROD, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,:SPECIAL_ATTACK,1,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityStatAbility(user, target, move, type, :ELECTRIC, :SPECIAL_ATTACK, 1, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.add(:MOTORDRIVE, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,:SPEED,1,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityStatAbility(user, target, move, type, :ELECTRIC, :SPEED, 1, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.add(:SAPSIPPER, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityStatAbility(user,target,move,type,:GRASS,:ATTACK,1,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityStatAbility(user, target, move, type, :GRASS, :ATTACK, 1, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.add(:SOUNDPROOF, - proc { |ability,user,target,move,type,battle| + proc { |ability, user, target, move, type, battle, show_message| next false if !move.soundMove? next false if Settings::MECHANICS_GENERATION >= 8 && user.index == target.index - battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",target.pbThis,target.abilityName,move.name)) + if show_message + battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!", target.pbThis, target.abilityName, move.name)) + end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) next true - } ) BattleHandlers::MoveImmunityTargetAbility.add(:STORMDRAIN, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityStatAbility(user,target,move,type,:WATER,:SPECIAL_ATTACK,1,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityStatAbility(user, target, move, type, :WATER, :SPECIAL_ATTACK, 1, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.add(:TELEPATHY, - proc { |ability,user,target,move,type,battle| + proc { |ability, user, target, move, type, battle, show_message| next false if move.statusMove? next false if user.index==target.index || target.opposes?(user) - battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("{1} avoids attacks by its ally Pokémon!",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1} avoids attacks by its ally Pokémon with {2}!", - target.pbThis,target.abilityName)) + if show_message + battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("{1} avoids attacks by its ally Pokémon!", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1} avoids attacks by its ally Pokémon with {2}!", + target.pbThis, target.abilityName)) + end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) next true } ) BattleHandlers::MoveImmunityTargetAbility.add(:VOLTABSORB, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityHealAbility(user,target,move,type,:ELECTRIC,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityHealAbility(user, target, move, type, :ELECTRIC, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.add(:WATERABSORB, - proc { |ability,user,target,move,type,battle| - next pbBattleMoveImmunityHealAbility(user,target,move,type,:WATER,battle) + proc { |ability, user, target, move, type, battle, show_message| + next pbBattleMoveImmunityHealAbility(user, target, move, type, :WATER, battle, show_message) } ) BattleHandlers::MoveImmunityTargetAbility.copy(:WATERABSORB,:DRYSKIN) BattleHandlers::MoveImmunityTargetAbility.add(:WONDERGUARD, - proc { |ability,user,target,move,type,battle| + proc { |ability, user, target, move, type, battle, show_message| next false if move.statusMove? next false if !type || Effectiveness.super_effective?(target.damageState.typeMod) - battle.pbShowAbilitySplash(target) - if PokeBattle_SceneConstants::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1} avoided damage with {2}!",target.pbThis,target.abilityName)) + if show_message + battle.pbShowAbilitySplash(target) + if PokeBattle_SceneConstants::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) + else + battle.pbDisplay(_INTL("{1} avoided damage with {2}!", target.pbThis, target.abilityName)) + end + battle.pbHideAbilitySplash(target) end - battle.pbHideAbilitySplash(target) next true } ) diff --git a/Data/Scripts/011_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb b/Data/Scripts/011_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb index f73dc8bdd..ac242d859 100644 --- a/Data/Scripts/011_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb +++ b/Data/Scripts/011_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb @@ -255,7 +255,7 @@ class PokemonDataBox < SpriteWrapper s = GameData::Status.get(@battler.status).icon_position end imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,36, - 0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT]) if s >= 0 + 0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT]) if s >= 0 end pbDrawImagePositions(self.bitmap,imagePos) refreshHP diff --git a/Data/Scripts/011_Battle/006_Other battle types/009_PokeBattle_Clauses.rb b/Data/Scripts/011_Battle/006_Other battle types/009_PokeBattle_Clauses.rb index 7f326eb23..077c86e53 100644 --- a/Data/Scripts/011_Battle/006_Other battle types/009_PokeBattle_Clauses.rb +++ b/Data/Scripts/011_Battle/006_Other battle types/009_PokeBattle_Clauses.rb @@ -132,12 +132,12 @@ end class PokeBattle_Move_067 # Skill Swap alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["skillswapclause"] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end @@ -146,12 +146,12 @@ end class PokeBattle_Move_06A # Sonic Boom alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["sonicboomclause"] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end @@ -160,12 +160,12 @@ end class PokeBattle_Move_06B # Dragon Rage alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["sonicboomclause"] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end @@ -174,12 +174,12 @@ end class PokeBattle_Move_070 # OHKO moves alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["ohkoclause"] - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end @@ -220,13 +220,13 @@ end class PokeBattle_Move_0E5 # Perish Song alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["perishsongclause"] && @battle.pbAbleNonActiveCount(user.idxOwnSide)==0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end @@ -235,12 +235,12 @@ end class PokeBattle_Move_0E7 # Destiny Bond alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget? - def pbFailsAgainstTarget?(user,target) + def pbFailsAgainstTarget?(user, target, show_message) if @battle.rules["perishsongclause"] && @battle.pbAbleNonActiveCount(user.idxOwnSide)==0 - @battle.pbDisplay(_INTL("But it failed!")) + @battle.pbDisplay(_INTL("But it failed!")) if show_message return true end - return __clauses__pbFailsAgainstTarget?(user,target) + return __clauses__pbFailsAgainstTarget?(user, target, show_message) end end diff --git a/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb b/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb index 0a3125c41..99a0afd3e 100644 --- a/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb +++ b/Data/Scripts/011_Battle/007_PokeBattle_DamageState.rb @@ -28,6 +28,7 @@ class PokeBattle_DamageState @typeMod = Effectiveness::INEFFECTIVE @unaffected = false @protected = false + @missed = false @magicCoat = false @magicBounce = false @totalHPLost = 0 @@ -36,7 +37,6 @@ class PokeBattle_DamageState end def resetPerHit - @missed = false @calcDamage = 0 @hpLost = 0 @critical = false