Resolved many Rubocop warnings

This commit is contained in:
Maruno17
2020-09-06 17:31:12 +01:00
parent 6c4670eaa3
commit 681a8331ab
137 changed files with 921 additions and 1200 deletions

View File

@@ -351,7 +351,6 @@ class PokeBattle_Battler
:COMATOSE,
:RKSSYSTEM
]
failed = false
abilityBlacklist.each do |abil|
return true if isConst?(@ability,PBAbilities,abil)
end

View File

@@ -31,7 +31,6 @@ class PokeBattle_Battler
def pbRecoverHPFromDrain(amt,target,msg=nil)
if target.hasActiveAbility?(:LIQUIDOOZE)
oldHP = @hp
@battle.pbShowAbilitySplash(target)
pbReduceHP(amt)
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",pbThis))

View File

@@ -566,7 +566,7 @@ class PokeBattle_Battler
#=============================================================================
# Flinching
#=============================================================================
def pbFlinch(user=nil)
def pbFlinch(_user=nil)
return if hasActiveAbility?(:INNERFOCUS) && !@battle.moldBreaker
@effects[PBEffects::Flinch] = true
end

View File

@@ -149,7 +149,7 @@ class PokeBattle_Battler
#=============================================================================
# Held item consuming/removing
#=============================================================================
def pbCanConsumeBerry?(item,alwaysCheckGluttony=true)
def pbCanConsumeBerry?(_item,alwaysCheckGluttony=true)
return false if @battle.pbCheckOpposingAbility(:UNNERVE,@index)
return true if @hp<=@totalhp/4
if alwaysCheckGluttony || NEWEST_BATTLE_MECHANICS

View File

@@ -67,7 +67,7 @@ class PokeBattle_Battler
#=============================================================================
#
#=============================================================================
def pbBeginTurn(choice)
def pbBeginTurn(_choice)
# Cancel some lingering effects which only apply until the user next moves
@effects[PBEffects::BeakBlast] = false
@effects[PBEffects::DestinyBondPrevious] = @effects[PBEffects::DestinyBond]
@@ -105,7 +105,7 @@ class PokeBattle_Battler
@effects[PBEffects::FuryCutter] = 0
end
def pbEndTurn(choice)
def pbEndTurn(_choice)
@lastRoundMoved = @battle.turnCount # Done something this round
if @effects[PBEffects::ChoiceBand]<0 &&
hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
@@ -438,7 +438,6 @@ class PokeBattle_Battler
# NOTE: If a multi-hit move becomes disabled partway through doing those
# hits (e.g. by Cursed Body), the rest of the hits continue as
# normal.
notFainted = false
break if !targets.any? { |t| !t.fainted? } # All targets are fainted
end
# Battle Arena only - attack is successful
@@ -479,7 +478,7 @@ class PokeBattle_Battler
newTargets = pbChangeTargets(move,b,newTargets)
success = pbProcessMoveHit(move,b,newTargets,0,false)
b.lastMoveFailed = true if !success
targets.each { |b| b.pbFaint if b && b.fainted? }
targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? }
user.pbFaint if user.fainted?
end
# Magic Coat's bouncing back (move has no targets)

View File

@@ -2,7 +2,7 @@ class PokeBattle_Battler
#=============================================================================
# Get move's user
#=============================================================================
def pbFindUser(choice,move)
def pbFindUser(_choice,_move)
return self
end
@@ -169,7 +169,7 @@ class PokeBattle_Battler
return true
end
def pbAddTargetRandomAlly(targets,user,move,nearOnly=true)
def pbAddTargetRandomAlly(targets,user,_move,nearOnly=true)
choices = []
user.eachAlly do |b|
next if nearOnly && !user.near?(b)
@@ -180,7 +180,7 @@ class PokeBattle_Battler
end
end
def pbAddTargetRandomFoe(targets,user,move,nearOnly=true)
def pbAddTargetRandomFoe(targets,user,_move,nearOnly=true)
choices = []
user.eachOpposing do |b|
next if nearOnly && !user.near?(b)

View File

