mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 06:34:59 +00:00
More Rubocopping
This commit is contained in:
@@ -281,7 +281,7 @@ class Battle
|
||||
# on the given side of battle.
|
||||
def pbNumPositions(side, idxTrainer)
|
||||
ret = 0
|
||||
for i in 0...pbSideSize(side)
|
||||
pbSideSize(side).times do |i|
|
||||
t = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
|
||||
next if t != idxTrainer
|
||||
ret += 1
|
||||
@@ -618,7 +618,7 @@ class Battle
|
||||
PBEffects::SkyDrop,
|
||||
PBEffects::TrappingUser]
|
||||
allBattlers.each do |b|
|
||||
for i in effectsToSwap
|
||||
effectsToSwap.each do |i|
|
||||
next if b.effects[i] != idxA && b.effects[i] != idxB
|
||||
b.effects[i] = (b.effects[i] == idxA) ? idxB : idxA
|
||||
end
|
||||
|
||||
@@ -43,12 +43,12 @@ class Battle
|
||||
# side if necessary
|
||||
loop do
|
||||
needsChanging = false
|
||||
for side in 0...2 # Each side in turn
|
||||
2.times do |side| # Each side in turn
|
||||
next if side == 1 && wildBattle? # Wild side's size already checked above
|
||||
sideCounts = (side == 0) ? side1counts : side2counts
|
||||
requireds = []
|
||||
# Find out how many Pokémon each trainer on side needs to have
|
||||
for i in 0...@sideSizes[side]
|
||||
@sideSizes[side].times do |i|
|
||||
idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
|
||||
requireds[idxTrainer] = 0 if requireds[idxTrainer].nil?
|
||||
requireds[idxTrainer] += 1
|
||||
@@ -90,7 +90,7 @@ class Battle
|
||||
if newSize == 0
|
||||
raise _INTL("Couldn't lower either side's size any further, battle isn't possible")
|
||||
end
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
next if side == 1 && wildBattle? # Wild Pokémon's side size is fixed
|
||||
next if @sideSizes[side] == 1 || newSize > @sideSizes[side]
|
||||
@sideSizes[side] = newSize
|
||||
@@ -115,7 +115,7 @@ class Battle
|
||||
|
||||
def pbSetUpSides
|
||||
ret = [[], []]
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
# Set up wild Pokémon
|
||||
if side == 1 && wildBattle?
|
||||
pbParty(1).each_with_index do |pkmn, idxPkmn|
|
||||
@@ -131,7 +131,7 @@ class Battle
|
||||
trainer = (side == 0) ? @player : @opponent
|
||||
requireds = []
|
||||
# Find out how many Pokémon each trainer on side needs to have
|
||||
for i in 0...@sideSizes[side]
|
||||
@sideSizes[side].times do |i|
|
||||
idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
|
||||
requireds[idxTrainer] = 0 if requireds[idxTrainer].nil?
|
||||
requireds[idxTrainer] += 1
|
||||
@@ -184,7 +184,7 @@ class Battle
|
||||
end
|
||||
end
|
||||
# Send out Pokémon (opposing trainers first)
|
||||
for side in [1, 0]
|
||||
[1, 0].each do |side|
|
||||
next if side == 1 && wildBattle?
|
||||
msg = ""
|
||||
toSendOut = []
|
||||
@@ -496,7 +496,7 @@ class Battle
|
||||
def pbDecisionOnTime
|
||||
counts = [0, 0]
|
||||
hpTotals = [0, 0]
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
pbParty(side).each do |pkmn|
|
||||
next if !pkmn || !pkmn.able?
|
||||
counts[side] += 1
|
||||
@@ -514,7 +514,7 @@ class Battle
|
||||
def pbDecisionOnTime2
|
||||
counts = [0, 0]
|
||||
hpTotals = [0, 0]
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
pbParty(side).each do |pkmn|
|
||||
next if !pkmn || !pkmn.able?
|
||||
counts[side] += 1
|
||||
|
||||
@@ -144,7 +144,7 @@ class Battle
|
||||
randomOrder[i], randomOrder[r] = randomOrder[r], randomOrder[i]
|
||||
end
|
||||
@priority.clear
|
||||
for i in 0..maxBattlerIndex
|
||||
(0..maxBattlerIndex).each do |i|
|
||||
b = @battlers[i]
|
||||
next if !b
|
||||
# [battler, speed, sub-priority, priority, tie-breaker order]
|
||||
|
||||
@@ -179,7 +179,7 @@ class Battle
|
||||
pbClearChoice(i) if pbCanShowCommands?(i)
|
||||
end
|
||||
# Reset choices to perform Mega Evolution if it wasn't done somehow
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
@megaEvolution[side].each_with_index do |megaEvo, i|
|
||||
@megaEvolution[side][i] = -1 if megaEvo >= 0
|
||||
end
|
||||
|
||||
@@ -148,7 +148,7 @@ class Battle
|
||||
# is not generalised to larger side sizes.
|
||||
if !singleBattle?
|
||||
swaps = [] # Each element is an array of two battler indices to swap
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
next if pbSideSize(side) == 1 # Only battlers on sides of size 2+ need to move
|
||||
# Check if any battler on this side is near any battler on the other side
|
||||
anyNear = false
|
||||
@@ -256,7 +256,7 @@ class Battle
|
||||
pbDisplay(_INTL("{1}'s wish came true!", wishMaker))
|
||||
end
|
||||
# Sea of Fire damage (Fire Pledge + Grass Pledge combination)
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
next if sides[side].effects[PBEffects::SeaOfFire] == 0
|
||||
@battle.pbCommonAnimation("SeaOfFire") if side == 0
|
||||
@battle.pbCommonAnimation("SeaOfFireOpp") if side == 1
|
||||
@@ -516,7 +516,7 @@ class Battle
|
||||
pbGainExp
|
||||
return
|
||||
end
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
# Reflect
|
||||
pbEORCountDownSideEffect(side, PBEffects::Reflect,
|
||||
_INTL("{1}'s Reflect wore off!", @battlers[side].pbTeam))
|
||||
@@ -664,7 +664,7 @@ class Battle
|
||||
b.lastFoeAttacker.clear
|
||||
end
|
||||
# Reset/count down side-specific effects (no messages)
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
@sides[side].effects[PBEffects::CraftyShield] = false
|
||||
if !@sides[side].effects[PBEffects::EchoedVoiceUsed]
|
||||
@sides[side].effects[PBEffects::EchoedVoiceCounter] = 0
|
||||
|
||||
@@ -414,7 +414,7 @@ class Battle::Battler
|
||||
numHits = move.pbNumHits(user, targets)
|
||||
# Process each hit in turn
|
||||
realNumHits = 0
|
||||
for i in 0...numHits
|
||||
numHits.times do |i|
|
||||
break if magicCoater >= 0 || magicBouncer >= 0
|
||||
success = pbProcessMoveHit(move, user, targets, i, skipAccuracyCheck)
|
||||
if !success
|
||||
|
||||
@@ -241,7 +241,7 @@ class Battle::Move
|
||||
def pbAnimateHitAndHPLost(user, targets)
|
||||
# Animate allies first, then foes
|
||||
animArray = []
|
||||
for side in 0...2 # side here means "allies first, then foes"
|
||||
2.times do |side| # side here means "allies first, then foes"
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected || b.damageState.hpLost == 0
|
||||
next if (side == 0 && b.opposes?(user)) || (side == 1 && !b.opposes?(user))
|
||||
|
||||
@@ -113,7 +113,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
return false if damagingMove?
|
||||
failed = true
|
||||
for i in 0...@statUp.length / 2
|
||||
(@statUp.length / 2).times do |i|
|
||||
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
|
||||
failed = false
|
||||
break
|
||||
@@ -128,7 +128,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move
|
||||
def pbEffectGeneral(user)
|
||||
return if damagingMove?
|
||||
showAnim = true
|
||||
for i in 0...@statUp.length / 2
|
||||
(@statUp.length / 2).times do |i|
|
||||
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
|
||||
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
|
||||
showAnim = false
|
||||
@@ -138,7 +138,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move
|
||||
|
||||
def pbAdditionalEffect(user, target)
|
||||
showAnim = true
|
||||
for i in 0...@statUp.length / 2
|
||||
(@statUp.length / 2).times do |i|
|
||||
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
|
||||
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
|
||||
showAnim = false
|
||||
@@ -154,7 +154,7 @@ class Battle::Move::StatDownMove < Battle::Move
|
||||
def pbEffectWhenDealingDamage(user, target)
|
||||
return if @battle.pbAllFainted?(target.idxOwnSide)
|
||||
showAnim = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
|
||||
if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim)
|
||||
showAnim = false
|
||||
@@ -195,7 +195,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return false if damagingMove?
|
||||
failed = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
|
||||
failed = false
|
||||
break
|
||||
@@ -205,14 +205,14 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
|
||||
# is shown here, I know.
|
||||
canLower = false
|
||||
if target.hasActiveAbility?(:CONTRARY) && !@battle.moldBreaker
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if target.statStageAtMax?(@statDown[i * 2])
|
||||
canLower = true
|
||||
break
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!", user.pbThis)) if !canLower && show_message
|
||||
else
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if target.statStageAtMin?(@statDown[i * 2])
|
||||
canLower = true
|
||||
break
|
||||
@@ -230,7 +230,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
|
||||
def pbCheckForMirrorArmor(user, target)
|
||||
if target.hasActiveAbility?(:MIRRORARMOR) && user.index != target.index
|
||||
failed = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if target.statStageAtMin?(@statDown[i * 2])
|
||||
next if !user.pbCanLowerStatStage?(@statDown[i * 2], target, self, false, false, true)
|
||||
failed = false
|
||||
@@ -253,7 +253,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
|
||||
return if !pbCheckForMirrorArmor(user, target)
|
||||
showAnim = true
|
||||
showMirrorArmorSplash = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
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)
|
||||
|
||||
@@ -482,7 +482,7 @@ class Battle::Move::SwapSideEffects < Battle::Move
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
has_effect = false
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
effects = @battle.sides[side].effects
|
||||
@number_effects.each do |e|
|
||||
next if effects[e] == 0
|
||||
|
||||
@@ -417,13 +417,13 @@ class Battle::Move::LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2 < Battle::Move
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
failed = true
|
||||
for i in 0...@statUp.length / 2
|
||||
(@statUp.length / 2).times do |i|
|
||||
if user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
end
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
if user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
|
||||
failed = false
|
||||
break
|
||||
@@ -438,14 +438,14 @@ class Battle::Move::LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2 < Battle::Move
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
showAnim = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
|
||||
if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim)
|
||||
showAnim = false
|
||||
end
|
||||
end
|
||||
showAnim = true
|
||||
for i in 0...@statUp.length / 2
|
||||
(@statUp.length / 2).times do |i|
|
||||
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
|
||||
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
|
||||
showAnim = false
|
||||
@@ -1359,7 +1359,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move
|
||||
def pbCheckForMirrorArmor(user, target)
|
||||
if target.hasActiveAbility?(:MIRRORARMOR) && user.index != target.index
|
||||
failed = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
next if target.statStageAtMin?(@statDown[i * 2])
|
||||
next if !user.pbCanLowerStatStage?(@statDown[i * 2], target, self, false, false, true)
|
||||
failed = false
|
||||
@@ -1383,7 +1383,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move
|
||||
return if !pbCheckForMirrorArmor(user, target)
|
||||
showAnim = true
|
||||
showMirrorArmorSplash = true
|
||||
for i in 0...@statDown.length / 2
|
||||
(@statDown.length / 2).times do |i|
|
||||
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)
|
||||
|
||||
@@ -381,7 +381,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbSelectBattler(idxBattler, selectMode = 1)
|
||||
numWindows = @battle.sideSizes.max * 2
|
||||
for i in 0...numWindows
|
||||
numWindows.times do |i|
|
||||
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i == idxBattler
|
||||
selVal = (sel) ? selectMode : 0
|
||||
@sprites["dataBox_#{i}"].selected = selVal if @sprites["dataBox_#{i}"]
|
||||
|
||||
@@ -48,13 +48,13 @@ class Battle::Scene
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport, 200, @battle.sideSizes)
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
# The party lineup graphics (bar and balls) for both sides
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.mirror = true if side == 0 # Player's lineup bar only
|
||||
partyBar.visible = false
|
||||
for i in 0...NUM_BALLS
|
||||
NUM_BALLS.times do |i|
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
|
||||
ball.z = 121
|
||||
ball.visible = false
|
||||
@@ -137,7 +137,7 @@ class Battle::Scene
|
||||
bg = pbAddSprite("battle_bg2", -Graphics.width, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.mirror = true
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
baseX, baseY = Battle::Scene.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}", baseX, baseY,
|
||||
(side == 0) ? playerBase : enemyBase, @viewport)
|
||||
|
||||
@@ -27,7 +27,7 @@ class Battle::Scene
|
||||
# data box(es), return the wild Pokémon's sprite(s) to normal colour, show
|
||||
# shiny animation(s)
|
||||
# Set up data box animation
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
@battle.sideSizes[1].times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@battle.battlers[idxBattler]
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler)
|
||||
@@ -42,7 +42,7 @@ class Battle::Scene
|
||||
end
|
||||
# Show shiny animation for wild Pokémon
|
||||
if @battle.showAnims
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
@battle.sideSizes[1].times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny?
|
||||
if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny?
|
||||
@@ -400,7 +400,7 @@ class Battle::Scene
|
||||
# Yield to other code, i.e. playing an animation
|
||||
yield
|
||||
# Restore shadow visibility
|
||||
for i in 0...@battle.battlers.length
|
||||
@battle.battlers.length.times do |i|
|
||||
shadow = @sprites["shadow_#{i}"]
|
||||
shadow.visible = shadows[i] if shadow
|
||||
end
|
||||
|
||||
@@ -38,21 +38,21 @@ class Battle::Scene::MenuBase
|
||||
|
||||
def z=(value)
|
||||
@z = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].z = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def visible=(value)
|
||||
@visible = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].visible = (value && @visibility[i[0]]) if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def color=(value)
|
||||
@color = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].color = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
@@ -174,7 +174,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
@msgBox.text = value[0]
|
||||
return if USE_GRAPHICS
|
||||
commands = []
|
||||
for i in 1..4
|
||||
(1..4).each do |i|
|
||||
commands.push(value[i]) if value[i] && value[i] != nil
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
@@ -182,8 +182,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
|
||||
def refreshButtons
|
||||
return if !USE_GRAPHICS
|
||||
for i in 0...@buttons.length
|
||||
button = @buttons[i]
|
||||
@buttons.each_with_index do |button, i|
|
||||
button.src_rect.x = (i == @index) ? @buttonBitmap.width / 2 : 0
|
||||
button.src_rect.y = MODES[@mode][i] * BUTTON_HEIGHT
|
||||
button.z = self.z + ((i == @index) ? 3 : 2)
|
||||
@@ -343,7 +342,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
if !USE_GRAPHICS
|
||||
# Fill in command window
|
||||
commands = []
|
||||
for i in 0...[4, moves.length].max
|
||||
[4, moves.length].max.times do |i|
|
||||
commands.push((moves[i]) ? moves[i].name : "-")
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
|
||||
@@ -133,14 +133,14 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def opacity=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].opacity = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def visible=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].visible = value if !i[1].disposed?
|
||||
end
|
||||
@expBar.visible = (value && @showExp)
|
||||
@@ -148,7 +148,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def color=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].color = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
@@ -335,7 +335,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
@expFlash = Graphics.frame_rate / 5
|
||||
pbSEPlay("Pkmn exp full")
|
||||
self.flash(Color.new(64, 200, 248, 192), @expFlash)
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].flash(Color.new(64, 200, 248, 192), @expFlash) if !i[1].disposed?
|
||||
end
|
||||
else
|
||||
|
||||
@@ -169,7 +169,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
a = (2 * startY) - (4 * midY) + (2 * endY)
|
||||
b = (4 * midY) - (3 * startY) - endY
|
||||
c = startY
|
||||
for i in 1..duration
|
||||
(1..duration).each do |i|
|
||||
t = i.to_f / duration # t ranges from 0 to 1
|
||||
x = startX + ((endX - startX) * t) # Linear in t
|
||||
y = (a * (t**2)) + (b * t) + c # Quadratic in t
|
||||
@@ -188,7 +188,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
end
|
||||
if numFrames > 1
|
||||
curFrame = 0
|
||||
for i in 1..duration
|
||||
(1..duration).each do |i|
|
||||
thisFrame = numFrames * numTumbles * i / duration
|
||||
if thisFrame > curFrame
|
||||
curFrame = thisFrame
|
||||
|
||||
@@ -33,7 +33,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
# Shadows
|
||||
for i in 0...@battle.battlers.length
|
||||
@battle.battlers.length.times do |i|
|
||||
makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::Center)
|
||||
end
|
||||
# Fading blackness over whole screen
|
||||
@@ -70,7 +70,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
|
||||
end
|
||||
|
||||
def createProcesses
|
||||
for i in 0...@sideSize
|
||||
@sideSize.times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@sprites["pokemon_#{idxBattler}"]
|
||||
battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom)
|
||||
@@ -117,7 +117,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
bar.y = barY
|
||||
bar.opacity = 255
|
||||
bar.visible = false
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
ball = sprites["partyBall_#{@side}_#{i}"]
|
||||
ball.x = ballX
|
||||
ball.y = ballY
|
||||
@@ -154,7 +154,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
bar.setDelta(0, dir * Graphics.width / 2, 0)
|
||||
bar.moveDelta(0, 8, -dir * Graphics.width / 2, 0)
|
||||
delay = bar.totalDuration
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
createBall(i, (@fullAnim) ? delay + (i * 2) : 0, dir)
|
||||
end
|
||||
end
|
||||
@@ -339,7 +339,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
||||
partyBar.setVisible(delay + 12, false)
|
||||
partyBar.setOpacity(delay + 12, 255)
|
||||
end
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible
|
||||
partyBall = addSprite(@sprites["partyBall_0_#{i}"])
|
||||
partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim
|
||||
@@ -384,7 +384,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
||||
partyBar.setVisible(delay + 12, false)
|
||||
partyBar.setOpacity(delay + 12, 255)
|
||||
end
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible
|
||||
partyBall = addSprite(@sprites["partyBall_1_#{i}"])
|
||||
partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim
|
||||
@@ -777,7 +777,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
delay = ball.totalDuration + 3
|
||||
end
|
||||
# Poké Ball drops to the ground
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
t = [4, 4, 3, 2][i] # Time taken to rise or fall for each bounce
|
||||
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
|
||||
delay -= t if i == 0
|
||||
@@ -793,7 +793,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
battler.setXY(ball.totalDuration, ballEndX, ballGroundY)
|
||||
# Poké Ball shakes
|
||||
delay = ball.totalDuration + 12
|
||||
for i in 0...[@numShakes, 3].min
|
||||
[@numShakes, 3].min.times do |i|
|
||||
ball.setSE(delay, "Battle ball shake")
|
||||
ball.moveXY(delay, 2, ballEndX - (2 * (4 - i)), ballGroundY)
|
||||
ball.moveAngle(delay, 2, 5 * (4 - i)) # positive means counterclockwise
|
||||
|
||||
@@ -193,7 +193,7 @@ module Battle::CatchAndStoreMixin
|
||||
end
|
||||
# Calculate the number of shakes
|
||||
numShakes = 0
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
break if numShakes < i
|
||||
numShakes += 1 if pbRandom(65536) < y
|
||||
end
|
||||
|
||||
@@ -123,10 +123,10 @@ def pbConvertRPGAnimation(animation)
|
||||
pbAnim.position = animation.position
|
||||
yOffset = -64 if animation.position == 0
|
||||
yOffset = 64 if animation.position == 2
|
||||
for i in 0...animation.frames.length
|
||||
animation.frames.length.times do |i|
|
||||
frame = pbAnim.addFrame
|
||||
animFrame = animation.frames[i]
|
||||
for j in 0...animFrame.cell_max
|
||||
animFrame.cell_max.times do |j|
|
||||
data = animFrame.cell_data
|
||||
if data[j, 0] == -1
|
||||
frame.push(nil)
|
||||
@@ -152,8 +152,7 @@ def pbConvertRPGAnimation(animation)
|
||||
frame.push(cel)
|
||||
end
|
||||
end
|
||||
for i in 0...animation.timings.length
|
||||
timing = animation.timings[i]
|
||||
animation.timings.each do |timing|
|
||||
newTiming = PBAnimTiming.new
|
||||
newTiming.frame = timing.frame
|
||||
newTiming.name = timing.se.name
|
||||
@@ -193,18 +192,18 @@ class RPG::Animation
|
||||
def addAnimation(otherAnim, frame, x, y) # frame is zero-based
|
||||
if frame + otherAnim.frames.length >= self.frames.length
|
||||
totalframes = frame + otherAnim.frames.length + 1
|
||||
for i in self.frames.length...totalframes
|
||||
(totalframes - self.frames.length).times do
|
||||
self.frames.push(RPG::Animation::Frame.new)
|
||||
end
|
||||
end
|
||||
self.frame_max = self.frames.length
|
||||
for i in 0...otherAnim.frame_max
|
||||
otherAnim.frame_max.times do |i|
|
||||
thisframe = self.frames[frame + i]
|
||||
otherframe = otherAnim.frames[i]
|
||||
cellStart = thisframe.cell_max
|
||||
thisframe.cell_max += otherframe.cell_max
|
||||
thisframe.cell_data.resize(thisframe.cell_max, 8)
|
||||
for j in 0...otherframe.cell_max
|
||||
otherframe.cell_max.times do |j|
|
||||
thisframe.cell_data[cellStart + j, 0] = otherframe.cell_data[j, 0]
|
||||
thisframe.cell_data[cellStart + j, 1] = otherframe.cell_data[j, 1] + x
|
||||
thisframe.cell_data[cellStart + j, 2] = otherframe.cell_data[j, 2] + y
|
||||
@@ -215,9 +214,8 @@ class RPG::Animation
|
||||
thisframe.cell_data[cellStart + j, 7] = otherframe.cell_data[j, 7]
|
||||
end
|
||||
end
|
||||
for i in 0...otherAnim.timings.length
|
||||
otherAnim.timings.each do |othertiming|
|
||||
timing = RPG::Animation::Timing.new
|
||||
othertiming = otherAnim.timings[i]
|
||||
timing.frame = frame + othertiming.frame
|
||||
timing.se = RPG::AudioFile.new(othertiming.se.name.clone,
|
||||
othertiming.se.volume,
|
||||
@@ -398,13 +396,9 @@ class PBAnimations < Array
|
||||
idxStart = @array.length
|
||||
idxEnd = len
|
||||
if idxStart > idxEnd
|
||||
for i in idxEnd...idxStart
|
||||
@array.pop
|
||||
end
|
||||
(idxStart - idxEnd).times { @array.pop }
|
||||
else
|
||||
for i in idxStart...idxEnd
|
||||
@array.push(PBAnimation.new)
|
||||
end
|
||||
(idxEnd - idxStart).times { @array.push(PBAnimation.new) }
|
||||
end
|
||||
self.selected = len if self.selected >= len
|
||||
end
|
||||
@@ -494,7 +488,7 @@ class PBAnimation < Array
|
||||
end
|
||||
|
||||
def playTiming(frame, bgGraphic, bgColor, foGraphic, foColor, oldbg = [], oldfo = [], user = nil)
|
||||
for i in @timing
|
||||
@timing.each do |i|
|
||||
next if i.frame != frame
|
||||
case i.timingType
|
||||
when 0 # Play SE
|
||||
@@ -562,7 +556,7 @@ class PBAnimation < Array
|
||||
end
|
||||
end
|
||||
end
|
||||
for i in @timing
|
||||
@timing.each do |i|
|
||||
case i.timingType
|
||||
when 2
|
||||
next if !i.duration || i.duration <= 0
|
||||
@@ -729,7 +723,7 @@ class PBAnimationPlayerX
|
||||
@animsprites = []
|
||||
@animsprites[0] = @usersprite
|
||||
@animsprites[1] = @targetsprite
|
||||
for i in 2...MAX_SPRITES
|
||||
(2...MAX_SPRITES).each do |i|
|
||||
@animsprites[i] = Sprite.new(@viewport)
|
||||
@animsprites[i].bitmap = nil
|
||||
@animsprites[i].visible = false
|
||||
@@ -768,7 +762,7 @@ class PBAnimationPlayerX
|
||||
|
||||
def dispose
|
||||
@animbitmap.dispose if @animbitmap
|
||||
for i in 2...MAX_SPRITES
|
||||
(2...MAX_SPRITES).each do |i|
|
||||
@animsprites[i].dispose if @animsprites[i]
|
||||
end
|
||||
@bgGraphic.dispose
|
||||
@@ -807,7 +801,7 @@ class PBAnimationPlayerX
|
||||
if !@animbitmap || @animbitmap.disposed?
|
||||
@animbitmap = AnimatedBitmap.new("Graphics/Animations/" + @animation.graphic,
|
||||
@animation.hue).deanimate
|
||||
for i in 0...MAX_SPRITES
|
||||
MAX_SPRITES.times do |i|
|
||||
@animsprites[i].bitmap = @animbitmap if @animsprites[i]
|
||||
end
|
||||
end
|
||||
@@ -821,11 +815,11 @@ class PBAnimationPlayerX
|
||||
if @framesPerTick == 1 || (@frame % @framesPerTick) == 0
|
||||
thisframe = @animation[animFrame]
|
||||
# Make all cel sprites invisible
|
||||
for i in 0...MAX_SPRITES
|
||||
MAX_SPRITES.times do |i|
|
||||
@animsprites[i].visible = false if @animsprites[i]
|
||||
end
|
||||
# Set each cel sprite acoordingly
|
||||
for i in 0...thisframe.length
|
||||
thisframe.length.times do |i|
|
||||
cel = thisframe[i]
|
||||
next if !cel
|
||||
sprite = @animsprites[i]
|
||||
|
||||
@@ -123,7 +123,7 @@ class BattlePalaceBattle < Battle
|
||||
category = 2
|
||||
end
|
||||
moves = []
|
||||
for i in 0...this_battler.moves.length
|
||||
this_battler.moves.length.times do |i|
|
||||
next if !pbCanChooseMovePartial?(idxBattler, i)
|
||||
next if pbMoveCategory(this_battler.moves[i]) != category
|
||||
moves[moves.length] = i
|
||||
|
||||
@@ -64,7 +64,7 @@ class BattleArenaBattle < Battle
|
||||
return if !favorDraws && @decision > 0
|
||||
pbJudge
|
||||
return if @decision > 0
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
next if !@battlers[side].fainted?
|
||||
next if @partyindexes[side] + 1 >= self.pbParty(side).length
|
||||
@partyindexes[side] += 1
|
||||
@@ -77,7 +77,7 @@ class BattleArenaBattle < Battle
|
||||
|
||||
def pbOnAllBattlersEnteringBattle
|
||||
@battlersChanged = true
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
@mind[side] = 0
|
||||
@skill[side] = 0
|
||||
@starthp[side] = battlers[side].hp
|
||||
@@ -88,7 +88,7 @@ class BattleArenaBattle < Battle
|
||||
|
||||
def pbRecordBattlerAsActive(battler)
|
||||
@battlersChanged = true
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
@mind[side] = 0
|
||||
@skill[side] = 0
|
||||
@starthp[side] = @battlers[side].hp
|
||||
@@ -122,7 +122,7 @@ class BattleArenaBattle < Battle
|
||||
return if @decision != 0
|
||||
# Update mind rating (asserting that a move was chosen)
|
||||
# TODO: Actually done at Pokémon's turn
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
if @choices[side][2] && @choices[side][0] == :UseMove
|
||||
@mind[side] += pbMindScore(@choices[side][2])
|
||||
end
|
||||
@@ -133,7 +133,7 @@ class BattleArenaBattle < Battle
|
||||
super
|
||||
return if @decision != 0
|
||||
# Update skill rating
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
@skill[side] += self.successStates[side].skill
|
||||
end
|
||||
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
|
||||
@@ -234,7 +234,7 @@ class Battle::Scene
|
||||
def updateJudgment(window, phase, battler1, battler2, ratings1, ratings2)
|
||||
total1 = 0
|
||||
total2 = 0
|
||||
for i in 0...phase
|
||||
phase.times do |i|
|
||||
total1 += ratings1[i]
|
||||
total2 += ratings2[i]
|
||||
end
|
||||
@@ -253,7 +253,7 @@ class Battle::Scene
|
||||
]
|
||||
pbDrawTextPositions(window.contents, textpos)
|
||||
images = []
|
||||
for i in 0...phase
|
||||
phase.times do |i|
|
||||
y = [48, 80, 112][i]
|
||||
x = (ratings1[i] == ratings2[i]) ? 64 : ((ratings1[i] > ratings2[i]) ? 0 : 32)
|
||||
images.push(["Graphics/Pictures/judgment", 64 - 16, y, x, 0, 32, 32])
|
||||
@@ -287,7 +287,7 @@ class Battle::Scene
|
||||
infowindow.height - infowindow.borderY)
|
||||
infowindow.z = 99999
|
||||
infowindow.visible = false
|
||||
for i in 0..10
|
||||
11.times do |i|
|
||||
pbGraphicsUpdate
|
||||
pbInputUpdate
|
||||
msgwindow.update
|
||||
@@ -296,7 +296,7 @@ class Battle::Scene
|
||||
end
|
||||
updateJudgment(infowindow, 0, battler1, battler2, ratings1, ratings2)
|
||||
infowindow.visible = true
|
||||
for i in 0..10
|
||||
11.times do |i|
|
||||
pbGraphicsUpdate
|
||||
pbInputUpdate
|
||||
msgwindow.update
|
||||
@@ -326,7 +326,7 @@ class Battle::Scene
|
||||
}
|
||||
total1 = 0
|
||||
total2 = 0
|
||||
for i in 0...3
|
||||
3.times do |i|
|
||||
total1 += ratings1[i]
|
||||
total2 += ratings2[i]
|
||||
end
|
||||
@@ -356,7 +356,7 @@ class Battle::Scene
|
||||
end
|
||||
infowindow.visible = false
|
||||
msgwindow.visible = false
|
||||
for i in 0..10
|
||||
11.times do |i|
|
||||
pbGraphicsUpdate
|
||||
pbInputUpdate
|
||||
msgwindow.update
|
||||
|
||||
@@ -29,11 +29,11 @@ module RecordedBattleModule
|
||||
return nil if !trainer
|
||||
if trainer.is_a?(Array)
|
||||
ret = []
|
||||
for i in 0...trainer.length
|
||||
if trainer[i].is_a?(Player)
|
||||
ret.push([trainer[i].trainer_type, trainer[i].name.clone, trainer[i].id, trainer[i].badges.clone])
|
||||
trainer.each do |tr|
|
||||
if tr.is_a?(Player)
|
||||
ret.push([tr.trainer_type, tr.name.clone, tr.id, tr.badges.clone])
|
||||
else # NPCTrainer
|
||||
ret.push([trainer[i].trainer_type, trainer[i].name.clone, trainer[i].id])
|
||||
ret.push([tr.trainer_type, tr.name.clone, tr.id])
|
||||
end
|
||||
end
|
||||
return ret
|
||||
@@ -202,7 +202,7 @@ module RecordedBattlePlaybackModule
|
||||
def pbCommandPhaseLoop(isPlayer)
|
||||
return if !isPlayer
|
||||
@roundindex += 1
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
next if @rounds[@roundindex][i].length == 0
|
||||
pbClearChoice(i)
|
||||
case @rounds[@roundindex][i][0]
|
||||
|
||||
Reference in New Issue
Block a user