More Rubocopping

This commit is contained in:
Maruno17
2021-12-20 17:18:21 +00:00
parent db4acd3369
commit 33fcbf623b
154 changed files with 1388 additions and 1420 deletions

View File

@@ -77,7 +77,7 @@ class PokemonEggHatch_Scene
# Fade and change the sprite
fadeTime = Graphics.frame_rate * 4 / 10
toneDiff = (255.0 / fadeTime).ceil
for i in 1..fadeTime
(1..fadeTime).each do |i|
@sprites["pokemon"].tone = Tone.new(i * toneDiff, i * toneDiff, i * toneDiff)
@sprites["overlay"].opacity = i * toneDiff
updateScene
@@ -88,7 +88,7 @@ class PokemonEggHatch_Scene
@sprites["pokemon"].y = 264
@pokemon.species_data.apply_metrics_to_sprite(@sprites["pokemon"], 1)
@sprites["hatch"].visible = false
for i in 1..fadeTime
(1..fadeTime).each do |i|
@sprites["pokemon"].tone = Tone.new(255 - (i * toneDiff), 255 - (i * toneDiff), 255 - (i * toneDiff))
@sprites["overlay"].opacity = 255 - (i * toneDiff)
updateScene
@@ -220,10 +220,10 @@ def pbHatch(pokemon)
end
Events.onStepTaken += proc { |_sender, _e|
for egg in $player.party
$player.party.each do |egg|
next if egg.steps_to_hatch <= 0
egg.steps_to_hatch -= 1
for i in $player.pokemon_party
$player.pokemon_party.each do |i|
next if ![:FLAMEBODY, :MAGMAARMOR, :STEAMENGINE].include?(i.ability_id)
egg.steps_to_hatch -= 1
break

View File

@@ -253,12 +253,12 @@ class SpriteMetafilePlayer
def update
if @playing
for j in @index...@metafile.length
(@index...@metafile.length).each do |j|
@index = j + 1
break if @metafile[j][0] < 0
code = @metafile[j][0]
value = @metafile[j][1]
for sprite in @sprites
@sprites.each do |sprite|
case code
when SpriteMetafile::X then sprite.x = value
when SpriteMetafile::Y then sprite.y = value
@@ -379,7 +379,7 @@ class PokemonEvolutionScene
currenttempo = 25
maxtempo = 7 * Graphics.frame_rate
while totaltempo < maxtempo
for j in 0...currenttempo
currenttempo.times do |j|
if alpha < 255
sprite.color.red = 255
sprite.color.green = 255
@@ -395,7 +395,7 @@ class PokemonEvolutionScene
end
totaltempo += currenttempo
if totaltempo + currenttempo < maxtempo
for j in 0...currenttempo
currenttempo.times do |j|
sprite.zoom = [1.1 * (j + 1) / currenttempo, 1.0].min
sprite2.zoom = [1.1 * (currenttempo - j - 1) / currenttempo, 1.0].min
sprite.update
@@ -542,7 +542,7 @@ class PokemonEvolutionScene
pbMEPlay("Evolution start")
pbBGMPlay("Evolution")
canceled = false
begin
loop do
pbUpdateNarrowScreen
metaplayer1.update
metaplayer2.update
@@ -555,7 +555,8 @@ class PokemonEvolutionScene
canceled = true
break
end
end while metaplayer1.playing? && metaplayer2.playing?
break unless metaplayer1.playing? && metaplayer2.playing?
end
pbFlashInOut(canceled, oldstate, oldstate2)
if canceled
$stats.evolutions_cancelled += 1
@@ -595,7 +596,7 @@ class PokemonEvolutionScene
$player.pokedex.set_owned(@newspecies)
# Learn moves upon evolution for evolved species
movelist = @pokemon.getMoveList
for i in movelist
movelist.each do |i|
next if i[0] != 0 && i[0] != @pokemon.level # 0 is "learn upon evolution"
pbLearnMove(@pokemon, i[1], true) { pbUpdate }
end

View File

@@ -8,22 +8,18 @@ class PokemonTrade_Scene
def pbRunPictures(pictures, sprites)
loop do
for i in 0...pictures.length
pictures[i].update
end
for i in 0...sprites.length
if sprites[i].is_a?(IconSprite)
setPictureIconSprite(sprites[i], pictures[i])
pictures.each { |pic| pic.update }
sprites.each_with_index do |sprite, i|
if sprite.is_a?(IconSprite)
setPictureIconSprite(sprite, pictures[i])
else
setPictureSprite(sprites[i], pictures[i])
setPictureSprite(sprite, pictures[i])
end
end
Graphics.update
Input.update
running = false
for i in 0...pictures.length
running = true if pictures[i].running?
end
pictures.each { |pic| running = true if pic.running? }
break if !running
end
end
@@ -119,7 +115,7 @@ class PokemonTrade_Scene
# Dropping ball
y = Graphics.height - 96 - 16 - 16 # end point of Poké Ball
delay = picturePoke.totalDuration + 2
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

View File

@@ -96,7 +96,7 @@ class HallOfFame_Scene
exponent = 8 if exponent > 8
max = 2**exponent
speed = (2**8) / max
for j in 0..max
(0..max).each do |j|
if extraWaitExponent > -1
(2**extraWaitExponent).times do
Graphics.update
@@ -117,7 +117,7 @@ class HallOfFame_Scene
# Change the pokémon sprites opacity except the index one
def setPokemonSpritesOpacity(index, opacity = 255)
for n in 0...@hallEntry.size
@hallEntry.size.times do |n|
@sprites["pokemon#{n}"].opacity = (n == index) ? 255 : opacity if @sprites["pokemon#{n}"]
end
end
@@ -201,7 +201,7 @@ class HallOfFame_Scene
def createBattlers(hide = true)
# Movement in animation
for i in 0...6
6.times do |i|
# Clear all 6 pokémon sprites and dispose the ones that exists every time
# that this method is call
restartSpritePosition(@sprites, "pokemon#{i}")

View File

@@ -144,17 +144,17 @@ _END_
@total_height = credit_lines.size * 32
lines_per_bitmap = @bitmap_height / 32
num_bitmaps = (credit_lines.size.to_f / lines_per_bitmap).ceil
for i in 0...num_bitmaps
num_bitmaps.times do |i|
credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height + 16)
pbSetSystemFont(credit_bitmap)
for j in 0...lines_per_bitmap
lines_per_bitmap.times do |j|
line = credit_lines[(i * lines_per_bitmap) + j]
next if !line
line = line.split("<s>")
xpos = 0
align = 1 # Centre align
linewidth = Graphics.width
for k in 0...line.length
line.length.times do |k|
if line.length > 1
xpos = (k == 0) ? 0 : 20 + (Graphics.width / 2)
align = (k == 0) ? 2 : 0 # Right align : left align

View File

