More aligning of code

This commit is contained in:
Maruno17
2021-12-19 12:19:08 +00:00
parent 13a238cc6a
commit 33781493f4
121 changed files with 977 additions and 838 deletions

View File

@@ -86,8 +86,8 @@ class Battle::Move
return false if @battle.moldBreaker
ret = false
if target.abilityActive?
ret = Battle::AbilityEffects.triggerMoveImmunity(target.ability,
user, target, self, @calcType, @battle, show_message)
ret = Battle::AbilityEffects.triggerMoveImmunity(target.ability, user, target,
self, @calcType, @battle, show_message)
end
return ret
end
@@ -131,7 +131,7 @@ class Battle::Move
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} is unaffected because of its {2}!",
target.pbThis, target.abilityName))
target.pbThis, target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -145,7 +145,7 @@ class Battle::Move
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} is unaffected because of {2}'s {3}!",
target.pbThis, b.pbThis(true), b.abilityName))
target.pbThis, b.pbThis(true), b.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -294,7 +294,7 @@ class Battle::Move
if target.damageState.affection_critical
if numTargets > 1
@battle.pbDisplay(_INTL("{1} landed a critical hit on {2}, wishing to be praised!",
user.pbThis, target.pbThis(true)))
user.pbThis, target.pbThis(true)))
else
@battle.pbDisplay(_INTL("{1} landed a critical hit, wishing to be praised!", user.pbThis))
end

View File

@@ -131,26 +131,31 @@ class Battle::Move
def pbCalcAccuracyModifiers(user, target, modifiers)
# Ability effects that alter accuracy calculation
if user.abilityActive?
Battle::AbilityEffects.triggerAccuracyCalcFromUser(user.ability,
modifiers, user, target, self, @calcType)
Battle::AbilityEffects.triggerAccuracyCalcFromUser(
user.ability, modifiers, user, target, self, @calcType
)
end
user.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerAccuracyCalcFromAlly(b.ability,
modifiers, user, target, self, @calcType)
Battle::AbilityEffects.triggerAccuracyCalcFromAlly(
b.ability, modifiers, user, target, self, @calcType
)
end
if target.abilityActive? && !@battle.moldBreaker
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(target.ability,
modifiers, user, target, self, @calcType)
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(
target.ability, modifiers, user, target, self, @calcType
)
end
# Item effects that alter accuracy calculation
if user.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromUser(user.item,
modifiers, user, target, self, @calcType)
Battle::ItemEffects.triggerAccuracyCalcFromUser(
user.item, modifiers, user, target, self, @calcType
)
end
if target.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromTarget(target.item,
modifiers, user, target, self, @calcType)
Battle::ItemEffects.triggerAccuracyCalcFromTarget(
target.item, modifiers, user, target, self, @calcType
)
end
# Other effects, inc. ones that set accuracy_multiplier or evasion_stage to
# specific values
@@ -295,8 +300,9 @@ class Battle::Move
end
# Ability effects that alter damage
if user.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromUser(user.ability,
user, target, self, multipliers, baseDmg, type)
Battle::AbilityEffects.triggerDamageCalcFromUser(
user.ability, user, target, self, multipliers, baseDmg, type
)
end
if !@battle.moldBreaker
# NOTE: It's odd that the user's Mold Breaker prevents its partner's
@@ -304,29 +310,35 @@ class Battle::Move
# how it works.
user.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromAlly(b.ability,
user, target, self, multipliers, baseDmg, type)
Battle::AbilityEffects.triggerDamageCalcFromAlly(
b.ability, user, target, self, multipliers, baseDmg, type
)
end
if target.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromTarget(target.ability,
user, target, self, multipliers, baseDmg, type) if !@battle.moldBreaker
Battle::AbilityEffects.triggerDamageCalcFromTargetNonIgnorable(target.ability,
user, target, self, multipliers, baseDmg, type)
Battle::AbilityEffects.triggerDamageCalcFromTarget(
target.ability, user, target, self, multipliers, baseDmg, type
)
Battle::AbilityEffects.triggerDamageCalcFromTargetNonIgnorable(
target.ability, user, target, self, multipliers, baseDmg, type
)
end
target.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromTargetAlly(b.ability,
user, target, self, multipliers, baseDmg, type)
Battle::AbilityEffects.triggerDamageCalcFromTargetAlly(
b.ability, user, target, self, multipliers, baseDmg, type
)
end
end
# Item effects that alter damage
if user.itemActive?
Battle::ItemEffects.triggerDamageCalcFromUser(user.item,
user, target, self, multipliers, baseDmg, type)
Battle::ItemEffects.triggerDamageCalcFromUser(
user.item, user, target, self, multipliers, baseDmg, type
)
end
if target.itemActive?
Battle::ItemEffects.triggerDamageCalcFromTarget(target.item,
user, target, self, multipliers, baseDmg, type)
Battle::ItemEffects.triggerDamageCalcFromTarget(
target.item, user, target, self, multipliers, baseDmg, type
)
end
# Parental Bond's second attack
if user.effects[PBEffects::ParentalBond] == 1

