mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
More tweaks from the Rubocop overlord
This commit is contained in:
@@ -71,14 +71,12 @@ class PokemonDuel
|
||||
end
|
||||
@oldmovespeed = $game_player.move_speed
|
||||
@oldeventspeed = event.move_speed
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn])
|
||||
pbWait(Graphics.frame_rate * 3 / 4)
|
||||
end
|
||||
|
||||
@@ -117,7 +115,7 @@ class PokemonDuel
|
||||
end
|
||||
end
|
||||
@special[1] = true if action == 3
|
||||
pbMessage(_INTL("{1}: {2}", opponent.name, speeches[action * 3 + rand(3)]))
|
||||
pbMessage(_INTL("{1}: {2}", opponent.name, speeches[(action * 3) + rand(3)]))
|
||||
list = [
|
||||
_INTL("DEFEND"),
|
||||
_INTL("PRECISE ATTACK"),
|
||||
@@ -127,105 +125,88 @@ class PokemonDuel
|
||||
command = pbMessage(_INTL("Choose a command."), list, 0)
|
||||
@special[0] = true if command == 3
|
||||
if action == 0 && command == 0
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90"
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90"
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90"])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90"])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbMessage(_INTL("You study each other's movements..."))
|
||||
elsif action == 0 && command == 1
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(false, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[1] -= 1
|
||||
pbMessage(_INTL("Your attack was not blocked!"))
|
||||
elsif action == 0 && command == 2
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Backward])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMessage(_INTL("Your attack was evaded!"))
|
||||
elsif [0, 1, 2].include?(action) && command == 3
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(false, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
@hp[1] -= 3
|
||||
pbMessage(_INTL("You pierce through the opponent's defenses!"))
|
||||
elsif action == 1 && command == 0
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, false)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[0] -= 1
|
||||
pbMessage(_INTL("You fail to block the opponent's attack!"))
|
||||
elsif action == 1 && command == 1
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 6 / 10)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 6 / 10)
|
||||
pbMoveRoute(event, [PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Forward])
|
||||
@@ -235,28 +216,24 @@ class PokemonDuel
|
||||
elsif (action == 1 && command == 2) ||
|
||||
(action == 2 && command == 1) ||
|
||||
(action == 2 && command == 2)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 8 / 10)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 9 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::Backward,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute(event, [PBMoveRoute::Forward])
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Forward])
|
||||
@@ -264,70 +241,58 @@ class PokemonDuel
|
||||
@hp[1] -= command # Player command
|
||||
pbMessage(_INTL("You hit each other!"))
|
||||
elsif action == 2 && command == 0
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpBackward"
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpBackward"])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMessage(_INTL("You evade the opponent's attack!"))
|
||||
elsif action == 3 && [0, 1, 2].include?(command)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, false)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[0] -= 3
|
||||
pbMessage(_INTL("The opponent pierces through your defenses!"))
|
||||
elsif action == 3 && command == 3
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::Wait, 15,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::Wait, 15,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2
|
||||
])
|
||||
pbMoveRoute(event,
|
||||
[PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbShake(9, 9, 8)
|
||||
pbFlash(Color.new(255, 255, 255, 255), 20)
|
||||
pbFlashScreens(true, true)
|
||||
@@ -343,14 +308,12 @@ class PokemonDuel
|
||||
|
||||
def pbEndDuel
|
||||
pbWait(Graphics.frame_rate * 3 / 4)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed, @oldmovespeed
|
||||
])
|
||||
pbMoveRoute(@event, [
|
||||
PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed, @oldeventspeed
|
||||
])
|
||||
pbMoveRoute($game_player,
|
||||
[PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed, @oldmovespeed])
|
||||
pbMoveRoute(@event,
|
||||
[PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed, @oldeventspeed])
|
||||
fade_time = Graphics.frame_rate * 4 / 10
|
||||
alpha_diff = (255.0 / fade_time).ceil
|
||||
fade_time.times do
|
||||
|
||||
@@ -23,10 +23,10 @@ class TriadCard
|
||||
speed = baseStats[:SPEED]
|
||||
@type = species_data.types[0]
|
||||
@type = species_data.types[1] if @type == :NORMAL && species_data.types[1]
|
||||
@west = baseStatToValue(attack + speed / 3)
|
||||
@east = baseStatToValue(defense + hp / 3)
|
||||
@north = baseStatToValue(spAtk + speed / 3)
|
||||
@south = baseStatToValue(spDef + hp / 3)
|
||||
@west = baseStatToValue(attack + (speed / 3))
|
||||
@east = baseStatToValue(defense + (hp / 3))
|
||||
@north = baseStatToValue(spAtk + (speed / 3))
|
||||
@south = baseStatToValue(spDef + (hp / 3))
|
||||
end
|
||||
|
||||
def baseStatToValue(stat)
|
||||
@@ -61,22 +61,22 @@ class TriadCard
|
||||
|
||||
def price
|
||||
maxValue = [@north, @east, @south, @west].max
|
||||
ret = @north * @north + @east * @east + @south * @south + @west * @west
|
||||
ret = (@north * @north) + (@east * @east) + (@south * @south) + (@west * @west)
|
||||
ret += maxValue * maxValue * 2
|
||||
ret *= maxValue
|
||||
ret *= (@north + @east + @south + @west)
|
||||
ret /= 10 # Ranges from 2 to 24,000
|
||||
# Quantize prices to the next highest "unit"
|
||||
if ret > 10000
|
||||
ret = (1 + ret / 1000) * 1000
|
||||
ret = (1 + (ret / 1000)) * 1000
|
||||
elsif ret > 5000
|
||||
ret = (1 + ret / 500) * 500
|
||||
ret = (1 + (ret / 500)) * 500
|
||||
elsif ret > 1000
|
||||
ret = (1 + ret / 100) * 100
|
||||
ret = (1 + (ret / 100)) * 100
|
||||
elsif ret > 500
|
||||
ret = (1 + ret / 50) * 50
|
||||
ret = (1 + (ret / 50)) * 50
|
||||
else
|
||||
ret = (1 + ret / 10) * 10
|
||||
ret = (1 + (ret / 10)) * 10
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -174,8 +174,8 @@ class TriadScene
|
||||
)
|
||||
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
|
||||
@sprites["sprite#{i}"].y = 36 + (i / 3) * 94
|
||||
@sprites["sprite#{i}"].x = (Graphics.width / 2) - 118 + ((i % 3) * 78)
|
||||
@sprites["sprite#{i}"].y = 36 + ((i / 3) * 94)
|
||||
@sprites["sprite#{i}"].z = 2
|
||||
bm = TriadCard.createBack(@battle.board[i].type, true)
|
||||
@bitmaps.push(bm)
|
||||
@@ -190,17 +190,18 @@ class TriadScene
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["player#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["player#{i}"].x = Graphics.width - 92
|
||||
@sprites["player#{i}"].y = 44 + 44 * i
|
||||
@sprites["player#{i}"].y = 44 + (44 * i)
|
||||
@sprites["player#{i}"].z = 2
|
||||
@cardIndexes.push(i)
|
||||
end
|
||||
@sprites["overlay"] = Sprite.new(@viewport)
|
||||
@sprites["overlay"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbDrawTextPositions(@sprites["overlay"].bitmap, [
|
||||
[@battle.opponentName, 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)],
|
||||
[@battle.playerName, Graphics.width - 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]
|
||||
])
|
||||
pbDrawTextPositions(
|
||||
@sprites["overlay"].bitmap,
|
||||
[[@battle.opponentName, 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)],
|
||||
[@battle.playerName, Graphics.width - 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]]
|
||||
)
|
||||
@sprites["score"] = Sprite.new(@viewport)
|
||||
@sprites["score"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height)
|
||||
pbSetSystemFont(@sprites["score"].bitmap)
|
||||
@@ -263,14 +264,14 @@ class TriadScene
|
||||
command = Window_CommandPokemonEx.newWithSize(commands, 0, 0, Graphics.width / 2, Graphics.height - 64, @viewport)
|
||||
@sprites["helpwindow"].text = _INTL("Choose {1} cards to use for this duel.", @battle.maxCards)
|
||||
preview = Sprite.new(@viewport)
|
||||
preview.x = Graphics.width / 2 + 20
|
||||
preview.x = (Graphics.width / 2) + 20
|
||||
preview.y = 60
|
||||
preview.z = 4
|
||||
index = -1
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["player#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["player#{i}"].x = Graphics.width - 92
|
||||
@sprites["player#{i}"].y = 44 + 44 * i
|
||||
@sprites["player#{i}"].y = 44 + (44 * i)
|
||||
@sprites["player#{i}"].z = 2
|
||||
end
|
||||
loop do
|
||||
@@ -348,7 +349,7 @@ class TriadScene
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["player#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["player#{i}"].x = Graphics.width - 92
|
||||
@sprites["player#{i}"].y = 44 + 44 * i
|
||||
@sprites["player#{i}"].y = 44 + (44 * i)
|
||||
@sprites["player#{i}"].z = 2
|
||||
@sprites["player#{i}"].bitmap = TriadCard.new(cards[i]).createBitmap(1)
|
||||
@cardBitmaps.push(@sprites["player#{i}"].bitmap)
|
||||
@@ -359,7 +360,7 @@ class TriadScene
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["opponent#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["opponent#{i}"].x = 12
|
||||
@sprites["opponent#{i}"].y = 44 + 44 * i
|
||||
@sprites["opponent#{i}"].y = 44 + (44 * i)
|
||||
@sprites["opponent#{i}"].z = 2
|
||||
@sprites["opponent#{i}"].bitmap = @battle.openHand ? TriadCard.new(cards[i]).createBitmap(2) : TriadCard.createBack
|
||||
@opponentCardBitmaps.push(@sprites["opponent#{i}"].bitmap)
|
||||
@@ -458,8 +459,8 @@ class TriadScene
|
||||
y = 44
|
||||
for i in 0...@cardIndexes.length
|
||||
if i == cardIndex # Card being placed
|
||||
@sprites["player#{@cardIndexes[i]}"].x = Graphics.width / 2 - 118 + boardX * 78
|
||||
@sprites["player#{@cardIndexes[i]}"].y = 36 + boardY * 94
|
||||
@sprites["player#{@cardIndexes[i]}"].x = (Graphics.width / 2) - 118 + (boardX * 78)
|
||||
@sprites["player#{@cardIndexes[i]}"].y = 36 + (boardY * 94)
|
||||
@sprites["player#{@cardIndexes[i]}"].z = 4
|
||||
else # Other cards in hand
|
||||
@sprites["player#{@cardIndexes[i]}"].x = Graphics.width - 92
|
||||
@@ -510,7 +511,7 @@ class TriadScene
|
||||
|
||||
def pbEndPlaceCard(position, cardIndex)
|
||||
spriteIndex = @cardIndexes[cardIndex]
|
||||
boardIndex = position[1] * @battle.width + position[0]
|
||||
boardIndex = (position[1] * @battle.width) + position[0]
|
||||
@boardSprites[boardIndex] = @sprites["player#{spriteIndex}"]
|
||||
@boardCards[boardIndex] = TriadCard.new(@playerCards[spriteIndex])
|
||||
pbRefresh
|
||||
@@ -526,8 +527,8 @@ class TriadScene
|
||||
@opponentCardBitmaps[@opponentCardIndexes[i]] = triadCard.createBitmap(2)
|
||||
sprite.bitmap.dispose if sprite.bitmap
|
||||
sprite.bitmap = @opponentCardBitmaps[@opponentCardIndexes[i]]
|
||||
sprite.x = Graphics.width / 2 - 118 + position[0] * 78
|
||||
sprite.y = 36 + position[1] * 94
|
||||
sprite.x = (Graphics.width / 2) - 118 + (position[0] * 78)
|
||||
sprite.y = 36 + (position[1] * 94)
|
||||
sprite.z = 2
|
||||
else
|
||||
sprite.x = 12
|
||||
@@ -540,7 +541,7 @@ class TriadScene
|
||||
|
||||
def pbEndOpponentPlaceCard(position, cardIndex)
|
||||
spriteIndex = @opponentCardIndexes[cardIndex]
|
||||
boardIndex = position[1] * @battle.width + position[0]
|
||||
boardIndex = (position[1] * @battle.width) + position[0]
|
||||
@boardSprites[boardIndex] = @sprites["opponent#{spriteIndex}"]
|
||||
@boardCards[boardIndex] = TriadCard.new(@opponentCards[spriteIndex])
|
||||
pbRefresh
|
||||
@@ -575,9 +576,10 @@ class TriadScene
|
||||
playerscore += @cardIndexes.length
|
||||
oppscore += @opponentCardIndexes.length
|
||||
end
|
||||
pbDrawTextPositions(bitmap, [
|
||||
[_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]
|
||||
])
|
||||
pbDrawTextPositions(
|
||||
bitmap,
|
||||
[[_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]]
|
||||
)
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
@@ -613,7 +615,7 @@ class TriadScreen
|
||||
def maxCards
|
||||
numcards = @width * @height
|
||||
if numcards.odd?
|
||||
numcards = numcards / 2 + 1
|
||||
numcards = (numcards / 2) + 1
|
||||
else
|
||||
numcards = numcards / 2
|
||||
end
|
||||
@@ -621,15 +623,15 @@ class TriadScreen
|
||||
end
|
||||
|
||||
def isOccupied?(x, y)
|
||||
return @board[y * @width + x].owner != 0
|
||||
return @board[(y * @width) + x].owner != 0
|
||||
end
|
||||
|
||||
def getOwner(x, y)
|
||||
return @board[y * @width + x].owner
|
||||
return @board[(y * @width) + x].owner
|
||||
end
|
||||
|
||||
def getPanel(x, y)
|
||||
return @board[y * @width + x]
|
||||
return @board[(y * @width) + x]
|
||||
end
|
||||
|
||||
def quantity(items, item)
|
||||
@@ -651,14 +653,14 @@ class TriadScreen
|
||||
panels[2] = (@wrapAround ? 0 : @width - 1) if panels[2] > @width - 1 # right
|
||||
panels[5] = (@wrapAround ? @height - 1 : 0) if panels[5] < 0 # top
|
||||
panels[7] = (@wrapAround ? 0 : @height - 1) if panels[7] > @height - 1 # bottom
|
||||
attacker = attackerParam != nil ? attackerParam : @board[y * @width + x]
|
||||
attacker = attackerParam != nil ? attackerParam : @board[(y * @width) + x]
|
||||
flips = []
|
||||
return nil if attackerParam != nil && @board[y * @width + x].owner != 0
|
||||
return nil if attackerParam != nil && @board[(y * @width) + x].owner != 0
|
||||
return nil if !attacker.card || attacker.owner == 0
|
||||
for i in 0...4
|
||||
defenderX = panels[i * 2]
|
||||
defenderY = panels[i * 2 + 1]
|
||||
defender = @board[defenderY * @width + defenderX]
|
||||
defenderY = panels[(i * 2) + 1]
|
||||
defender = @board[(defenderY * @width) + defenderX]
|
||||
next if !defender.card
|
||||
if attacker.owner != defender.owner
|
||||
attack = attacker.attack(i)
|
||||
@@ -847,7 +849,7 @@ class TriadScreen
|
||||
position = [result[1], result[2]]
|
||||
@scene.pbOpponentPlaceCard(triadCard, position, cardIndex)
|
||||
end
|
||||
boardIndex = position[1] * @width + position[0]
|
||||
boardIndex = (position[1] * @width) + position[0]
|
||||
board[boardIndex].card = triadCard
|
||||
board[boardIndex].owner = playerTurn ? 1 : 2
|
||||
flipBoard(position[0], position[1])
|
||||
@@ -1084,8 +1086,8 @@ def pbBuyTriads
|
||||
goldwindow.y = 0
|
||||
goldwindow.z = 99999
|
||||
preview = Sprite.new
|
||||
preview.x = Graphics.width * 3 / 4 - 40
|
||||
preview.y = Graphics.height / 2 - 48
|
||||
preview.x = (Graphics.width * 3 / 4) - 40
|
||||
preview.y = (Graphics.height / 2) - 48
|
||||
preview.z = 4
|
||||
preview.bitmap = TriadCard.new(commands[cmdwindow.index][3]).createBitmap(1)
|
||||
olditem = commands[cmdwindow.index][3]
|
||||
@@ -1172,8 +1174,8 @@ def pbSellTriads
|
||||
goldwindow.y = 0
|
||||
goldwindow.z = 99999
|
||||
preview = Sprite.new
|
||||
preview.x = Graphics.width * 3 / 4 - 40
|
||||
preview.y = Graphics.height / 2 - 48
|
||||
preview.x = (Graphics.width * 3 / 4) - 40
|
||||
preview.y = (Graphics.height / 2) - 48
|
||||
preview.z = 4
|
||||
item = $PokemonGlobal.triads.get_item(cmdwindow.index)
|
||||
preview.bitmap = TriadCard.new(item).createBitmap(1)
|
||||
@@ -1269,7 +1271,7 @@ def pbTriadList
|
||||
cmdwindow = Window_CommandPokemonEx.newWithSize(commands, 0, 0, Graphics.width / 2, Graphics.height)
|
||||
cmdwindow.z = 99999
|
||||
sprite = Sprite.new
|
||||
sprite.x = Graphics.width / 2 + 40
|
||||
sprite.x = (Graphics.width / 2) + 40
|
||||
sprite.y = 48
|
||||
sprite.z = 99999
|
||||
done = false
|
||||
|
||||
@@ -73,7 +73,7 @@ class SlotMachineReel < BitmapSprite
|
||||
for i in 0...4
|
||||
num = @index - i
|
||||
num += @reel.length if num < 0
|
||||
self.bitmap.blt(0, @toppos + i * 48, @images.bitmap, Rect.new(@reel[num] * 64, 0, 64, 48))
|
||||
self.bitmap.blt(0, @toppos + (i * 48), @images.bitmap, Rect.new(@reel[num] * 64, 0, 64, 48))
|
||||
end
|
||||
self.bitmap.blt(0, 0, @shading.bitmap, Rect.new(0, 0, 64, 144))
|
||||
end
|
||||
@@ -246,7 +246,7 @@ class SlotMachineScene
|
||||
@sprites["reel2"] = SlotMachineReel.new(144, 112, difficulty)
|
||||
@sprites["reel3"] = SlotMachineReel.new(224, 112, difficulty)
|
||||
for i in 1..3
|
||||
@sprites["button#{i}"] = IconSprite.new(68 + 80 * (i - 1), 260, @viewport)
|
||||
@sprites["button#{i}"] = IconSprite.new(68 + (80 * (i - 1)), 260, @viewport)
|
||||
@sprites["button#{i}"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/button"))
|
||||
@sprites["button#{i}"].visible = false
|
||||
end
|
||||
@@ -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)
|
||||
|
||||
@@ -75,7 +75,7 @@ class VoltorbFlip
|
||||
for i in 0...25
|
||||
x = i if i % 5 == 0
|
||||
r = rand(squareValues.length)
|
||||
@squares[i] = [(i - x).abs * 64 + 128, (i / 5).abs * 64, squareValues[r], false]
|
||||
@squares[i] = [((i - x).abs * 64) + 128, (i / 5).abs * 64, squareValues[r], false]
|
||||
squareValues.delete_at(r)
|
||||
end
|
||||
pbCreateSprites
|
||||
@@ -258,14 +258,14 @@ class VoltorbFlip
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if @cursor[0][3] == 64 # If in mark mode
|
||||
for i in 0...@squares.length
|
||||
if @index[0] * 64 + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false
|
||||
if (@index[0] * 64) + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false
|
||||
pbSEPlay("Voltorb Flip mark")
|
||||
end
|
||||
end
|
||||
for i in 0...@marks.length + 1
|
||||
if @marks[i] == nil
|
||||
@marks[i] = [@directory + "tiles", @index[0] * 64 + 128, @index[1] * 64, 256, 0, 64, 64]
|
||||
elsif @marks[i][1] == @index[0] * 64 + 128 && @marks[i][2] == @index[1] * 64
|
||||
@marks[i] = [@directory + "tiles", (@index[0] * 64) + 128, @index[1] * 64, 256, 0, 64, 64]
|
||||
elsif @marks[i][1] == (@index[0] * 64) + 128 && @marks[i][2] == @index[1] * 64
|
||||
@marks.delete_at(i)
|
||||
@marks.compact!
|
||||
@sprites["mark"].bitmap.clear
|
||||
@@ -278,8 +278,8 @@ class VoltorbFlip
|
||||
# Display the tile for the selected spot
|
||||
icons = []
|
||||
for i in 0...@squares.length
|
||||
if @index[0] * 64 + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false
|
||||
pbAnimateTile(@index[0] * 64 + 128, @index[1] * 64, @squares[i][2])
|
||||
if (@index[0] * 64) + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false
|
||||
pbAnimateTile((@index[0] * 64) + 128, @index[1] * 64, @squares[i][2])
|
||||
@squares[i][3] = true
|
||||
# If Voltorb (0), display all tiles on the board
|
||||
if @squares[i][2] == 0
|
||||
@@ -288,7 +288,7 @@ class VoltorbFlip
|
||||
# Part1
|
||||
animation = []
|
||||
for j in 0...3
|
||||
animation[0] = icons[0] = [@directory + "tiles", @index[0] * 64 + 128, @index[1] * 64, 704 + (64 * j), 0, 64, 64]
|
||||
animation[0] = icons[0] = [@directory + "tiles", (@index[0] * 64) + 128, @index[1] * 64, 704 + (64 * j), 0, 64, 64]
|
||||
pbDrawImagePositions(@sprites["animation"].bitmap, animation)
|
||||
pbWait(Graphics.frame_rate / 20)
|
||||
@sprites["animation"].bitmap.clear
|
||||
@@ -296,7 +296,7 @@ class VoltorbFlip
|
||||
# Part2
|
||||
animation = []
|
||||
for j in 0...6
|
||||
animation[0] = [@directory + "explosion", @index[0] * 64 - 32 + 128, @index[1] * 64 - 32, j * 128, 0, 128, 128]
|
||||
animation[0] = [@directory + "explosion", (@index[0] * 64) - 32 + 128, (@index[1] * 64) - 32, j * 128, 0, 128, 128]
|
||||
pbDrawImagePositions(@sprites["animation"].bitmap, animation)
|
||||
pbWait(Graphics.frame_rate / 10)
|
||||
@sprites["animation"].bitmap.clear
|
||||
@@ -336,7 +336,7 @@ class VoltorbFlip
|
||||
# Play tile animation
|
||||
animation = []
|
||||
for j in 0...4
|
||||
animation[0] = [@directory + "flipAnimation", @index[0] * 64 - 14 + 128, @index[1] * 64 - 16, j * 92, 0, 92, 96]
|
||||
animation[0] = [@directory + "flipAnimation", (@index[0] * 64) - 14 + 128, (@index[1] * 64) - 16, j * 92, 0, 92, 96]
|
||||
pbDrawImagePositions(@sprites["animation"].bitmap, animation)
|
||||
pbWait(Graphics.frame_rate / 20)
|
||||
@sprites["animation"].bitmap.clear
|
||||
@@ -441,9 +441,9 @@ class VoltorbFlip
|
||||
numText += num.to_s
|
||||
numImages = numText.split(//)[0...2]
|
||||
for j in 0...2
|
||||
@numbers[j] = [@directory + "numbersSmall", 472 + j * 16, i * 64 + 8, numImages[j].to_i * 16, 0, 16, 16]
|
||||
@numbers[j] = [@directory + "numbersSmall", 472 + (j * 16), (i * 64) + 8, numImages[j].to_i * 16, 0, 16, 16]
|
||||
end
|
||||
@voltorbNumbers[i] = [@directory + "numbersSmall", 488, i * 64 + 34, voltorbs * 16, 0, 16, 16]
|
||||
@voltorbNumbers[i] = [@directory + "numbersSmall", 488, (i * 64) + 34, voltorbs * 16, 0, 16, 16]
|
||||
# Display the numbers
|
||||
pbDrawImagePositions(@sprites["numbers"].bitmap, @numbers)
|
||||
pbDrawImagePositions(@sprites["numbers"].bitmap, @voltorbNumbers)
|
||||
@@ -459,7 +459,7 @@ class VoltorbFlip
|
||||
numText += num.to_s
|
||||
numImages = numText.split(//)[0...2]
|
||||
for j in 0...2
|
||||
@numbers[j] = [@directory + "numbersSmall", (i * 64) + 152 + j * 16, 328, numImages[j].to_i * 16, 0, 16, 16]
|
||||
@numbers[j] = [@directory + "numbersSmall", (i * 64) + 152 + (j * 16), 328, numImages[j].to_i * 16, 0, 16, 16]
|
||||
end
|
||||
@voltorbNumbers[i] = [@directory + "numbersSmall", (i * 64) + 168, 354, voltorbs * 16, 0, 16, 16]
|
||||
# Display the numbers
|
||||
@@ -476,7 +476,7 @@ class VoltorbFlip
|
||||
coinText += source.to_s
|
||||
coinImages = coinText.split(//)[0...5]
|
||||
for i in 0...5
|
||||
@coins[i] = [@directory + "numbersScore", 6 + i * 24, y, coinImages[i].to_i * 24, 0, 24, 38]
|
||||
@coins[i] = [@directory + "numbersScore", 6 + (i * 24), y, coinImages[i].to_i * 24, 0, 24, 38]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -144,82 +144,82 @@ class MiningGameScene
|
||||
BOARD_WIDTH = 13
|
||||
BOARD_HEIGHT = 10
|
||||
ITEMS = [ # Item, probability, graphic x, graphic y, width, height, pattern
|
||||
[:DOMEFOSSIL, 20, 0, 3, 5, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 5, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 9, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:HELIXFOSSIL, 5, 13, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 17, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:OLDAMBER, 10, 21, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:OLDAMBER, 10, 25, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:ROOTFOSSIL, 5, 0, 7, 5, 5, [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0]],
|
||||
[:ROOTFOSSIL, 5, 5, 7, 5, 5, [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:ROOTFOSSIL, 5, 10, 7, 5, 5, [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]],
|
||||
[:ROOTFOSSIL, 5, 15, 7, 5, 5, [0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]],
|
||||
[:SKULLFOSSIL, 20, 20, 7, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0]],
|
||||
[:ARMORFOSSIL, 20, 24, 7, 5, 4, [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:CLAWFOSSIL, 5, 0, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0]],
|
||||
[:CLAWFOSSIL, 5, 4, 12, 5, 4, [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1]],
|
||||
[:CLAWFOSSIL, 5, 9, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0]],
|
||||
[:CLAWFOSSIL, 5, 13, 12, 5, 4, [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1]],
|
||||
[:FIRESTONE, 20, 20, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:WATERSTONE, 20, 23, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:THUNDERSTONE, 20, 26, 11, 3, 3, [0, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:LEAFSTONE, 10, 18, 14, 3, 4, [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0]],
|
||||
[:LEAFSTONE, 10, 21, 14, 4, 3, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]],
|
||||
[:MOONSTONE, 10, 25, 14, 4, 2, [0, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:MOONSTONE, 10, 27, 16, 2, 4, [1, 0, 1, 1, 1, 1, 0, 1]],
|
||||
[:SUNSTONE, 20, 21, 17, 3, 3, [0, 1, 0, 1, 1, 1, 1, 1, 1]],
|
||||
[:OVALSTONE, 150, 24, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:EVERSTONE, 150, 21, 20, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:STARPIECE, 100, 0, 17, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]],
|
||||
[:REVIVE, 100, 0, 20, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]],
|
||||
[:MAXREVIVE, 50, 0, 23, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:RAREBONE, 50, 3, 17, 6, 3, [1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1]],
|
||||
[:RAREBONE, 50, 3, 20, 3, 6, [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1]],
|
||||
[:LIGHTCLAY, 100, 6, 20, 4, 4, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1]],
|
||||
[:HARDSTONE, 200, 6, 24, 2, 2, [1, 1, 1, 1]],
|
||||
[:HEARTSCALE, 200, 8, 24, 2, 2, [1, 0, 1, 1]],
|
||||
[:IRONBALL, 100, 9, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ODDKEYSTONE, 100, 10, 20, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:HEATROCK, 50, 12, 17, 4, 3, [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DAMPROCK, 50, 14, 20, 3, 3, [1, 1, 1, 1, 1, 1, 1, 0, 1]],
|
||||
[:SMOOTHROCK, 50, 17, 18, 4, 4, [0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0]],
|
||||
[:ICYROCK, 50, 17, 22, 4, 4, [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1]],
|
||||
[:REDSHARD, 100, 21, 22, 3, 3, [1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:GREENSHARD, 100, 25, 20, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]],
|
||||
[:YELLOWSHARD, 100, 25, 23, 4, 3, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1]],
|
||||
[:BLUESHARD, 100, 26, 26, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:INSECTPLATE, 10, 0, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DREADPLATE, 10, 4, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DRACOPLATE, 10, 8, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ZAPPLATE, 10, 12, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:FISTPLATE, 10, 16, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:FLAMEPLATE, 10, 20, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:MEADOWPLATE, 10, 0, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:EARTHPLATE, 10, 4, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ICICLEPLATE, 10, 8, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:TOXICPLATE, 10, 12, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:MINDPLATE, 10, 16, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:STONEPLATE, 10, 20, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SKYPLATE, 10, 0, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SPOOKYPLATE, 10, 4, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:IRONPLATE, 10, 8, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SPLASHPLATE, 10, 12, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
|
||||
[:DOMEFOSSIL, 20, 0, 3, 5, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 5, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 9, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:HELIXFOSSIL, 5, 13, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:HELIXFOSSIL, 5, 17, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:OLDAMBER, 10, 21, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:OLDAMBER, 10, 25, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:ROOTFOSSIL, 5, 0, 7, 5, 5, [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0]],
|
||||
[:ROOTFOSSIL, 5, 5, 7, 5, 5, [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:ROOTFOSSIL, 5, 10, 7, 5, 5, [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]],
|
||||
[:ROOTFOSSIL, 5, 15, 7, 5, 5, [0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]],
|
||||
[:SKULLFOSSIL, 20, 20, 7, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0]],
|
||||
[:ARMORFOSSIL, 20, 24, 7, 5, 4, [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
|
||||
[:CLAWFOSSIL, 5, 0, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0]],
|
||||
[:CLAWFOSSIL, 5, 4, 12, 5, 4, [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1]],
|
||||
[:CLAWFOSSIL, 5, 9, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0]],
|
||||
[:CLAWFOSSIL, 5, 13, 12, 5, 4, [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1]],
|
||||
[:FIRESTONE, 20, 20, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:WATERSTONE, 20, 23, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:THUNDERSTONE, 20, 26, 11, 3, 3, [0, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:LEAFSTONE, 10, 18, 14, 3, 4, [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0]],
|
||||
[:LEAFSTONE, 10, 21, 14, 4, 3, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]],
|
||||
[:MOONSTONE, 10, 25, 14, 4, 2, [0, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:MOONSTONE, 10, 27, 16, 2, 4, [1, 0, 1, 1, 1, 1, 0, 1]],
|
||||
[:SUNSTONE, 20, 21, 17, 3, 3, [0, 1, 0, 1, 1, 1, 1, 1, 1]],
|
||||
[:OVALSTONE, 150, 24, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:EVERSTONE, 150, 21, 20, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:STARPIECE, 100, 0, 17, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]],
|
||||
[:REVIVE, 100, 0, 20, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]],
|
||||
[:MAXREVIVE, 50, 0, 23, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:RAREBONE, 50, 3, 17, 6, 3, [1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1]],
|
||||
[:RAREBONE, 50, 3, 20, 3, 6, [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1]],
|
||||
[:LIGHTCLAY, 100, 6, 20, 4, 4, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1]],
|
||||
[:HARDSTONE, 200, 6, 24, 2, 2, [1, 1, 1, 1]],
|
||||
[:HEARTSCALE, 200, 8, 24, 2, 2, [1, 0, 1, 1]],
|
||||
[:IRONBALL, 100, 9, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ODDKEYSTONE, 100, 10, 20, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:HEATROCK, 50, 12, 17, 4, 3, [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DAMPROCK, 50, 14, 20, 3, 3, [1, 1, 1, 1, 1, 1, 1, 0, 1]],
|
||||
[:SMOOTHROCK, 50, 17, 18, 4, 4, [0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0]],
|
||||
[:ICYROCK, 50, 17, 22, 4, 4, [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1]],
|
||||
[:REDSHARD, 100, 21, 22, 3, 3, [1, 1, 1, 1, 1, 0, 1, 1, 1]],
|
||||
[:GREENSHARD, 100, 25, 20, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]],
|
||||
[:YELLOWSHARD, 100, 25, 23, 4, 3, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1]],
|
||||
[:BLUESHARD, 100, 26, 26, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]],
|
||||
[:INSECTPLATE, 10, 0, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DREADPLATE, 10, 4, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:DRACOPLATE, 10, 8, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ZAPPLATE, 10, 12, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:FISTPLATE, 10, 16, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:FLAMEPLATE, 10, 20, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:MEADOWPLATE, 10, 0, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:EARTHPLATE, 10, 4, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:ICICLEPLATE, 10, 8, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:TOXICPLATE, 10, 12, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:MINDPLATE, 10, 16, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:STONEPLATE, 10, 20, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SKYPLATE, 10, 0, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SPOOKYPLATE, 10, 4, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:IRONPLATE, 10, 8, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[:SPLASHPLATE, 10, 12, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
|
||||
]
|
||||
IRON = [ # Graphic x, graphic y, width, height, pattern
|
||||
[0, 0, 1, 4, [1, 1, 1, 1]],
|
||||
[1, 0, 2, 4, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[3, 0, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[3, 2, 4, 1, [1, 1, 1, 1]],
|
||||
[7, 0, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[0, 5, 3, 2, [1, 1, 0, 0, 1, 1]],
|
||||
[0, 7, 3, 2, [0, 1, 0, 1, 1, 1]],
|
||||
[3, 5, 3, 2, [0, 1, 1, 1, 1, 0]],
|
||||
[3, 7, 3, 2, [1, 1, 1, 0, 1, 0]],
|
||||
[6, 3, 2, 3, [1, 0, 1, 1, 0, 1]],
|
||||
[8, 3, 2, 3, [0, 1, 1, 1, 1, 0]],
|
||||
[6, 6, 2, 3, [1, 0, 1, 1, 1, 0]],
|
||||
[8, 6, 2, 3, [0, 1, 1, 1, 0, 1]]
|
||||
[0, 0, 1, 4, [1, 1, 1, 1]],
|
||||
[1, 0, 2, 4, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[3, 0, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[3, 2, 4, 1, [1, 1, 1, 1]],
|
||||
[7, 0, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
[0, 5, 3, 2, [1, 1, 0, 0, 1, 1]],
|
||||
[0, 7, 3, 2, [0, 1, 0, 1, 1, 1]],
|
||||
[3, 5, 3, 2, [0, 1, 1, 1, 1, 0]],
|
||||
[3, 7, 3, 2, [1, 1, 1, 0, 1, 0]],
|
||||
[6, 3, 2, 3, [1, 0, 1, 1, 0, 1]],
|
||||
[8, 3, 2, 3, [0, 1, 1, 1, 1, 0]],
|
||||
[6, 6, 2, 3, [1, 0, 1, 1, 1, 0]],
|
||||
[8, 6, 2, 3, [0, 1, 1, 1, 0, 1]]
|
||||
]
|
||||
|
||||
def update
|
||||
@@ -241,7 +241,7 @@ class MiningGameScene
|
||||
pbDistributeIron
|
||||
for i in 0...BOARD_HEIGHT
|
||||
for j in 0...BOARD_WIDTH
|
||||
@sprites["tile#{j + i * BOARD_WIDTH}"] = MiningGameTile.new(32 * j, 64 + 32 * i)
|
||||
@sprites["tile#{j + (i * BOARD_WIDTH)}"] = MiningGameTile.new(32 * j, 64 + (32 * i))
|
||||
end
|
||||
end
|
||||
@sprites["crack"] = MiningGameCounter.new(0, 4)
|
||||
@@ -293,7 +293,7 @@ class MiningGameScene
|
||||
oy = ITEMS[i[0]][3]
|
||||
rectx = ITEMS[i[0]][4]
|
||||
recty = ITEMS[i[0]][5]
|
||||
layer.blt(32 * i[1], 64 + 32 * i[2], @itembitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty))
|
||||
layer.blt(32 * i[1], 64 + (32 * i[2]), @itembitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -319,7 +319,7 @@ class MiningGameScene
|
||||
oy = IRON[i[0]][1]
|
||||
rectx = IRON[i[0]][2]
|
||||
recty = IRON[i[0]][3]
|
||||
layer.blt(32 * i[1], 64 + 32 * i[2], @ironbitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty))
|
||||
layer.blt(32 * i[1], 64 + (32 * i[2]), @ironbitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -354,7 +354,7 @@ class MiningGameScene
|
||||
yco = prey + (j / prewidth).floor
|
||||
next if provx + provwidth <= xco || provx > xco ||
|
||||
provy + provheight <= yco || provy > yco
|
||||
return false if provpattern[xco - provx + (yco - provy) * provwidth] == 1
|
||||
return false if provpattern[xco - provx + ((yco - provy) * provwidth)] == 1
|
||||
end
|
||||
end
|
||||
if checkiron # Check other irons as well
|
||||
@@ -372,7 +372,7 @@ class MiningGameScene
|
||||
yco = prey + (j / prewidth).floor
|
||||
next if provx + provwidth <= xco || provx > xco ||
|
||||
provy + provheight <= yco || provy > yco
|
||||
return false if provpattern[xco - provx + (yco - provy) * provwidth] == 1
|
||||
return false if provpattern[xco - provx + ((yco - provy) * provwidth)] == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -399,12 +399,12 @@ class MiningGameScene
|
||||
hittype = 2
|
||||
else
|
||||
for i in 0..2
|
||||
ytile = i - 1 + position / BOARD_WIDTH
|
||||
ytile = i - 1 + (position / BOARD_WIDTH)
|
||||
next if ytile < 0 || ytile >= BOARD_HEIGHT
|
||||
for j in 0..2
|
||||
xtile = j - 1 + position % BOARD_WIDTH
|
||||
xtile = j - 1 + (position % BOARD_WIDTH)
|
||||
next if xtile < 0 || xtile >= BOARD_WIDTH
|
||||
@sprites["tile#{xtile + ytile * BOARD_WIDTH}"].layer -= pattern[j + i * 3]
|
||||
@sprites["tile#{xtile + (ytile * BOARD_WIDTH)}"].layer -= pattern[j + (i * 3)]
|
||||
end
|
||||
end
|
||||
if @sprites["cursor"].mode == 1 # Hammer
|
||||
@@ -439,7 +439,7 @@ class MiningGameScene
|
||||
next if posy < i[2] || posy >= (i[2] + height)
|
||||
dx = posx - i[1]
|
||||
dy = posy - i[2]
|
||||
return true if pattern[dx + dy * width] > 0
|
||||
return true if pattern[dx + (dy * width)] > 0
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -456,7 +456,7 @@ class MiningGameScene
|
||||
next if posy < i[2] || posy >= (i[2] + height)
|
||||
dx = posx - i[1]
|
||||
dy = posy - i[2]
|
||||
return true if pattern[dx + dy * width] > 0
|
||||
return true if pattern[dx + (dy * width)] > 0
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -472,8 +472,8 @@ class MiningGameScene
|
||||
pattern = ITEMS[index][6]
|
||||
for j in 0...height
|
||||
for k in 0...width
|
||||
layer = @sprites["tile#{@items[i][1] + k + (@items[i][2] + j) * BOARD_WIDTH}"].layer
|
||||
revealed = false if layer > 0 && pattern[k + j * width] > 0
|
||||
layer = @sprites["tile#{@items[i][1] + k + ((@items[i][2] + j) * BOARD_WIDTH)}"].layer
|
||||
revealed = false if layer > 0 && pattern[k + (j * width)] > 0
|
||||
break if !revealed
|
||||
end
|
||||
break if !revealed
|
||||
@@ -491,12 +491,12 @@ class MiningGameScene
|
||||
for i in 1..halfFlashTime * 2
|
||||
for index in revealed
|
||||
burieditem = @items[index]
|
||||
revealeditems.bitmap.blt(32 * burieditem[1], 64 + 32 * burieditem[2],
|
||||
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]))
|
||||
if i > halfFlashTime
|
||||
revealeditems.color = Color.new(255, 255, 255, (halfFlashTime * 2 - i) * alphaDiff)
|
||||
revealeditems.color = Color.new(255, 255, 255, ((halfFlashTime * 2) - i) * alphaDiff)
|
||||
else
|
||||
revealeditems.color = Color.new(255, 255, 255, i * alphaDiff)
|
||||
end
|
||||
@@ -575,7 +575,7 @@ class MiningGameScene
|
||||
newmode = (@sprites["cursor"].mode + 1) % 2
|
||||
@sprites["cursor"].mode = newmode
|
||||
@sprites["tool"].src_rect.set(newmode * 68, 0, 68, 100)
|
||||
@sprites["tool"].y = 254 - 144 * newmode
|
||||
@sprites["tool"].y = 254 - (144 * newmode)
|
||||
elsif Input.trigger?(Input::USE) # Hit
|
||||
pbHit
|
||||
elsif Input.trigger?(Input::BACK) # Quit
|
||||
|
||||
@@ -43,13 +43,13 @@ class TilePuzzleCursor < BitmapSprite
|
||||
self.bitmap.clear
|
||||
x = (Graphics.width - (@tilewidth * @boardwidth)) / 2
|
||||
if @position >= @boardwidth * @boardheight
|
||||
x = (x - (@tilewidth * (@boardwidth / 2).ceil)) / 2 - 10
|
||||
x = ((x - (@tilewidth * (@boardwidth / 2).ceil)) / 2) - 10
|
||||
if (@position % @boardwidth) >= (@boardwidth / 2).ceil
|
||||
x = Graphics.width - x - @tilewidth * @boardwidth
|
||||
x = Graphics.width - x - (@tilewidth * @boardwidth)
|
||||
end
|
||||
end
|
||||
x += @tilewidth * (@position % @boardwidth)
|
||||
y = (Graphics.height - (@tileheight * @boardheight)) / 2 - 32
|
||||
y = ((Graphics.height - (@tileheight * @boardheight)) / 2) - 32
|
||||
y += @tileheight * ((@position % (@boardwidth * @boardheight)) / @boardwidth)
|
||||
self.tone = Tone.new(0, (@holding ? 64 : 0), (@holding ? 64 : 0), 0)
|
||||
# Cursor
|
||||
@@ -57,8 +57,8 @@ class TilePuzzleCursor < BitmapSprite
|
||||
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),
|
||||
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)
|
||||
@@ -68,14 +68,14 @@ class TilePuzzleCursor < BitmapSprite
|
||||
# Arrows
|
||||
if @selected || @game == 3
|
||||
expand = (@game == 3) ? 0 : 4
|
||||
xin = [(@tilewidth - @cursorbitmap.width / 4) / 2, -expand,
|
||||
@tilewidth - @cursorbitmap.width / 4 + expand, (@tilewidth - @cursorbitmap.width / 4) / 2]
|
||||
yin = [@tileheight - @cursorbitmap.height / 2 + expand, (@tileheight - @cursorbitmap.height / 2) / 2,
|
||||
(@tileheight - @cursorbitmap.height / 2) / 2, -expand]
|
||||
xin = [(@tilewidth - (@cursorbitmap.width / 4)) / 2, -expand,
|
||||
@tilewidth - (@cursorbitmap.width / 4) + expand, (@tilewidth - (@cursorbitmap.width / 4)) / 2]
|
||||
yin = [@tileheight - (@cursorbitmap.height / 2) + expand, (@tileheight - (@cursorbitmap.height / 2)) / 2,
|
||||
(@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),
|
||||
Rect.new((@cursorbitmap.width / 2) + ((i % 2) * (@cursorbitmap.width / 4)),
|
||||
(i / 2) * (@cursorbitmap.height / 2),
|
||||
@cursorbitmap.width / 4, @cursorbitmap.height / 2))
|
||||
end
|
||||
@@ -96,7 +96,7 @@ class TilePuzzleScene
|
||||
|
||||
def update
|
||||
xtop = (Graphics.width - (@tilewidth * @boardwidth)) / 2
|
||||
ytop = (Graphics.height - (@tileheight * @boardheight)) / 2 + @tileheight / 2 - 32
|
||||
ytop = ((Graphics.height - (@tileheight * @boardheight)) / 2) + (@tileheight / 2) - 32
|
||||
for i in 0...@boardwidth * @boardheight
|
||||
pos = -1
|
||||
for j in 0...@tiles.length
|
||||
@@ -112,13 +112,13 @@ class TilePuzzleScene
|
||||
thisx = xtop
|
||||
if pos >= 0
|
||||
if pos >= @boardwidth * @boardheight
|
||||
thisx = (xtop - (@tilewidth * (@boardwidth / 2).ceil)) / 2 - 10
|
||||
thisx = ((xtop - (@tilewidth * (@boardwidth / 2).ceil)) / 2) - 10
|
||||
if (pos % @boardwidth) >= (@boardwidth / 2).ceil
|
||||
thisx = Graphics.width - thisx - @tilewidth * @boardwidth
|
||||
thisx = Graphics.width - thisx - (@tilewidth * @boardwidth)
|
||||
end
|
||||
end
|
||||
@sprites["tile#{i}"].x = thisx + @tilewidth * (pos % @boardwidth) + @tilewidth / 2
|
||||
@sprites["tile#{i}"].y = ytop + @tileheight * ((pos % (@boardwidth * @boardheight)) / @boardwidth)
|
||||
@sprites["tile#{i}"].x = thisx + (@tilewidth * (pos % @boardwidth)) + (@tilewidth / 2)
|
||||
@sprites["tile#{i}"].y = ytop + (@tileheight * ((pos % (@boardwidth * @boardheight)) / @boardwidth))
|
||||
next if @game == 3
|
||||
rotatebitmaps = [@tilebitmap, @tilebitmap1, @tilebitmap2, @tilebitmap3]
|
||||
@sprites["tile#{i}"].bitmap.clear
|
||||
@@ -173,7 +173,7 @@ class TilePuzzleScene
|
||||
@sprites["tile#{i}"] = BitmapSprite.new(@tilewidth, @tileheight, @viewport)
|
||||
@sprites["tile#{i}"].ox = @tilewidth / 2
|
||||
@sprites["tile#{i}"].oy = @tileheight / 2
|
||||
break if @game == 3 && i >= @boardwidth * @boardheight - 1
|
||||
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))
|
||||
end
|
||||
@@ -210,17 +210,16 @@ class TilePuzzleScene
|
||||
num = 0
|
||||
blank = -1
|
||||
for i in 0...ret.length - 1
|
||||
blank = i if ret[i] == @boardwidth * @boardheight - 1
|
||||
blank = i if ret[i] == (@boardwidth * @boardheight) - 1
|
||||
for j in i...ret.length
|
||||
num += 1 if ret[j] < ret[i] && ret[i] != @boardwidth * @boardheight - 1 &&
|
||||
ret[j] != @boardwidth * @boardheight - 1
|
||||
num += 1 if ret[j] < ret[i] && ret[i] != (@boardwidth * @boardheight) - 1 &&
|
||||
ret[j] != (@boardwidth * @boardheight) - 1
|
||||
end
|
||||
end
|
||||
if @boardwidth.odd?
|
||||
ret = pbShuffleTiles if num.odd?
|
||||
else
|
||||
ret = pbShuffleTiles if !((num.even? && (@boardheight - (blank / @boardwidth)).odd?) ||
|
||||
(num.odd? && (@boardheight - (blank / @boardwidth)).even?))
|
||||
elsif num.even? == (@boardheight - (blank / @boardwidth)).even?
|
||||
ret = pbShuffleTiles
|
||||
end
|
||||
end
|
||||
if @game == 1 || @game == 2
|
||||
@@ -242,7 +241,7 @@ class TilePuzzleScene
|
||||
def pbDefaultCursorPosition
|
||||
if @game == 3
|
||||
for i in 0...@boardwidth * @boardheight
|
||||
return i if @tiles[i] == @boardwidth * @boardheight - 1
|
||||
return i if @tiles[i] == (@boardwidth * @boardheight) - 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
@@ -255,16 +254,14 @@ class TilePuzzleScene
|
||||
when 4
|
||||
if pos >= @boardwidth * @boardheight
|
||||
if pos % @boardwidth == (@boardwidth / 2).ceil
|
||||
pos = ((pos % (@boardwidth * @boardheight)) / @boardwidth) * @boardwidth + @boardwidth - 1
|
||||
pos = (((pos % (@boardwidth * @boardheight)) / @boardwidth) * @boardwidth) + @boardwidth - 1
|
||||
else
|
||||
pos -= 1
|
||||
end
|
||||
elsif (pos % @boardwidth) == 0
|
||||
pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil - 1
|
||||
else
|
||||
if (pos % @boardwidth) == 0
|
||||
pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil - 1
|
||||
else
|
||||
pos -= 1
|
||||
end
|
||||
pos -= 1
|
||||
end
|
||||
when 6
|
||||
if pos >= @boardwidth * @boardheight
|
||||
@@ -273,12 +270,10 @@ class TilePuzzleScene
|
||||
else
|
||||
pos += 1
|
||||
end
|
||||
elsif pos % @boardwidth >= @boardwidth - 1
|
||||
pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil
|
||||
else
|
||||
if pos % @boardwidth >= @boardwidth - 1
|
||||
pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil
|
||||
else
|
||||
pos += 1
|
||||
end
|
||||
pos += 1
|
||||
end
|
||||
when 8
|
||||
pos -= @boardwidth
|
||||
@@ -420,7 +415,7 @@ class TilePuzzleScene
|
||||
cursor += (@boardwidth * dist)
|
||||
end
|
||||
for i in 0...@boardheight
|
||||
tiles.push(cursor - i * dist * @boardwidth)
|
||||
tiles.push(cursor - (i * dist * @boardwidth))
|
||||
end
|
||||
else
|
||||
dist = dir - 5
|
||||
@@ -429,7 +424,7 @@ class TilePuzzleScene
|
||||
cursor -= dist
|
||||
end
|
||||
for i in 0...@boardwidth
|
||||
tiles.push(cursor + i * dist)
|
||||
tiles.push(cursor + (i * dist))
|
||||
end
|
||||
end
|
||||
# Shift tiles
|
||||
@@ -508,7 +503,7 @@ class TilePuzzleScene
|
||||
if pbCheckWin
|
||||
@sprites["cursor"].visible = false
|
||||
if @game == 3
|
||||
extratile = @sprites["tile#{@boardwidth * @boardheight - 1}"]
|
||||
extratile = @sprites["tile#{(@boardwidth * @boardheight) - 1}"]
|
||||
extratile.bitmap.clear
|
||||
extratile.bitmap.blt(0, 0, @tilebitmap.bitmap,
|
||||
Rect.new(@tilewidth * (@boardwidth - 1), @tileheight * (@boardheight - 1),
|
||||
|
||||
Reference in New Issue
Block a user