@@ -58,7 +58,7 @@ class Window_Pokedex < Window_DrawableCommand
dheight = self.height - self.borderY
self.contents = pbDoEnsureBitmap(self.contents, dwidth, dheight)
self.contents.clear
for i in 0...@item_max
@item_max.times do |i|
next if i < self.top_item || i > self.top_item + self.page_item_max
drawItem(i, @item_max, itemRect(i))
end
@@ -613,7 +613,7 @@ class PokemonPokedex_Scene
# Draw selected option(s) text in top bar
case mode
when 2 # Type icons
for i in 0...2
2.times do |i|
if !sel[i] || sel[i] < 0
textpos.push(["----", 298 + (128 * i), 58, 2, base, shadow, 1])
else
@@ -695,7 +695,7 @@ class PokemonPokedex_Scene
textpos.push([txt1, xpos1 + halfwidth, ypos1, 2, base, nil, 1])
textpos.push([txt2, xpos2 + halfwidth, ypos2, 2, base, nil, 1])
else
for i in 0...sel.length
sel.length.times do |i|
selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight)
if sel[i] >= 0
overlay.blt(xstart + ((sel[i] % cols) * xgap), ystart + ((sel[i] / cols).floor * ygap), @selbitmap.bitmap, selrect)
@@ -707,7 +707,7 @@ class PokemonPokedex_Scene
# Draw options
case mode
when 0, 1 # Order, name
for i in 0...cmds.length
cmds.length.times do |i|
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 6 + ((i / cols).floor * ygap)
textpos.push([cmds[i], x, y, 2, base, shadow, 1])
@@ -718,14 +718,14 @@ class PokemonPokedex_Scene
end
when 2 # Type
typerect = Rect.new(0, 0, 96, 32)
for i in 0...cmds.length
cmds.length.times do |i|
typerect.y = @typeCommands[i].icon_position * 32
overlay.blt(xstart + 14 + ((i % cols) * xgap), ystart + 6 + ((i / cols).floor * ygap), @typebitmap.bitmap, typerect)
end
textpos.push(["----",
xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1])
when 5 # Color
for i in 0...cmds.length
cmds.length.times do |i|
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 6 + ((i / cols).floor * ygap)
textpos.push([cmds[i].name, x, y, 2, base, shadow, 1])
@@ -734,7 +734,7 @@ class PokemonPokedex_Scene
xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1])
when 6 # Shape
shaperect = Rect.new(0, 0, 60, 60)
for i in 0...cmds.length
cmds.length.times do |i|
shaperect.y = @shapeCommands[i].icon_position * 60
overlay.blt(xstart + 4 + ((i % cols) * xgap), ystart + 4 + ((i / cols).floor * ygap), @shapebitmap.bitmap, shaperect)
end
@@ -838,7 +838,7 @@ class PokemonPokedex_Scene
$PokemonGlobal.pokedexMode = MODENUMERICAL
@searchParams = [$PokemonGlobal.pokedexMode, -1, -1, -1, -1, -1, -1, -1, -1, -1]
pbRefreshDexList($PokemonGlobal.pokedexIndex[pbGetSavePositionIndex])
for i in 0...@dexlist.length
@dexlist.length.times do |i|
next if @dexlist[i][0] != oldspecies
@sprites["pokedex"].index = i
pbRefresh
@@ -1202,7 +1202,7 @@ class PokemonPokedex_Scene
params[9] = newparam[0] if newparam != nil
pbRefreshDexSearch(params, index)
when 7 # Clear filters
for i in 0...10
10.times do |i|
params[i] = (i == 0) ? MODENUMERICAL : -1
end
pbRefreshDexSearch(params, index)

View File