View File

@@ -256,7 +256,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
for i in 0...@statDown.length / 2
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user,
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim = false
end
showMirrorArmorSplash = false
@@ -567,7 +567,7 @@ class Battle::Move::PledgeMove < Battle::Move
user.effects[PBEffects::FirstPledge] = nil
return if !@pledgeSetup
@battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",
user.pbThis, @pledgeOtherUser.pbThis(true)))
user.pbThis, @pledgeOtherUser.pbThis(true)))
@pledgeOtherUser.effects[PBEffects::FirstPledge] = @function
@pledgeOtherUser.effects[PBEffects::MoveNext] = true
user.lastMoveFailed = true # Treated as a failure for Stomping Tantrum

View File

@@ -386,7 +386,7 @@ class Battle::Move::AddSpikesToFoeSide < Battle::Move
def pbEffectGeneral(user)
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
@battle.pbDisplay(_INTL("Spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
user.pbOpposingTeam(true)))
end
end
@@ -408,7 +408,7 @@ class Battle::Move::AddToxicSpikesToFoeSide < Battle::Move
def pbEffectGeneral(user)
user.pbOpposingSide.effects[PBEffects::ToxicSpikes] += 1
@battle.pbDisplay(_INTL("Poison spikes were scattered all around {1}'s feet!",
user.pbOpposingTeam(true)))
user.pbOpposingTeam(true)))
end
end
@@ -429,7 +429,7 @@ class Battle::Move::AddStealthRocksToFoeSide < Battle::Move
def pbEffectGeneral(user)
user.pbOpposingSide.effects[PBEffects::StealthRock] = true
@battle.pbDisplay(_INTL("Pointed stones float in the air around {1}!",
user.pbOpposingTeam(true)))
user.pbOpposingTeam(true)))
end
end
@@ -450,7 +450,7 @@ class Battle::Move::AddStickyWebToFoeSide < Battle::Move
def pbEffectGeneral(user)
user.pbOpposingSide.effects[PBEffects::StickyWeb] = true
@battle.pbDisplay(_INTL("A sticky web has been laid out beneath {1}'s feet!",
user.pbOpposingTeam(true)))
user.pbOpposingTeam(true)))
end
end
@@ -672,7 +672,7 @@ class Battle::Move::UserSwapsPositionsWithAlly < Battle::Move
idxB = @idxAlly
if @battle.pbSwapBattlers(idxA, idxB)
@battle.pbDisplay(_INTL("{1} and {2} switched places!",
@battle.battlers[idxB].pbThis, @battle.battlers[idxA].pbThis(true)))
@battle.battlers[idxB].pbThis, @battle.battlers[idxA].pbThis(true)))
[idxA, idxB].each { |idx| @battle.pbEffectsOnBattlerEnteringPosition(@battle.battlers[idx]) }
end
end

View File

@@ -1386,7 +1386,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move
for i in 0...@statDown.length / 2
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user,
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim = false
end
showMirrorArmorSplash = false

View File