@@ -136,7 +136,7 @@ class PokeBattle_Battler
@battle.pbDisplay(_INTL("{1} ignored orders!",pbThis))
return false if !@battle.pbCanShowFightMenu?(@index)
otherMoves = []
eachMoveWithIndex do |m,i|
eachMoveWithIndex do |_m,i|
next if i==choice[1]
otherMoves[otherMoves.length] = i if @battle.pbCanChooseMove?(@index,i,false)
end

View File

@@ -61,7 +61,7 @@ class PokeBattle_Move
#=============================================================================
# About the move
#=============================================================================
def pbTarget(user); return @target; end
def pbTarget(_user); return @target; end
def totalpp
return @totalpp if @totalpp && @totalpp>0 # Usually undefined
@@ -127,8 +127,8 @@ class PokeBattle_Move
def danceMove?; return @flags[/o/]; end
# Causes perfect accuracy (param=1) and double damage (param=2).
def tramplesMinimize?(param=1); return false; end
def nonLethal?(user,target); return false; end # For False Swipe
def tramplesMinimize?(_param=1); return false; end
def nonLethal?(_user,_target); return false; end # For False Swipe
def ignoresSubstitute?(user) # user is the Pokémon using this move
if NEWEST_BATTLE_MECHANICS

View File

@@ -30,8 +30,8 @@ class PokeBattle_Move
# attack in the same turn.
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
# charging turn, and is 0 during the attack turn.
def pbIsChargingTurn?(user); return false; end
def pbDamagingMove?; return damagingMove?; end
def pbIsChargingTurn?(user); return false; end
def pbDamagingMove?; return damagingMove?; end
def pbContactMove?(user)
return false if user.hasActiveAbility?(:LONGREACH)
@@ -92,7 +92,7 @@ class PokeBattle_Move
# Move failure checks
#=============================================================================
# Check whether the move fails completely due to move-specific requirements.
def pbMoveFailed?(user,targets); return false; end
def pbMoveFailed?(user,targets); return false; end
# Checks whether the move will be ineffective against the target.
def pbFailsAgainstTarget?(user,target); return false; end

View File