@@ -26,7 +26,7 @@ class PokemonPokedexInfo_Scene
@sprites["areamap"].setBitmap("Graphics/Pictures/#{@mapdata[@region][1]}")
@sprites["areamap"].x += (Graphics.width - @sprites["areamap"].bitmap.width) / 2
@sprites["areamap"].y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2
for hidden in Settings::REGION_MAP_EXTRAS
Settings::REGION_MAP_EXTRAS.each do |hidden|
if hidden[0] == @region && hidden[1] > 0 && $game_switches[hidden[1]]
pbDrawImagePositions(
@sprites["areamap"].bitmap,
@@ -82,7 +82,7 @@ class PokemonPokedexInfo_Scene
dexnumshift = true if dexnum > 0 && Settings::DEXES_WITH_OFFSETS.include?(-1)
end
else
for i in 0...$player.pokedex.dexes_count - 1 # Regional Dexes
($player.pokedex.dexes_count - 1).times do |i| # Regional Dexes
next if !$player.pokedex.unlocked?(i)
num = pbGetRegionalNumber(i, species)
next if num <= 0
@@ -158,7 +158,7 @@ class PokemonPokedexInfo_Scene
real_gender = 2 if sp.gender_ratio == :Genderless
ret.push([sp.form_name, real_gender, sp.form])
else # Both male and female
for real_gender in 0...2
2.times do |real_gender|
next if !$player.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
ret.push([sp.form_name, real_gender, sp.form])
break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
@@ -309,7 +309,7 @@ class PokemonPokedexInfo_Scene
mappos = (map_metadata) ? map_metadata.town_map_position : nil
next if !mappos || mappos[0] != @region
showpoint = true
for loc in @mapdata[@region][2]
@mapdata[@region][2].each do |loc|
showpoint = false if loc[0] == mappos[1] && loc[1] == mappos[2] &&
loc[7] && !$game_switches[loc[7]]
end
@@ -318,8 +318,8 @@ class PokemonPokedexInfo_Scene
if mapsize && mapsize[0] && mapsize[0] > 0
sqwidth = mapsize[0]
sqheight = (mapsize[1].length.to_f / mapsize[0]).ceil
for i in 0...sqwidth
for j in 0...sqheight
sqwidth.times do |i|
sqheight.times do |j|
if mapsize[1][i + (j * sqwidth), 1].to_i > 0
points[mappos[1] + i + ((mappos[2] + j) * mapwidth)] = true
end
@@ -334,7 +334,7 @@ class PokemonPokedexInfo_Scene
pointcolorhl = Color.new(192, 248, 248)
sqwidth = PokemonRegionMap_Scene::SQUARE_WIDTH
sqheight = PokemonRegionMap_Scene::SQUARE_HEIGHT
for j in 0...points.length
points.length.times do |j|
if points[j]
x = (j % mapwidth) * sqwidth
x += (Graphics.width - @sprites["areamap"].bitmap.width) / 2
@@ -377,7 +377,7 @@ class PokemonPokedexInfo_Scene
shadow = Color.new(168, 184, 184)
# Write species and form name
formname = ""
for i in @available
@available.each do |i|
if i[1] == @gender && i[2] == @form
formname = i[0]
break
@@ -415,7 +415,7 @@ class PokemonPokedexInfo_Scene
def pbChooseForm
index = 0
for i in 0...@available.length
@available.length.times do |i|
if @available[i][1] == @gender && @available[i][2] == @form
index = i
break

View File

@@ -108,7 +108,7 @@ end
class Window_CommandPokemonColor < Window_CommandPokemon
def initialize(commands, width = nil)
@colorKey = []
for i in 0...commands.length
commands.length.times do |i|
if commands[i].is_a?(Array)
@colorKey[i] = commands[i][1]
commands[i] = commands[i][0]
@@ -472,7 +472,7 @@ class PokemonParty_Scene
pbBottomLeftLines(@sprites["helpwindow"], 1)
pbSetHelpText(starthelptext)
# Add party Pokémon sprites
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
if @party[i]
@sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i], i, @viewport)
else
@@ -599,7 +599,7 @@ class PokemonParty_Scene
end
def pbAnnotate(annot)
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@sprites["pokemon#{i}"].text = (annot) ? annot[i] : nil
end
end
@@ -607,7 +607,7 @@ class PokemonParty_Scene
def pbSelect(item)
@activecmd = item
numsprites = Settings::MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
for i in 0...numsprites
numsprites.times do |i|
@sprites["pokemon#{i}"].selected = (i == @activecmd)
end
end
@@ -646,7 +646,7 @@ class PokemonParty_Scene
Input.update
self.update
end
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@sprites["pokemon#{i}"].preselected = false
@sprites["pokemon#{i}"].switching = false
end
@@ -654,7 +654,7 @@ class PokemonParty_Scene
end
def pbClearSwitching
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@sprites["pokemon#{i}"].preselected = false
@sprites["pokemon#{i}"].switching = false
end
@@ -700,7 +700,7 @@ class PokemonParty_Scene
end
def pbChoosePokemon(switching = false, initialsel = -1, canswitch = 0)
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@sprites["pokemon#{i}"].preselected = (switching && i == @activecmd)
@sprites["pokemon#{i}"].switching = switching
end
@@ -722,7 +722,7 @@ class PokemonParty_Scene
if @activecmd != oldsel # Changing selection
pbPlayCursorSE
numsprites = Settings::MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
for i in 0...numsprites
numsprites.times do |i|
@sprites["pokemon#{i}"].selected = (i == @activecmd)
end
end
@@ -759,17 +759,19 @@ class PokemonParty_Scene
numsprites = Settings::MAX_PARTY_SIZE + ((@multiselect) ? 2 : 1)
case key
when Input::LEFT
begin
loop do
currentsel -= 1
end while currentsel > 0 && currentsel < @party.length && !@party[currentsel]
break unless currentsel > 0 && currentsel < @party.length && !@party[currentsel]
end
if currentsel >= @party.length && currentsel < Settings::MAX_PARTY_SIZE
currentsel = @party.length - 1
end
currentsel = numsprites - 1 if currentsel < 0
when Input::RIGHT
begin
loop do
currentsel += 1
end while currentsel < @party.length && !@party[currentsel]
break unless currentsel < @party.length && !@party[currentsel]
end
if currentsel == @party.length
currentsel = Settings::MAX_PARTY_SIZE
elsif currentsel == numsprites
@@ -782,9 +784,10 @@ class PokemonParty_Scene
currentsel -= 1
end
else
begin
loop do
currentsel -= 2
end while currentsel > 0 && !@party[currentsel]
break unless currentsel > 0 && !@party[currentsel]
end
end
if currentsel >= @party.length && currentsel < Settings::MAX_PARTY_SIZE
currentsel = @party.length - 1
@@ -809,14 +812,14 @@ class PokemonParty_Scene
def pbHardRefresh
oldtext = []
lastselected = -1
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
oldtext.push(@sprites["pokemon#{i}"].text)
lastselected = i if @sprites["pokemon#{i}"].selected
@sprites["pokemon#{i}"].dispose
end
lastselected = @party.length - 1 if lastselected >= @party.length
lastselected = 0 if lastselected < 0
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
if @party[i]
@sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i], i, @viewport)
else
@@ -828,7 +831,7 @@ class PokemonParty_Scene
end
def pbRefresh
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
sprite = @sprites["pokemon#{i}"]
if sprite
if sprite.is_a?(PokemonPartyPanel)
@@ -943,8 +946,8 @@ class PokemonPartyScreen
# Checks for identical species
def pbCheckSpecies(array) # Unused
for i in 0...array.length
for j in i + 1...array.length
array.length.times do |i|
(i + 1...array.length).each do |j|
return false if array[i].species == array[j].species
end
end
@@ -953,9 +956,9 @@ class PokemonPartyScreen
# Checks for identical held items
def pbCheckItems(array) # Unused
for i in 0...array.length
array.length.times do |i|
next if !array[i].hasItem?
for j in i + 1...array.length
(i + 1...array.length).each do |j|
return false if array[i].item == array[j].item
end
end
@@ -974,7 +977,7 @@ class PokemonPartyScreen
def pbChooseMove(pokemon, helptext, index = 0)
movenames = []
for i in pokemon.moves
pokemon.moves.each do |i|
next if !i || !i.id
if i.total_pp <= 0
movenames.push(_INTL("{1} (PP: ---)", i.name))
@@ -988,7 +991,7 @@ class PokemonPartyScreen
def pbRefreshAnnotations(ableProc) # For after using an evolution stone
return if !@scene.pbHasAnnotations?
annot = []
for pkmn in @party
@party.each do |pkmn|
elig = ableProc.call(pkmn)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end
@@ -1006,7 +1009,7 @@ class PokemonPartyScreen
positions = [_INTL("FIRST"), _INTL("SECOND"), _INTL("THIRD"), _INTL("FOURTH"),
_INTL("FIFTH"), _INTL("SIXTH"), _INTL("SEVENTH"), _INTL("EIGHTH"),
_INTL("NINTH"), _INTL("TENTH"), _INTL("ELEVENTH"), _INTL("TWELFTH")]
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
if i < positions.length
ordinals.push(positions[i])
else
@@ -1016,25 +1019,25 @@ class PokemonPartyScreen
return nil if !ruleset.hasValidTeam?(@party)
ret = nil
addedEntry = false
for i in 0...@party.length
@party.length.times do |i|
statuses[i] = (ruleset.isPokemonValid?(@party[i])) ? 1 : 2
annot[i] = ordinals[statuses[i]]
end
@scene.pbStartScene(@party, _INTL("Choose Pokémon and confirm."), annot, true)
loop do
realorder = []
for i in 0...@party.length
for j in 0...@party.length
@party.length.times do |i|
@party.length.times do |j|
if statuses[j] == i + 3
realorder.push(j)
break
end
end
end
for i in 0...realorder.length
realorder.length.times do |i|
statuses[realorder[i]] = i + 3
end
for i in 0...@party.length
@party.length.times do |i|
annot[i] = ordinals[statuses[i]]
end
@scene.pbAnnotate(annot)
@@ -1046,7 +1049,7 @@ class PokemonPartyScreen
addedEntry = false
if pkmnid == Settings::MAX_PARTY_SIZE # Confirm was chosen
ret = []
for i in realorder
realorder.each do |i|
ret.push(@party[i])
end
error = []
@@ -1092,7 +1095,7 @@ class PokemonPartyScreen
def pbChooseAblePokemon(ableProc, allowIneligible = false)
annot = []
eligibility = []
for pkmn in @party
@party.each do |pkmn|
elig = ableProc.call(pkmn)
eligibility.push(elig)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
@@ -1123,7 +1126,7 @@ class PokemonPartyScreen
def pbChooseTradablePokemon(ableProc, allowIneligible = false)
annot = []
eligibility = []
for pkmn in @party
@party.each do |pkmn|
elig = ableProc.call(pkmn)
elig = false if pkmn.egg? || pkmn.shadowPokemon? || pkmn.cannot_trade
eligibility.push(elig)

View File

