Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -2,16 +2,16 @@ class Battle::Battler
#=============================================================================
# Change HP
#=============================================================================
def pbReduceHP(amt,anim = true,registerDamage = true,anyAnim = true)
def pbReduceHP(amt, anim = true, registerDamage = true, anyAnim = true)
amt = amt.round
amt = @hp if amt>@hp
amt = 1 if amt<1 && !fainted?
amt = @hp if amt > @hp
amt = 1 if amt < 1 && !fainted?
oldHP = @hp
self.hp -= amt
PBDebug.log("[HP change] #{pbThis} lost #{amt} HP (#{oldHP}=>#{@hp})") if amt>0
raise _INTL("HP less than 0") if @hp<0
raise _INTL("HP greater than total HP") if @hp>@totalhp
@battle.scene.pbHPChanged(self,oldHP,anim) if anyAnim && amt>0
PBDebug.log("[HP change] #{pbThis} lost #{amt} HP (#{oldHP}=>#{@hp})") if amt > 0
raise _INTL("HP less than 0") if @hp < 0
raise _INTL("HP greater than total HP") if @hp > @totalhp
@battle.scene.pbHPChanged(self, oldHP, anim) if anyAnim && amt > 0
if amt > 0 && registerDamage
@droppedBelowHalfHP = true if @hp < @totalhp / 2 && @hp + amt >= @totalhp / 2
@tookDamageThisRound = true
@@ -19,32 +19,32 @@ class Battle::Battler
return amt
end
def pbRecoverHP(amt,anim = true,anyAnim = true)
def pbRecoverHP(amt, anim = true, anyAnim = true)
amt = amt.round
amt = @totalhp-@hp if amt>@totalhp-@hp
amt = 1 if amt<1 && @hp<@totalhp
amt = @totalhp - @hp if amt > @totalhp - @hp
amt = 1 if amt < 1 && @hp < @totalhp
oldHP = @hp
self.hp += amt
PBDebug.log("[HP change] #{pbThis} gained #{amt} HP (#{oldHP}=>#{@hp})") if amt>0
raise _INTL("HP less than 0") if @hp<0
raise _INTL("HP greater than total HP") if @hp>@totalhp
@battle.scene.pbHPChanged(self,oldHP,anim) if anyAnim && amt>0
PBDebug.log("[HP change] #{pbThis} gained #{amt} HP (#{oldHP}=>#{@hp})") if amt > 0
raise _INTL("HP less than 0") if @hp < 0
raise _INTL("HP greater than total HP") if @hp > @totalhp
@battle.scene.pbHPChanged(self, oldHP, anim) if anyAnim && amt > 0
@droppedBelowHalfHP = false if @hp >= @totalhp / 2
return amt
end
def pbRecoverHPFromDrain(amt,target,msg = nil)
def pbRecoverHPFromDrain(amt, target, msg = nil)
if target.hasActiveAbility?(:LIQUIDOOZE)
@battle.pbShowAbilitySplash(target)
pbReduceHP(amt)
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",pbThis))
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", pbThis))
@battle.pbHideAbilitySplash(target)
pbItemHPHealCheck
else
msg = _INTL("{1} had its energy drained!",target.pbThis) if nil_or_empty?(msg)
msg = _INTL("{1} had its energy drained!", target.pbThis) if nil_or_empty?(msg)
@battle.pbDisplay(msg)
if canHeal?
amt = (amt*1.3).floor if hasActiveItem?(:BIGROOT)
amt = (amt * 1.3).floor if hasActiveItem?(:BIGROOT)
pbRecoverHP(amt)
end
end
@@ -66,7 +66,7 @@ class Battle::Battler
return
end
return if @fainted # Has already fainted properly
@battle.pbDisplayBrief(_INTL("{1} fainted!",pbThis)) if showMessage
@battle.pbDisplayBrief(_INTL("{1} fainted!", pbThis)) if showMessage
PBDebug.log("[Pokémon fainted] #{pbThis} (#{@index})") if !showMessage
@battle.scene.pbFaintBattler(self)
@battle.pbSetDefeated(self) if opposes?
@@ -80,7 +80,7 @@ class Battle::Battler
@pokemon.changeHappiness((badLoss) ? "faintbad" : "faint")
end
# Reset form
@battle.peer.pbOnLeavingBattle(@battle,@pokemon,@battle.usedInBattle[idxOwnSide][@index/2])
@battle.peer.pbOnLeavingBattle(@battle, @pokemon, @battle.usedInBattle[idxOwnSide][@index / 2])
@pokemon.makeUnmega if mega?
@pokemon.makeUnprimal if primal?
# Do other things
@@ -98,26 +98,26 @@ class Battle::Battler
#=============================================================================
# Move PP
#=============================================================================
def pbSetPP(move,pp)
def pbSetPP(move, pp)
move.pp = pp
# No need to care about @effects[PBEffects::Mimic], since Mimic can't copy
# Mimic
if move.realMove && move.id==move.realMove.id && !@effects[PBEffects::Transform]
if move.realMove && move.id == move.realMove.id && !@effects[PBEffects::Transform]
move.realMove.pp = pp
end
end
def pbReducePP(move)
return true if usingMultiTurnAttack?
return true if move.pp<0 # Don't reduce PP for special calls of moves
return true if move.total_pp<=0 # Infinite PP, can always be used
return false if move.pp==0 # Ran out of PP, couldn't reduce
pbSetPP(move,move.pp-1) if move.pp>0
return true if move.pp < 0 # Don't reduce PP for special calls of moves
return true if move.total_pp <= 0 # Infinite PP, can always be used
return false if move.pp == 0 # Ran out of PP, couldn't reduce
pbSetPP(move, move.pp - 1) if move.pp > 0
return true
end
def pbReducePPOther(move)
pbSetPP(move,move.pp-1) if move.pp>0
pbSetPP(move, move.pp - 1) if move.pp > 0
end
#=============================================================================
@@ -150,17 +150,17 @@ class Battle::Battler
#=============================================================================
# Forms
#=============================================================================
def pbChangeForm(newForm,msg)
return if fainted? || @effects[PBEffects::Transform] || @form==newForm
def pbChangeForm(newForm, msg)
return if fainted? || @effects[PBEffects::Transform] || @form == newForm
oldForm = @form
oldDmg = @totalhp-@hp
oldDmg = @totalhp - @hp
self.form = newForm
pbUpdate(true)
@hp = @totalhp-oldDmg
@hp = @totalhp - oldDmg
@effects[PBEffects::WeightChange] = 0 if Settings::MECHANICS_GENERATION >= 6
@battle.scene.pbChangePokemon(self,@pokemon)
@battle.scene.pbChangePokemon(self, @pokemon)
@battle.scene.pbRefreshOne(@index)
@battle.pbDisplay(msg) if msg && msg!=""
@battle.pbDisplay(msg) if msg && msg != ""
PBDebug.log("[Form changed] #{pbThis} changed from form #{oldForm} to form #{newForm}")
@battle.pbSetSeen(self)
end
@@ -169,7 +169,7 @@ class Battle::Battler
return if fainted? || @effects[PBEffects::Transform]
# Shaymin - reverts if frozen
if isSpecies?(:SHAYMIN) && frozen?
pbChangeForm(0,_INTL("{1} transformed!",pbThis))
pbChangeForm(0, _INTL("{1} transformed!", pbThis))
end
end
@@ -179,7 +179,7 @@ class Battle::Battler
if isSpecies?(:KELDEO)
newForm = 0
newForm = 1 if pbHasMove?(:SECRETSWORD)
pbChangeForm(newForm,_INTL("{1} transformed!",pbThis))
pbChangeForm(newForm, _INTL("{1} transformed!", pbThis))
end
end
@@ -194,13 +194,13 @@ class Battle::Battler
when :Rain, :HeavyRain then newForm = 2
when :Hail then newForm = 3
end
if @form!=newForm
@battle.pbShowAbilitySplash(self,true)
if @form != newForm
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(newForm,_INTL("{1} transformed!",pbThis))
pbChangeForm(newForm, _INTL("{1} transformed!", pbThis))
end
else
pbChangeForm(0,_INTL("{1} transformed!",pbThis))
pbChangeForm(0, _INTL("{1} transformed!", pbThis))
end
end
# Cherrim - Flower Gift
@@ -208,13 +208,13 @@ class Battle::Battler
if hasActiveAbility?(:FLOWERGIFT)
newForm = 0
newForm = 1 if [:Sun, :HarshSun].include?(effectiveWeather)
if @form!=newForm
@battle.pbShowAbilitySplash(self,true)
if @form != newForm
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(newForm,_INTL("{1} transformed!",pbThis))
pbChangeForm(newForm, _INTL("{1} transformed!", pbThis))
end
else
pbChangeForm(0,_INTL("{1} transformed!",pbThis))
pbChangeForm(0, _INTL("{1} transformed!", pbThis))
end
end
# Eiscue - Ice Face
@@ -233,57 +233,57 @@ class Battle::Battler
pbCheckFormOnWeatherChange if !endOfRound
# Darmanitan - Zen Mode
if isSpecies?(:DARMANITAN) && self.ability == :ZENMODE
if @hp<=@totalhp/2
if @hp <= @totalhp / 2
if (@form % 2) == 0
@battle.pbShowAbilitySplash(self,true)
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(@form + 1, _INTL("{1} triggered!", abilityName))
end
elsif (@form % 2) != 0
@battle.pbShowAbilitySplash(self,true)
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(@form - 1, _INTL("{1} triggered!", abilityName))
end
end
# Minior - Shields Down
if isSpecies?(:MINIOR) && self.ability == :SHIELDSDOWN
if @hp>@totalhp/2 # Turn into Meteor form
newForm = (@form>=7) ? @form-7 : @form
if @form!=newForm
@battle.pbShowAbilitySplash(self,true)
if @hp > @totalhp / 2 # Turn into Meteor form
newForm = (@form >= 7) ? @form - 7 : @form
if @form != newForm
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(newForm,_INTL("{1} deactivated!",abilityName))
pbChangeForm(newForm, _INTL("{1} deactivated!", abilityName))
elsif !endOfRound
@battle.pbDisplay(_INTL("{1} deactivated!",abilityName))
@battle.pbDisplay(_INTL("{1} deactivated!", abilityName))
end
elsif @form<7 # Turn into Core form
@battle.pbShowAbilitySplash(self,true)
elsif @form < 7 # Turn into Core form
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(@form+7,_INTL("{1} activated!",abilityName))
pbChangeForm(@form + 7, _INTL("{1} activated!", abilityName))
end
end
# Wishiwashi - Schooling
if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING
if @level>=20 && @hp>@totalhp/4
if @form!=1
@battle.pbShowAbilitySplash(self,true)
if @level >= 20 && @hp > @totalhp / 4
if @form != 1
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(1,_INTL("{1} formed a school!",pbThis))
pbChangeForm(1, _INTL("{1} formed a school!", pbThis))
end
elsif @form!=0
@battle.pbShowAbilitySplash(self,true)
elsif @form != 0
@battle.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(0,_INTL("{1} stopped schooling!",pbThis))
pbChangeForm(0, _INTL("{1} stopped schooling!", pbThis))
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
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.pbShowAbilitySplash(self, true)
@battle.pbHideAbilitySplash(self)
pbChangeForm(newForm,_INTL("{1} transformed into its Complete Forme!",pbThis))
pbChangeForm(newForm, _INTL("{1} transformed into its Complete Forme!", pbThis))
end
end
# Morpeko - Hunger Switch
@@ -311,7 +311,7 @@ class Battle::Battler
@effects[PBEffects::LaserFocus] = target.effects[PBEffects::LaserFocus]
end
@moves.clear
target.moves.each_with_index do |m,i|
target.moves.each_with_index do |m, i|
@moves[i] = Battle::Move.from_pokemon_move(@battle, Pokemon::Move.new(m.id))
@moves[i].pp = 5
@moves[i].total_pp = 5
@@ -320,7 +320,7 @@ class Battle::Battler
@effects[PBEffects::DisableMove] = nil
@effects[PBEffects::WeightChange] = target.effects[PBEffects::WeightChange]
@battle.scene.pbRefreshOne(@index)
@battle.pbDisplay(_INTL("{1} transformed into {2}!",pbThis,target.pbThis(true)))
@battle.pbDisplay(_INTL("{1} transformed into {2}!", pbThis, target.pbThis(true)))
pbOnLosingAbility(oldAbil)
end