Yet more Rubocopping

This commit is contained in:
Maruno17
2021-12-23 00:27:17 +00:00
parent 514fe13ca2
commit 132a16950d
171 changed files with 1455 additions and 1647 deletions

View File

@@ -140,7 +140,7 @@ class Battle::Move
def ignoresSubstitute?(user) # user is the Pokémon using this move
if Settings::MECHANICS_GENERATION >= 6
return true if soundMove?
return true if user && user.hasActiveAbility?(:INFILTRATOR)
return true if user&.hasActiveAbility?(:INFILTRATOR)
end
return false
end

View File

@@ -31,28 +31,29 @@ class Battle::Move
#=============================================================================
def pbCalcTypeModSingle(moveType, defType, user, target)
ret = Effectiveness.calculate_one(moveType, defType)
# Ring Target
if target.hasActiveItem?(:RINGTARGET)
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if Effectiveness.ineffective_type?(moveType, defType)
end
# Foresight
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
Effectiveness.ineffective_type?(moveType, defType)
end
# Miracle Eye
if target.effects[PBEffects::MiracleEye]
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
Effectiveness.ineffective_type?(moveType, defType)
end
# Delta Stream's weather
if target.effectiveWeather == :StrongWinds
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
Effectiveness.super_effective_type?(moveType, defType)
if Effectiveness.ineffective_type?(moveType, defType)
# Ring Target
if target.hasActiveItem?(:RINGTARGET)
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
end
# Foresight
if (user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]) &&
defType == :GHOST
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
end
# Miracle Eye
if target.effects[PBEffects::MiracleEye] && defType == :DARK
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
end
elsif Effectiveness.super_effective_type?(moveType, defType)
# Delta Stream's weather
if target.effectiveWeather == :StrongWinds && defType == :FLYING
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
end
end
# Grounded Flying-type Pokémon become susceptible to Ground moves
if !target.airborne?
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
if !target.airborne? && defType == :FLYING && moveType == :GROUND
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
end
return ret
end
@@ -493,9 +494,9 @@ class Battle::Move
def pbAdditionalEffectChance(user, target, effectChance = 0)
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
ret = (effectChance > 0) ? effectChance : @addlEffect
if Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment"
ret *= 2 if user.hasActiveAbility?(:SERENEGRACE) ||
user.pbOwnSide.effects[PBEffects::Rainbow] > 0
if (Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment") &&
(user.hasActiveAbility?(:SERENEGRACE) || user.pbOwnSide.effects[PBEffects::Rainbow] > 0)
ret *= 2
end
ret = 100 if $DEBUG && Input.press?(Input::CTRL)
return ret
@@ -507,9 +508,8 @@ class Battle::Move
return 0 if flinchingMove?
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
ret = 0
if user.hasActiveAbility?(:STENCH, true)
ret = 10
elsif user.hasActiveItem?([:KINGSROCK, :RAZORFANG], true)
if user.hasActiveAbility?(:STENCH, true) ||
user.hasActiveItem?([:KINGSROCK, :RAZORFANG], true)
ret = 10
end
ret *= 2 if user.hasActiveAbility?(:SERENEGRACE) ||

View File

@@ -1427,9 +1427,7 @@ class Battle::Move::RaiseUserAndAlliesAtkDef1 < Battle::Move
def pbEffectAgainstTarget(user, target)
showAnim = true
if target.pbCanRaiseStatStage?(:ATTACK, user, self)
if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
showAnim = false
end
showAnim = false if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
end
if target.pbCanRaiseStatStage?(:DEFENSE, user, self)
target.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
@@ -1477,9 +1475,7 @@ class Battle::Move::RaisePlusMinusUserAndAlliesAtkSpAtk1 < Battle::Move
def pbEffectAgainstTarget(user, target)
showAnim = true
if target.pbCanRaiseStatStage?(:ATTACK, user, self)
if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
showAnim = false
end
showAnim = false if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
end
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
target.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user, showAnim)
@@ -1532,9 +1528,7 @@ class Battle::Move::RaisePlusMinusUserAndAlliesDefSpDef1 < Battle::Move
def pbEffectAgainstTarget(user, target)
showAnim = true
if target.pbCanRaiseStatStage?(:DEFENSE, user, self)
if target.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
showAnim = false
end
showAnim = false if target.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
end
if target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user, self)
target.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, user, showAnim)
@@ -1579,9 +1573,7 @@ class Battle::Move::RaiseGroundedGrassBattlersAtkSpAtk1 < Battle::Move
def pbEffectAgainstTarget(user, target)
showAnim = true
if target.pbCanRaiseStatStage?(:ATTACK, user, self)
if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
showAnim = false
end
showAnim = false if target.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
end
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
target.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user, showAnim)
@@ -1729,9 +1721,7 @@ class Battle::Move::UserStealTargetPositiveStatStages < Battle::Move
GameData::Stat.each_battle do |s|
next if target.stages[s.id] <= 0
if user.pbCanRaiseStatStage?(s.id, user, self)
if user.pbRaiseStatStage(s.id, target.stages[s.id], user, showAnim)
showAnim = false
end
showAnim = false if user.pbRaiseStatStage(s.id, target.stages[s.id], user, showAnim)
end
target.statsLoweredThisRound = true
target.statsDropped = true