@@ -402,7 +402,7 @@ class PokemonSummary_Scene
dexnum = @nationalDexList.index(@pokemon.species_data.species) || 0
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
else
for i in 0...$player.pokedex.dexes_count - 1
($player.pokedex.dexes_count - 1).times do |i|
next if !$player.pokedex.unlocked?(i)
num = pbGetRegionalNumber(i, @pokemon.species)
next if num <= 0
@@ -578,7 +578,7 @@ class PokemonSummary_Scene
best_iv = 0
stats_order = [:HP, :ATTACK, :DEFENSE, :SPEED, :SPECIAL_ATTACK, :SPECIAL_DEFENSE]
start_point = @pokemon.personalID % stats_order.length # Tiebreaker
for i in 0...stats_order.length
stats_order.length.times do |i|
stat = stats_order[(i + start_point) % stats_order.length]
if !best_stat || @pokemon.iv[stat] > @pokemon.iv[best_stat]
best_stat = stat
@@ -694,7 +694,7 @@ class PokemonSummary_Scene
imagepos = []
# Write move names, types and PP amounts for each known move
yPos = 92
for i in 0...Pokemon::MAX_MOVES
Pokemon::MAX_MOVES.times do |i|
move = @pokemon.moves[i]
if move
type_number = GameData::Type.get(move.display_type(@pokemon)).icon_position
@@ -756,7 +756,7 @@ class PokemonSummary_Scene
yPos = 92
yPos -= 76 if move_to_learn
limit = (move_to_learn) ? Pokemon::MAX_MOVES + 1 : Pokemon::MAX_MOVES
for i in 0...limit
limit.times do |i|
move = @pokemon.moves[i]
if i == Pokemon::MAX_MOVES
move = move_to_learn
@@ -842,7 +842,7 @@ class PokemonSummary_Scene
# Show all ribbons
imagepos = []
coord = 0
for i in @ribbonOffset * 4...(@ribbonOffset * 4) + 12
(@ribbonOffset * 4...(@ribbonOffset * 4) + 12).each do |i|
break if !@pokemon.ribbons[i]
ribbon_data = GameData::Ribbon.get(@pokemon.ribbons[i])
ribn = ribbon_data.icon_position

View File

@@ -82,11 +82,13 @@ class Window_PokemonBag < Window_DrawableCommand
if @bag.registered?(item)
pbDrawImagePositions(
self.contents,
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]])
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]]
)
elsif pbCanRegisterItem?(item)
pbDrawImagePositions(
self.contents,
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]])
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]]
)
end
else
qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1]
@@ -105,7 +107,7 @@ class Window_PokemonBag < Window_DrawableCommand
dheight = self.height - self.borderY
self.contents = pbDoEnsureBitmap(self.contents, dwidth, dheight)
self.contents.clear
for i in 0...@item_max
@item_max.times do |i|
next if i < self.top_item - 1 || i > self.top_item + self.page_item_max
drawItem(i, @item_max, itemRect(i))
end
@@ -147,18 +149,18 @@ class PokemonBag_Scene
if @choosing
numfilledpockets = 0
if @filterlist != nil
for i in 1...@bag.pockets.length
(1...@bag.pockets.length).each do |i|
numfilledpockets += 1 if @filterlist[i].length > 0
end
else
for i in 1...@bag.pockets.length
(1...@bag.pockets.length).each do |i|
numfilledpockets += 1 if @bag.pockets[i].length > 0
end
end
lastpocket = (resetpocket) ? 1 : @bag.last_viewed_pocket
if (@filterlist && @filterlist[lastpocket].length == 0) ||
(!@filterlist && @bag.pockets[lastpocket].length == 0)
for i in 1...@bag.pockets.length
(1...@bag.pockets.length).each do |i|
if @filterlist && @filterlist[i].length > 0
lastpocket = i
break
@@ -267,7 +269,7 @@ class PokemonBag_Scene
# Draw the pocket icons
@sprites["pocketicon"].bitmap.clear
if @choosing && @filterlist
for i in 1...@bag.pockets.length
(1...@bag.pockets.length).each do |i|
if @filterlist[i].length == 0
@sprites["pocketicon"].bitmap.blt(
6 + ((i - 1) * 22), 6, @pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20)
@@ -292,7 +294,8 @@ class PokemonBag_Scene
# Draw the pocket name
pbDrawTextPositions(
overlay,
[[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]])
[[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]]
)
# Draw slider arrows
showslider = false
if itemlist.top_row > 0
@@ -332,9 +335,9 @@ class PokemonBag_Scene
return if !@choosing
return if @filterproc == nil
@filterlist = []
for i in 1...@bag.pockets.length
(1...@bag.pockets.length).each do |i|
@filterlist[i] = []
for j in 0...@bag.pockets[i].length
@bag.pockets[i].length.times do |j|
@filterlist[i].push(j) if @filterproc.call(@bag.pockets[i][j][0])
end
end

View File

@@ -57,7 +57,7 @@ end
#===============================================================================
class PokemonPokegear_Scene
def pbUpdate
for i in 0...@commands.length
@commands.length.times do |i|
@sprites["button#{i}"].selected = (i == @index)
end
pbUpdateSpriteHash(@sprites)
@@ -75,7 +75,7 @@ class PokemonPokegear_Scene
else
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg")
end
for i in 0...@commands.length
@commands.length.times do |i|
y = 196 - (@commands.length * 24) + (i * 48)
@sprites["button#{i}"] = PokegearButton.new(@commands[i], 118, y, @viewport)
end

View File

@@ -118,7 +118,8 @@ class PokemonRegionMap_Scene
end
pbDrawImagePositions(
@sprites["map2"].bitmap,
[["Graphics/Pictures/#{graphic[4]}", graphic[2] * SQUARE_WIDTH, graphic[3] * SQUARE_HEIGHT]])
[["Graphics/Pictures/#{graphic[4]}", graphic[2] * SQUARE_WIDTH, graphic[3] * SQUARE_HEIGHT]]
)
end
@sprites["mapbottom"] = MapBottomSprite.new(@viewport)
@sprites["mapbottom"].mapname = pbGetMessage(MessageTypes::RegionNames, mapindex)
@@ -179,14 +180,14 @@ class PokemonRegionMap_Scene
def pbSaveMapData
File.open("PBS/town_map.txt", "wb") { |f|
Compiler.add_PBS_header_to_file(f)
for i in 0...@map_data.length
@map_data.length.times do |i|
map = @map_data[i]
next if !map
f.write("\#-------------------------------\r\n")
f.write(sprintf("[%d]\r\n", i))
f.write(sprintf("Name = %s\r\nFilename = %s\r\n",
Compiler.csvQuote(map[0]), Compiler.csvQuote(map[1])))
for loc in map[2]
map[2].each do |loc|
f.write("Point = ")
Compiler.pbWriteCsvRecord(loc, f, [nil, "uussUUUU"])
f.write("\r\n")
@@ -197,7 +198,7 @@ class PokemonRegionMap_Scene
def pbGetMapLocation(x, y)
return "" if !@map[2]
for point in @map[2]
@map[2].each do |point|
next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
name = pbGetMessageFromHash(MessageTypes::PlaceNames, point[2])
@@ -225,7 +226,7 @@ class PokemonRegionMap_Scene
def pbGetMapDetails(x, y) # From Wichu, with my help
return "" if !@map[2]
for point in @map[2]
@map[2].each do |point|
next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
mapdesc = pbGetMessageFromHash(MessageTypes::PlaceDescriptions, point[3])
@@ -236,7 +237,7 @@ class PokemonRegionMap_Scene
def pbGetHealingSpot(x, y)
return nil if !@map[2]
for point in @map[2]
@map[2].each do |point|
next if point[0] != x || point[1] != y
return nil if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
return (point[4] && point[5] && point[6]) ? [point[4], point[5], point[6]] : nil
@@ -250,7 +251,8 @@ class PokemonRegionMap_Scene
text = (@mode == 0) ? _INTL("ACTION: Fly") : _INTL("ACTION: Cancel Fly")
pbDrawTextPositions(
@sprites["help"].bitmap,
[[text, Graphics.width - 16, -8, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)]])
[[text, Graphics.width - 16, -8, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)]]
)
@sprites.each do |key, sprite|
next if !key.include?("point")
sprite.visible = (@mode == 1)