@@ -543,8 +543,7 @@ class PokeBattle_Move_097 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
dmgs = [200,80,60,50,40]
ppLeft = [@pp,dmgs.length-1].min # PP is reduced before the move is used
baseDmg = dmgs[ppLeft]
return baseDmg
return dmgs[ppLeft]
end
end
@@ -897,7 +896,7 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
PBEnvironment::Forest, PBEnvironment::ForestGrass
@secretPower = 2 # (Same as Grassy Terrain)
when PBEnvironment::MovingWater, PBEnvironment::StillWater,
PBEnvironment::Puddle, PBEnvironment::Underwater
PBEnvironment::Underwater
@secretPower = 5 # Water Pulse, lower Attack by 1
when PBEnvironment::Puddle
@secretPower = 6 # Mud Shot, lower Speed by 1
@@ -1052,7 +1051,7 @@ class PokeBattle_Move_0A9 < PokeBattle_Move
end
def pbGetDefenseStats(user,target)
ret1, ret2 = super
ret1, _ret2 = super
return ret1, 6 # Def/SpDef stat stage
end
end
@@ -1321,7 +1320,6 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
# turn into, but what self-respecting game wouldn't at least have Tri
# Attack in it?
@npMove = getID(PBMoves,:TRIATTACK)
m = nil
case @battle.field.terrain
when PBBattleTerrains::Electric
@npMove = getConst(PBMoves,:THUNDERBOLT) || @npMove
@@ -2409,7 +2407,7 @@ class PokeBattle_Move_0D3 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
shift = (4-user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
shift += 1 if user.effects[PBEffects::DefenseCurl]
baseDmg = baseDmg<<shift
baseDmg = baseDmg << shift
return baseDmg
end
@@ -3013,7 +3011,7 @@ class PokeBattle_Move_0EB < PokeBattle_Move
end
if @battle.trainerBattle?
canSwitch = false
@battle.eachInTeamFromBattlerIndex(target.index) do |pkmn,i|
@battle.eachInTeamFromBattlerIndex(target.index) do |_pkmn,i|
next if !@battle.pbCanSwitchLax?(target.index,i)
canSwitch = true
break
@@ -3555,7 +3553,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move
end
return if pbIsMegaStone?(user.item)
flingableItem = false
@flingPowers.each do |power,items|
@flingPowers.each do |_power,items|
items.each do |i|
next if !isConst?(user.item,PBItems,i)
flingableItem = true

View File

@@ -1029,7 +1029,7 @@ class PokeBattle_Move_133 < PokeBattle_Move
def pbMoveFailed?(user,targets)
hasAlly = false
user.eachAlly do |b|
user.eachAlly do |_b|
hasAlly = true
break
end

View File

@@ -307,7 +307,7 @@ class PokeBattle_Battle
# screen.
def pbPlayerDisplayParty(idxBattler=0)
partyOrders = pbPartyOrder(idxBattler)
idxStart, idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
idxStart, _idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
ret = []
eachInTeamFromBattlerIndex(idxBattler) { |pkmn,i| ret[partyOrders[i]-idxStart] = pkmn }
return ret
@@ -408,7 +408,7 @@ class PokeBattle_Battle
# Used to calculate money gained/lost after winning/losing a battle.
def pbMaxLevelInTeam(side,idxTrainer)
ret = 1
eachInTeam(side,idxTrainer) do |pkmn,i|
eachInTeam(side,idxTrainer) do |pkmn,_i|
ret = pkmn.level if pkmn.level>ret
end
return ret
@@ -433,13 +433,13 @@ class PokeBattle_Battle
def pbSideBattlerCount(idxBattler=0)
ret = 0
eachSameSideBattler(idxBattler) { |b| ret += 1 }
eachSameSideBattler(idxBattler) { |_b| ret += 1 }
return ret
end
def pbOpposingBattlerCount(idxBattler=0)
ret = 0
eachOtherSideBattler(idxBattler) { |b| ret += 1 }
eachOtherSideBattler(idxBattler) { |_b| ret += 1 }
return ret
end
@@ -558,7 +558,7 @@ class PokeBattle_Battle
idxPartyEnd = (idxTrainer<partyStarts.length-1) ? partyStarts[idxTrainer+1] : party.length
origPartyPos = partyOrders[idxParty] # Position of erased Pokémon initially
partyOrders[idxParty] = idxPartyEnd # Put erased Pokémon last in the team
party.each_with_index do |pkmn,i|
party.each_with_index do |_pkmn,i|
next if i<idxPartyStart || i>=idxPartyEnd # Only check the team
next if partyOrders[i]<origPartyPos # Appeared before erased Pokémon
partyOrders[i] -= 1 # Appeared after erased Pokémon; bump it up by 1
@@ -756,8 +756,8 @@ class PokeBattle_Battle
@scene.pbAnimation(move,user,targets,hitNum) if @showAnims
end
def pbCommonAnimation(name,user=nil,targets=nil,hitNum=0)
@scene.pbCommonAnimation(name,user,targets,hitNum) if @showAnims
def pbCommonAnimation(name,user=nil,targets=nil)
@scene.pbCommonAnimation(name,user,targets) if @showAnims
end
def pbShowAbilitySplash(battler,delay=false,logTrigger=true)

View File

@@ -58,7 +58,7 @@ class PokeBattle_Battle
raise _INTL("Error: def pbGetOwnerIndexFromBattlerIndex gives invalid owner index ({1} for battle type {2}v{3}, trainers {4}v{5})",
requireds.length-1,@sideSizes[0],@sideSizes[1],side1counts.length,side2counts.length)
end
sideCounts.each_with_index do |count,i|
sideCounts.each_with_index do |_count,i|
if !requireds[i] || requireds[i]==0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i+1,@sideSizes[0],@sideSizes[1]) if side==0
@@ -139,7 +139,7 @@ class PokeBattle_Battle
# For each trainer in turn, find the needed number of Pokémon for them to
# send out, and initialize them
battlerNumber = 0
trainer.each_with_index do |t,idxTrainer|
trainer.each_with_index do |_t,idxTrainer|
ret[side][idxTrainer] = []
eachInTeam(side,idxTrainer) do |pkmn,idxPkmn|
next if !pkmn.able?
@@ -403,7 +403,7 @@ class PokeBattle_Battle
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].fullname,
@opponent[1].fullname,@opponent[2].fullname))
end
@opponent.each_with_index do |t,i|
@opponent.each_with_index do |_t,i|
@scene.pbShowOpponent(i)
msg = (@endSpeeches[i] && @endSpeeches[i]!="") ? @endSpeeches[i] : "..."
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))
@@ -437,7 +437,7 @@ class PokeBattle_Battle
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose
elsif @decision==2
if @opponent
@opponent.each_with_index do |t,i|
@opponent.each_with_index do |_t,i|
@scene.pbShowOpponent(i)
msg = (@endSpeechesWin[i] && @endSpeechesWin[i]!="") ? @endSpeechesWin[i] : "..."
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))

