mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
More Rubocopping
This commit is contained in:
@@ -427,7 +427,7 @@ def pbTrainerTypeEditorNew(default_name)
|
||||
id = "T_" + id
|
||||
end
|
||||
if GameData::TrainerType.exists?(id)
|
||||
for i in 1..100
|
||||
(1..100).each do |i|
|
||||
trial_id = sprintf("%s_%d", id, i)
|
||||
next if GameData::TrainerType.exists?(trial_id)
|
||||
id = trial_id
|
||||
@@ -522,10 +522,10 @@ def pbTrainerBattleEditor
|
||||
tr_data.version,
|
||||
tr_data.real_lose_text
|
||||
]
|
||||
for i in 0...Settings::MAX_PARTY_SIZE
|
||||
Settings::MAX_PARTY_SIZE.times do |i|
|
||||
data.push(tr_data.pokemon[i])
|
||||
end
|
||||
for i in 0...TrainerBattleProperty::NUM_ITEMS
|
||||
TrainerBattleProperty::NUM_ITEMS.times do |i|
|
||||
data.push(tr_data.items[i])
|
||||
end
|
||||
loop do
|
||||
@@ -533,10 +533,10 @@ def pbTrainerBattleEditor
|
||||
break if !data
|
||||
party = []
|
||||
items = []
|
||||
for i in 0...Settings::MAX_PARTY_SIZE
|
||||
Settings::MAX_PARTY_SIZE.times do |i|
|
||||
party.push(data[4 + i]) if data[4 + i] && data[4 + i][:species]
|
||||
end
|
||||
for i in 0...TrainerBattleProperty::NUM_ITEMS
|
||||
TrainerBattleProperty::NUM_ITEMS.times do |i|
|
||||
items.push(data[4 + Settings::MAX_PARTY_SIZE + i]) if data[4 + Settings::MAX_PARTY_SIZE + i]
|
||||
end
|
||||
if !data[0]
|
||||
@@ -959,7 +959,7 @@ def pbItemEditorNew(default_name)
|
||||
id = "ITEM_" + id
|
||||
end
|
||||
if GameData::Item.exists?(id)
|
||||
for i in 1..100
|
||||
(1..100).each do |i|
|
||||
trial_id = sprintf("%s_%d", id, i)
|
||||
next if GameData::Item.exists?(trial_id)
|
||||
id = trial_id
|
||||
@@ -1387,7 +1387,7 @@ def pbAppendEvoToFamilyArray(species, array, seenarray)
|
||||
evos = GameData::Species.get(species).get_evolutions
|
||||
if evos.length > 0
|
||||
subarray = []
|
||||
for i in evos
|
||||
evos.each do |i|
|
||||
pbAppendEvoToFamilyArray(i[0], subarray, seenarray)
|
||||
end
|
||||
array.push(subarray) if subarray.length > 0
|
||||
@@ -1410,9 +1410,9 @@ end
|
||||
def pbEvoFamiliesToStrings
|
||||
ret = []
|
||||
families = pbGetEvoFamilies
|
||||
for fam in 0...families.length
|
||||
families.length.times do |fam|
|
||||
string = ""
|
||||
for p in 0...families[fam].length
|
||||
families[fam].length.times do |p|
|
||||
if p >= 3
|
||||
string += " + #{families[fam].length - 3} more"
|
||||
break
|
||||
@@ -1457,7 +1457,7 @@ def pbAnimationsOrganiser
|
||||
loop do
|
||||
if refreshlist
|
||||
commands = []
|
||||
for i in 0...list.length
|
||||
list.length.times do |i|
|
||||
commands.push(sprintf("%d: %s", i, (list[i]) ? list[i].name : "???"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ class PokemonTilesetScene
|
||||
|
||||
def choose_tileset
|
||||
commands = []
|
||||
for i in 1...@tilesets_data.length
|
||||
(1...@tilesets_data.length).each do |i|
|
||||
commands.push(sprintf("%03d %s", i, @tilesets_data[i].name))
|
||||
end
|
||||
ret = pbShowCommands(nil, commands, -1)
|
||||
@@ -69,10 +69,10 @@ class PokemonTilesetScene
|
||||
|
||||
def draw_tiles
|
||||
@sprites["tileset"].bitmap.clear
|
||||
for yy in 0...@visible_height
|
||||
@visible_height.times do |yy|
|
||||
autotile_row = (@top_y == 0 && yy == 0) # Autotiles
|
||||
id_y_offset = (autotile_row) ? 0 : TILESET_START_ID + ((@top_y + yy - 1) * TILES_PER_ROW)
|
||||
for xx in 0...TILES_PER_ROW
|
||||
TILES_PER_ROW.times do |xx|
|
||||
id_x_offset = (autotile_row) ? xx * TILES_PER_AUTOTILE : xx
|
||||
@tilehelper.bltTile(@sprites["tileset"].bitmap, xx * TILE_SIZE, yy * TILE_SIZE,
|
||||
id_y_offset + id_x_offset)
|
||||
@@ -84,8 +84,8 @@ class PokemonTilesetScene
|
||||
@sprites["overlay"].bitmap.clear
|
||||
# Draw all text over tiles (terrain tag numbers)
|
||||
textpos = []
|
||||
for yy in 0...@visible_height
|
||||
for xx in 0...TILES_PER_ROW
|
||||
@visible_height.times do |yy|
|
||||
TILES_PER_ROW.times do |xx|
|
||||
tile_id = tile_ID_from_coordinates(xx, @top_y + yy)
|
||||
terr = @tileset.terrain_tags[tile_id]
|
||||
textpos.push(["#{terr}", (xx * TILE_SIZE) + (TILE_SIZE / 2), (yy * TILE_SIZE) - 6, 2, TEXT_COLOR, TEXT_SHADOW_COLOR])
|
||||
@@ -137,9 +137,7 @@ class PokemonTilesetScene
|
||||
|
||||
def set_terrain_tag_for_tile_ID(i, value)
|
||||
if i < TILESET_START_ID
|
||||
for j in 0...TILES_PER_AUTOTILE
|
||||
@tileset.terrain_tags[i + j] = value
|
||||
end
|
||||
TILES_PER_AUTOTILE.times { |j| @tileset.terrain_tags[i + j] = value }
|
||||
else
|
||||
@tileset.terrain_tags[i] = value
|
||||
end
|
||||
|
||||
@@ -168,7 +168,7 @@ class MapScreenScene
|
||||
mapsprite = getMapSprite(id)
|
||||
dispx = mapsprite.x
|
||||
dispy = mapsprite.y
|
||||
for conn in conns
|
||||
conns.each do |conn|
|
||||
if conn[0] == id
|
||||
b = sprites.any? { |i| i == conn[3] }
|
||||
if !b
|
||||
@@ -192,7 +192,7 @@ class MapScreenScene
|
||||
end
|
||||
|
||||
def hasConnections?(conns, id)
|
||||
for conn in conns
|
||||
conns.each do |conn|
|
||||
return true if conn[0] == id || conn[3] == id
|
||||
end
|
||||
return false
|
||||
@@ -228,7 +228,7 @@ class MapScreenScene
|
||||
thissprite = getMapSprite(map)
|
||||
thisdims = MapFactoryHelper.getMapDims(map)
|
||||
ret = []
|
||||
for i in keys
|
||||
keys.each do |i|
|
||||
next if i == map
|
||||
othersprite = getMapSprite(i)
|
||||
otherdims = MapFactoryHelper.getMapDims(i)
|
||||
@@ -250,19 +250,19 @@ class MapScreenScene
|
||||
def generateConnectionData
|
||||
ret = []
|
||||
# Create a clone of current map connection
|
||||
for conn in @mapconns
|
||||
@mapconns.each do |conn|
|
||||
ret.push(conn.clone)
|
||||
end
|
||||
keys = @mapsprites.keys
|
||||
return ret if keys.length < 2
|
||||
# Remove all connections containing any sprites on the canvas from the array
|
||||
for i in keys
|
||||
keys.each do |i|
|
||||
removeOldConnections(ret, i)
|
||||
end
|
||||
# Rebuild connections
|
||||
for i in keys
|
||||
keys.each do |i|
|
||||
refs = getDirectConnections(keys, i)
|
||||
for refmap in refs
|
||||
refs.each do |refmap|
|
||||
othersprite = getMapSprite(i)
|
||||
refsprite = getMapSprite(refmap)
|
||||
c1 = (refsprite.x - othersprite.x) / 4
|
||||
@@ -302,7 +302,7 @@ class MapScreenScene
|
||||
|
||||
def saveMapSpritePos
|
||||
@mapspritepos.clear
|
||||
for i in @mapsprites.keys
|
||||
@mapsprites.keys.each do |i|
|
||||
s = @mapsprites[i]
|
||||
@mapspritepos[i] = [s.x, s.y] if s && !s.disposed?
|
||||
end
|
||||
@@ -332,7 +332,7 @@ class MapScreenScene
|
||||
@mapinfos = pbLoadMapInfos
|
||||
conns = MapFactoryHelper.getMapConnections
|
||||
@mapconns = []
|
||||
for map_conns in conns
|
||||
conns.each do |map_conns|
|
||||
next if !map_conns
|
||||
map_conns.each do |c|
|
||||
@mapconns.push(c.clone) if !@mapconns.any? { |x| x[0] == c[0] && x[3] == c[3] }
|
||||
@@ -347,7 +347,7 @@ class MapScreenScene
|
||||
end
|
||||
|
||||
def setTopSprite(id)
|
||||
for i in @mapsprites.keys
|
||||
@mapsprites.keys.each do |i|
|
||||
@mapsprites[i].z = (i == id) ? 1 : 0
|
||||
end
|
||||
end
|
||||
@@ -441,7 +441,7 @@ class MapScreenScene
|
||||
else
|
||||
xpos = x - @dragOffsetX
|
||||
ypos = y - @dragOffsetY
|
||||
for i in @mapspritepos.keys
|
||||
@mapspritepos.keys.each do |i|
|
||||
sprite = getMapSprite(i)
|
||||
sprite.x = (@mapspritepos[i][0] + xpos) & ~3
|
||||
sprite.y = (@mapspritepos[i][1] + ypos) & ~3
|
||||
@@ -456,7 +456,7 @@ class MapScreenScene
|
||||
end
|
||||
|
||||
def hittest(x, y)
|
||||
for i in @mapsprites.keys
|
||||
@mapsprites.keys.each do |i|
|
||||
sx = @mapsprites[i].x
|
||||
sy = @mapsprites[i].y
|
||||
sr = sx + @mapsprites[i].bitmap.width
|
||||
@@ -495,22 +495,22 @@ class MapScreenScene
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::UP)
|
||||
for i in @mapsprites
|
||||
@mapsprites.each do |i|
|
||||
i[1].y += 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::DOWN)
|
||||
for i in @mapsprites
|
||||
@mapsprites.each do |i|
|
||||
i[1].y -= 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::LEFT)
|
||||
for i in @mapsprites
|
||||
@mapsprites.each do |i|
|
||||
i[1].x += 4 if i
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::RIGHT)
|
||||
for i in @mapsprites
|
||||
@mapsprites.each do |i|
|
||||
i[1].x -= 4 if i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#===============================================================================
|
||||
def findBottom(bitmap)
|
||||
return 0 if !bitmap
|
||||
for i in 1..bitmap.height
|
||||
for j in 0..bitmap.width - 1
|
||||
(1..bitmap.height).each do |i|
|
||||
bitmap.width.times do |j|
|
||||
return bitmap.height - i if bitmap.get_pixel(j, bitmap.height - i).alpha > 0
|
||||
end
|
||||
end
|
||||
@@ -117,7 +117,7 @@ class SpritePositioner
|
||||
return
|
||||
end
|
||||
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
|
||||
for i in 0...2
|
||||
2.times do |i|
|
||||
pos = Battle::Scene.pbBattlerPosition(i, 1)
|
||||
@sprites["pokemon_#{i}"].x = pos[0]
|
||||
@sprites["pokemon_#{i}"].y = pos[1]
|
||||
|
||||
@@ -41,7 +41,7 @@ def pbSafeCopyFile(x, y, z = nil)
|
||||
end
|
||||
|
||||
def pbAllocateAnimation(animations, name)
|
||||
for i in 1...animations.length
|
||||
(1...animations.length).each do |i|
|
||||
anim = animations[i]
|
||||
return i if !anim
|
||||
# if name && name!="" && anim.name==name
|
||||
@@ -62,7 +62,7 @@ def pbMapTree
|
||||
mapinfos = pbLoadMapInfos
|
||||
maplevels = []
|
||||
retarray = []
|
||||
for i in mapinfos.keys
|
||||
mapinfos.keys.each do |i|
|
||||
info = mapinfos[i]
|
||||
level = -1
|
||||
while info
|
||||
@@ -97,7 +97,7 @@ def pbMapTree
|
||||
next
|
||||
end
|
||||
retarray.push([maplevel[0], mapinfos[maplevel[0]].name, maplevel[1]])
|
||||
for i in index + 1...maplevels.length
|
||||
(index + 1...maplevels.length).each do |i|
|
||||
if maplevels[i][2] == maplevel[0]
|
||||
stack.push(i)
|
||||
stack.push(maplevel[0])
|
||||
@@ -191,8 +191,8 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||
moveDefault = 0
|
||||
if defaultMoveID
|
||||
commands.each_with_index do |_item, i|
|
||||
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
|
||||
commands.each_with_index do |item, i|
|
||||
moveDefault = i if moveDefault == 0 && item[2] == defaultMoveID
|
||||
end
|
||||
end
|
||||
# Get all moves
|
||||
@@ -203,8 +203,8 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
end
|
||||
commands2.sort! { |a, b| a[1] <=> b[1] }
|
||||
if defaultMoveID
|
||||
commands2.each_with_index do |_item, i|
|
||||
moveDefault = i if moveDefault == 0 && i[2] == defaultMoveID
|
||||
commands2.each_with_index do |item, i|
|
||||
moveDefault = i if moveDefault == 0 && item[2] == defaultMoveID
|
||||
end
|
||||
end
|
||||
# Choose from all moves
|
||||
@@ -225,12 +225,14 @@ def pbChooseBallList(defaultMoveID = nil)
|
||||
end
|
||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||
if defaultMoveID
|
||||
for i in 0...commands.length
|
||||
moveDefault = i if commands[i][0] == defaultMoveID
|
||||
commands.each_with_index do |cmd, i|
|
||||
next if cmd[0] != defaultMoveID
|
||||
moveDefault = i
|
||||
break
|
||||
end
|
||||
end
|
||||
realcommands = []
|
||||
for i in commands
|
||||
commands.each do |i|
|
||||
realcommands.push(i[1])
|
||||
end
|
||||
ret = pbCommands2(cmdwin, realcommands, -1, moveDefault, true)
|
||||
@@ -354,7 +356,7 @@ def pbChooseList(commands, default = 0, cancelValue = -1, sortType = 1)
|
||||
commands.each_with_index { |command, i| itemIndex = i if command[0] == itemID }
|
||||
end
|
||||
realcommands = []
|
||||
for command in commands
|
||||
commands.each do |command|
|
||||
if sortType <= 0
|
||||
realcommands.push(sprintf("%03d: %s", command[0], command[1]))
|
||||
else
|
||||
|
||||
@@ -5,7 +5,7 @@ class Window_Menu < Window_CommandPokemon
|
||||
def initialize(commands, x, y)
|
||||
tempbitmap = Bitmap.new(32, 32)
|
||||
w = 0
|
||||
for i in commands
|
||||
commands.each do |i|
|
||||
width = tempbitmap.text_size(i).width
|
||||
w = width if w < width
|
||||
end
|
||||
@@ -28,7 +28,7 @@ class Window_Menu < Window_CommandPokemon
|
||||
mousepos = Mouse.getMousePos
|
||||
return -1 if !mousepos
|
||||
toprow = self.top_row
|
||||
for i in toprow...toprow + @item_max
|
||||
(toprow...toprow + @item_max).each do |i|
|
||||
rc = Rect.new(0, 32 * (i - toprow), self.contents.width, 32)
|
||||
rc.x += self.x + self.leftEdge
|
||||
rc.y += self.y + self.topEdge
|
||||
@@ -229,7 +229,7 @@ class AnimationWindow < SpriteWrapper
|
||||
rect = Rect.new(0, 0, 0, 0)
|
||||
rectdst = Rect.new(0, 0, 0, 0)
|
||||
x = arrowwidth
|
||||
for i in 0...NUMFRAMES
|
||||
NUMFRAMES.times do |i|
|
||||
j = i + @start
|
||||
rect.set((j % 5) * 192, (j / 5) * 192, 192, 192)
|
||||
rectdst.set(x, 0, 96, 96)
|
||||
@@ -237,7 +237,7 @@ class AnimationWindow < SpriteWrapper
|
||||
x += 96
|
||||
end
|
||||
end
|
||||
for i in 0...NUMFRAMES
|
||||
NUMFRAMES.times do |i|
|
||||
drawrect(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(100, 100, 100))
|
||||
if @start + i == @selected && havebitmap
|
||||
drawborder(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(255, 0, 0))
|
||||
@@ -265,10 +265,10 @@ class AnimationWindow < SpriteWrapper
|
||||
right.y += self.y
|
||||
swatchrects = []
|
||||
repeattime = Input.time?(Input::MOUSELEFT) / 1000
|
||||
for i in 0...NUMFRAMES
|
||||
NUMFRAMES.times do |i|
|
||||
swatchrects.push(Rect.new(arrowwidth + (i * 96) + self.x, self.y, 96, 96))
|
||||
end
|
||||
for i in 0...NUMFRAMES
|
||||
NUMFRAMES.times do |i|
|
||||
if swatchrects[i].contains(mousepos[0], mousepos[1])
|
||||
@selected = @start + i
|
||||
@changed = true
|
||||
@@ -458,12 +458,12 @@ class AnimationCanvas < Sprite
|
||||
@target = AnimatedBitmap.new("Graphics/Pictures/testfront").deanimate
|
||||
@testscreen = AnimatedBitmap.new("Graphics/Pictures/testscreen")
|
||||
self.bitmap = @testscreen.bitmap
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
@lastframesprites[i] = SpriteFrame.new(i, @celsprites[i], viewport, true)
|
||||
@lastframesprites[i].selected = false
|
||||
@lastframesprites[i].visible = false
|
||||
end
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
@celsprites[i] = Sprite.new(viewport)
|
||||
@celsprites[i].visible = false
|
||||
@celsprites[i].src_rect = Rect.new(0, 0, 0, 0)
|
||||
@@ -499,7 +499,7 @@ class AnimationCanvas < Sprite
|
||||
def animbitmap=(value)
|
||||
@animbitmap.dispose if @animbitmap
|
||||
@animbitmap = value
|
||||
for i in 2...PBAnimation::MAX_SPRITES
|
||||
(2...PBAnimation::MAX_SPRITES).each do |i|
|
||||
@celsprites[i].bitmap = @animbitmap if @celsprites[i]
|
||||
end
|
||||
self.invalidate
|
||||
@@ -512,7 +512,7 @@ class AnimationCanvas < Sprite
|
||||
@selectedbitmap.dispose if @selectedbitmap
|
||||
@celbitmap.dispose if @celbitmap
|
||||
self.bitmap.dispose if self.bitmap
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
@celsprites[i].dispose if @celsprites[i]
|
||||
end
|
||||
super
|
||||
@@ -557,7 +557,7 @@ class AnimationCanvas < Sprite
|
||||
@sprites["pokemon_1"].x += BORDERSIZE
|
||||
@sprites["pokemon_1"].y += BORDERSIZE
|
||||
oldstate = []
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
oldstate.push([@celsprites[i].visible, @framesprites[i].visible, @lastframesprites[i].visible])
|
||||
@celsprites[i].visible = false
|
||||
@framesprites[i].visible = false
|
||||
@@ -568,7 +568,7 @@ class AnimationCanvas < Sprite
|
||||
self.update
|
||||
break if !@playing
|
||||
end
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
@celsprites[i].visible = oldstate[i][0]
|
||||
@framesprites[i].visible = oldstate[i][1]
|
||||
@lastframesprites[i].visible = oldstate[i][2]
|
||||
@@ -581,7 +581,7 @@ class AnimationCanvas < Sprite
|
||||
end
|
||||
|
||||
def invalidate
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
invalidateCel(i)
|
||||
end
|
||||
end
|
||||
@@ -635,7 +635,7 @@ class AnimationCanvas < Sprite
|
||||
|
||||
def offsetFrame(frame, ox, oy)
|
||||
if frame >= 0 && frame < @animation.length
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
if !self.locked?(i) && @animation[frame][i]
|
||||
@animation[frame][i][AnimFrame::X] += ox
|
||||
@animation[frame][i][AnimFrame::Y] += oy
|
||||
@@ -648,7 +648,7 @@ class AnimationCanvas < Sprite
|
||||
# Clears all items in the frame except locked items
|
||||
def clearFrame(frame)
|
||||
if frame >= 0 && frame < @animation.length
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
if self.deletable?(i)
|
||||
@animation[frame][i] = nil
|
||||
else
|
||||
@@ -667,7 +667,7 @@ class AnimationCanvas < Sprite
|
||||
|
||||
def copyFrame(src, dst)
|
||||
return if dst >= @animation.length
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
clonedframe = @animation[src][i]
|
||||
clonedframe = clonedframe.clone if clonedframe && clonedframe != true
|
||||
@animation[dst][i] = clonedframe
|
||||
@@ -704,7 +704,7 @@ class AnimationCanvas < Sprite
|
||||
def pasteCel(x, y)
|
||||
return if @currentframe >= @animation.length
|
||||
return if Clipboard.typekey != "PBAnimCel"
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
next if @animation[@currentframe][i]
|
||||
@animation[@currentframe][i] = Clipboard.data
|
||||
cel = @animation[@currentframe][i]
|
||||
@@ -754,7 +754,7 @@ class AnimationCanvas < Sprite
|
||||
if cel[AnimFrame::PATTERN] < 0
|
||||
count = 0
|
||||
pattern = cel[AnimFrame::PATTERN]
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
othercel = @animation[self.currentframe][i]
|
||||
count += 1 if othercel && othercel[AnimFrame::PATTERN] == pattern
|
||||
end
|
||||
@@ -786,7 +786,7 @@ class AnimationCanvas < Sprite
|
||||
|
||||
def addSprite(x, y)
|
||||
return false if @currentframe >= @animation.length
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
next if @animation[@currentframe][i]
|
||||
@animation[@currentframe][i] = pbCreateCel(x, y, @pattern, @animation.position)
|
||||
@dirty[i] = true
|
||||
@@ -803,7 +803,7 @@ class AnimationCanvas < Sprite
|
||||
if Input.trigger?(Input::MOUSELEFT) # Left mouse button
|
||||
selectedcel = -1
|
||||
usealpha = (Input.press?(Input::ALT)) ? true : false
|
||||
for j in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |j|
|
||||
if pbSpriteHitTest(@celsprites[j], mousepos[0], mousepos[1], usealpha, false)
|
||||
selectedcel = j
|
||||
end
|
||||
@@ -924,7 +924,7 @@ class AnimationCanvas < Sprite
|
||||
# @testscreen.update
|
||||
# self.bitmap=@testscreen.bitmap
|
||||
if @currentframe < @animation.length
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
if @dirty[i]
|
||||
if @celsprites[i]
|
||||
setBitmap(i, @currentframe)
|
||||
@@ -938,7 +938,7 @@ class AnimationCanvas < Sprite
|
||||
end
|
||||
end
|
||||
else
|
||||
for i in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |i|
|
||||
pbSpriteSetAnimFrame(@celsprites[i], nil, @celsprites[0], @celsprites[1], true)
|
||||
@celsprites[i].x += BORDERSIZE
|
||||
@celsprites[i].y += BORDERSIZE
|
||||
|
||||
@@ -233,7 +233,7 @@ class TextField < UIControl
|
||||
chars = self.text.scan(/./m)
|
||||
chars.insert(@cursor, ch)
|
||||
@text = ""
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
@text += ch
|
||||
end
|
||||
@cursor += 1
|
||||
@@ -246,7 +246,7 @@ class TextField < UIControl
|
||||
chars = self.text.scan(/./m)
|
||||
chars.delete_at(@cursor - 1)
|
||||
@text = ""
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
@text += ch
|
||||
end
|
||||
@cursor -= 1
|
||||
@@ -320,7 +320,7 @@ class TextField < UIControl
|
||||
break if fromcursor > width - 4
|
||||
startpos -= 1
|
||||
end
|
||||
for i in startpos...scanlength
|
||||
(startpos...scanlength).each do |i|
|
||||
c = textscan[i]
|
||||
textwidth = bitmap.text_size(c).width
|
||||
next if c == "\n"
|
||||
@@ -669,7 +669,7 @@ class TextSlider < UIControl
|
||||
def refresh
|
||||
bitmap = self.bitmap
|
||||
if @maxoptionwidth == nil
|
||||
for i in 0...@options.length
|
||||
@options.length.times do |i|
|
||||
w = self.bitmap.text_size(" " + @options[i] + " ").width
|
||||
@maxoptionwidth = w if !@maxoptionwidth || @maxoptionwidth < w
|
||||
end
|
||||
@@ -808,21 +808,15 @@ class ControlWindow < SpriteWindow_Base
|
||||
end
|
||||
|
||||
def refresh
|
||||
for i in 0...@controls.length
|
||||
@controls[i].refresh
|
||||
end
|
||||
@controls.each { |ctrl| ctrl.refresh }
|
||||
end
|
||||
|
||||
def repaint
|
||||
for i in 0...@controls.length
|
||||
@controls[i].repaint
|
||||
end
|
||||
@controls.each { |ctrl| ctrl.repaint }
|
||||
end
|
||||
|
||||
def invalidate
|
||||
for i in 0...@controls.length
|
||||
@controls[i].invalidate
|
||||
end
|
||||
@controls.each { |ctrl| ctrl.invalidate }
|
||||
end
|
||||
|
||||
def hittest?(i)
|
||||
@@ -882,9 +876,7 @@ class ControlWindow < SpriteWindow_Base
|
||||
|
||||
def update
|
||||
super
|
||||
for i in 0...@controls.length
|
||||
@controls[i].update
|
||||
end
|
||||
@controls.each { |ctrl| ctrl.update }
|
||||
repaint
|
||||
end
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class PointPath
|
||||
|
||||
def inspect
|
||||
p = []
|
||||
for point in @points
|
||||
@points.each do |point|
|
||||
p.push([point[0].to_i, point[1].to_i])
|
||||
end
|
||||
return p.inspect
|
||||
@@ -164,7 +164,7 @@ class PointPath
|
||||
curdist = 0
|
||||
distForT = @totaldist * t
|
||||
i = 0
|
||||
for dist in @distances
|
||||
@distances.each do |dist|
|
||||
curdist += dist
|
||||
if dist > 0.0
|
||||
if curdist >= distForT
|
||||
@@ -249,7 +249,7 @@ def pbDefinePath(canvas)
|
||||
if path
|
||||
path = path.smoothPointPath(sliderwin2.value(0), false)
|
||||
i = 0
|
||||
for point in path
|
||||
path.each do |point|
|
||||
if i < points.length
|
||||
points[i].x = point[0]
|
||||
points[i].y = point[1]
|
||||
@@ -258,14 +258,14 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
for j in i...points.length
|
||||
(i...points.length).each do |j|
|
||||
points[j].dispose
|
||||
points[j] = nil
|
||||
end
|
||||
points.compact!
|
||||
end
|
||||
elsif sliderwin2.changed?(defcurvebutton)
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
points.clear
|
||||
@@ -293,19 +293,19 @@ def pbDefinePath(canvas)
|
||||
break
|
||||
end
|
||||
if Input.trigger?(Input::MOUSELEFT)
|
||||
for j in 0...4
|
||||
4.times do |j|
|
||||
next if !curve[j].hittest?
|
||||
if [1, 2].include?(j)
|
||||
next if !curve[0].visible || !curve[3].visible
|
||||
end
|
||||
curve[j].visible = true
|
||||
for k in 0...4
|
||||
4.times do |k|
|
||||
curve[k].dragging = (k == j)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
for j in 0...4
|
||||
4.times do |j|
|
||||
curve[j].mouseover
|
||||
end
|
||||
mousepos = Mouse.getMousePos(true)
|
||||
@@ -315,7 +315,7 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
if curve[0].visible && curve[3].visible &&
|
||||
!curve[0].dragging && !curve[3].dragging
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.visible = true
|
||||
end
|
||||
if !showline
|
||||
@@ -331,7 +331,7 @@ def pbDefinePath(canvas)
|
||||
if showline
|
||||
step = 1.0 / (points.length - 1)
|
||||
t = 0.0
|
||||
for i in 0...points.length
|
||||
points.length.times do |i|
|
||||
point = getCurvePoint(curve, t)
|
||||
points[i].x = point[0]
|
||||
points[i].y = point[1]
|
||||
@@ -341,18 +341,18 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
window.dispose
|
||||
# dispose temporary path
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
points.clear
|
||||
if showline
|
||||
path = curveToPointPath(curve, sliderwin2.value(0))
|
||||
# File.open("pointpath.txt","wb") { |f| f.write(path.inspect) }
|
||||
for point in path
|
||||
path.each do |point|
|
||||
points.push(PointSprite.new(point[0], point[1], canvas.viewport))
|
||||
end
|
||||
end
|
||||
for point in curve
|
||||
curve.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
sliderwin2.visible = true
|
||||
@@ -360,7 +360,7 @@ def pbDefinePath(canvas)
|
||||
elsif sliderwin2.changed?(defpathbutton)
|
||||
canceled = false
|
||||
pointpath = PointPath.new
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
points.clear
|
||||
@@ -396,14 +396,14 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
window.dispose
|
||||
# dispose temporary path
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
points.clear
|
||||
# generate smooth path from temporary path
|
||||
path = pointpath.smoothPointPath(sliderwin2.value(0), true)
|
||||
# redraw path from smooth path
|
||||
for point in path
|
||||
path.each do |point|
|
||||
points.push(PointSprite.new(point[0], point[1], canvas.viewport))
|
||||
end
|
||||
# File.open("pointpath.txt","wb") { |f| f.write(path.inspect) }
|
||||
@@ -417,7 +417,7 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
thiscel = canvas.currentCel
|
||||
celnumber = canvas.currentcel
|
||||
for i in canvas.currentframe...neededsize
|
||||
(canvas.currentframe...neededsize).each do |i|
|
||||
cel = canvas.animation[i][celnumber]
|
||||
if !canvas.animation[i][celnumber]
|
||||
cel = pbCreateCel(0, 0, thiscel[AnimFrame::PATTERN], canvas.animation.position)
|
||||
@@ -432,7 +432,7 @@ def pbDefinePath(canvas)
|
||||
end
|
||||
end
|
||||
# dispose all points
|
||||
for point in points
|
||||
points.each do |point|
|
||||
point.dispose
|
||||
end
|
||||
points.clear
|
||||
|
||||
@@ -87,9 +87,9 @@ end
|
||||
################################################################################
|
||||
def pbConvertAnimToNewFormat(textdata)
|
||||
needconverting = false
|
||||
for i in 0...textdata.length
|
||||
textdata.length.times do |i|
|
||||
next if !textdata[i]
|
||||
for j in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |j|
|
||||
next if !textdata[i][j]
|
||||
needconverting = true if textdata[i][j][AnimFrame::FOCUS] == nil
|
||||
break if needconverting
|
||||
@@ -97,9 +97,9 @@ def pbConvertAnimToNewFormat(textdata)
|
||||
break if needconverting
|
||||
end
|
||||
if needconverting
|
||||
for i in 0...textdata.length
|
||||
textdata.length.times do |i|
|
||||
next if !textdata[i]
|
||||
for j in 0...PBAnimation::MAX_SPRITES
|
||||
PBAnimation::MAX_SPRITES.times do |j|
|
||||
next if !textdata[i][j]
|
||||
textdata[i][j][AnimFrame::PRIORITY] = 1 if textdata[i][j][AnimFrame::PRIORITY] == nil
|
||||
case j
|
||||
@@ -132,7 +132,7 @@ def pbConvertAnimsToNewFormat
|
||||
pbMessage(_INTL("No animations exist."))
|
||||
return
|
||||
end
|
||||
for k in 0...animations.length
|
||||
animations.length.times do |k|
|
||||
next if !animations[k]
|
||||
ret = pbConvertAnimToNewFormat(animations[k])
|
||||
count += 1 if ret
|
||||
|
||||
@@ -15,9 +15,7 @@ class MiniBattle
|
||||
|
||||
def initialize
|
||||
@battlers = []
|
||||
for i in 0...4
|
||||
@battlers[i] = MiniBattler.new(i)
|
||||
end
|
||||
4.times { |i| @battlers[i] = MiniBattler.new(i) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -118,7 +116,7 @@ end
|
||||
|
||||
def pbAnimList(animations, canvas, animwin)
|
||||
commands = []
|
||||
for i in 0...animations.length
|
||||
animations.length.times do |i|
|
||||
animations[i] = PBAnimation.new if !animations[i]
|
||||
commands[commands.length] = _INTL("{1} {2}", i, animations[i].name)
|
||||
end
|
||||
@@ -146,7 +144,7 @@ def pbAnimList(animations, canvas, animwin)
|
||||
newsize = maxsizewindow.value(0)
|
||||
animations.resize(newsize)
|
||||
commands.clear
|
||||
for i in 0...animations.length
|
||||
animations.length.times do |i|
|
||||
commands[commands.length] = _INTL("{1} {2}", i, animations[i].name)
|
||||
end
|
||||
cmdwin.commands = commands
|
||||
@@ -382,7 +380,7 @@ def pbTimingList(canvas)
|
||||
cmdEditBG = -1
|
||||
cmdNewFO = -1
|
||||
cmdEditFO = -1
|
||||
for i in canvas.animation.timing
|
||||
canvas.animation.timing.each do |i|
|
||||
commands.push(sprintf("%s", i))
|
||||
end
|
||||
commands[cmdNewSound = commands.length] = _INTL("Add: Play Sound...")
|
||||
@@ -752,7 +750,7 @@ def pbClearFrames(canvas)
|
||||
if sliderwin2.changed?(okbutton)
|
||||
startframe = sliderwin2.value(0) - 1
|
||||
endframe = sliderwin2.value(1) - 1
|
||||
for i in startframe..endframe
|
||||
(startframe..endframe).each do |i|
|
||||
canvas.clearFrame(i)
|
||||
end
|
||||
break
|
||||
@@ -789,7 +787,7 @@ def pbTweening(canvas)
|
||||
frames = endframe - startframe
|
||||
startcel = sliderwin2.value(s1set2)
|
||||
endcel = sliderwin2.value(s1set3)
|
||||
for j in startcel..endcel
|
||||
(startcel..endcel).each do |j|
|
||||
cel1 = canvas.animation[startframe][j]
|
||||
cel2 = canvas.animation[endframe][j]
|
||||
next if !cel1 || !cel2
|
||||
@@ -809,7 +807,7 @@ def pbTweening(canvas)
|
||||
startAngle = cel1[AnimFrame::ANGLE]
|
||||
startOpacity = cel1[AnimFrame::OPACITY]
|
||||
startBlend = cel1[AnimFrame::BLENDTYPE]
|
||||
for k in 0..frames
|
||||
(0..frames).each do |k|
|
||||
cel = canvas.animation[startframe + k][j]
|
||||
curcel = cel
|
||||
if !cel
|
||||
@@ -879,8 +877,8 @@ def pbCellBatch(canvas)
|
||||
endframe = sliderwin1.value(s1set1) - 1
|
||||
startcel = sliderwin1.value(s1set2)
|
||||
endcel = sliderwin1.value(s1set3)
|
||||
for i in startframe..endframe
|
||||
for j in startcel..endcel
|
||||
(startframe..endframe).each do |i|
|
||||
(startcel..endcel).each do |j|
|
||||
next if !canvas.animation[i][j]
|
||||
cel = canvas.animation[i][j]
|
||||
cel[AnimFrame::PATTERN] = sliderwin2.value(set0) if sliderwin2.value(set0)
|
||||
@@ -926,7 +924,7 @@ def pbEntireSlide(canvas)
|
||||
endvalue = sliderwin2.value(1) - 1
|
||||
xoffset = sliderwin2.value(2)
|
||||
yoffset = sliderwin2.value(3)
|
||||
for i in startvalue..endvalue
|
||||
(startvalue..endvalue).each do |i|
|
||||
canvas.offsetFrame(i, xoffset, yoffset)
|
||||
end
|
||||
break
|
||||
@@ -1129,7 +1127,7 @@ def animationEditorMain(animation)
|
||||
if sidewin.changed?(1)
|
||||
positions = [_INTL("User"), _INTL("Target"), _INTL("User and target"), _INTL("Screen")]
|
||||
indexes = [2, 1, 3, 4] # Keeping backwards compatibility
|
||||
for i in 0...positions.length
|
||||
positions.length.times do |i|
|
||||
selected = "[ ]"
|
||||
if animation[animation.selected].position == indexes[i]
|
||||
selected = "[x]"
|
||||
|
||||
@@ -190,7 +190,7 @@ class EnumProperty
|
||||
|
||||
def set(settingname, oldsetting)
|
||||
commands = []
|
||||
for value in @values
|
||||
@values.each do |value|
|
||||
commands.push(value)
|
||||
end
|
||||
cmd = pbMessage(_INTL("Choose a value for {1}.", settingname), commands, -1)
|
||||
@@ -217,7 +217,7 @@ class EnumProperty2
|
||||
|
||||
def set(settingname, oldsetting)
|
||||
commands = []
|
||||
for i in 0..@module.maxValue
|
||||
(0..@module.maxValue).each do |i|
|
||||
commands.push(getConstantName(@module, i))
|
||||
end
|
||||
cmd = pbMessage(_INTL("Choose a value for {1}.", settingname), commands, -1, nil, oldsetting)
|
||||
@@ -299,7 +299,7 @@ class StringListProperty
|
||||
else # Cancel/quit
|
||||
case pbMessage(_INTL("Keep changes?"), [_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
for i in 0...real_cmds.length
|
||||
real_cmds.length.times do |i|
|
||||
real_cmds[i] = (real_cmds[i][1] == -1) ? nil : real_cmds[i][0]
|
||||
end
|
||||
real_cmds.compact!
|
||||
@@ -769,7 +769,7 @@ module RegionMapCoordsProperty
|
||||
selregion = regions[0][0]
|
||||
else
|
||||
cmds = []
|
||||
for region in regions
|
||||
regions.each do |region|
|
||||
cmds.push(region[1])
|
||||
end
|
||||
selcmd = pbMessage(_INTL("Choose a region map."), cmds, -1)
|
||||
@@ -790,7 +790,7 @@ module RegionMapCoordsProperty
|
||||
def self.getMapNameList
|
||||
mapdata = pbLoadTownMapData
|
||||
ret = []
|
||||
for i in 0...mapdata.length
|
||||
mapdata.length.times do |i|
|
||||
next if !mapdata[i]
|
||||
ret.push([i, pbGetMessage(MessageTypes::RegionNames, i)])
|
||||
end
|
||||
@@ -1067,7 +1067,7 @@ class GameDataPoolProperty
|
||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
values.shift # Remove the "add value" option
|
||||
for i in 0...values.length
|
||||
values.length.times do |i|
|
||||
values[i] = values[i][0]
|
||||
end
|
||||
values.compact!
|
||||
@@ -1107,7 +1107,7 @@ module LevelUpMovesProperty
|
||||
# Get all moves in move pool
|
||||
realcmds = []
|
||||
realcmds.push([-1, nil, -1, "-"]) # Level, move ID, index in this list, name
|
||||
for i in 0...oldsetting.length
|
||||
oldsetting.length.times do |i|
|
||||
realcmds.push([oldsetting[i][0], oldsetting[i][1], i, GameData::Move.get(oldsetting[i][1]).real_name])
|
||||
end
|
||||
# Edit move pool
|
||||
@@ -1221,7 +1221,7 @@ module LevelUpMovesProperty
|
||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
when 0
|
||||
realcmds.shift
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
realcmds[i].pop # Remove name
|
||||
realcmds[i].pop # Remove index in this list
|
||||
end
|
||||
@@ -1244,7 +1244,7 @@ module LevelUpMovesProperty
|
||||
|
||||
def self.format(value)
|
||||
ret = ""
|
||||
for i in 0...value.length
|
||||
value.length.times do |i|
|
||||
ret << "," if i > 0
|
||||
ret << sprintf("%s,%s", value[i][0], GameData::Move.get(value[i][1]).real_name)
|
||||
end
|
||||
@@ -1300,7 +1300,7 @@ class EvolutionsProperty
|
||||
commands = []
|
||||
realcmds = []
|
||||
realcmds.push([-1, 0, 0, -1])
|
||||
for i in 0...oldsetting.length
|
||||
oldsetting.length.times do |i|
|
||||
realcmds.push([oldsetting[i][0], oldsetting[i][1], oldsetting[i][2], i])
|
||||
end
|
||||
refreshlist = true
|
||||
@@ -1310,7 +1310,7 @@ class EvolutionsProperty
|
||||
if refreshlist
|
||||
realcmds.sort! { |a, b| a[3] <=> b[3] }
|
||||
commands = []
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
if realcmds[i][3] < 0
|
||||
commands.push(_INTL("[ADD EVOLUTION]"))
|
||||
else
|
||||
@@ -1359,7 +1359,7 @@ class EvolutionsProperty
|
||||
newparam = edit_parameter(newmethod)
|
||||
if newparam || GameData::Evolution.get(newmethod).parameter.nil?
|
||||
existing_evo = -1
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
existing_evo = realcmds[i][3] if realcmds[i][0] == newspecies &&
|
||||
realcmds[i][1] == newmethod &&
|
||||
realcmds[i][2] == newparam
|
||||
@@ -1384,7 +1384,7 @@ class EvolutionsProperty
|
||||
newspecies = pbChooseSpeciesList(entry[0])
|
||||
if newspecies
|
||||
existing_evo = -1
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
existing_evo = realcmds[i][3] if realcmds[i][0] == newspecies &&
|
||||
realcmds[i][1] == entry[1] &&
|
||||
realcmds[i][2] == entry[2]
|
||||
@@ -1405,7 +1405,7 @@ class EvolutionsProperty
|
||||
if newmethodindex >= 0
|
||||
newmethod = @evo_ids[newmethodindex]
|
||||
existing_evo = -1
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
existing_evo = realcmds[i][3] if realcmds[i][0] == entry[0] &&
|
||||
realcmds[i][1] == newmethod &&
|
||||
realcmds[i][2] == entry[2]
|
||||
@@ -1427,7 +1427,7 @@ class EvolutionsProperty
|
||||
newparam = edit_parameter(entry[1], entry[2])
|
||||
if newparam
|
||||
existing_evo = -1
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
existing_evo = realcmds[i][3] if realcmds[i][0] == entry[0] &&
|
||||
realcmds[i][1] == entry[1] &&
|
||||
realcmds[i][2] == newparam
|
||||
@@ -1453,7 +1453,7 @@ class EvolutionsProperty
|
||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||
if [0, 1].include?(cmd2)
|
||||
if cmd2 == 0
|
||||
for i in 0...realcmds.length
|
||||
realcmds.length.times do |i|
|
||||
realcmds[i].pop
|
||||
realcmds[i] = nil if realcmds[i][0] == -1
|
||||
end
|
||||
@@ -1475,7 +1475,7 @@ class EvolutionsProperty
|
||||
|
||||
def format(value)
|
||||
ret = ""
|
||||
for i in 0...value.length
|
||||
value.length.times do |i|
|
||||
ret << "," if i > 0
|
||||
param = value[i][2]
|
||||
evo_method_data = GameData::Evolution.get(value[i][1])
|
||||
@@ -1564,13 +1564,13 @@ def pbPropertyList(title, data, properties, saveprompt = false)
|
||||
selectedmap = -1
|
||||
retval = nil
|
||||
commands = []
|
||||
for i in 0...properties.length
|
||||
properties.length.times do |i|
|
||||
propobj = properties[i][1]
|
||||
commands.push(sprintf("%s=%s", properties[i][0], propobj.format(data[i])))
|
||||
end
|
||||
list.commands = commands
|
||||
list.index = 0
|
||||
begin
|
||||
loop do
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -1591,7 +1591,7 @@ def pbPropertyList(title, data, properties, saveprompt = false)
|
||||
end
|
||||
end
|
||||
commands.clear
|
||||
for i in 0...properties.length
|
||||
properties.length.times do |i|
|
||||
propobj = properties[i][1]
|
||||
commands.push(sprintf("%s=%s", properties[i][0], propobj.format(data[i])))
|
||||
end
|
||||
@@ -1605,7 +1605,7 @@ def pbPropertyList(title, data, properties, saveprompt = false)
|
||||
newsetting = propobj.set(properties[selectedmap][0], oldsetting)
|
||||
data[selectedmap] = newsetting
|
||||
commands.clear
|
||||
for i in 0...properties.length
|
||||
properties.length.times do |i|
|
||||
propobj = properties[i][1]
|
||||
commands.push(sprintf("%s=%s", properties[i][0], propobj.format(data[i])))
|
||||
end
|
||||
@@ -1622,7 +1622,8 @@ def pbPropertyList(title, data, properties, saveprompt = false)
|
||||
retval = (cmd == 0)
|
||||
end
|
||||
end
|
||||
end while selectedmap != -1
|
||||
break unless selectedmap != -1
|
||||
end
|
||||
title.dispose
|
||||
list.dispose
|
||||
desc.dispose
|
||||
|
||||
@@ -129,18 +129,18 @@ DebugMenuCommands.register("togglewallpapers", {
|
||||
paperscmds = []
|
||||
paperscmds.push(_INTL("Unlock all"))
|
||||
paperscmds.push(_INTL("Lock all"))
|
||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
||||
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
|
||||
paperscmds.push(_INTL("{1} {2}", unlockarray[i] ? "[Y]" : "[ ]", w[i]))
|
||||
end
|
||||
paperscmd = pbShowCommands(nil, paperscmds, -1, paperscmd)
|
||||
break if paperscmd < 0
|
||||
case paperscmd
|
||||
when 0 # Unlock all
|
||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
||||
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
|
||||
unlockarray[i] = true
|
||||
end
|
||||
when 1 # Lock all
|
||||
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
|
||||
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
|
||||
unlockarray[i] = false
|
||||
end
|
||||
else
|
||||
@@ -406,7 +406,7 @@ DebugMenuCommands.register("resettrainers", {
|
||||
"description" => _INTL("Turn off Self Switches A and B for all events with \"Trainer\" in their name."),
|
||||
"effect" => proc {
|
||||
if $game_map
|
||||
for event in $game_map.events.values
|
||||
$game_map.events.values.each do |event|
|
||||
if event.name[/trainer/i]
|
||||
$game_self_switches[[$game_map.map_id, event.id, "A"]] = false
|
||||
$game_self_switches[[$game_map.map_id, event.id, "B"]] = false
|
||||
@@ -428,7 +428,7 @@ DebugMenuCommands.register("readyrematches", {
|
||||
if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length == 0
|
||||
pbMessage(_INTL("There are no trainers in the Phone."))
|
||||
else
|
||||
for i in $PokemonGlobal.phoneNumbers
|
||||
$PokemonGlobal.phoneNumbers.each do |i|
|
||||
next if i.length != 8 # Isn't a trainer with an event
|
||||
i[4] = 2
|
||||
pbSetReadyToBattle(i)
|
||||
@@ -566,7 +566,7 @@ DebugMenuCommands.register("demoparty", {
|
||||
"effect" => proc {
|
||||
party = []
|
||||
species = [:PIKACHU, :PIDGEOTTO, :KADABRA, :GYARADOS, :DIGLETT, :CHANSEY]
|
||||
for id in species
|
||||
species.each do |id|
|
||||
party.push(id) if GameData::Species.exists?(id)
|
||||
end
|
||||
$player.party.clear
|
||||
@@ -674,8 +674,8 @@ DebugMenuCommands.register("clearboxes", {
|
||||
"name" => _INTL("Clear Storage Boxes"),
|
||||
"description" => _INTL("Remove all Pokémon in storage."),
|
||||
"effect" => proc {
|
||||
for i in 0...$PokemonStorage.maxBoxes
|
||||
for j in 0...$PokemonStorage.maxPokemon(i)
|
||||
$PokemonStorage.maxBoxes.times do |i|
|
||||
$PokemonStorage.maxPokemon(i).times do |j|
|
||||
$PokemonStorage[i, j] = nil
|
||||
end
|
||||
end
|
||||
@@ -715,7 +715,7 @@ DebugMenuCommands.register("setbadges", {
|
||||
badgecmds = []
|
||||
badgecmds.push(_INTL("Give all"))
|
||||
badgecmds.push(_INTL("Remove all"))
|
||||
for i in 0...24
|
||||
24.times do |i|
|
||||
badgecmds.push(_INTL("{1} Badge {2}", $player.badges[i] ? "[Y]" : "[ ]", i + 1))
|
||||
end
|
||||
badgecmd = pbShowCommands(nil, badgecmds, -1, badgecmd)
|
||||
@@ -803,7 +803,7 @@ DebugMenuCommands.register("dexlists", {
|
||||
dexescmds = []
|
||||
dexescmds.push(_INTL("Have Pokédex: {1}", $player.has_pokedex ? "[YES]" : "[NO]"))
|
||||
dex_names = Settings.pokedex_names
|
||||
for i in 0...dex_names.length
|
||||
dex_names.length.times do |i|
|
||||
name = (dex_names[i].is_a?(Array)) ? dex_names[i][0] : dex_names[i]
|
||||
unlocked = $player.pokedex.unlocked?(i)
|
||||
dexescmds.push(_INTL("{1} {2}", unlocked ? "[Y]" : "[ ]", name))
|
||||
|
||||
@@ -20,7 +20,7 @@ def pbWarpToMap
|
||||
y = rand(map.height)
|
||||
next if !map.passableStrict?(x, y, 0, $game_player)
|
||||
blocked = false
|
||||
for event in map.events.values
|
||||
map.events.values.each do |event|
|
||||
if event.at_coordinate?(x, y) && !event.through
|
||||
blocked = true if event.character_name != ""
|
||||
end
|
||||
@@ -509,7 +509,7 @@ def pbDebugRoamers
|
||||
pbPlayBuzzerSE
|
||||
else
|
||||
pbPlayDecisionSE
|
||||
for i in 0...Settings::ROAMING_SPECIES.length
|
||||
Settings::ROAMING_SPECIES.length.times do |i|
|
||||
$PokemonGlobal.roamPosition[i] = nil
|
||||
end
|
||||
$PokemonGlobal.roamedAlready = false
|
||||
@@ -564,7 +564,7 @@ def pbExportAllAnimations
|
||||
animations = pbLoadBattleAnimations
|
||||
if animations
|
||||
msgwindow = pbCreateMessageWindow
|
||||
for anim in animations
|
||||
animations.each do |anim|
|
||||
next if !anim || anim.length == 0 || anim.name == ""
|
||||
pbMessageDisplay(msgwindow, anim.name, false)
|
||||
Graphics.update
|
||||
@@ -577,7 +577,7 @@ def pbExportAllAnimations
|
||||
graphicname = RTP.getImagePath("Graphics/Animations/" + anim.graphic)
|
||||
pbSafeCopyFile(graphicname, "Animations/#{safename}/" + File.basename(graphicname))
|
||||
end
|
||||
for timing in anim.timing
|
||||
anim.timing.each do |timing|
|
||||
if !timing.timingType || timing.timingType == 0
|
||||
if timing.name && timing.name != ""
|
||||
audioName = RTP.getAudioPath("Audio/SE/Anim/" + timing.name)
|
||||
@@ -618,7 +618,7 @@ def pbImportAllAnimations
|
||||
msgwindow = pbCreateMessageWindow
|
||||
animations = pbLoadBattleAnimations
|
||||
animations = PBAnimations.new if !animations
|
||||
for folder in animationFolders
|
||||
animationFolders.each do |folder|
|
||||
pbMessageDisplay(msgwindow, folder, false)
|
||||
Graphics.update
|
||||
audios = []
|
||||
@@ -628,7 +628,7 @@ def pbImportAllAnimations
|
||||
audios.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
|
||||
audios.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
|
||||
}
|
||||
for audio in audios
|
||||
audios.each do |audio|
|
||||
pbSafeCopyFile(audio, RTP.getAudioPath("Audio/SE/Anim/" + File.basename(audio)), "Audio/SE/Anim/" + File.basename(audio))
|
||||
end
|
||||
images = []
|
||||
@@ -637,7 +637,7 @@ def pbImportAllAnimations
|
||||
images.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
|
||||
images.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
|
||||
}
|
||||
for image in images
|
||||
images.each do |image|
|
||||
pbSafeCopyFile(image, RTP.getImagePath("Graphics/Animations/" + File.basename(image)), "Graphics/Animations/" + File.basename(image))
|
||||
end
|
||||
Dir.glob(folder + "/*.anm") { |f|
|
||||
@@ -655,7 +655,7 @@ def pbImportAllAnimations
|
||||
missingFiles.push(textdata.graphic)
|
||||
end
|
||||
end
|
||||
for timing in textdata.timing
|
||||
textdata.timing.each do |timing|
|
||||
if timing.name && timing.name != ""
|
||||
if !safeExists?(folder + "/" + timing.name) &&
|
||||
!FileTest.audio_exist?("Audio/SE/Anim/" + timing.name)
|
||||
@@ -687,7 +687,7 @@ def pbDebugFixInvalidTiles
|
||||
Graphics.update
|
||||
total_maps = mapData.mapinfos.keys.length
|
||||
Console.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps)
|
||||
for id in mapData.mapinfos.keys.sort
|
||||
mapData.mapinfos.keys.sort.each do |id|
|
||||
if Time.now.to_i - t >= 5
|
||||
Graphics.update
|
||||
t = Time.now.to_i
|
||||
@@ -697,9 +697,9 @@ def pbDebugFixInvalidTiles
|
||||
next if !map || !mapData.mapinfos[id]
|
||||
passages = mapData.getTilesetPassages(map, id)
|
||||
# Check all tiles in map for non-existent tiles
|
||||
for x in 0...map.data.xsize
|
||||
for y in 0...map.data.ysize
|
||||
for i in 0...map.data.zsize
|
||||
map.data.xsize.times do |x|
|
||||
map.data.ysize.times do |y|
|
||||
map.data.zsize.times do |i|
|
||||
tile_id = map.data[x, y, i]
|
||||
next if pbCheckTileValidity(tile_id, map, tilesets, passages)
|
||||
map.data[x, y, i] = 0
|
||||
@@ -708,9 +708,9 @@ def pbDebugFixInvalidTiles
|
||||
end
|
||||
end
|
||||
# Check all events in map for page graphics using a non-existent tile
|
||||
for key in map.events.keys
|
||||
map.events.keys.each do |key|
|
||||
event = map.events[key]
|
||||
for page in event.pages
|
||||
event.pages.each do |page|
|
||||
next if page.graphic.tile_id <= 0
|
||||
next if pbCheckTileValidity(page.graphic.tile_id, map, tilesets, passages)
|
||||
page.graphic.tile_id = 0
|
||||
@@ -864,7 +864,7 @@ class PokemonDebugPartyScreen
|
||||
|
||||
def pbChooseMove(pkmn, text, index = 0)
|
||||
moveNames = []
|
||||
for i in pkmn.moves
|
||||
pkmn.moves.each do |i|
|
||||
if i.total_pp <= 0
|
||||
moveNames.push(_INTL("{1} (PP: ---)", i.name))
|
||||
else
|
||||
|
||||
@@ -565,7 +565,7 @@ PokemonDebugMenuCommands.register("setmovepp", {
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
for i in pkmn.moves
|
||||
pkmn.moves.each do |i|
|
||||
break if !i.id
|
||||
if i.total_pp <= 0
|
||||
commands.push(_INTL("{1} (PP: ---)", i.name))
|
||||
@@ -698,7 +698,7 @@ PokemonDebugMenuCommands.register("setability", {
|
||||
abils = pkmn.getAbilityList
|
||||
ability_commands = []
|
||||
abil_cmd = 0
|
||||
for i in abils
|
||||
abils.each do |i|
|
||||
ability_commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
|
||||
abil_cmd = ability_commands.length - 1 if pkmn.ability_id == i[0]
|
||||
end
|
||||
@@ -917,8 +917,8 @@ PokemonDebugMenuCommands.register("setpokeball", {
|
||||
end
|
||||
balls.sort! { |a, b| a[1] <=> b[1] }
|
||||
cmd = 0
|
||||
for i in 0...balls.length
|
||||
next if balls[i][0] != pkmn.poke_ball
|
||||
balls.each_with_index do |ball, i|
|
||||
next if ball[0] != pkmn.poke_ball
|
||||
cmd = i
|
||||
break
|
||||
end
|
||||
|
||||
@@ -7,8 +7,8 @@ module FilenameUpdater
|
||||
def readDirectoryFiles(directory, formats)
|
||||
files = []
|
||||
Dir.chdir(directory) {
|
||||
for i in 0...formats.length
|
||||
Dir.glob(formats[i]) { |f| files.push(f) }
|
||||
formats.each do |format|
|
||||
Dir.glob(format) { |f| files.push(f) }
|
||||
end
|
||||
}
|
||||
return files
|
||||
@@ -40,14 +40,14 @@ module FilenameUpdater
|
||||
Graphics.update
|
||||
Console.echo_li _INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length)
|
||||
idx = 0
|
||||
for id in mapData.mapinfos.keys.sort
|
||||
mapData.mapinfos.keys.sort.each do |id|
|
||||
echo "." if idx % 20 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
map = mapData.getMap(id)
|
||||
next if !map || !mapData.mapinfos[id]
|
||||
changed = false
|
||||
for key in map.events.keys
|
||||
map.events.keys.each do |key|
|
||||
if Time.now.to_i - t >= 5
|
||||
Graphics.update
|
||||
t = Time.now.to_i
|
||||
|
||||
@@ -385,7 +385,7 @@ BattlerDebugMenuCommands.register("settypes", {
|
||||
loop do
|
||||
commands = []
|
||||
types = []
|
||||
(0...max_main_types).each do |i|
|
||||
max_main_types.times do |i|
|
||||
type = battler.types[i]
|
||||
type_name = (type) ? GameData::Type.get(type).name : "-"
|
||||
commands.push(_INTL("Type {1}: {2}", i + 1, type_name))
|
||||
|
||||
@@ -314,7 +314,7 @@ class MapLister
|
||||
@maps = pbMapTree
|
||||
@addGlobalOffset = (addGlobal) ? 1 : 0
|
||||
@index = 0
|
||||
for i in 0...@maps.length
|
||||
@maps.length.times do |i|
|
||||
@index = i + @addGlobalOffset if @maps[i][0] == selmap
|
||||
end
|
||||
end
|
||||
@@ -337,7 +337,7 @@ class MapLister
|
||||
if @addGlobalOffset == 1
|
||||
@commands.push(_INTL("[GLOBAL]"))
|
||||
end
|
||||
for i in 0...@maps.length
|
||||
@maps.length.times do |i|
|
||||
@commands.push(sprintf("%s%03d %s", (" " * @maps[i][2]), @maps[i][0], @maps[i][1]))
|
||||
end
|
||||
return @commands
|
||||
@@ -393,7 +393,7 @@ class SpeciesLister
|
||||
@commands.push(_INTL("[NEW SPECIES]"))
|
||||
@ids.push(true)
|
||||
end
|
||||
for i in cmds
|
||||
cmds.each do |i|
|
||||
@commands.push(sprintf("%03d: %s", i[0], i[2]))
|
||||
@ids.push(i[1])
|
||||
end
|
||||
@@ -452,7 +452,7 @@ class ItemLister
|
||||
@commands.push(_INTL("[NEW ITEM]"))
|
||||
@ids.push(true)
|
||||
end
|
||||
for i in cmds
|
||||
cmds.each do |i|
|
||||
@commands.push(sprintf("%03d: %s", i[0], i[2]))
|
||||
@ids.push(i[1])
|
||||
end
|
||||
@@ -513,7 +513,7 @@ class TrainerTypeLister
|
||||
@commands.push(_INTL("[NEW TRAINER TYPE]"))
|
||||
@ids.push(true)
|
||||
end
|
||||
for t in cmds
|
||||
cmds.each do |t|
|
||||
@commands.push(sprintf("%03d: %s", t[0], t[2]))
|
||||
@ids.push(t[1])
|
||||
end
|
||||
@@ -604,7 +604,7 @@ class TrainerBattleLister
|
||||
@commands.push(_INTL("[NEW TRAINER BATTLE]"))
|
||||
@ids.push(true)
|
||||
end
|
||||
for t in cmds
|
||||
cmds.each do |t|
|
||||
if t[3] > 0
|
||||
@commands.push(_INTL("{1} {2} ({3}) x{4}",
|
||||
GameData::TrainerType.get(t[1]).name, t[2], t[3],
|
||||
|
||||
Reference in New Issue
Block a user