View File

@@ -25,7 +25,7 @@ class PokemonPhoneScene
commands = []
@trainers = []
if $PokemonGlobal.phoneNumbers
for num in $PokemonGlobal.phoneNumbers
$PokemonGlobal.phoneNumbers.each do |num|
if num[0] # if visible
if num.length == 8 # if trainer
@trainers.push([num[1], num[2], num[6], (num[4] >= 2)])
@@ -67,7 +67,7 @@ class PokemonPhoneScene
@sprites["icon"].x = 86 - (charwidth / 8)
@sprites["icon"].y = 134 - (charheight / 8)
@sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
for trainer in @trainers
@trainers.each do |trainer|
if trainer.length == 4
displayname = _INTL("{1} {2}", GameData::TrainerType.get(trainer[0]).name,
pbGetMessageFromHash(MessageTypes::TrainerNames, trainer[1]))
@@ -77,7 +77,7 @@ class PokemonPhoneScene
end
end
@sprites["list"].commands = commands
for i in 0...@sprites["list"].page_item_max
@sprites["list"].page_item_max.times do |i|
@sprites["rematch[#{i}]"] = IconSprite.new(468, 62 + (i * 32), @viewport)
j = i + @sprites["list"].top_item
next if j >= commands.length
@@ -89,7 +89,7 @@ class PokemonPhoneScene
end
end
rematchcount = 0
for trainer in @trainers
@trainers.each do |trainer|
if trainer.length == 4
rematchcount += 1 if trainer[3]
end
@@ -120,7 +120,7 @@ class PokemonPhoneScene
@sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
mapname = (trainer[2]) ? pbGetMapNameFromId(trainer[2]) : ""
@sprites["bottom"].text = "<ac>" + mapname
for i in 0...@sprites["list"].page_item_max
@sprites["list"].page_item_max.times do |i|
@sprites["rematch[#{i}]"].clearBitmaps
j = i + @sprites["list"].top_item
next if j >= commands.length

View File

@@ -66,7 +66,7 @@ class PokemonTrainerCard_Scene
x = 72
region = pbGetCurrentRegion(0) # Get the current region
imagePositions = []
for i in 0...8
8.times do |i|
if $player.badges[i + (region * 8)]
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges", x, 310, i * 32, region * 32, 32, 32])
end

View File