View File

@@ -168,7 +168,6 @@ class PokeBattle_Battle
raise RuntimeError.new(
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
pkmn.name,debugInfo))
return
end
# Give Exp
if pkmn.shadowPokemon?

View File

@@ -94,7 +94,7 @@ class PokeBattle_Battle
end
def pbCanChooseNonActive?(idxBattler)
pbParty(idxBattler).each_with_index do |pkmn,i|
pbParty(idxBattler).each_with_index do |_pkmn,i|
return true if pbCanSwitchLax?(idxBattler,i)
end
return false
@@ -212,7 +212,7 @@ class PokeBattle_Battle
if random
return -1 if !pbCanSwitch?(idxBattler) # Can battler switch out?
choices = [] # Find all Pokémon that can switch in
eachInTeamFromBattlerIndex(idxBattler) do |pkmn,i|
eachInTeamFromBattlerIndex(idxBattler) do |_pkmn,i|
choices.push(i) if pbCanSwitchLax?(idxBattler,i)
end
return -1 if choices.length==0

View File

@@ -45,7 +45,7 @@ class PokeBattle_Battle
return false if battler.effects[PBEffects::Encore]>0
# No moves that can be chosen (will Struggle instead)
usable = false
battler.eachMoveWithIndex do |m,i|
battler.eachMoveWithIndex do |_m,i|
next if !pbCanChooseMove?(idxBattler,i,false)
usable = true
break

View File

@@ -297,7 +297,7 @@ class PokeBattle_Battle
next if !b.canHeal?
hpGain = b.totalhp/16
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
hpGain = b.pbRecoverHP(hpGain)
b.pbRecoverHP(hpGain)
pbDisplay(_INTL("Aqua Ring restored {1}'s HP!",b.pbThis(true)))
end
# Ingrain
@@ -306,7 +306,7 @@ class PokeBattle_Battle
next if !b.canHeal?
hpGain = b.totalhp/16
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
hpGain = b.pbRecoverHP(hpGain)
b.pbRecoverHP(hpGain)
pbDisplay(_INTL("{1} absorbed nutrients with its roots!",b.pbThis))
end
# Leech Seed

View File

@@ -147,7 +147,7 @@ class PokeBattle_AI
#=============================================================================
def pbDefaultChooseNewEnemy(idxBattler,party)
enemies = []
party.each_with_index do |p,i|
party.each_with_index do |_p,i|
enemies.push(i) if @battle.pbCanSwitchLax?(idxBattler,i)
end
return -1 if enemies.length==0

View File

@@ -14,7 +14,7 @@ class PokeBattle_AI
# NOTE: A move is only added to the choices array if it has a non-zero
# score.
choices = []
user.eachMoveWithIndex do |m,i|
user.eachMoveWithIndex do |_m,i|
next if !@battle.pbCanChooseMove?(idxBattler,i,false)
if wildBattler
pbRegisterMoveWild(user,i,choices)
@@ -106,7 +106,7 @@ class PokeBattle_AI
# Get scores for the given move against each possible target
#=============================================================================
# Wild Pokémon choose their moves randomly.
def pbRegisterMoveWild(user,idxMove,choices)
def pbRegisterMoveWild(_user,idxMove,choices)
choices.push([idxMove,100,-1]) # Move index, score, target
end
@@ -195,7 +195,6 @@ class PokeBattle_AI
end
# If user is asleep, prefer moves that are usable while asleep
if user.status==PBStatuses::SLEEP && !move.usableWhenAsleep?
hasSleepMove = false
user.eachMove do |m|
next unless m.usableWhenAsleep?
score -= 60

View File

