Many more Rubocop-inspired code improvements

This commit is contained in:
Maruno17
2021-12-18 19:06:22 +00:00
parent d17fc40a47
commit 13a238cc6a
107 changed files with 651 additions and 652 deletions

View File

@@ -10,7 +10,6 @@ class Battle::Battler
attr_accessor :ability_id
attr_accessor :item_id
attr_accessor :moves
attr_accessor :gender
attr_accessor :attack
attr_accessor :spatk
attr_accessor :speed
@@ -739,7 +738,7 @@ class Battle::Battler
# Returns an array containing all unfainted ally Pokémon.
def allAllies
return @battle.allSameSideBattlers(@index).select { |b| b.index != @index }
return @battle.allSameSideBattlers(@index).reject { |b| b.index == @index }
end
# Yields each unfainted opposing Pokémon.

View File

@@ -234,12 +234,12 @@ class Battle::Battler
# Darmanitan - Zen Mode
if isSpecies?(:DARMANITAN) && self.ability == :ZENMODE
if @hp <= @totalhp / 2
if (@form % 2) == 0
if @form.even?
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(@form + 1, _INTL("{1} triggered!", abilityName))
end
elsif (@form % 2) != 0
elsif @form.odd?
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(@form - 1, _INTL("{1} triggered!", abilityName))

View File

@@ -72,7 +72,6 @@ class Battle::Battler
# in and not at any later times, even if a traceable ability turns
# up later. Essentials ignores this, and allows Trace to trigger
# whenever it can even in the old battle mechanics.
choices = []
choices = @battle.allOtherSideBattlers(@index).select { |b|
next !b.ungainableAbility? &&
![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)

View File

@@ -22,7 +22,7 @@ class Battle::Battler
idxOther = (@index + 2) % 4
when 3
if @index != 2 && @index != 3 # If not in middle spot already
idxOther = ((@index % 2) == 0) ? 2 : 3
idxOther = (@index.even?) ? 2 : 3
end
end
if idxOther >= 0

View File

@@ -22,9 +22,10 @@ class Battle::Battler
@battle.scene.pbDamageAnimation(user)
user.pbReduceHP(user.totalhp / 4, false)
end
if target.form == 1 # Gulping Form
case target.form
when 1 # Gulping Form
user.pbLowerStatStageByAbility(:DEFENSE, 1, target, false)
elsif target.form == 2 # Gorging Form
when 2 # Gorging Form
target.pbParalyze(user) if target.pbCanParalyze?(user, false)
end
@battle.pbHideAbilitySplash(target)