More aligning of code

This commit is contained in:
Maruno17
2021-12-19 12:19:08 +00:00
parent 13a238cc6a
commit 33781493f4
121 changed files with 977 additions and 838 deletions

View File

@@ -419,7 +419,8 @@ def pbDuel(trainer_id, trainer_name, event, speeches)
trainer_id = GameData::TrainerType.get(trainer_id).id
duel = PokemonDuel.new
opponent = NPCTrainer.new(
pbGetMessageFromHash(MessageTypes::TrainerNames, trainer_name), trainer_id)
pbGetMessageFromHash(MessageTypes::TrainerNames, trainer_name), trainer_id
)
speech_texts = []
for i in 0...12
speech_texts.push(_I(speeches[i]))

View File

@@ -169,8 +169,9 @@ class TriadScene
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
addBackgroundPlane(@sprites, "background", "triad_bg", @viewport)
@sprites["helpwindow"] = Window_AdvancedTextPokemon.newWithSize("",
0, Graphics.height - 64, Graphics.width, 64, @viewport)
@sprites["helpwindow"] = Window_AdvancedTextPokemon.newWithSize(
"", 0, Graphics.height - 64, Graphics.width, 64, @viewport
)
for i in 0...@battle.width * @battle.height
@sprites["sprite#{i}"] = SpriteWrapper.new(@viewport)
@sprites["sprite#{i}"].x = Graphics.width / 2 - 118 + (i % 3) * 78
@@ -637,7 +638,7 @@ class TriadScreen
def pbAdd(items, item)
return ItemStorageHelper.add(items, $PokemonGlobal.triads.maxSize,
TriadStorage::MAX_PER_SLOT, item, 1)
TriadStorage::MAX_PER_SLOT, item, 1)
end
def pbSubtract(items, item)
@@ -719,7 +720,7 @@ class TriadScreen
for i in 0...$PokemonGlobal.triads.length
item = $PokemonGlobal.triads[i]
ItemStorageHelper.add(@triadCards, $PokemonGlobal.triads.maxSize,
TriadStorage::MAX_PER_SLOT, item[0], item[1])
TriadStorage::MAX_PER_SLOT, item[0], item[1])
count += item[1] # Add item count to total count
end
@board = []
@@ -1076,7 +1077,8 @@ def pbBuyTriads
cmdwindow = Window_CommandPokemonEx.newWithSize(realcommands, 0, 0, Graphics.width / 2, Graphics.height)
cmdwindow.z = 99999
goldwindow = Window_UnformattedTextPokemon.newWithSize(
_INTL("Money:\r\n{1}", pbGetGoldString), 0, 0, 32, 32)
_INTL("Money:\r\n{1}", pbGetGoldString), 0, 0, 32, 32
)
goldwindow.resizeToFit(goldwindow.text, Graphics.width)
goldwindow.x = Graphics.width - goldwindow.width
goldwindow.y = 0
@@ -1118,7 +1120,8 @@ def pbBuyTriads
params.setInitialValue(1)
params.setCancelValue(0)
quantity = pbMessageChooseNumber(
_INTL("The {1} card? Certainly. How many would you like?", itemname), params)
_INTL("The {1} card? Certainly. How many would you like?", itemname), params
)
next if quantity <= 0
price *= quantity
next if !pbConfirmMessage(_INTL("{1}, and you want {2}. That will be ${3}. OK?", itemname, quantity, price.to_s_formatted))
@@ -1162,7 +1165,8 @@ def pbSellTriads
cmdwindow = Window_CommandPokemonEx.newWithSize(commands, 0, 0, Graphics.width / 2, Graphics.height)
cmdwindow.z = 99999
goldwindow = Window_UnformattedTextPokemon.newWithSize(
_INTL("Money:\r\n{1}", pbGetGoldString), 0, 0, 32, 32)
_INTL("Money:\r\n{1}", pbGetGoldString), 0, 0, 32, 32
)
goldwindow.resizeToFit(goldwindow.text, Graphics.width)
goldwindow.x = Graphics.width - goldwindow.width
goldwindow.y = 0
@@ -1216,7 +1220,8 @@ def pbSellTriads
params.setInitialValue(1)
params.setCancelValue(0)
quantity = pbMessageChooseNumber(
_INTL("The {1} card? How many would you like to sell?", itemname), params)
_INTL("The {1} card? How many would you like to sell?", itemname), params
)
end
if quantity > 0
price /= 4

View File

@@ -254,7 +254,7 @@ class SlotMachineScene
y = [170, 122, 218, 82, 82][i - 1]
@sprites["row#{i}"] = IconSprite.new(2, y, @viewport)
@sprites["row#{i}"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/line%1d%s",
1 + i / 2, (i >= 4) ? ((i == 4) ? "a" : "b") : ""))
1 + i / 2, (i >= 4) ? ((i == 4) ? "a" : "b") : ""))
@sprites["row#{i}"].visible = false
end
@sprites["light1"] = IconSprite.new(16, 32, @viewport)

View File