View File

@@ -209,8 +209,8 @@ class Battle::Move::ParalyzeFlinchTarget < Battle::Move
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
if target.pbCanParalyze?(user, false, self) && @battle.pbRandom(100) < chance
target.pbParalyze(user)
end
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
@@ -258,8 +258,8 @@ class Battle::Move::BurnFlinchTarget < Battle::Move
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
if target.pbCanBurn?(user, false, self) && @battle.pbRandom(100) < chance
target.pbBurn(user)
end
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
@@ -317,8 +317,8 @@ class Battle::Move::FreezeFlinchTarget < Battle::Move
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbFreeze if target.pbCanFreeze?(user, false, self)
if target.pbCanFreeze?(user, false, self) && @battle.pbRandom(100) < chance
target.pbFreeze
end
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
@@ -429,7 +429,7 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
def pbMoveFailed?(user, targets)
has_effect = @battle.allSameSideBattlers(user).any? { |b| b.status != :NONE }
if !has_effect
has_effect = @battle.pbParty(user.index).any? { |pkmn| pkmn && pkmn.able? && pkmn.status != :NONE }
has_effect = @battle.pbParty(user.index).any? { |pkmn| pkmn&.able? && pkmn.status != :NONE }
end
if !has_effect
@battle.pbDisplay(_INTL("But it failed!"))

View File

@@ -221,13 +221,12 @@ end
class Battle::Move::TwoTurnAttackOneTurnInSun < Battle::Move::TwoTurnMove
def pbIsChargingTurn?(user)
ret = super
if !user.effects[PBEffects::TwoTurnAttack]
if [:Sun, :HarshSun].include?(user.effectiveWeather)
@powerHerb = false
@chargingTurn = true
@damagingTurn = true
return false
end
if !user.effects[PBEffects::TwoTurnAttack] &&
[:Sun, :HarshSun].include?(user.effectiveWeather)
@powerHerb = false
@chargingTurn = true
@damagingTurn = true
return false
end
return ret
end

View File

@@ -175,9 +175,7 @@ class Battle::Move::CurseTargetOrLowerUserSpd1RaiseUserAtkDef1 < Battle::Move
end
showAnim = true
if user.pbCanRaiseStatStage?(:ATTACK, user, self)
if user.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
showAnim = false
end
showAnim = false if user.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
end
if user.pbCanRaiseStatStage?(:DEFENSE, user, self)
user.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
@@ -562,9 +560,7 @@ class Battle::Move::PowerDependsOnUserStockpile < Battle::Move
showAnim = true
if user.effects[PBEffects::StockpileDef] > 0 &&
user.pbCanLowerStatStage?(:DEFENSE, user, self)
if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
showAnim = false
end
showAnim = false if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
end
if user.effects[PBEffects::StockpileSpDef] > 0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user, self)
@@ -611,11 +607,9 @@ class Battle::Move::HealUserDependingOnUserStockpile < Battle::Move
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!", user.pbThis))
showAnim = true
if user.effects[PBEffects::StockpileDef] > 0 &&
user.pbCanLowerStatStage?(:DEFENSE, user, self)
if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
user.pbCanLowerStatStage?(:DEFENSE, user, self) && user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
showAnim = false
end
end
if user.effects[PBEffects::StockpileSpDef] > 0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user, self)
user.pbLowerStatStage(:SPECIAL_DEFENSE, user.effects[PBEffects::StockpileSpDef], user, showAnim)