@@ -105,7 +105,7 @@ class PokemonLoad_Scene
@viewport.z = 99998
addBackgroundOrColoredPlane(@sprites, "background", "loadbg", Color.new(248, 248, 248), @viewport)
y = 16 * 2
for i in 0...commands.length
commands.length.times do |i|
@sprites["panel#{i}"] = PokemonLoadPanel.new(
i, commands[i], (show_continue) ? (i == 0) : false, trainer,
frame_count, stats, map_id, @viewport
@@ -141,20 +141,20 @@ class PokemonLoad_Scene
@sprites["panel#{newi}"].selected = true
@sprites["panel#{newi}"].pbRefresh
while @sprites["panel#{newi}"].y > Graphics.height - (40 * 2)
for i in 0...@commands.length
@commands.length.times do |i|
@sprites["panel#{i}"].y -= 24 * 2
end
for i in 0...6
6.times do |i|
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y -= 24 * 2
end
@sprites["player"].y -= 24 * 2 if @sprites["player"]
end
while @sprites["panel#{newi}"].y < 16 * 2
for i in 0...@commands.length
@commands.length.times do |i|
@sprites["panel#{i}"].y += 24 * 2
end
for i in 0...6
6.times do |i|
break if !@sprites["party#{i}"]
@sprites["party#{i}"].y += 24 * 2
end
@@ -175,8 +175,8 @@ class PokemonLoad_Scene
@sprites["player"].y = (56 * 2) - (charheight / 8)
@sprites["player"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
end
for i in 0...trainer.party.length
@sprites["party#{i}"] = PokemonIconSprite.new(trainer.party[i], @viewport)
trainer.party.each_with_index do |pkmn, i|
@sprites["party#{i}"] = PokemonIconSprite.new(pkmn, @viewport)
@sprites["party#{i}"].setOffset(PictureOrigin::Center)
@sprites["party#{i}"].x = (167 + (33 * (i % 2))) * 2
@sprites["party#{i}"].y = (56 + (25 * (i / 2))) * 2

View File

@@ -6,8 +6,10 @@ def pbEmergencySave
if SaveData.exists?
File.open(SaveData::FILE_PATH, 'rb') do |r|
File.open(SaveData::FILE_PATH + '.bak', 'wb') do |w|
while s = r.read(4096)
w.write s
loop do
s = r.read(4096)
break if !s
w.write(s)
end
end
end

View File

@@ -179,7 +179,7 @@ class Window_PokemonOption < Window_DrawableCommand
@selShadowColor = Color.new(31 * 8, 17 * 8, 16 * 8)
@optvalues = []
@mustUpdateOptions = false
for i in 0...@options.length
@options.length.times do |i|
@optvalues[i] = 0
end
super(x, y, width, height)
@@ -213,14 +213,14 @@ class Window_PokemonOption < Window_DrawableCommand
when EnumOption
if @options[index].values.length > 1
totalwidth = 0
for value in @options[index].values
@options[index].values.each do |value|
totalwidth += self.contents.text_size(value).width
end
spacing = (optionwidth - totalwidth) / (@options[index].values.length - 1)
spacing = 0 if spacing < 0
xpos = optionwidth + rect.x
ivalue = 0
for value in @options[index].values
@options[index].values.each do |value|
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
(ivalue == self[index]) ? @selBaseColor : self.baseColor,
(ivalue == self[index]) ? @selShadowColor : self.shadowColor)
@@ -391,7 +391,7 @@ class PokemonOption_Scene
@sprites["option"].viewport = @viewport
@sprites["option"].visible = true
# Get the values of each option
for i in 0...@PokemonOptions.length
@PokemonOptions.length.times do |i|
@sprites["option"].setValueNoRefresh(i, (@PokemonOptions[i].get || 0))
end
@sprites["option"].refresh
@@ -413,7 +413,7 @@ class PokemonOption_Scene
pbUpdate
if @sprites["option"].mustUpdateOptions
# Set the values of each option
for i in 0...@PokemonOptions.length
@PokemonOptions.length.times do |i|
@PokemonOptions[i].set(@sprites["option"][i])
end
if $PokemonSystem.textskin != oldTextSkin
@@ -440,7 +440,7 @@ class PokemonOption_Scene
pbPlayCloseMenuSE
pbFadeOutAndHide(@sprites) { pbUpdate }
# Set the values of each option
for i in 0...@PokemonOptions.length
@PokemonOptions.length.times do |i|
@PokemonOptions[i].set(@sprites["option"][i])
end
pbDisposeMessageWindow(@sprites["textbox"])

View File

@@ -104,10 +104,10 @@ class PokemonReadyMenu_Scene
@commands = commands
@movecommands = []
@itemcommands = []
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@movecommands.push(@commands[0][i][1])
end
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@itemcommands.push(@commands[1][i][1])
end
@index = $bag.ready_menu_selection
@@ -129,10 +129,10 @@ class PokemonReadyMenu_Scene
@sprites["cmdwindow"].height = 6 * 32
@sprites["cmdwindow"].visible = false
@sprites["cmdwindow"].viewport = @viewport
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@sprites["movebutton#{i}"] = ReadyMenuButton.new(i, @commands[0][i], @index[0], @index[2], @viewport)
end
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@sprites["itembutton#{i}"] = ReadyMenuButton.new(i, @commands[1][i], @index[1], @index[2], @viewport)
end
pbSEPlay("GUI menu open")
@@ -140,20 +140,20 @@ class PokemonReadyMenu_Scene
def pbShowMenu
@sprites["cmdwindow"].visible = false
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@sprites["movebutton#{i}"].visible = true
end
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@sprites["itembutton#{i}"].visible = true
end
end
def pbHideMenu
@sprites["cmdwindow"].visible = false
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@sprites["movebutton#{i}"].visible = false
end
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@sprites["itembutton#{i}"].visible = false
end
end
@@ -190,10 +190,10 @@ class PokemonReadyMenu_Scene
end
def pbChangeSide
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@sprites["movebutton#{i}"].side = @index[2]
end
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@sprites["itembutton#{i}"].side = @index[2]
end
@sprites["cmdwindow"].commands = (@index[2] == 0) ? @movecommands : @itemcommands
@@ -208,11 +208,11 @@ class PokemonReadyMenu_Scene
if @index[@index[2]] != oldindex
case @index[2]
when 0
for i in 0...@commands[0].length
@commands[0].length.times do |i|
@sprites["movebutton#{i}"].selected = @index[@index[2]]
end
when 1
for i in 0...@commands[1].length
@commands[1].length.times do |i|
@sprites["itembutton#{i}"].selected = @index[@index[2]]
end
end
@@ -243,11 +243,11 @@ class PokemonReadyMenu
def pbStartReadyMenu(moves, items)
commands = [[], []] # Moves, items
for i in moves
moves.each do |i|
commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
end
commands[0].sort! { |a, b| a[1] <=> b[1] }
for i in items
items.each do |i|
commands[1].push([i, GameData::Item.get(i).name, false])
end
commands[1].sort! { |a, b| a[1] <=> b[1] }
@@ -313,7 +313,7 @@ def pbUseKeyItem
end
end
real_items = []
for i in $bag.registered_items
$bag.registered_items.each do |i|
itm = GameData::Item.get(i).id
real_items.push(itm) if $bag.has?(itm)
end

View File

@@ -299,7 +299,7 @@ class PokemonBoxSprite < SpriteWrapper
@refreshBox = true
@refreshSprites = true
@pokemonsprites = []
for i in 0...PokemonBox::BOX_SIZE
PokemonBox::BOX_SIZE.times do |i|
@pokemonsprites[i] = nil
pokemon = @storage[boxnumber, i]
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon, viewport)
@@ -313,7 +313,7 @@ class PokemonBoxSprite < SpriteWrapper
def dispose
if !disposed?
for i in 0...PokemonBox::BOX_SIZE
PokemonBox::BOX_SIZE.times do |i|
@pokemonsprites[i].dispose if @pokemonsprites[i]
@pokemonsprites[i] = nil
end
@@ -336,7 +336,7 @@ class PokemonBoxSprite < SpriteWrapper
def color=(value)
super
if @refreshSprites
for i in 0...PokemonBox::BOX_SIZE
PokemonBox::BOX_SIZE.times do |i|
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = value
end
@@ -347,7 +347,7 @@ class PokemonBoxSprite < SpriteWrapper
def visible=(value)
super
for i in 0...PokemonBox::BOX_SIZE
PokemonBox::BOX_SIZE.times do |i|
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value
end
@@ -414,9 +414,9 @@ class PokemonBoxSprite < SpriteWrapper
@refreshBox = false
end
yval = self.y + 30
for j in 0...PokemonBox::BOX_HEIGHT
PokemonBox::BOX_HEIGHT.times do |j|
xval = self.x + 10
for k in 0...PokemonBox::BOX_WIDTH
PokemonBox::BOX_WIDTH.times do |k|
sprite = @pokemonsprites[(j * PokemonBox::BOX_WIDTH) + k]
if sprite && !sprite.disposed?
sprite.viewport = self.viewport
@@ -432,7 +432,7 @@ class PokemonBoxSprite < SpriteWrapper
def update
super
for i in 0...PokemonBox::BOX_SIZE
PokemonBox::BOX_SIZE.times do |i|
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].update
end
@@ -449,7 +449,7 @@ class PokemonBoxPartySprite < SpriteWrapper
@party = party
@boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/overlay_party")
@pokemonsprites = []
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@pokemonsprites[i] = nil
pokemon = @party[i]
if pokemon
@@ -465,7 +465,7 @@ class PokemonBoxPartySprite < SpriteWrapper
end
def dispose
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@pokemonsprites[i].dispose if @pokemonsprites[i]
end
@boxbitmap.dispose
@@ -485,7 +485,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def color=(value)
super
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = pbSrcOver(@pokemonsprites[i].color, value)
end
@@ -494,7 +494,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def visible=(value)
super
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value
end
@@ -535,13 +535,13 @@ class PokemonBoxPartySprite < SpriteWrapper
)
xvalues = [] # [18, 90, 18, 90, 18, 90]
yvalues = [] # [2, 18, 66, 82, 130, 146]
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
xvalues.push(18 + (72 * (i % 2)))
yvalues.push(2 + (16 * (i % 2)) + (64 * (i / 2)))
end
@pokemonsprites.delete_if { |sprite| sprite && sprite.disposed? }
@pokemonsprites.each { |sprite| sprite.refresh if sprite }
for j in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |j|
sprite = @pokemonsprites[j]
if sprite && !sprite.disposed?
sprite.viewport = self.viewport
@@ -554,7 +554,7 @@ class PokemonBoxPartySprite < SpriteWrapper
def update
super
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
@pokemonsprites[i].update if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
end
end
@@ -775,7 +775,7 @@ class PokemonStorageScene
return if selection < 0
xvalues = [] # [200, 272, 200, 272, 200, 272, 236]
yvalues = [] # [2, 18, 66, 82, 130, 146, 220]
for i in 0...Settings::MAX_PARTY_SIZE
Settings::MAX_PARTY_SIZE.times do |i|
xvalues.push(200 + (72 * (i % 2)))
yvalues.push(2 + (16 * (i % 2)) + (64 * (i / 2)))
end
@@ -1196,7 +1196,7 @@ class PokemonStorageScene
def pbChooseBox(msg)
commands = []
for i in 0...@storage.maxBoxes
@storage.maxBoxes.times do |i|
box = @storage[i]
if box
commands.push(_INTL("{1} ({2}/{3})", box.name, box.nitems, box.length))
@@ -1527,7 +1527,6 @@ class PokemonStorageScreen
cmdMark = -1
cmdRelease = -1
cmdDebug = -1
cmdCancel = -1
if heldpoke
helptext = _INTL("{1} is selected.", heldpoke.name)
commands[cmdMove = commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place")
@@ -1541,7 +1540,7 @@ class PokemonStorageScreen
commands[cmdMark = commands.length] = _INTL("Mark")
commands[cmdRelease = commands.length] = _INTL("Release")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdCancel = commands.length] = _INTL("Cancel")
commands[commands.length] = _INTL("Cancel")
command = pbShowCommands(helptext, commands)
if cmdMove >= 0 && command == cmdMove # Move/Shift/Place
if @heldpkmn
@@ -1674,7 +1673,7 @@ class PokemonStorageScreen
def pbAbleCount
count = 0
for p in @storage.party
@storage.party.each do |p|
count += 1 if pbAble?(p)
end
return count
@@ -1869,7 +1868,7 @@ class PokemonStorageScreen
def pbChooseMove(pkmn, helptext, 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
@@ -1938,7 +1937,7 @@ class PokemonStorageScreen
when 1
papers = @storage.availableWallpapers
index = 0
for i in 0...papers[1].length
papers[1].length.times do |i|
if papers[1][i] == @storage[@storage.currentBox].background
index = i
break

View File

@@ -54,7 +54,7 @@ class StorageSystemPC
end
when 2 # Deposit
count = 0
for p in $PokemonStorage.party
$PokemonStorage.party.each do |p|
count += 1 if p && !p.egg? && p.hp > 0
end
if count <= 1
@@ -86,7 +86,7 @@ module PokemonPCList
def self.getCommandList
commands = []
for pc in @@pclist
@@pclist.each do |pc|
commands.push(pc.name) if pc.shouldShow?
end
commands.push(_INTL("Log Off"))
@@ -96,7 +96,7 @@ module PokemonPCList
def self.callCommand(cmd)
return false if cmd < 0 || cmd >= @@pclist.length
i = 0
for pc in @@pclist
@@pclist.each do |pc|
next if !pc.shouldShow?
if i == cmd
pc.access
@@ -169,7 +169,7 @@ def pbPCMailbox
loop do
command = 0
commands = []
for mail in $PokemonGlobal.mailbox
$PokemonGlobal.mailbox.each do |mail|
commands.push(mail.sender)
end
commands.push(_INTL("Cancel"))

View File

@@ -257,7 +257,7 @@ class PokemonMart_Scene
@viewport2.z = 99999
numFrames = Graphics.frame_rate * 4 / 10
alphaDiff = (255.0 / numFrames).ceil
for j in 0..numFrames
(0..numFrames).each do |j|
col = Color.new(0, 0, 0, j * alphaDiff)
@viewport2.color = col
Graphics.update
@@ -301,7 +301,7 @@ class PokemonMart_Scene
if @viewport2
numFrames = Graphics.frame_rate * 4 / 10
alphaDiff = (255.0 / numFrames).ceil
for j in 0..numFrames
(0..numFrames).each do |j|
col = Color.new(0, 0, 0, (numFrames - j) * alphaDiff)
@viewport2.color = col
Graphics.update

View File

@@ -63,7 +63,7 @@ class MoveRelearner_Scene
]
imagepos = []
yPos = 76
for i in 0...VISIBLEMOVES
VISIBLEMOVES.times do |i|
moveobject = @moves[@sprites["commands"].top_item + i]
if moveobject
moveData = GameData::Move.get(moveobject)
@@ -157,7 +157,7 @@ class MoveRelearnerScreen
end
tmoves = []
if pkmn.first_moves
for i in pkmn.first_moves
pkmn.first_moves.each do |i|
tmoves.push(i) if !pkmn.hasMove?(i) && !moves.include?(i)
end
end