@@ -12,13 +12,13 @@ class PokeBattle_AI
@battle.eachBattler { |b| numTargets += 1 if b.near?(user) }
return numTargets>1
when PBTargets::UserAndAllies
@battle.eachSameSideBattler(user) { |b| numTargets += 1 }
@battle.eachSameSideBattler(user) { |_b| numTargets += 1 }
return numTargets>1
when PBTargets::AllFoes
@battle.eachOtherSideBattler(user) { |b| numTargets += 1 }
@battle.eachOtherSideBattler(user) { |_b| numTargets += 1 }
return numTargets>1
when PBTargets::AllBattlers
@battle.eachBattler { |b| numTargets += 1 }
@battle.eachBattler { |_b| numTargets += 1 }
return numTargets>1
end
return false
@@ -75,7 +75,7 @@ class PokeBattle_AI
# For switching. Determines the effectiveness of a potential switch-in against
# an opposing battler.
def pbCalcTypeModPokemon(battlerThis,battlerOther)
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
mod1 = PBTypes.getCombinedEffectiveness(battlerThis.type1,target.type1,target.type2)
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE
if battlerThis.type1!=battlerThis.type2
@@ -214,7 +214,7 @@ class PokeBattle_AI
end
when "0C1" # Beat Up
mult = 0
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i|
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i|
mult += 1 if pkmn && pkmn.able? && pkmn.status==PBStatuses::NONE
end
baseDmg *= mult

View File