@@ -85,12 +85,12 @@ class VoltorbFlip
pbUpdateColumnNumbers(0, 0, i)
end
pbDrawShadowText(@sprites["text"].bitmap, 8, 16, 118, 26,
_INTL("Your coins"), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
_INTL("Your coins"), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
pbDrawShadowText(@sprites["text"].bitmap, 8, 82, 118, 26,
_INTL("Earned coins"), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
_INTL("Earned coins"), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
# Draw current level
pbDrawShadowText(@sprites["level"].bitmap, 8, 150, 118, 28,
_INTL("Level {1}", @level.to_s), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
_INTL("Level {1}", @level.to_s), Color.new(60, 60, 60), Color.new(150, 190, 170), 1)
# Displays total and current coins
pbUpdateCoins
# Draw curtain effect

View File

@@ -492,9 +492,9 @@ class MiningGameScene
for index in revealed
burieditem = @items[index]
revealeditems.bitmap.blt(32 * burieditem[1], 64 + 32 * burieditem[2],
@itembitmap.bitmap,
Rect.new(32 * ITEMS[burieditem[0]][2], 32 * ITEMS[burieditem[0]][3],
32 * ITEMS[burieditem[0]][4], 32 * ITEMS[burieditem[0]][5]))
@itembitmap.bitmap,
Rect.new(32 * ITEMS[burieditem[0]][2], 32 * ITEMS[burieditem[0]][3],
32 * ITEMS[burieditem[0]][4], 32 * ITEMS[burieditem[0]][5]))
if i > halfFlashTime
revealeditems.color = Color.new(255, 255, 255, (halfFlashTime * 2 - i) * alphaDiff)
else
@@ -531,7 +531,7 @@ class MiningGameScene
collapseFraction = (Graphics.height.to_f / collapseTime).ceil
for i in 1..collapseTime
@sprites["collapse"].bitmap.fill_rect(0, collapseFraction * (i - 1),
Graphics.width, collapseFraction * i, Color.new(0, 0, 0))
Graphics.width, collapseFraction * i, Color.new(0, 0, 0))
Graphics.update
end
pbMessage(_INTL("The wall collapsed!"))
@@ -590,10 +590,10 @@ class MiningGameScene
for i in @itemswon
if $bag.add(i)
pbMessage(_INTL("One {1} was obtained.\\se[Mining item get]\\wtnp[30]",
GameData::Item.get(i).name))
GameData::Item.get(i).name))
else
pbMessage(_INTL("One {1} was found, but you have no room for it.",
GameData::Item.get(i).name))
GameData::Item.get(i).name))
end
end
end

View File

@@ -56,11 +56,13 @@ class TilePuzzleCursor < BitmapSprite
if @game != 3
expand = (@holding) ? 0 : 4
for i in 0...4
self.bitmap.blt(x + (i % 2) * (@tilewidth - @cursorbitmap.width / 4) + expand * (((i % 2) * 2) - 1),
y + (i / 2) * (@tileheight - @cursorbitmap.height / 2) + expand * (((i / 2) * 2) - 1),
@cursorbitmap.bitmap, Rect.new(
(i % 2) * @cursorbitmap.width / 4, (i / 2) * @cursorbitmap.height / 2,
@cursorbitmap.width / 4, @cursorbitmap.height / 2))
self.bitmap.blt(
x + (i % 2) * (@tilewidth - @cursorbitmap.width / 4) + expand * (((i % 2) * 2) - 1),
y + (i / 2) * (@tileheight - @cursorbitmap.height / 2) + expand * (((i / 2) * 2) - 1),
@cursorbitmap.bitmap, Rect.new((i % 2) * @cursorbitmap.width / 4,
(i / 2) * @cursorbitmap.height / 2,
@cursorbitmap.width / 4, @cursorbitmap.height / 2)
)
end
end
# Arrows
@@ -72,10 +74,10 @@ class TilePuzzleCursor < BitmapSprite
(@tileheight - @cursorbitmap.height / 2) / 2, -expand]
for i in 0...4
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))
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
@@ -122,11 +124,11 @@ class TilePuzzleScene
@sprites["tile#{i}"].bitmap.clear
if rotatebitmaps[@angles[i]]
@sprites["tile#{i}"].bitmap.blt(0, 0, rotatebitmaps[@angles[i]].bitmap,
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
@sprites["tile#{i}"].angle = 0
else
@sprites["tile#{i}"].bitmap.blt(0, 0, @tilebitmap.bitmap,
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
@sprites["tile#{i}"].angle = @angles[i] * 90
end
end
@@ -173,13 +175,13 @@ class TilePuzzleScene
@sprites["tile#{i}"].oy = @tileheight / 2
break if @game == 3 && i >= @boardwidth * @boardheight - 1
@sprites["tile#{i}"].bitmap.blt(0, 0, @tilebitmap.bitmap,
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight))
end
@heldtile = -1
@angles = []
@tiles = pbShuffleTiles
@sprites["cursor"] = TilePuzzleCursor.new(@game, pbDefaultCursorPosition,
@tilewidth, @tileheight, @boardwidth, @boardheight)
@tilewidth, @tileheight, @boardwidth, @boardheight)
update
pbFadeInAndShow(@sprites)
end
@@ -509,8 +511,8 @@ class TilePuzzleScene
extratile = @sprites["tile#{@boardwidth * @boardheight - 1}"]
extratile.bitmap.clear
extratile.bitmap.blt(0, 0, @tilebitmap.bitmap,
Rect.new(@tilewidth * (@boardwidth - 1), @tileheight * (@boardheight - 1),
@tilewidth, @tileheight))
Rect.new(@tilewidth * (@boardwidth - 1), @tileheight * (@boardheight - 1),
@tilewidth, @tileheight))
extratile.opacity = 0
appearTime = Graphics.frame_rate * 8 / 10
opacityDiff = (255.0 / appearTime).ceil