View File

@@ -83,7 +83,7 @@ class PurifyChamberSet
def flow
ret = 0
return 0 if !@shadow
for i in 0...@list.length
@list.length.times do |i|
ret += (PurifyChamberSet.isSuperEffective(@list[i], @list[(i + 1) % @list.length])) ? 1 : 0
end
if @list[@facing]
@@ -106,7 +106,7 @@ class PurifyChamberSet
# clockwise direction. Tempo also depends on the number of Pokemon in the set
def tempo
ret = 0
for i in 0...@list.length
@list.length.times do |i|
ret += (PurifyChamberSet.isSuperEffective(@list[i], @list[(i + 1) % @list.length])) ? 1 : 0
end
return partialSum(@list.length) + ret
@@ -235,7 +235,7 @@ class PurifyChamber
# Define an exception for Lugia
if shadow.isSpecies?(:LUGIA)
maxtempo = PurifyChamber.maximumTempo
for i in 0...NUMSETS
NUMSETS.times do |i|
return false if @sets[i].tempo != maxtempo
end
end
@@ -247,7 +247,7 @@ class PurifyChamber
end
def update # called each step
for set in 0...NUMSETS
NUMSETS.times do |set|
# If a shadow Pokemon and a regular Pokemon are on the same set
if @sets[set].shadow
if @sets[set].shadow.heart_gauge > 0
@@ -560,7 +560,7 @@ class PurifyChamberScreen
def pbCheckPurify
purifiables = []
for set in 0...PurifyChamber::NUMSETS
PurifyChamber::NUMSETS.times do |set|
if @chamber.isPurifiable?(set) # if ready for purification
purifiables.push(set)
end
@@ -570,12 +570,12 @@ class PurifyChamberScreen
def pbDoPurify
purifiables = []
for set in 0...PurifyChamber::NUMSETS
PurifyChamber::NUMSETS.times do |set|
if @chamber.isPurifiable?(set) # if ready for purification
purifiables.push(set)
end
end
for i in 0...purifiables.length
purifiables.length.times do |i|
set = purifiables[i]
@chamber.currentSet = set
@scene.pbOpenSet(set)
@@ -698,13 +698,13 @@ class DirectFlowDiagram
end
def visible=(value)
for point in @points
@points.each do |point|
point.visible = value
end
end
def dispose
for point in @points
@points.each do |point|
point.dispose
end
end
@@ -719,7 +719,7 @@ class DirectFlowDiagram
end
def update
for point in @points
@points.each do |point|
point.update
point.visible = false
end
@@ -741,7 +741,7 @@ class DirectFlowDiagram
end
def color=(value)
for point in @points
@points.each do |point|
point.color = value
end
end
@@ -772,13 +772,13 @@ class FlowDiagram
end
def visible=(value)
for point in @points
@points.each do |point|
point.visible = value
end
end
def dispose
for point in @points
@points.each do |point|
point.dispose
end
end
@@ -802,7 +802,7 @@ class FlowDiagram
end
def update
for point in @points
@points.each do |point|
point.update
point.visible = false
end
@@ -824,7 +824,7 @@ class FlowDiagram
end
def color=(value)
for point in @points
@points.each do |point|
point.color = value
end
end
@@ -862,7 +862,7 @@ class PurifyChamberSetView < SpriteWrapper
@directflow.setFlowStrength(1)
@__sprites = []
@__sprites[0] = PokemonIconSprite.new(nil, viewport)
for i in 0...PurifyChamber::SETSIZE * 2
PurifyChamber::SETSIZE * 2.times do |i|
@__sprites[i + 1] = PokemonIconSprite.new(nil, viewport)
end
@__sprites[1 + (PurifyChamber::SETSIZE * 2)] = PokemonIconSprite.new(nil, viewport)
@@ -871,11 +871,11 @@ class PurifyChamberSetView < SpriteWrapper
end
def refreshFlows
for flow in @flows
@flows.each do |flow|
flow.setFlowStrength(0)
end
setcount = @chamber.setCount(@set)
for i in 0...setcount
setcount.times do |i|
if !@flows[i]
@flows[i] = FlowDiagram.new(self.viewport)
end
@@ -988,7 +988,7 @@ class PurifyChamberSetView < SpriteWrapper
points = [@chamber.setCount(@set) * 2, 1].max
setList = @chamber.setList(@set)
refreshFlows
for i in 0...PurifyChamber::SETSIZE * 2
(PurifyChamber::SETSIZE * 2).times do |i|
pkmn = (i.odd? || i >= points) ? nil : setList[i / 2]
angle = 360 - (i * 360 / points)
angle += 90 # start at 12 not 3 o'clock
@@ -1031,10 +1031,10 @@ class PurifyChamberSetView < SpriteWrapper
def visible=(value)
super
for sprite in @__sprites
@__sprites.each do |sprite|
sprite.visible = value
end
for flow in @flows
@flows.each do |flow|
flow.visible = value
end
@directflow.visible = value
@@ -1044,10 +1044,10 @@ class PurifyChamberSetView < SpriteWrapper
def color=(value)
super
for sprite in @__sprites
@__sprites.each do |sprite|
sprite.color = pbSrcOver(sprite.color, value.clone)
end
for flow in @flows
@flows.each do |flow|
flow.color = value.clone
end
@directflow.color = value.clone
@@ -1057,10 +1057,10 @@ class PurifyChamberSetView < SpriteWrapper
def update
super
for sprite in @__sprites
@__sprites.each do |sprite|
sprite.update if sprite
end
for flow in @flows
@flows.each do |flow|
flow.update
end
@directflow.update
@@ -1069,10 +1069,10 @@ class PurifyChamberSetView < SpriteWrapper
end
def dispose
for sprite in @__sprites
@__sprites.each do |sprite|
sprite.dispose if sprite
end
for flow in @flows
@flows.each do |flow|
flow.dispose
end
@directflow.dispose
@@ -1261,7 +1261,7 @@ class PurifyChamberScene
indexes = []
startindex = 0
set = @sprites["setview"].set
for i in 0...@chamber.setCount(set) * 2
(@chamber.setCount(set) * 2).times do |i|
p = PurifyChamberHelper.pbGetPokemon2(@chamber, set, i)
if p
startindex = party.length if i == pos