@@ -820,7 +820,7 @@ class Battle::Move::SetUserTypesToTargetTypes < Battle::Move
def pbEffectAgainstTarget(user, target)
user.pbChangeTypes(target)
@battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",
user.pbThis, target.pbThis(true)))
user.pbThis, target.pbThis(true)))
end
end
@@ -1067,7 +1067,7 @@ class Battle::Move::SetUserAbilityToTargetAbility < Battle::Move
user.ability = target.ability
@battle.pbReplaceAbilitySplash(user)
@battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",
user.pbThis, target.pbThis(true), target.abilityName))
user.pbThis, target.pbThis(true), target.abilityName))
@battle.pbHideAbilitySplash(user)
user.pbOnLosingAbility(oldAbil)
user.pbTriggerAbilityOnGainingIt
@@ -1169,7 +1169,7 @@ class Battle::Move::UserTargetSwapAbilities < Battle::Move
@battle.pbDisplay(_INTL("{1} swapped Abilities with its target!", user.pbThis))
else
@battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
user.pbThis, target.abilityName, user.abilityName))
user.pbThis, target.abilityName, user.abilityName))
end
if user.opposes?(target)
@battle.pbHideAbilitySplash(user)
@@ -1359,7 +1359,7 @@ class Battle::Move::StartGravity < Battle::Move
showMessage = true
end
@battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!",
b.pbThis)) if showMessage
b.pbThis)) if showMessage
end
end
end

View File

@@ -80,7 +80,7 @@ class Battle::Move::OHKO < Battle::Move::FixedDamageMove
@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))
target.pbThis(true), target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -149,12 +149,12 @@ class Battle::Move::DamageTargetAlly < Battle::Move
end
if hitAlly.length == 2
@battle.pbDisplay(_INTL("The bursting flame hit {1} and {2}!",
@battle.battlers[hitAlly[0][0]].pbThis(true),
@battle.battlers[hitAlly[1][0]].pbThis(true)))
@battle.battlers[hitAlly[0][0]].pbThis(true),
@battle.battlers[hitAlly[1][0]].pbThis(true)))
elsif hitAlly.length > 0
hitAlly.each do |b|
@battle.pbDisplay(_INTL("The bursting flame hit {1}!",
@battle.battlers[b[0]].pbThis(true)))
@battle.battlers[b[0]].pbThis(true)))
end
end
hitAlly.each { |b| @battle.battlers[b[0]].pbItemHPHealCheck }
@@ -824,7 +824,7 @@ class Battle::Move::StartWeakenDamageAgainstUserSideIfHail < Battle::Move
user.pbOwnSide.effects[PBEffects::AuroraVeil] = 5
user.pbOwnSide.effects[PBEffects::AuroraVeil] = 8 if user.hasActiveItem?(:LIGHTCLAY)
@battle.pbDisplay(_INTL("{1} made {2} stronger against physical and special moves!",
@name, user.pbTeam(true)))
@name, user.pbTeam(true)))
end
end

View File

@@ -468,7 +468,7 @@ class Battle::Move::UserLosesHalfOfTotalHPExplosive < Battle::Move
@battle.pbDisplay(_INTL("{1} cannot use {2}!", user.pbThis, @name))
else
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
end
@battle.pbHideAbilitySplash(bearer)
return true
@@ -500,7 +500,7 @@ class Battle::Move::UserFaintsExplosive < Battle::Move
@battle.pbDisplay(_INTL("{1} cannot use {2}!", user.pbThis, @name))
else
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
end
@battle.pbHideAbilitySplash(bearer)
return true

View File

@@ -98,7 +98,7 @@ class Battle::Move::UserTargetSwapItems < Battle::Move
@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))
target.pbThis(true), target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -223,7 +223,7 @@ class Battle::Move::CorrodeTargetItem < Battle::Move
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} is unaffected because of its {2}!",
target.pbThis(true), target.abilityName))
target.pbThis(true), target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -239,7 +239,7 @@ class Battle::Move::CorrodeTargetItem < Battle::Move
def pbEffectAgainstTarget(user, target)
@battle.corrosiveGas[target.index % 2][target.pokemonIndex] = true
@battle.pbDisplay(_INTL("{1} corroded {2}'s {3}!",
user.pbThis, target.pbThis(true), target.itemName))
user.pbThis, target.pbThis(true), target.itemName))
end
end

