Lots of rubocop

This commit is contained in:
Maruno17
2023-01-28 15:21:12 +00:00
parent 2d056052ce
commit 13aab8d911
159 changed files with 1679 additions and 1931 deletions

View File

@@ -293,8 +293,8 @@ class TriadScene
item = chosenCards.pop
@battle.pbAdd(cardStorage, item)
commands = []
cardStorage.each do |item|
commands.push(_INTL("{1} x{2}", GameData::Species.get(item[0]).name, item[1]))
cardStorage.each do |itm|
commands.push(_INTL("{1} x{2}", GameData::Species.get(itm[0]).name, itm[1]))
end
command.commands = commands
index = -1
@@ -315,8 +315,8 @@ class TriadScene
chosenCards.push(item[0])
@battle.pbSubtract(cardStorage, item[0])
commands = []
cardStorage.each do |item|
commands.push(_INTL("{1} x{2}", GameData::Species.get(item[0]).name, item[1]))
cardStorage.each do |itm|
commands.push(_INTL("{1} x{2}", GameData::Species.get(itm[0]).name, itm[1]))
end
command.commands = commands
command.index = commands.length - 1 if command.index >= commands.length
@@ -762,10 +762,10 @@ class TriadScreen
# Set the opponent's cards.
if oppdeck.is_a?(Array) && oppdeck.length == self.maxCards # Preset
opponentCards = []
oppdeck.each do |i|
species_data = GameData::Species.try_get(i)
oppdeck.each do |species|
species_data = GameData::Species.try_get(species)
if !species_data
@scene.pbDisplayPaused(_INTL("Opponent has an illegal card, \"{1}\".", i))
@scene.pbDisplayPaused(_INTL("Opponent has an illegal card, \"{1}\".", species))
@scene.pbEndScene
return 0
end
@@ -819,16 +819,16 @@ class TriadScreen
# Opponent's turn
@scene.pbDisplay(_INTL("{1} is making a move...", @opponentName))
scores = []
opponentCards.length.times do |cardIndex|
opponentCards.length.times do |cardIdx|
square = TriadSquare.new
square.card = TriadCard.new(opponentCards[cardIndex])
square.card = TriadCard.new(opponentCards[cardIdx])
square.owner = 2
(@width * @height).times do |i|
x = i % @width
y = i / @width
square.type = @board[i].type
(@width * @height).times do |j|
x = j % @width
y = j / @width
square.type = @board[j].type
flips = flipBoard(x, y, square)
scores.push([cardIndex, x, y, flips.length]) if flips
scores.push([cardIdx, x, y, flips.length]) if flips
end
end
# Sort by number of flips
@@ -875,16 +875,12 @@ class TriadScreen
result = 3
if @trade == 1
# Keep only cards of your color
originalCards.each do |card|
$PokemonGlobal.triads.remove(card)
end
cards.each do |i|
$PokemonGlobal.triads.add(i)
end
originalCards.each { |crd| $PokemonGlobal.triads.remove(crd) }
cards.each { |crd| $PokemonGlobal.triads.add(crd) }
(@width * @height).times do |i|
if board[i].owner == 1
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
$PokemonGlobal.triads.add(card)
crd = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
$PokemonGlobal.triads.add(crd)
end
end
@scene.pbDisplayPaused(_INTL("Kept all cards of your color."))
@@ -906,12 +902,8 @@ class TriadScreen
@scene.pbDisplayPaused(_INTL("Got opponent's {1} card.", cardname))
end
when 1 # Keep only cards of your color
originalCards.each do |card|
$PokemonGlobal.triads.remove(card)
end
cards.each do |i|
$PokemonGlobal.triads.add(i)
end
originalCards.each { |crd| $PokemonGlobal.triads.remove(crd) }
cards.each { |crd| $PokemonGlobal.triads.add(crd) }
(@width * @height).times do |i|
if board[i].owner == 1
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
@@ -920,9 +912,7 @@ class TriadScreen
end
@scene.pbDisplayPaused(_INTL("Kept all cards of your color."))
when 2 # Gain all opponent's cards
originalOpponentCards.each do |card|
$PokemonGlobal.triads.add(card)
end
originalOpponentCards.each { |crd| $PokemonGlobal.triads.add(crd) }
@scene.pbDisplayPaused(_INTL("Got all opponent's cards."))
end
end
@@ -936,12 +926,8 @@ class TriadScreen
cardname = GameData::Species.get(card).name
@scene.pbDisplayPaused(_INTL("Opponent won your {1} card.", cardname))
when 1 # Keep only cards of your color
originalCards.each do |card|
$PokemonGlobal.triads.remove(card)
end
cards.each do |i|
$PokemonGlobal.triads.add(i)
end
originalCards.each { |crd| $PokemonGlobal.triads.remove(card) }
cards.each { |crd| $PokemonGlobal.triads.add(crd) }
(@width * @height).times do |i|
if board[i].owner == 1
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
@@ -950,9 +936,7 @@ class TriadScreen
end
@scene.pbDisplayPaused(_INTL("Kept all cards of your color.", cardname))
when 2 # Lose all your cards
originalCards.each do |card|
$PokemonGlobal.triads.remove(card)
end
originalCards.each { |crd| $PokemonGlobal.triads.remove(crd) }
@scene.pbDisplayPaused(_INTL("Opponent won all your cards."))
end
end
@@ -971,11 +955,11 @@ end
def pbTriadDuel(name, minLevel, maxLevel, rules = nil, oppdeck = nil, prize = nil)
ret = 0
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
scene = TriadScene.new
screen = TriadScreen.new(scene)
ret = screen.pbStartScreen(name, minLevel, maxLevel, rules, oppdeck, prize)
}
end
return ret
end
@@ -1198,9 +1182,7 @@ def pbSellTriads
item = $PokemonGlobal.triads.get_item(cmdwindow.index)
if olditem != item
preview.bitmap&.dispose
if item
preview.bitmap = TriadCard.new(item).createBitmap(1)
end
preview.bitmap = TriadCard.new(item).createBitmap(1) if item
olditem = item
end
if Input.trigger?(Input::BACK)