More Rubocop changes

This commit is contained in:
Maruno17
2022-02-13 00:57:54 +00:00
parent cca5989746
commit f68e699cc9
108 changed files with 708 additions and 808 deletions

View File

@@ -553,11 +553,10 @@ class TriadScene
(@battle.width * @battle.height).times do |i|
x = i % @battle.width
y = i / @battle.width
if @boardSprites[i]
owner = @battle.getOwner(x, y)
@boardSprites[i].bitmap&.dispose
@boardSprites[i].bitmap = @boardCards[i].createBitmap(owner)
end
next if !@boardSprites[i]
@boardSprites[i].bitmap&.dispose
owner = @battle.getOwner(x, y)
@boardSprites[i].bitmap = @boardCards[i].createBitmap(owner)
end
end
@@ -655,7 +654,7 @@ class TriadScreen
panels[7] = (@wrapAround ? 0 : @height - 1) if panels[7] > @height - 1 # bottom
attacker = attackerParam.nil? ? @board[(y * @width) + x] : attackerParam
flips = []
return nil if attackerParam != nil && @board[(y * @width) + x].owner != 0
return nil if attackerParam && @board[(y * @width) + x].owner != 0
return nil if !attacker.card || attacker.owner == 0
4.times do |i|
defenderX = panels[i * 2]
@@ -830,9 +829,7 @@ class TriadScreen
y = i / @width
square.type = @board[i].type
flips = flipBoard(x, y, square)
if flips != nil
scores.push([cardIndex, x, y, flips.length])
end
scores.push([cardIndex, x, y, flips.length]) if flips
end
end
# Sort by number of flips

View File

@@ -53,11 +53,10 @@ class VoltorbFlip
squareValues[i] = rand(2..3)
total *= squareValues[i]
end
if total > LEVEL_RANGES[@level - 1][1]
# Lowers value of square to 1 if over max
total /= squareValues[i]
squareValues[i] = 1
end
next if total <= LEVEL_RANGES[@level - 1][1]
# Lowers value of square to 1 if over max
total /= squareValues[i]
squareValues[i] = 1
end
# Randomize the values a little
25.times do |i|
@@ -67,11 +66,10 @@ class VoltorbFlip
squareValues[i] -= 1
total *= squareValues[i]
end
if total < LEVEL_RANGES[@level - 1][0] && squareValues[i] > 0
total /= squareValues[i]
squareValues[i] = temp
total *= squareValues[i]
end
next if total >= LEVEL_RANGES[@level - 1][0] || squareValues[i] <= 0
total /= squareValues[i]
squareValues[i] = temp
total *= squareValues[i]
end
# Populate @squares array
25.times do |i|

View File

@@ -20,33 +20,25 @@ def pbLottery(winnum, nameVar = 2, positionVar = 3, matchedVar = 4)
thismatched = 0
id = i.owner.public_id
5.times do |j|
if (id / (10**j)) % 10 == (winnum / (10**j)) % 10
thismatched += 1
else
break
end
end
if thismatched > winmatched
winpoke = i.name
winpos = 1 # Party
winmatched = thismatched
break if (id / (10**j)) % 10 != (winnum / (10**j)) % 10
thismatched += 1
end
next if thismatched <= winmatched
winpoke = i.name
winpos = 1 # Party
winmatched = thismatched
end
pbEachPokemon { |poke, _box|
thismatched = 0
id = poke.owner.public_id
5.times do |j|
if (id / (10**j)) % 10 == (winnum / (10**j)) % 10
thismatched += 1
else
break
end
end
if thismatched > winmatched
winpoke = poke.name
winpos = 2 # Storage
winmatched = thismatched
break if (id / (10**j)) % 10 != (winnum / (10**j)) % 10
thismatched += 1
end
next if thismatched <= winmatched
winpoke = poke.name
winpos = 2 # Storage
winmatched = thismatched
}
$game_variables[nameVar] = winpoke
$game_variables[positionVar] = winpos

View File

@@ -73,12 +73,11 @@ class TilePuzzleCursor < BitmapSprite
yin = [@tileheight - (@cursorbitmap.height / 2) + expand, (@tileheight - (@cursorbitmap.height / 2)) / 2,
(@tileheight - (@cursorbitmap.height / 2)) / 2, -expand]
4.times do |i|
if @arrows[i]
self.bitmap.blt(x + xin[i], y + yin[i], @cursorbitmap.bitmap,
Rect.new((@cursorbitmap.width / 2) + ((i % 2) * (@cursorbitmap.width / 4)),
(i / 2) * (@cursorbitmap.height / 2),
@cursorbitmap.width / 4, @cursorbitmap.height / 2))
end
next if !@arrows[i]
self.bitmap.blt(x + xin[i], y + yin[i], @cursorbitmap.bitmap,
Rect.new((@cursorbitmap.width / 2) + ((i % 2) * (@cursorbitmap.width / 4)),
(i / 2) * (@cursorbitmap.height / 2),
@cursorbitmap.width / 4, @cursorbitmap.height / 2))
end
end
end