mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 14:44:58 +00:00
Yet more Rubocopping
This commit is contained in:
@@ -136,17 +136,17 @@ class Battle::Battler
|
||||
#=============================================================================
|
||||
def hasMega?
|
||||
return false if @effects[PBEffects::Transform]
|
||||
return @pokemon && @pokemon.hasMegaForm?
|
||||
return @pokemon&.hasMegaForm?
|
||||
end
|
||||
|
||||
def mega?; return @pokemon && @pokemon.mega?; end
|
||||
def mega?; return @pokemon&.mega?; end
|
||||
|
||||
def hasPrimal?
|
||||
return false if @effects[PBEffects::Transform]
|
||||
return @pokemon && @pokemon.hasPrimalForm?
|
||||
return @pokemon&.hasPrimalForm?
|
||||
end
|
||||
|
||||
def primal?; return @pokemon && @pokemon.primal?; end
|
||||
def primal?; return @pokemon&.primal?; end
|
||||
|
||||
def shadowPokemon?; return false; end
|
||||
|
||||
@@ -184,11 +184,11 @@ class Battle::Battler
|
||||
|
||||
def shiny?
|
||||
return @effects[PBEffects::Illusion].shiny? if @effects[PBEffects::Illusion]
|
||||
return @pokemon && @pokemon.shiny?
|
||||
return @pokemon&.shiny?
|
||||
end
|
||||
|
||||
def super_shiny?
|
||||
return @pokemon && @pokemon.super_shiny?
|
||||
return @pokemon&.super_shiny?
|
||||
end
|
||||
|
||||
def owned?
|
||||
@@ -295,7 +295,7 @@ class Battle::Battler
|
||||
end
|
||||
|
||||
def isSpecies?(species)
|
||||
return @pokemon && @pokemon.isSpecies?(species)
|
||||
return @pokemon&.isSpecies?(species)
|
||||
end
|
||||
|
||||
# Returns the active types of this Pokémon. The array should not include the
|
||||
@@ -311,8 +311,8 @@ class Battle::Battler
|
||||
ret.push(:NORMAL) if ret.length == 0
|
||||
end
|
||||
# Add the third type specially.
|
||||
if withType3 && @effects[PBEffects::Type3]
|
||||
ret.push(@effects[PBEffects::Type3]) if !ret.include?(@effects[PBEffects::Type3])
|
||||
if withType3 && @effects[PBEffects::Type3] && !ret.include?(@effects[PBEffects::Type3])
|
||||
ret.push(@effects[PBEffects::Type3])
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -277,14 +277,13 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
# Zygarde - Power Construct
|
||||
if isSpecies?(:ZYGARDE) && self.ability == :POWERCONSTRUCT && endOfRound
|
||||
if @hp <= @totalhp / 2 && @form < 2 # Turn into Complete Forme
|
||||
newForm = @form + 2
|
||||
@battle.pbDisplay(_INTL("You sense the presence of many!"))
|
||||
@battle.pbShowAbilitySplash(self, true)
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
pbChangeForm(newForm, _INTL("{1} transformed into its Complete Forme!", pbThis))
|
||||
end
|
||||
if isSpecies?(:ZYGARDE) && self.ability == :POWERCONSTRUCT && endOfRound &&
|
||||
@hp <= @totalhp / 2 && @form < 2 # Turn into Complete Forme
|
||||
newForm = @form + 2
|
||||
@battle.pbDisplay(_INTL("You sense the presence of many!"))
|
||||
@battle.pbShowAbilitySplash(self, true)
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
pbChangeForm(newForm, _INTL("{1} transformed into its Complete Forme!", pbThis))
|
||||
end
|
||||
# Morpeko - Hunger Switch
|
||||
if isSpecies?(:MORPEKO) && hasActiveAbility?(:HUNGERSWITCH) && endOfRound
|
||||
|
||||
@@ -281,11 +281,11 @@ class Battle::Battler
|
||||
|
||||
def pbCanSleepYawn?
|
||||
return false if self.status != :NONE
|
||||
if affectedByTerrain?
|
||||
return false if [:Electric, :Misty].include?(@battle.field.terrain)
|
||||
if affectedByTerrain? && [:Electric, :Misty].include?(@battle.field.terrain)
|
||||
return false
|
||||
end
|
||||
if !hasActiveAbility?(:SOUNDPROOF)
|
||||
return false if @battle.allBattlers.any? { |b| b.effects[PBEffects::Uproar] > 0 }
|
||||
if !hasActiveAbility?(:SOUNDPROOF) && @battle.allBattlers.any? { |b| b.effects[PBEffects::Uproar] > 0 }
|
||||
return false
|
||||
end
|
||||
if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, :SLEEP)
|
||||
return false
|
||||
@@ -454,19 +454,17 @@ class Battle::Battler
|
||||
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
if selfInflicted || !@battle.moldBreaker
|
||||
if hasActiveAbility?(:OWNTEMPO)
|
||||
if showMessages
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
if Battle::Scene::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} doesn't become confused!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents confusion!", pbThis, abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
if (selfInflicted || !@battle.moldBreaker) && hasActiveAbility?(:OWNTEMPO)
|
||||
if showMessages
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
if Battle::Scene::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} doesn't become confused!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents confusion!", pbThis, abilityName))
|
||||
end
|
||||
return false
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
end
|
||||
return false
|
||||
end
|
||||
if pbOwnSide.effects[PBEffects::Safeguard] > 0 && !selfInflicted &&
|
||||
!(user && user.hasActiveAbility?(:INFILTRATOR))
|
||||
|
||||
@@ -118,7 +118,8 @@ class Battle::Battler
|
||||
return @stages[stat] <= -6
|
||||
end
|
||||
|
||||
def pbCanLowerStatStage?(stat, user = nil, move = nil, showFailMsg = false, ignoreContrary = false, ignoreMirrorArmor = false)
|
||||
def pbCanLowerStatStage?(stat, user = nil, move = nil, showFailMsg = false,
|
||||
ignoreContrary = false, ignoreMirrorArmor = false)
|
||||
return false if fainted?
|
||||
if !@battle.moldBreaker
|
||||
# Contrary
|
||||
@@ -126,12 +127,14 @@ class Battle::Battler
|
||||
return pbCanRaiseStatStage?(stat, user, move, showFailMsg, true)
|
||||
end
|
||||
# Mirror Armor
|
||||
if hasActiveAbility?(:MIRRORARMOR) && !ignoreMirrorArmor && user && user.index != @index
|
||||
return true if !statStageAtMin?(stat)
|
||||
if hasActiveAbility?(:MIRRORARMOR) && !ignoreMirrorArmor &&
|
||||
user && user.index != @index && !statStageAtMin?(stat)
|
||||
return true
|
||||
end
|
||||
end
|
||||
if !user || user.index != @index # Not self-inflicted
|
||||
if @effects[PBEffects::Substitute] > 0 && (ignoreMirrorArmor || !(move && move.ignoresSubstitute?(user)))
|
||||
if @effects[PBEffects::Substitute] > 0 &&
|
||||
(ignoreMirrorArmor || !(move && move.ignoresSubstitute?(user)))
|
||||
@battle.pbDisplay(_INTL("{1} is protected by its substitute!", pbThis)) if showFailMsg
|
||||
return false
|
||||
end
|
||||
@@ -328,13 +331,12 @@ class Battle::Battler
|
||||
pbThis, user.pbThis(true), user.abilityName))
|
||||
return false
|
||||
end
|
||||
if abilityActive?
|
||||
if Battle::AbilityEffects.triggerStatLossImmunity(self.ability, self, :ATTACK, @battle, false) ||
|
||||
Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(self.ability, self, :ATTACK, @battle, false)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
|
||||
pbThis, abilityName, user.pbThis(true), user.abilityName))
|
||||
return false
|
||||
end
|
||||
if abilityActive? &&
|
||||
(Battle::AbilityEffects.triggerStatLossImmunity(self.ability, self, :ATTACK, @battle, false) ||
|
||||
Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(self.ability, self, :ATTACK, @battle, false))
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
|
||||
pbThis, abilityName, user.pbThis(true), user.abilityName))
|
||||
return false
|
||||
end
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
|
||||
@@ -378,7 +378,7 @@ class Battle::Battler
|
||||
|
||||
def pbItemsOnUnnerveEnding
|
||||
@battle.pbPriority(true).each do |b|
|
||||
b.pbHeldItemTriggerCheck if b.item && b.item.is_berry?
|
||||
b.pbHeldItemTriggerCheck if b.item&.is_berry?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -175,12 +175,11 @@ class Battle::Battler
|
||||
elsif @effects[PBEffects::Encore] > 0 && choice[1] >= 0 &&
|
||||
@battle.pbCanShowCommands?(@index)
|
||||
idxEncoredMove = pbEncoredMoveIndex
|
||||
if idxEncoredMove >= 0 && @battle.pbCanChooseMove?(@index, idxEncoredMove, false)
|
||||
if choice[1] != idxEncoredMove # Change move if battler was Encored mid-round
|
||||
choice[1] = idxEncoredMove
|
||||
choice[2] = @moves[idxEncoredMove]
|
||||
choice[3] = -1 # No target chosen
|
||||
end
|
||||
if idxEncoredMove >= 0 && choice[1] != idxEncoredMove &&
|
||||
@battle.pbCanChooseMove?(@index, idxEncoredMove, false) # Change move if battler was Encored mid-round
|
||||
choice[1] = idxEncoredMove
|
||||
choice[2] = @moves[idxEncoredMove]
|
||||
choice[3] = -1 # No target chosen
|
||||
end
|
||||
end
|
||||
# Labels the move being used as "move"
|
||||
@@ -203,19 +202,17 @@ class Battle::Battler
|
||||
move = choice[2] # In case disobedience changed the move to be used
|
||||
return if !move # if move was not chosen somehow
|
||||
# Subtract PP
|
||||
if !specialUsage
|
||||
if !pbReducePP(move)
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!", pbThis, move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
pbEndTurn(choice)
|
||||
return
|
||||
end
|
||||
if !specialUsage && !pbReducePP(move)
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!", pbThis, move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
pbEndTurn(choice)
|
||||
return
|
||||
end
|
||||
# Stance Change
|
||||
if isSpecies?(:AEGISLASH) && self.ability == :STANCECHANGE
|
||||
@@ -356,21 +353,21 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
# Protean
|
||||
if user.hasActiveAbility?([:LIBERO, :PROTEAN]) && !move.callsAnotherMove? && !move.snatched
|
||||
if user.pbHasOtherType?(move.calcType) && !GameData::Type.get(move.calcType).pseudo_type
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
|
||||
@battle.pbHideAbilitySplash(user)
|
||||
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
|
||||
# Pokémon which becomes Ghost-type because of Protean, it should
|
||||
# target and curse itself. I think this is silly, so I'm making it
|
||||
# choose a random opponent to curse instead.
|
||||
if move.function == "CurseTargetOrLowerUserSpd1RaiseUserAtkDef1" && targets.length == 0
|
||||
choice[3] = -1
|
||||
targets = pbFindTargets(choice, move, user)
|
||||
end
|
||||
if user.hasActiveAbility?([:LIBERO, :PROTEAN]) &&
|
||||
!move.callsAnotherMove? && !move.snatched &&
|
||||
user.pbHasOtherType?(move.calcType) && !GameData::Type.get(move.calcType).pseudo_type
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
|
||||
@battle.pbHideAbilitySplash(user)
|
||||
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
|
||||
# Pokémon which becomes Ghost-type because of Protean, it should
|
||||
# target and curse itself. I think this is silly, so I'm making it
|
||||
# choose a random opponent to curse instead.
|
||||
if move.function == "CurseTargetOrLowerUserSpd1RaiseUserAtkDef1" && targets.length == 0
|
||||
choice[3] = -1
|
||||
targets = pbFindTargets(choice, move, user)
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -486,7 +483,7 @@ class Battle::Battler
|
||||
end
|
||||
pbProcessMoveHit(move, b, newTargets, 0, false) if success
|
||||
b.lastMoveFailed = true if !success
|
||||
targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? }
|
||||
targets.each { |otherB| otherB.pbFaint if otherB&.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
# Magic Coat's bouncing back (move has no targets)
|
||||
@@ -502,14 +499,14 @@ class Battle::Battler
|
||||
success = pbProcessMoveHit(move, mc, [], 0, false)
|
||||
end
|
||||
mc.lastMoveFailed = true if !success
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
targets.each { |b| b.pbFaint if b&.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
end
|
||||
# Move-specific effects after all hits
|
||||
targets.each { |b| move.pbEffectAfterAllHits(user, b) }
|
||||
# Faint if 0 HP
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
targets.each { |b| b.pbFaint if b&.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
# External/general effects after all hits. Eject Button, Shell Bell, etc.
|
||||
pbEffectsAfterMove(user, targets, move, realNumHits)
|
||||
@@ -707,7 +704,7 @@ class Battle::Battler
|
||||
@battle.pbPriority(true).each { |b| b.pbItemHPHealCheck }
|
||||
# Animate battlers fainting (checks all battlers rather than just targets
|
||||
# because Flame Burst's splash damage affects non-targets)
|
||||
@battle.pbPriority(true).each { |b| b.pbFaint if b && b.fainted? }
|
||||
@battle.pbPriority(true).each { |b| b.pbFaint if b&.fainted? }
|
||||
end
|
||||
@battle.pbJudgeCheckpoint(user, move)
|
||||
# Main effect (recoil/drain, etc.)
|
||||
@@ -716,7 +713,7 @@ class Battle::Battler
|
||||
move.pbEffectAgainstTarget(user, b)
|
||||
end
|
||||
move.pbEffectGeneral(user)
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
targets.each { |b| b.pbFaint if b&.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
# Additional effect
|
||||
if !user.hasActiveAbility?(:SHEERFORCE)
|
||||
@@ -761,13 +758,12 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
# Fainting
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
targets.each { |b| b.pbFaint if 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
|
||||
if move.pbRepeatHit? && hitNum == 0 &&
|
||||
targets.any? { |b| !b.fainted? && !b.damageState.unaffected }
|
||||
pbProcessMoveHit(move, user, all_targets, 1, skipAccuracyCheck)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -265,12 +265,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
# Paralysis
|
||||
if @status == :PARALYSIS
|
||||
if @battle.pbRandom(100) < 25
|
||||
pbContinueStatus
|
||||
@lastMoveFailed = true
|
||||
return false
|
||||
end
|
||||
if @status == :PARALYSIS && @battle.pbRandom(100) < 25
|
||||
pbContinueStatus
|
||||
@lastMoveFailed = true
|
||||
return false
|
||||
end
|
||||
# Infatuation
|
||||
if @effects[PBEffects::Attract] >= 0
|
||||
@@ -358,10 +356,9 @@ class Battle::Battler
|
||||
end
|
||||
target.damageState.protected = true
|
||||
@battle.successStates[user.index].protected = true
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect?
|
||||
if user.pbCanLowerStatStage?(:ATTACK, target)
|
||||
user.pbLowerStatStage(:ATTACK, (Settings::MECHANICS_GENERATION >= 8) ? 1 : 2, target)
|
||||
end
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
|
||||
user.pbCanLowerStatStage?(:ATTACK, target)
|
||||
user.pbLowerStatStage(:ATTACK, (Settings::MECHANICS_GENERATION >= 8) ? 1 : 2, target)
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -389,8 +386,9 @@ class Battle::Battler
|
||||
end
|
||||
target.damageState.protected = true
|
||||
@battle.successStates[user.index].protected = true
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect?
|
||||
user.pbPoison(target) if user.pbCanPoison?(target, false)
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
|
||||
user.pbCanPoison?(target, false)
|
||||
user.pbPoison(target)
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -402,10 +400,9 @@ class Battle::Battler
|
||||
end
|
||||
target.damageState.protected = true
|
||||
@battle.successStates[user.index].protected = true
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect?
|
||||
if user.pbCanLowerStatStage?(:DEFENSE, target)
|
||||
user.pbLowerStatStage(:DEFENSE, 2, target)
|
||||
end
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
|
||||
user.pbCanLowerStatStage?(:DEFENSE, target)
|
||||
user.pbLowerStatStage(:DEFENSE, 2, target)
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -550,8 +547,8 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
if target.effects[PBEffects::SkyDrop] >= 0 &&
|
||||
target.effects[PBEffects::SkyDrop] != user.index
|
||||
miss = true if !move.hitsFlyingTargets?
|
||||
target.effects[PBEffects::SkyDrop] != user.index && !move.hitsFlyingTargets?
|
||||
miss = true
|
||||
end
|
||||
end
|
||||
target.damageState.invulnerable = true if miss
|
||||
@@ -572,9 +569,7 @@ class Battle::Battler
|
||||
def pbMissMessage(move, user, target)
|
||||
if target.damageState.affection_missed
|
||||
@battle.pbDisplay(_INTL("{1} avoided the move in time with your shout!", target.pbThis))
|
||||
elsif move.pbTarget(user).num_targets > 1
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!", target.pbThis))
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]
|
||||
elsif move.pbTarget(user).num_targets > 1 || target.effects[PBEffects::TwoTurnAttack]
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!", target.pbThis))
|
||||
elsif !move.pbMissMessage(user, target)
|
||||
@battle.pbDisplay(_INTL("{1}'s attack missed!", user.pbThis))
|
||||
|
||||
@@ -45,27 +45,26 @@ class Battle::Battler
|
||||
end
|
||||
if target.opposes?(user)
|
||||
# Rage
|
||||
if target.effects[PBEffects::Rage] && !target.fainted?
|
||||
if target.pbCanRaiseStatStage?(:ATTACK, target)
|
||||
@battle.pbDisplay(_INTL("{1}'s rage is building!", target.pbThis))
|
||||
target.pbRaiseStatStage(:ATTACK, 1, target)
|
||||
end
|
||||
if target.effects[PBEffects::Rage] && !target.fainted? &&
|
||||
target.pbCanRaiseStatStage?(:ATTACK, target)
|
||||
@battle.pbDisplay(_INTL("{1}'s rage is building!", target.pbThis))
|
||||
target.pbRaiseStatStage(:ATTACK, 1, target)
|
||||
end
|
||||
# Beak Blast
|
||||
if target.effects[PBEffects::BeakBlast]
|
||||
PBDebug.log("[Lingering effect] #{target.pbThis}'s Beak Blast")
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect?
|
||||
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
|
||||
if move.pbContactMove?(user) && user.affectedByContactEffect? &&
|
||||
target.pbCanBurn?(user, false, self)
|
||||
target.pbBurn(user)
|
||||
end
|
||||
end
|
||||
# Shell Trap (make the trapper move next if the trap was triggered)
|
||||
if target.effects[PBEffects::ShellTrap] &&
|
||||
@battle.choices[target.index][0] == :UseMove && !target.movedThisRound?
|
||||
if target.damageState.hpLost > 0 && !target.damageState.substitute && move.physicalMove?
|
||||
target.tookPhysicalHit = true
|
||||
target.effects[PBEffects::MoveNext] = true
|
||||
target.effects[PBEffects::Quash] = 0
|
||||
end
|
||||
if target.effects[PBEffects::ShellTrap] && move.physicalMove? &&
|
||||
@battle.choices[target.index][0] == :UseMove && !target.movedThisRound? &&
|
||||
target.damageState.hpLost > 0 && !target.damageState.substitute
|
||||
target.tookPhysicalHit = true
|
||||
target.effects[PBEffects::MoveNext] = true
|
||||
target.effects[PBEffects::Quash] = 0
|
||||
end
|
||||
# Grudge
|
||||
if target.effects[PBEffects::Grudge] && target.fainted?
|
||||
@@ -74,10 +73,9 @@ class Battle::Battler
|
||||
user.pbThis, move.name))
|
||||
end
|
||||
# Destiny Bond (recording that it should apply)
|
||||
if target.effects[PBEffects::DestinyBond] && target.fainted?
|
||||
if user.effects[PBEffects::DestinyBondTarget] < 0
|
||||
user.effects[PBEffects::DestinyBondTarget] = target.index
|
||||
end
|
||||
if target.effects[PBEffects::DestinyBond] && target.fainted? &&
|
||||
user.effects[PBEffects::DestinyBondTarget] < 0
|
||||
user.effects[PBEffects::DestinyBondTarget] = target.index
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -114,10 +112,10 @@ class Battle::Battler
|
||||
if user.abilityActive?
|
||||
Battle::AbilityEffects.triggerOnEndOfUsingMove(user.ability, user, targets, move, @battle)
|
||||
end
|
||||
# Greninja - Battle Bond
|
||||
if !user.fainted? && !user.effects[PBEffects::Transform] &&
|
||||
user.isSpecies?(:GRENINJA) && user.ability == :BATTLEBOND
|
||||
if !@battle.pbAllFainted?(user.idxOpposingSide) &&
|
||||
!@battle.pbAllFainted?(user.idxOpposingSide)
|
||||
# Greninja - Battle Bond
|
||||
if user.isSpecies?(:GRENINJA) && user.ability == :BATTLEBOND &&
|
||||
!@battle.battleBond[user.index & 1][user.pokemonIndex]
|
||||
numFainted = 0
|
||||
targets.each { |b| numFainted += 1 if b.damageState.fainted }
|
||||
@@ -129,11 +127,8 @@ class Battle::Battler
|
||||
user.pbChangeForm(2, _INTL("{1} became Ash-Greninja!", user.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
# Cramorant = Gulp Missile
|
||||
if !user.fainted? && !user.effects[PBEffects::Transform] &&
|
||||
user.isSpecies?(:CRAMORANT) && user.ability == :GULPMISSILE && user.form == 0
|
||||
if !@battle.pbAllFainted?(user.idxOpposingSide) &&
|
||||
# Cramorant = Gulp Missile
|
||||
if user.isSpecies?(:CRAMORANT) && user.ability == :GULPMISSILE && user.form == 0 &&
|
||||
((move.id == :SURF && numHits > 0) || (move.id == :DIVE && move.chargingTurn))
|
||||
# NOTE: Intentionally no ability splash or message here.
|
||||
user.pbChangeForm((user.hp > user.totalhp / 2) ? 1 : 2, nil)
|
||||
@@ -181,16 +176,13 @@ class Battle::Battler
|
||||
def pbEffectsAfterMove2(user, targets, move, numHits, switched_battlers)
|
||||
# Target's held item (Eject Button, Red Card, Eject Pack)
|
||||
@battle.pbPriority(true).each do |b|
|
||||
if targets.any? { |targetB| targetB.index == b.index }
|
||||
if !b.damageState.unaffected && b.damageState.calcDamage > 0 && b.itemActive?
|
||||
Battle::ItemEffects.triggerAfterMoveUseFromTarget(b.item, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
if targets.any? { |targetB| targetB.index == b.index } &&
|
||||
!b.damageState.unaffected && b.damageState.calcDamage > 0 && b.itemActive?
|
||||
Battle::ItemEffects.triggerAfterMoveUseFromTarget(b.item, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
# Target's Eject Pack
|
||||
if switched_battlers.empty? && b.index != user.index
|
||||
if b.pbItemOnStatDropped(user)
|
||||
switched_battlers.push(b.index)
|
||||
end
|
||||
if switched_battlers.empty? && b.index != user.index && b.pbItemOnStatDropped(user)
|
||||
switched_battlers.push(b.index)
|
||||
end
|
||||
end
|
||||
# User's held item (Life Orb, Shell Bell, Throat Spray, Eject Pack)
|
||||
@@ -199,16 +191,14 @@ class Battle::Battler
|
||||
end
|
||||
# Target's ability (Berserk, Color Change, Emergency Exit, Pickpocket, Wimp Out)
|
||||
@battle.pbPriority(true).each do |b|
|
||||
if targets.any? { |targetB| targetB.index == b.index }
|
||||
if !b.damageState.unaffected && !switched_battlers.include?(b.index) && b.abilityActive?
|
||||
Battle::AbilityEffects.triggerAfterMoveUseFromTarget(b.ability, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
if targets.any? { |targetB| targetB.index == b.index } &&
|
||||
!b.damageState.unaffected && !switched_battlers.include?(b.index) && b.abilityActive?
|
||||
Battle::AbilityEffects.triggerAfterMoveUseFromTarget(b.ability, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
# Target's Emergency Exit, Wimp Out (including for Pokémon hurt by Flame Burst)
|
||||
if switched_battlers.empty? && move.damagingMove? && b.index != user.index
|
||||
if b.pbAbilitiesOnDamageTaken(user)
|
||||
switched_battlers.push(b.index)
|
||||
end
|
||||
if switched_battlers.empty? && move.damagingMove? &&
|
||||
b.index != user.index && b.pbAbilitiesOnDamageTaken(user)
|
||||
switched_battlers.push(b.index)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -216,16 +206,12 @@ class Battle::Battler
|
||||
# Everything in this method is negated by Sheer Force.
|
||||
def pbEffectsAfterMove3(user, targets, move, numHits, switched_battlers)
|
||||
# User's held item that switches it out (Eject Pack)
|
||||
if switched_battlers.empty?
|
||||
if user.pbItemOnStatDropped(user)
|
||||
switched_battlers.push(user.index)
|
||||
end
|
||||
if switched_battlers.empty? && user.pbItemOnStatDropped(user)
|
||||
switched_battlers.push(user.index)
|
||||
end
|
||||
# User's ability (Emergency Exit, Wimp Out)
|
||||
if switched_battlers.empty? && move.damagingMove?
|
||||
if user.pbAbilitiesOnDamageTaken(user)
|
||||
switched_battlers.push(user.index)
|
||||
end
|
||||
if switched_battlers.empty? && move.damagingMove? && user.pbAbilitiesOnDamageTaken(user)
|
||||
switched_battlers.push(user.index)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user