@@ -18,16 +18,16 @@ class BattleIntroAnimation < PokeBattle_Animation
makeSlideSprite("base_0",1,appearTime,PictureOrigin::Bottom)
makeSlideSprite("base_1",-1,appearTime,PictureOrigin::Center)
# Player sprite, partner trainer sprite
@battle.player.each_with_index do |p,i|
@battle.player.each_with_index do |_p,i|
makeSlideSprite("player_#{i+1}",1,appearTime,PictureOrigin::Bottom)
end
# Opposing trainer sprite(s) or wild Pokémon sprite(s)
if @battle.trainerBattle?
@battle.opponent.each_with_index do |p,i|
@battle.opponent.each_with_index do |_p,i|
makeSlideSprite("trainer_#{i+1}",-1,appearTime,PictureOrigin::Bottom)
end
else # Wild battle
@battle.pbParty(1).each_with_index do |pkmn,i|
@battle.pbParty(1).each_with_index do |_pkmn,i|
idxBattler = 2*i+1
makeSlideSprite("pokemon_#{idxBattler}",-1,appearTime,PictureOrigin::Bottom)
end
@@ -574,9 +574,7 @@ class BattlerRecallAnimation < PokeBattle_Animation
# Calculate the color to turn the battler sprite
col = getBattlerColorFromBallType(ballType)
col.alpha = 0
# Calculate start and end coordinates for battler sprite movement
battlerStartX = batSprite.x
battlerStartY = batSprite.y
# Calculate end coordinates for battler sprite movement
ballPos = PokeBattle_SceneConstants.pbBattlerPosition(@idxBattler,batSprite.sideSize)
battlerEndX = ballPos[0]
battlerEndY = ballPos[1]
@@ -867,8 +865,6 @@ class PokeballThrowDeflectAnimation < PokeBattle_Animation
# Set up Poké Ball sprite
ball = addBallSprite(ballStartX,ballStartY,@ballType)
ball.setZ(0,90)
# Set up battler sprite
battler = addSprite(batSprite,PictureOrigin::Bottom)
# Poké Ball arc animation
ball.setSE(0,"Battle throw")
createBallTrajectory(ball,0,16,

View File

@@ -293,7 +293,7 @@ class PokeBattle_Scene
def pbBeginEndOfRoundPhase
end
def pbEndBattle(result)
def pbEndBattle(_result)
@abortable = false
pbShowWindow(BLANK)
# Fade out all sprites

View File

@@ -144,9 +144,8 @@ class PokeBattle_Scene
# Fade out and hide all sprites
visibleSprites = pbFadeOutAndHide(@sprites)
# Get player's party
party = @battle.pbParty(idxBattler)
partyPos = @battle.pbPartyOrder(idxBattler)
partyStart, partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
modParty = @battle.pbPlayerDisplayParty(idxBattler)
# Start party screen
scene = PokemonParty_Scene.new
@@ -190,7 +189,7 @@ class PokeBattle_Scene
#=============================================================================
# Opens the Bag screen and chooses an item to use
#=============================================================================
def pbItemMenu(idxBattler,firstAction)
def pbItemMenu(idxBattler,_firstAction)
# Fade out and hide all sprites
visibleSprites = pbFadeOutAndHide(@sprites)
# Set Bag starting positions
@@ -250,7 +249,7 @@ class PokeBattle_Scene
# Get player's party
party = @battle.pbParty(idxBattler)
partyPos = @battle.pbPartyOrder(idxBattler)
partyStart, partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
modParty = @battle.pbPlayerDisplayParty(idxBattler)
# Start party screen
pkmnScene = PokemonParty_Scene.new

View File

@@ -272,7 +272,7 @@ class PokeBattle_Scene
#=============================================================================
# Shows stats windows upon a Pokémon levelling up
#=============================================================================
def pbLevelUp(pkmn,battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
def pbLevelUp(pkmn,_battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
pbTopRightWindow(
_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
pkmn.totalhp-oldTotalHP,pkmn.attack-oldAttack,pkmn.defense-oldDefense,
@@ -482,7 +482,7 @@ class PokeBattle_Scene
end
# Plays a common animation.
def pbCommonAnimation(animName,user=nil,target=nil,hitNum=0)
def pbCommonAnimation(animName,user=nil,target=nil)
return if !animName || animName==""
target = target[0] if target && target.is_a?(Array)
animations = pbLoadBattleAnimations

View File

@@ -119,7 +119,7 @@ def pbConvertRPGAnimation(animation)
pbAnim.graphic = animation.animation_name
pbAnim.hue = animation.animation_hue
pbAnim.array.clear
yoffset = 0
yOffset = 0
pbAnim.position = animation.position
yOffset = -64 if animation.position==0
yOffset = 64 if animation.position==2
@@ -240,7 +240,7 @@ end
#===============================================================================
class PBAnimTiming
attr_accessor :frame
attr_accessor :timingType # 0=play SE, 1=set bg, 2=bg mod
attr_writer :timingType # 0=play SE, 1=set bg, 2=bg mod
attr_accessor :name # Name of SE file or BG file
attr_accessor :volume
attr_accessor :pitch
@@ -251,7 +251,7 @@ class PBAnimTiming
attr_accessor :colorGreen # Color of bg (or to change bg to)
attr_accessor :colorBlue # Color of bg (or to change bg to)
attr_accessor :colorAlpha # Color of bg (or to change bg to)
attr_accessor :duration # How long to spend changing to the new bg coords/color
attr_writer :duration # How long to spend changing to the new bg coords/color
attr_accessor :flashScope
attr_accessor :flashColor
attr_accessor :flashDuration
@@ -276,13 +276,11 @@ class PBAnimTiming
end
def timingType
@timingType = 0 if !@timingType
return @timingType
return @timingType || 0
end
def duration
@duration = 5 if !@duration
return @duration
return @duration || 5
end
def to_s

View File

@@ -110,7 +110,6 @@ class ThrowBaitAnimation < PokeBattle_Animation
def createProcesses
# Calculate start and end coordinates for battler sprite movement
batSprite = @sprites["pokemon_#{@battler.index}"]
shaSprite = @sprites["shadow_#{@battler.index}"]
traSprite = @sprites["player_1"]
ballPos = PokeBattle_SceneConstants.pbBattlerPosition(@battler.index,batSprite.sideSize)
ballStartX = traSprite.x
@@ -177,7 +176,6 @@ class ThrowRockAnimation < PokeBattle_Animation
def createProcesses
# Calculate start and end coordinates for battler sprite movement
batSprite = @sprites["pokemon_#{@battler.index}"]
shaSprite = @sprites["shadow_#{@battler.index}"]
traSprite = @sprites["player_1"]
ballStartX = traSprite.x
ballStartY = traSprite.y-traSprite.bitmap.height/2
@@ -431,7 +429,7 @@ class PokeBattle_SafariZone
catchFactor = [[catchFactor,3].max,20].min
escapeFactor = (pbEscapeRate(rareness)*100)/1275
escapeFactor = [[escapeFactor,2].max,20].min
begin
loop do
cmd = @scene.pbSafariCommandMenu(0)
case cmd
when 0 # Ball
@@ -483,7 +481,8 @@ class PokeBattle_SafariZone
# Weather continues
@scene.pbCommonAnimation(PBWeather.animationName(@weather))
end
end while @decision==0
break if @decision > 0
end
@scene.pbEndBattle(@decision)
rescue BattleAbortedException
@decision = 0

View File

@@ -40,11 +40,11 @@ class PokeBattle_BugContestBattle < PokeBattle_Battle
super(*arg)
end
def pbItemMenu(idxBattler,firstAction)
def pbItemMenu(idxBattler,_firstAction)
return pbRegisterItem(idxBattler,@ballConst,1)
end
def pbCommandMenu(idxBattler,firstAction)
def pbCommandMenu(idxBattler,_firstAction)
return @scene.pbCommandMenuEx(idxBattler,[
_INTL("Sport Balls: {1}",@ballCount),
_INTL("Fight"),
@@ -54,7 +54,7 @@ class PokeBattle_BugContestBattle < PokeBattle_Battle
],4)
end
def pbConsumeItemInBag(item,idxBattler)
def pbConsumeItemInBag(_item,_idxBattler)
@ballCount -= 1 if @ballCount>0
end

View File

@@ -134,7 +134,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
end
end
def pbRegisterMove(idxBattler,idxMove,showMessages=true)
def pbRegisterMove(idxBattler,idxMove,_showMessages=true)
thispkmn = @battlers[idxBattler]
if idxMove==-2
@choices[idxPokemon][0] = :UseMove # Move
@@ -264,7 +264,7 @@ class PokeBattle_AI
end
@justswitched[idxBattler] = shouldswitch
if shouldswitch
@battle.pbParty(idxBattler).each_with_index do |pkmn,i|
@battle.pbParty(idxBattler).each_with_index do |_pkmn,i|
next if !@battle.pbCanSwitch?(idxBattler,i)
@battle.pbRegisterSwitch(idxBattler,i)
return true

View File

@@ -13,7 +13,7 @@ class PokeBattle_BattleArena < PokeBattle_Battle
@battleAI.battleArena = true
end
def pbCanSwitchLax?(idxBattler,idxParty,partyScene=nil)
def pbCanSwitchLax?(idxBattler,_idxParty,partyScene=nil)
if partyScene
partyScene.pbDisplay(_INTL("{1} can't be switched out!",@battlers[idxBattler].pbThis))
end
@@ -101,7 +101,6 @@ class PokeBattle_BattleArena < PokeBattle_Battle
end
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
if @count==3
points = [0,0]
@battlers[0].pbCancelMoves
@battlers[1].pbCancelMoves
ratings1 = [0,0,0]

View File

@@ -209,13 +209,13 @@ module PokeBattle_BattlePlayerModule
super
end
def pbSwitchInBetween(idxBattler,checkLaxOnly=false,canCancel=false)
def pbSwitchInBetween(_idxBattler,_checkLaxOnly=false,_canCancel=false)
ret = @switches[@switchindex]
@switchindex += 1
return ret
end
def pbRandom(num)
def pbRandom(_num)
ret = @randomnums[@randomindex]
@randomindex += 1
return ret

View File

@@ -24,7 +24,7 @@ class PokeBattle_DebugSceneNoLogging
def pbBeginAttackPhase; end
def pbShowOpponent(idxTrainer); end
def pbDamageAnimation(battler,effectiveness=0); end
def pbCommonAnimation(animName,user=nil,target=nil,hitNum=0); end
def pbCommonAnimation(animName,user=nil,target=nil); end
def pbAnimation(moveID,user,targets,hitNum=0); end
def pbEndBattle(result); end
def pbWildBattleSuccess; end
@@ -74,7 +74,7 @@ class PokeBattle_DebugSceneNoLogging
def pbPartyScreen(idxBattler,canCancel=false)
replacements = []
@battle.eachInTeamFromBattlerIndex(idxBattler) do |b,idxParty|
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b,idxParty|
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty,idxBattler)
end
return if replacements.length==0

View File

@@ -2129,7 +2129,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER)
moveType = pbHiddenPower(b.pokemon)[0]
end
eff = PBTypes.getCombinedEffectiveness(moveData[MOVE_TYPE],type1,type2,type3)
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
next if PBTypes.ineffective?(eff)
next if !PBTypes.superEffective?(eff) && moveData[MOVE_FUNCTION_CODE]!="070" # OHKO
else