Yet more Rubocopping

This commit is contained in:
Maruno17
2021-12-23 00:27:17 +00:00
parent 514fe13ca2
commit 132a16950d
171 changed files with 1455 additions and 1647 deletions

View File

@@ -361,13 +361,11 @@ def pbTrainerTypeEditor
if tr_type
case button
when Input::ACTION
if tr_type.is_a?(Symbol)
if pbConfirmMessageSerious("Delete this trainer type?")
GameData::TrainerType::DATA.delete(tr_type)
GameData::TrainerType.save
pbConvertTrainerData
pbMessage(_INTL("The Trainer type was deleted."))
end
if tr_type.is_a?(Symbol) && pbConfirmMessageSerious("Delete this trainer type?")
GameData::TrainerType::DATA.delete(tr_type)
GameData::TrainerType.save
pbConvertTrainerData
pbMessage(_INTL("The Trainer type was deleted."))
end
when Input::USE
if tr_type.is_a?(Symbol)
@@ -502,13 +500,11 @@ def pbTrainerBattleEditor
if trainer_id
case button
when Input::ACTION
if trainer_id.is_a?(Array)
if pbConfirmMessageSerious("Delete this trainer battle?")
tr_data = GameData::Trainer::DATA[trainer_id]
GameData::Trainer::DATA.delete(trainer_id)
modified = true
pbMessage(_INTL("The Trainer battle was deleted."))
end
if trainer_id.is_a?(Array) && pbConfirmMessageSerious("Delete this trainer battle?")
tr_data = GameData::Trainer::DATA[trainer_id]
GameData::Trainer::DATA.delete(trainer_id)
modified = true
pbMessage(_INTL("The Trainer battle was deleted."))
end
when Input::USE
if trainer_id.is_a?(Array) # Edit existing trainer
@@ -874,8 +870,8 @@ def pbItemEditor
[_INTL("Name"), ItemNameProperty, _INTL("Name of this item as displayed by the game.")],
[_INTL("NamePlural"), ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")],
[_INTL("Pocket"), PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
[_INTL("Price"), LimitProperty.new(999999), _INTL("Purchase price of this item.")],
[_INTL("SellPrice"), LimitProperty.new(999999), _INTL("Sell price of this item. If blank, is half the purchase price.")],
[_INTL("Price"), LimitProperty.new(999_999), _INTL("Purchase price of this item.")],
[_INTL("SellPrice"), LimitProperty.new(999_999), _INTL("Sell price of this item. If blank, is half the purchase price.")],
[_INTL("Description"), StringProperty, _INTL("Description of this item")],
[_INTL("FieldUse"), EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
[_INTL("BattleUse"), EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
@@ -887,13 +883,11 @@ def pbItemEditor
if item
case button
when Input::ACTION
if item.is_a?(Symbol)
if pbConfirmMessageSerious("Delete this item?")
GameData::Item::DATA.delete(item)
GameData::Item.save
Compiler.write_items
pbMessage(_INTL("The item was deleted."))
end
if item.is_a?(Symbol) && pbConfirmMessageSerious("Delete this item?")
GameData::Item::DATA.delete(item)
GameData::Item.save
Compiler.write_items
pbMessage(_INTL("The item was deleted."))
end
when Input::USE
if item.is_a?(Symbol)
@@ -974,7 +968,7 @@ def pbItemEditorNew(default_name)
pocket = PocketProperty.set("", 0)
return if pocket == 0
# Choose a price
price = LimitProperty.new(999999).set(_INTL("Purchase price"), -1)
price = LimitProperty.new(999_999).set(_INTL("Purchase price"), -1)
return if price == -1
# Choose a description
description = StringProperty.set(_INTL("Description"), "")
@@ -1030,7 +1024,7 @@ def pbPokemonEditor
[_INTL("WildItemRare"), GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")],
[_INTL("EggGroup 1"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
[_INTL("HatchSteps"), LimitProperty.new(99_999), _INTL("Number of steps until an egg of this species hatches.")],
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
[_INTL("Offspring"), GameDataPoolProperty.new(:Species), _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")],
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
@@ -1039,20 +1033,18 @@ def pbPokemonEditor
[_INTL("Color"), GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")],
[_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
[_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
[_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("Generation"), LimitProperty.new(99_999), _INTL("The number of the generation the Pokémon debuted in.")],
[_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")]
]
pbListScreenBlock(_INTL("Pokémon species"), SpeciesLister.new(0, false)) { |button, species|
if species
case button
when Input::ACTION
if species.is_a?(Symbol)
if pbConfirmMessageSerious("Delete this species?")
GameData::Species::DATA.delete(species)
GameData::Species.save
Compiler.write_pokemon
pbMessage(_INTL("The species was deleted."))
end
if species.is_a?(Symbol) && pbConfirmMessageSerious("Delete this species?")
GameData::Species::DATA.delete(species)
GameData::Species.save
Compiler.write_pokemon
pbMessage(_INTL("The species was deleted."))
end
when Input::USE
if species.is_a?(Symbol)
@@ -1259,7 +1251,7 @@ def pbRegionalDexEditor(dex)
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0 # Save all changes to Dex
dex.slice!(-1) while !dex[-1]
dex.slice!(-1) until dex[-1]
ret = dex
break
when 1 # Just quit

View File

@@ -48,7 +48,7 @@ class PokemonTilesetScene
def load_tileset(id)
@tileset = @tilesets_data[id]
@tilehelper.dispose if @tilehelper
@tilehelper&.dispose
@tilehelper = TileDrawingHelper.fromTileset(@tileset)
@x = 0
@y = 0
@@ -88,7 +88,7 @@ class PokemonTilesetScene
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])
textpos.push([terr.to_s, (xx * TILE_SIZE) + (TILE_SIZE / 2), (yy * TILE_SIZE) - 6, 2, TEXT_COLOR, TEXT_SHADOW_COLOR])
end
end
pbDrawTextPositions(@sprites["overlay"].bitmap, textpos)
@@ -188,9 +188,9 @@ class PokemonTilesetScene
]
case pbShowCommands(nil, commands, -1)
when 0
update_cursor_position(0, 99999)
update_cursor_position(0, 99_999)
when 1
update_cursor_position(0, -99999)
update_cursor_position(0, -99_999)
when 2
choose_tileset
end

View File

@@ -50,7 +50,7 @@ class SelectionSprite < Sprite
end
def dispose
@sprite.bitmap.dispose if @sprite.bitmap
@sprite.bitmap&.dispose
@othersprite = nil
@sprite.dispose
end
@@ -234,8 +234,8 @@ class MapScreenScene
otherdims = MapFactoryHelper.getMapDims(i)
x1 = (thissprite.x - othersprite.x) / 4
y1 = (thissprite.y - othersprite.y) / 4
if (x1 == otherdims[0] || x1 == -thisdims[0] ||
y1 == otherdims[1] || y1 == -thisdims[1])
if x1 == otherdims[0] || x1 == -thisdims[0] ||
y1 == otherdims[1] || y1 == -thisdims[1]
ret.push(i)
end
end

View File

@@ -21,11 +21,11 @@ def pbAutoPositionAll
metrics = GameData::SpeciesMetrics.get_species_form(sp.species, sp.form)
bitmap1 = GameData::Species.sprite_bitmap(sp.species, sp.form, nil, nil, nil, true)
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
if bitmap1 && bitmap1.bitmap # Player's y
if bitmap1&.bitmap # Player's y
metrics.back_sprite[0] = 0
metrics.back_sprite[1] = (bitmap1.height - (findBottom(bitmap1.bitmap) + 1)) / 2
end
if bitmap2 && bitmap2.bitmap # Foe's y
if bitmap2&.bitmap # Foe's y
metrics.front_sprite[0] = 0
metrics.front_sprite[1] = (bitmap2.height - (findBottom(bitmap2.bitmap) + 1)) / 2
metrics.front_sprite[1] += 4 # Just because
@@ -33,8 +33,8 @@ def pbAutoPositionAll
metrics.front_sprite_altitude = 0 # Shouldn't be used
metrics.shadow_x = 0
metrics.shadow_size = 2
bitmap1.dispose if bitmap1
bitmap2.dispose if bitmap2
bitmap1&.dispose
bitmap2&.dispose
end
GameData::SpeciesMetrics.save
Compiler.write_pokemon_metrics