View File

@@ -521,7 +521,7 @@ class Battle::Move::UserAddStockpileRaiseDefSpDef1 < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Stockpile] += 1
@battle.pbDisplay(_INTL("{1} stockpiled {2}!",
user.pbThis, user.effects[PBEffects::Stockpile]))
user.pbThis, user.effects[PBEffects::Stockpile]))
showAnim = true
if user.pbCanRaiseStatStage?(:DEFENSE, user, self)
if user.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)

View File

@@ -37,7 +37,7 @@ class Battle::Move::SwitchOutUserStatusMove < Battle::Move
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
return if user.wild?
@battle.pbDisplay(_INTL("{1} went back to {2}!", user.pbThis,
@battle.pbGetOwnerName(user.index)))
@battle.pbGetOwnerName(user.index)))
@battle.pbPursuit(user.index)
return if user.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
@@ -71,7 +71,7 @@ class Battle::Move::SwitchOutUserDamagingMove < Battle::Move
return if targetSwitched
return if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbDisplay(_INTL("{1} went back to {2}!", user.pbThis,
@battle.pbGetOwnerName(user.index)))
@battle.pbGetOwnerName(user.index)))
@battle.pbPursuit(user.index)
return if user.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
@@ -103,7 +103,7 @@ class Battle::Move::LowerTargetAtkSpAtk1SwitchOutUser < Battle::Move::TargetMult
return if switcher.fainted? || numHits == 0
return if !@battle.pbCanChooseNonActive?(switcher.index)
@battle.pbDisplay(_INTL("{1} went back to {2}!", switcher.pbThis,
@battle.pbGetOwnerName(switcher.index)))
@battle.pbGetOwnerName(switcher.index)))
@battle.pbPursuit(switcher.index)
return if switcher.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(switcher.index) # Owner chooses
@@ -673,7 +673,7 @@ class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move
reduction = [3, last_move.pp].min
target.pbSetPP(last_move, last_move.pp - reduction)
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
target.pbThis(true), last_move.name, reduction))
target.pbThis(true), last_move.name, reduction))
end
end
@@ -698,7 +698,7 @@ class Battle::Move::LowerPPOfTargetLastMoveBy4 < Battle::Move
reduction = [4, last_move.pp].min
target.pbSetPP(last_move, last_move.pp - reduction)
@battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",
target.pbThis(true), last_move.name, reduction))
target.pbThis(true), last_move.name, reduction))
end
end
@@ -733,7 +733,7 @@ class Battle::Move::DisableTargetLastMoveUsed < Battle::Move
target.effects[PBEffects::Disable] = 5
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!", target.pbThis,
GameData::Move.get(target.lastRegularMoveUsed).name))
GameData::Move.get(target.lastRegularMoveUsed).name))
target.pbItemStatusCureCheck
end
end
@@ -853,7 +853,7 @@ class Battle::Move::DisableTargetStatusMoves < Battle::Move
@battle.pbDisplay(_INTL("But it failed!"))
else
@battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
target.pbThis(true), target.abilityName))
target.pbThis(true), target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -897,8 +897,10 @@ end
class Battle::Move::DisableTargetSoundMoves < Battle::Move
def pbAdditionalEffect(user, target)
return if target.fainted? || target.damageState.substitute
@battle.pbDisplay(_INTL("The effects of {1} prevent {2} from using certain moves!",
@name, target.pbThis(true))) if target.effects[PBEffects::ThroatChop] == 0
if target.effects[PBEffects::ThroatChop] == 0
@battle.pbDisplay(_INTL("The effects of {1} prevent {2} from using certain moves!",
@name, target.pbThis(true)))
end
target.effects[PBEffects::ThroatChop] = 3
end
end