View File

@@ -63,7 +63,7 @@ def pbEditMysteryGift(type, item, id = 0, giftname = "")
master = IO.read("MysteryGiftMaster.txt")
master = pbMysteryGiftDecrypt(master)
end
for i in master
master.each do |i|
idlist.push(i[0])
end
params = ChooseNumberParams.new
@@ -161,7 +161,7 @@ def pbManageMysteryGifts
elsif command == commands.length - 2 # Export selected to file
begin
newfile = []
for gift in master
master.each do |gift|
newfile.push(gift) if online.include?(gift[0])
end
string = pbMysteryGiftEncrypt(newfile)
@@ -200,7 +200,7 @@ def pbManageMysteryGifts
next
end
replaced = false
for i in 0...$player.mystery_gifts.length
$player.mystery_gifts.length.times do |i|
if $player.mystery_gifts[i][0] == gift[0]
$player.mystery_gifts[i] = gift
replaced = true
@@ -219,7 +219,7 @@ end
def pbRefreshMGCommands(master, online)
commands = []
for gift in master
master.each do |gift|
itemname = "BLANK"
if gift[1] == 0
itemname = gift[2].speciesName
@@ -252,9 +252,9 @@ def pbDownloadMysteryGift(trainer)
else
online = pbMysteryGiftDecrypt(string)
pending = []
for gift in online
online.each do |gift|
notgot = true
for j in trainer.mystery_gifts
trainer.mystery_gifts.each do |j|
notgot = false if j[0] == gift[0]
end
pending.push(gift) if notgot
@@ -264,7 +264,7 @@ def pbDownloadMysteryGift(trainer)
else
loop do
commands = []
for gift in pending
pending.each do |gift|
commands.push(gift[3])
end
commands.push(_INTL("Cancel"))
@@ -356,7 +356,7 @@ end
# Collecting a Mystery Gift from the deliveryman.
#===============================================================================
def pbNextMysteryGiftID
for i in $player.mystery_gifts
$player.mystery_gifts.each do |i|
return i[0] if i.length > 1
end
return 0
@@ -364,7 +364,7 @@ end
def pbReceiveMysteryGift(id)
index = -1
for i in 0...$player.mystery_gifts.length
$player.mystery_gifts.length.times do |i|
if $player.mystery_gifts[i][0] == id && $player.mystery_gifts[i].length > 1
index = i
break

View File

@@ -381,13 +381,13 @@ class PokemonEntryScene2
@helper = CharacterEntryHelper.new(initialText)
# Create bitmaps
@bitmaps = []
for i in 0...@@Characters.length
@@Characters.length.times do |i|
@bitmaps[i] = AnimatedBitmap.new(sprintf("Graphics/Pictures/Naming/overlay_tab_#{i + 1}"))
b = @bitmaps[i].bitmap.clone
pbSetSystemFont(b)
textPos = []
for y in 0...COLUMNS
for x in 0...ROWS
COLUMNS.times do |y|
ROWS.times do |x|
pos = (y * ROWS) + x
textPos.push([@@Characters[i][0][pos], 44 + (x * 32), 12 + (y * 38), 2,
Color.new(16, 24, 32), Color.new(160, 160, 160)])
@@ -517,7 +517,7 @@ class PokemonEntryScene2
]
chars = @helper.textChars
x = 166
for ch in chars
chars.each do |ch|
textPositions.push([ch, x, 42, false, Color.new(16, 24, 32), Color.new(168, 184, 184)])
x += 24
end
@@ -566,7 +566,7 @@ class PokemonEntryScene2
end
def pbUpdate
for i in 0...@@Characters.length
@@Characters.length.times do |i|
@bitmaps[i].update
end
if @init || Graphics.frame_count % 5 == 0
@@ -608,20 +608,22 @@ class PokemonEntryScene2
@cursorpos -= 1
@cursorpos = OK if @cursorpos < MODE1
else
begin
loop do
cursormod = wrapmod(cursormod - 1, ROWS)
@cursorpos = cursororigin + cursormod
end while pbColumnEmpty?(cursormod)
break unless pbColumnEmpty?(cursormod)
end
end
elsif Input.repeat?(Input::RIGHT)
if @cursorpos < 0 # Controls
@cursorpos += 1
@cursorpos = MODE1 if @cursorpos > OK
else
begin
loop do
cursormod = wrapmod(cursormod + 1, ROWS)
@cursorpos = cursororigin + cursormod
end while pbColumnEmpty?(cursormod)
break unless pbColumnEmpty?(cursormod)
end
end
elsif Input.repeat?(Input::UP)
if @cursorpos < 0 # Controls
@@ -738,7 +740,7 @@ class PokemonEntryScene2
def pbEndScene
pbFadeOutAndHide(@sprites) { pbUpdate }
for bitmap in @bitmaps
@bitmaps.each do |bitmap|
bitmap.dispose if bitmap
end
@bitmaps.clear