mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -166,17 +166,17 @@ class TriadScene
|
||||
@bitmaps = []
|
||||
@battle = battle
|
||||
# Allocate viewport
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
addBackgroundPlane(@sprites,"background","triad_bg",@viewport)
|
||||
addBackgroundPlane(@sprites, "background", "triad_bg", @viewport)
|
||||
@sprites["helpwindow"] = Window_AdvancedTextPokemon.newWithSize("",
|
||||
0,Graphics.height-64,Graphics.width,64,@viewport)
|
||||
for i in 0...@battle.width*@battle.height
|
||||
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
|
||||
@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)
|
||||
bm = TriadCard.createBack(@battle.board[i].type, true)
|
||||
@bitmaps.push(bm)
|
||||
@sprites["sprite#{i}"].bitmap = bm
|
||||
end
|
||||
@@ -188,20 +188,20 @@ class TriadScene
|
||||
@boardCards = []
|
||||
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}"].x = Graphics.width - 92
|
||||
@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)
|
||||
@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)
|
||||
@sprites["score"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height)
|
||||
pbSetSystemFont(@sprites["score"].bitmap)
|
||||
pbBGMPlay("Triple Triad")
|
||||
# Fade in all sprites
|
||||
@@ -230,7 +230,7 @@ class TriadScene
|
||||
|
||||
def pbDisplayPaused(text)
|
||||
@sprites["helpwindow"].letterbyletter = true
|
||||
@sprites["helpwindow"].text = text+"\1"
|
||||
@sprites["helpwindow"].text = text + "\1"
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -248,7 +248,7 @@ class TriadScene
|
||||
@sprites["helpwindow"].text = ""
|
||||
end
|
||||
|
||||
def pbNotifyCards(playerCards,opponentCards)
|
||||
def pbNotifyCards(playerCards, opponentCards)
|
||||
@playerCards = playerCards
|
||||
@opponentCards = opponentCards
|
||||
end
|
||||
@@ -259,17 +259,17 @@ class TriadScene
|
||||
for item in cardStorage
|
||||
commands.push(_INTL("{1} x{2}", GameData::Species.get(item[0]).name, item[1]))
|
||||
end
|
||||
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)
|
||||
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}"].x = Graphics.width - 92
|
||||
@sprites["player#{i}"].y = 44 + 44 * i
|
||||
@sprites["player#{i}"].z = 2
|
||||
end
|
||||
loop do
|
||||
@@ -277,18 +277,18 @@ class TriadScene
|
||||
Input.update
|
||||
pbUpdate
|
||||
command.update
|
||||
if command.index!=index
|
||||
if command.index != index
|
||||
preview.bitmap.dispose if preview.bitmap
|
||||
if command.index<cardStorage.length
|
||||
if command.index < cardStorage.length
|
||||
item = cardStorage[command.index]
|
||||
preview.bitmap = TriadCard.new(item[0]).createBitmap(1)
|
||||
end
|
||||
index = command.index
|
||||
end
|
||||
if Input.trigger?(Input::BACK)
|
||||
if chosenCards.length>0
|
||||
if chosenCards.length > 0
|
||||
item = chosenCards.pop
|
||||
@battle.pbAdd(cardStorage,item)
|
||||
@battle.pbAdd(cardStorage, item)
|
||||
commands = []
|
||||
for item in cardStorage
|
||||
commands.push(_INTL("{1} x{2}", GameData::Species.get(item[0]).name, item[1]))
|
||||
@@ -299,9 +299,9 @@ class TriadScene
|
||||
pbPlayBuzzerSE
|
||||
end
|
||||
elsif Input.trigger?(Input::USE)
|
||||
break if chosenCards.length==@battle.maxCards
|
||||
break if chosenCards.length == @battle.maxCards
|
||||
item = cardStorage[command.index]
|
||||
if !item || @battle.quantity(cardStorage,item[0])==0
|
||||
if !item || @battle.quantity(cardStorage, item[0]) == 0
|
||||
pbPlayBuzzerSE
|
||||
else
|
||||
pbPlayDecisionSE
|
||||
@@ -310,27 +310,27 @@ class TriadScene
|
||||
@cardBitmaps[chosenCards.length] = TriadCard.new(item[0]).createBitmap(1)
|
||||
sprite.bitmap = @cardBitmaps[chosenCards.length]
|
||||
chosenCards.push(item[0])
|
||||
@battle.pbSubtract(cardStorage,item[0])
|
||||
@battle.pbSubtract(cardStorage, item[0])
|
||||
commands = []
|
||||
for item in cardStorage
|
||||
commands.push(_INTL("{1} x{2}", GameData::Species.get(item[0]).name, item[1]))
|
||||
end
|
||||
command.commands = commands
|
||||
command.index = commands.length-1 if command.index>=commands.length
|
||||
command.index = commands.length - 1 if command.index >= commands.length
|
||||
index = -1
|
||||
end
|
||||
end
|
||||
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["player#{i}"].visible = (i<chosenCards.length)
|
||||
@sprites["player#{i}"].visible = (i < chosenCards.length)
|
||||
end
|
||||
if chosenCards.length==@battle.maxCards
|
||||
@sprites["helpwindow"].text = _INTL("{1} cards have been chosen.",@battle.maxCards)
|
||||
if chosenCards.length == @battle.maxCards
|
||||
@sprites["helpwindow"].text = _INTL("{1} cards have been chosen.", @battle.maxCards)
|
||||
command.visible = false
|
||||
command.active = false
|
||||
preview.visible = false
|
||||
else
|
||||
@sprites["helpwindow"].text = _INTL("Choose {1} cards to use for this duel.",@battle.maxCards)
|
||||
@sprites["helpwindow"].text = _INTL("Choose {1} cards to use for this duel.", @battle.maxCards)
|
||||
command.visible = true
|
||||
command.active = true
|
||||
preview.visible = true
|
||||
@@ -346,8 +346,8 @@ class TriadScene
|
||||
def pbShowPlayerCards(cards)
|
||||
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}"].x = Graphics.width - 92
|
||||
@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)
|
||||
@@ -358,7 +358,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)
|
||||
@@ -371,29 +371,29 @@ class TriadScene
|
||||
choice = 0
|
||||
lastChoice = -1
|
||||
loop do
|
||||
if lastChoice!=choice
|
||||
if lastChoice != choice
|
||||
y = 44
|
||||
for i in 0...@opponentCardIndexes.length
|
||||
@sprites["opponent#{@opponentCardIndexes[i]}"].bitmap = @opponentCardBitmaps[@opponentCardIndexes[i]]
|
||||
@sprites["opponent#{@opponentCardIndexes[i]}"].x = (i==choice) ? 28 : 12
|
||||
@sprites["opponent#{@opponentCardIndexes[i]}"].x = (i == choice) ? 28 : 12
|
||||
@sprites["opponent#{@opponentCardIndexes[i]}"].y = y
|
||||
@sprites["opponent#{@opponentCardIndexes[i]}"].z = 2
|
||||
y += 44
|
||||
end
|
||||
lastChoice = choice
|
||||
end
|
||||
break if choice==-1
|
||||
break if choice == -1
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.repeat?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
choice += 1
|
||||
choice = 0 if choice>=numCards
|
||||
choice = 0 if choice >= numCards
|
||||
elsif Input.repeat?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
choice -= 1
|
||||
choice = numCards-1 if choice<0
|
||||
choice = numCards - 1 if choice < 0
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
choice = -1
|
||||
@@ -411,11 +411,11 @@ class TriadScene
|
||||
choice = 0
|
||||
lastChoice = -1
|
||||
loop do
|
||||
if lastChoice!=choice
|
||||
if lastChoice != choice
|
||||
y = 44
|
||||
for i in 0...@cardIndexes.length
|
||||
@sprites["player#{@cardIndexes[i]}"].bitmap = @cardBitmaps[@cardIndexes[i]]
|
||||
@sprites["player#{@cardIndexes[i]}"].x = (i==choice) ? Graphics.width-108 : Graphics.width-92
|
||||
@sprites["player#{@cardIndexes[i]}"].x = (i == choice) ? Graphics.width - 108 : Graphics.width - 92
|
||||
@sprites["player#{@cardIndexes[i]}"].y = y
|
||||
@sprites["player#{@cardIndexes[i]}"].z = 2
|
||||
y += 44
|
||||
@@ -428,11 +428,11 @@ class TriadScene
|
||||
if Input.repeat?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
choice += 1
|
||||
choice = 0 if choice>=numCards
|
||||
choice = 0 if choice >= numCards
|
||||
elsif Input.repeat?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
choice -= 1
|
||||
choice = numCards-1 if choice<0
|
||||
choice = numCards - 1 if choice < 0
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
break
|
||||
@@ -456,12 +456,12 @@ class TriadScene
|
||||
if doRefresh
|
||||
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
|
||||
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]}"].z = 4
|
||||
else # Other cards in hand
|
||||
@sprites["player#{@cardIndexes[i]}"].x = Graphics.width-92
|
||||
@sprites["player#{@cardIndexes[i]}"].x = Graphics.width - 92
|
||||
@sprites["player#{@cardIndexes[i]}"].y = y
|
||||
@sprites["player#{@cardIndexes[i]}"].z = 2
|
||||
y += 44
|
||||
@@ -475,27 +475,27 @@ class TriadScene
|
||||
if Input.repeat?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
boardY += 1
|
||||
boardY = 0 if boardY>=@battle.height
|
||||
boardY = 0 if boardY >= @battle.height
|
||||
doRefresh = true
|
||||
elsif Input.repeat?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
boardY -= 1
|
||||
boardY = @battle.height-1 if boardY<0
|
||||
boardY = @battle.height - 1 if boardY < 0
|
||||
doRefresh = true
|
||||
elsif Input.repeat?(Input::LEFT)
|
||||
pbPlayCursorSE
|
||||
boardX -= 1
|
||||
boardX = @battle.width-1 if boardX<0
|
||||
boardX = @battle.width - 1 if boardX < 0
|
||||
doRefresh = true
|
||||
elsif Input.repeat?(Input::RIGHT)
|
||||
pbPlayCursorSE
|
||||
boardX += 1
|
||||
boardX = 0 if boardX>=@battle.width
|
||||
boardX = 0 if boardX >= @battle.width
|
||||
doRefresh = true
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
return nil
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if @battle.isOccupied?(boardX,boardY)
|
||||
if @battle.isOccupied?(boardX, boardY)
|
||||
pbPlayBuzzerSE
|
||||
else
|
||||
pbPlayDecisionSE
|
||||
@@ -504,12 +504,12 @@ class TriadScene
|
||||
end
|
||||
end
|
||||
end
|
||||
return [boardX,boardY]
|
||||
return [boardX, boardY]
|
||||
end
|
||||
|
||||
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
|
||||
@@ -521,12 +521,12 @@ class TriadScene
|
||||
y = 44
|
||||
for i in 0...@opponentCardIndexes.length
|
||||
sprite = @sprites["opponent#{@opponentCardIndexes[i]}"]
|
||||
if i==cardIndex
|
||||
if i == cardIndex
|
||||
@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
|
||||
@@ -539,7 +539,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
|
||||
@@ -548,11 +548,11 @@ class TriadScene
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
for i in 0...@battle.width*@battle.height
|
||||
x = i%@battle.width
|
||||
y = i/@battle.width
|
||||
for i in 0...@battle.width * @battle.height
|
||||
x = i % @battle.width
|
||||
y = i / @battle.width
|
||||
if @boardSprites[i]
|
||||
owner = @battle.getOwner(x,y)
|
||||
owner = @battle.getOwner(x, y)
|
||||
@boardSprites[i].bitmap.dispose if @boardSprites[i].bitmap
|
||||
@boardSprites[i].bitmap = @boardCards[i].createBitmap(owner)
|
||||
end
|
||||
@@ -564,18 +564,18 @@ class TriadScene
|
||||
bitmap.clear
|
||||
playerscore = 0
|
||||
oppscore = 0
|
||||
for i in 0...@battle.width*@battle.height
|
||||
for i in 0...@battle.width * @battle.height
|
||||
if @boardSprites[i]
|
||||
playerscore += 1 if @battle.board[i].owner==1
|
||||
oppscore += 1 if @battle.board[i].owner==2
|
||||
playerscore += 1 if @battle.board[i].owner == 1
|
||||
oppscore += 1 if @battle.board[i].owner == 2
|
||||
end
|
||||
end
|
||||
if @battle.countUnplayedCards
|
||||
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
|
||||
|
||||
@@ -610,32 +610,32 @@ class TriadScreen
|
||||
end
|
||||
|
||||
def maxCards
|
||||
numcards = @width*@height
|
||||
if numcards%2 == 1
|
||||
numcards = numcards/2+1
|
||||
numcards = @width * @height
|
||||
if numcards % 2 == 1
|
||||
numcards = numcards / 2 + 1
|
||||
else
|
||||
numcards = numcards/2
|
||||
numcards = numcards / 2
|
||||
end
|
||||
return numcards
|
||||
end
|
||||
|
||||
def isOccupied?(x,y)
|
||||
return @board[y*@width+x].owner!=0
|
||||
def isOccupied?(x, y)
|
||||
return @board[y * @width + x].owner != 0
|
||||
end
|
||||
|
||||
def getOwner(x,y)
|
||||
return @board[y*@width+x].owner
|
||||
def getOwner(x, y)
|
||||
return @board[y * @width + x].owner
|
||||
end
|
||||
|
||||
def getPanel(x,y)
|
||||
return @board[y*@width+x]
|
||||
def getPanel(x, y)
|
||||
return @board[y * @width + x]
|
||||
end
|
||||
|
||||
def quantity(items,item)
|
||||
def quantity(items, item)
|
||||
return ItemStorageHelper.quantity(items, item)
|
||||
end
|
||||
|
||||
def pbAdd(items,item)
|
||||
def pbAdd(items, item)
|
||||
return ItemStorageHelper.add(items, $PokemonGlobal.triads.maxSize,
|
||||
TriadStorage::MAX_PER_SLOT, item, 1)
|
||||
end
|
||||
@@ -644,28 +644,28 @@ class TriadScreen
|
||||
return ItemStorageHelper.remove(items, item, 1)
|
||||
end
|
||||
|
||||
def flipBoard(x,y,attackerParam = nil,recurse = false)
|
||||
panels = [x-1,y,x+1,y,x,y-1,x,y+1]
|
||||
panels[0] = (@wrapAround ? @width-1 : 0) if panels[0]<0 # left
|
||||
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]
|
||||
def flipBoard(x, y, attackerParam = nil, recurse = false)
|
||||
panels = [x - 1, y, x + 1, y, x, y - 1, x, y + 1]
|
||||
panels[0] = (@wrapAround ? @width - 1 : 0) if panels[0] < 0 # left
|
||||
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]
|
||||
flips = []
|
||||
return nil if attackerParam!=nil && @board[y*@width+x].owner!=0
|
||||
return nil if !attacker.card || attacker.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]
|
||||
defenderX = panels[i * 2]
|
||||
defenderY = panels[i * 2 + 1]
|
||||
defender = @board[defenderY * @width + defenderX]
|
||||
next if !defender.card
|
||||
if attacker.owner!=defender.owner
|
||||
if attacker.owner != defender.owner
|
||||
attack = attacker.attack(i)
|
||||
defense = defender.defense(i)
|
||||
if @elements
|
||||
# If attacker's type matches the tile's element, add
|
||||
# a bonus of 1 (only for original attacker, not combos)
|
||||
attack += 1 if !recurse && attacker.type==attacker.card.type
|
||||
attack += 1 if !recurse && attacker.type == attacker.card.type
|
||||
else
|
||||
# Modifier depends on opponent's Pokémon type:
|
||||
# +1 - Super effective
|
||||
@@ -673,19 +673,19 @@ class TriadScreen
|
||||
# -2 - Immune
|
||||
# attack += attacker.bonus(defender)
|
||||
end
|
||||
if attack>defense || (attack==defense && @sameWins)
|
||||
flips.push([defenderX,defenderY])
|
||||
if attackerParam==nil
|
||||
if attack > defense || (attack == defense && @sameWins)
|
||||
flips.push([defenderX, defenderY])
|
||||
if attackerParam == nil
|
||||
defender.owner = attacker.owner
|
||||
if @sameWins
|
||||
# Combo with the "sameWins" rule
|
||||
ret = flipBoard(defenderX,defenderY,nil,true)
|
||||
ret = flipBoard(defenderX, defenderY, nil, true)
|
||||
flips.concat(ret) if ret
|
||||
end
|
||||
else
|
||||
if @sameWins
|
||||
# Combo with the "sameWins" rule
|
||||
ret = flipBoard(defenderX,defenderY,attackerParam,true)
|
||||
ret = flipBoard(defenderX, defenderY, attackerParam, true)
|
||||
flips.concat(ret) if ret
|
||||
end
|
||||
end
|
||||
@@ -697,21 +697,21 @@ class TriadScreen
|
||||
|
||||
# If pbStartScreen includes parameters, it should
|
||||
# pass the parameters to pbStartScene.
|
||||
def pbStartScreen(opponentName,minLevel,maxLevel,rules = nil,oppdeck = nil,prize = nil)
|
||||
raise _INTL("Minimum level must be 0 through 9.") if minLevel<0 || minLevel>9
|
||||
raise _INTL("Maximum level must be 0 through 9.") if maxLevel<0 || maxLevel>9
|
||||
raise _INTL("Maximum level shouldn't be less than the minimum level.") if maxLevel<minLevel
|
||||
if rules && rules.is_a?(Array) && rules.length>0
|
||||
def pbStartScreen(opponentName, minLevel, maxLevel, rules = nil, oppdeck = nil, prize = nil)
|
||||
raise _INTL("Minimum level must be 0 through 9.") if minLevel < 0 || minLevel > 9
|
||||
raise _INTL("Maximum level must be 0 through 9.") if maxLevel < 0 || maxLevel > 9
|
||||
raise _INTL("Maximum level shouldn't be less than the minimum level.") if maxLevel < minLevel
|
||||
if rules && rules.is_a?(Array) && rules.length > 0
|
||||
for rule in rules
|
||||
@sameWins = true if rule=="samewins"
|
||||
@openHand = true if rule=="openhand"
|
||||
@wrapAround = true if rule=="wrap"
|
||||
@elements = true if rule=="elements"
|
||||
@randomHand = true if rule=="randomhand"
|
||||
@countUnplayedCards = true if rule=="countunplayed"
|
||||
@trade = 1 if rule=="direct"
|
||||
@trade = 2 if rule=="winall"
|
||||
@trade = 3 if rule=="noprize"
|
||||
@sameWins = true if rule == "samewins"
|
||||
@openHand = true if rule == "openhand"
|
||||
@wrapAround = true if rule == "wrap"
|
||||
@elements = true if rule == "elements"
|
||||
@randomHand = true if rule == "randomhand"
|
||||
@countUnplayedCards = true if rule == "countunplayed"
|
||||
@trade = 1 if rule == "direct"
|
||||
@trade = 2 if rule == "winall"
|
||||
@trade = 3 if rule == "noprize"
|
||||
end
|
||||
end
|
||||
@triadCards = []
|
||||
@@ -726,7 +726,7 @@ class TriadScreen
|
||||
@playerName = $player ? $player.name : "Trainer"
|
||||
@opponentName = opponentName
|
||||
type_keys = GameData::Type.keys
|
||||
for i in 0...@width*@height
|
||||
for i in 0...@width * @height
|
||||
square = TriadSquare.new
|
||||
if @elements
|
||||
loop do
|
||||
@@ -741,7 +741,7 @@ class TriadScreen
|
||||
end
|
||||
@scene.pbStartScene(self) # (param1, param2)
|
||||
# Check whether there are enough cards.
|
||||
if count<self.maxCards
|
||||
if count < self.maxCards
|
||||
@scene.pbDisplayPaused(_INTL("You don't have enough cards."))
|
||||
@scene.pbEndScene
|
||||
return 0
|
||||
@@ -751,7 +751,7 @@ class TriadScreen
|
||||
if @randomHand # Determine hand at random
|
||||
self.maxCards.times do
|
||||
randCard = @triadCards[rand(@triadCards.length)]
|
||||
pbSubtract(@triadCards,randCard[0])
|
||||
pbSubtract(@triadCards, randCard[0])
|
||||
cards.push(randCard[0])
|
||||
end
|
||||
@scene.pbShowPlayerCards(cards)
|
||||
@@ -759,12 +759,12 @@ class TriadScreen
|
||||
cards = @scene.pbChooseTriadCard(@triadCards)
|
||||
end
|
||||
# Set the opponent's cards.
|
||||
if oppdeck && oppdeck.is_a?(Array) && oppdeck.length==self.maxCards # Preset
|
||||
if oppdeck && oppdeck.is_a?(Array) && oppdeck.length == self.maxCards # Preset
|
||||
opponentCards = []
|
||||
for i in oppdeck
|
||||
species_data = GameData::Species.try_get(i)
|
||||
if !species_data
|
||||
@scene.pbDisplayPaused(_INTL("Opponent has an illegal card, \"{1}\".",i))
|
||||
@scene.pbDisplayPaused(_INTL("Opponent has an illegal card, \"{1}\".", i))
|
||||
@scene.pbEndScene
|
||||
return 0
|
||||
end
|
||||
@@ -787,7 +787,7 @@ class TriadScreen
|
||||
end
|
||||
end
|
||||
# sort by total point count
|
||||
candidates.sort! { |a,b| a[1] <=> b[1] }
|
||||
candidates.sort! { |a, b| a[1] <=> b[1] }
|
||||
opponentCards = []
|
||||
self.maxCards.times do
|
||||
# Choose random card from candidates based on trainer's level
|
||||
@@ -797,13 +797,13 @@ class TriadScreen
|
||||
end
|
||||
originalCards = cards.clone
|
||||
originalOpponentCards = opponentCards.clone
|
||||
@scene.pbNotifyCards(cards.clone,opponentCards.clone)
|
||||
@scene.pbNotifyCards(cards.clone, opponentCards.clone)
|
||||
@scene.pbShowOpponentCards(opponentCards)
|
||||
@scene.pbDisplay(_INTL("Choosing the starting player..."))
|
||||
@scene.pbUpdateScore
|
||||
playerTurn = (rand(2) == 0)
|
||||
@scene.pbDisplay(_INTL("{1} will go first.", (playerTurn) ? @playerName : @opponentName))
|
||||
for i in 0...@width*@height
|
||||
for i in 0...@width * @height
|
||||
position = nil
|
||||
triadCard = nil
|
||||
cardIndex = 0
|
||||
@@ -816,65 +816,65 @@ class TriadScreen
|
||||
end
|
||||
else
|
||||
# Opponent's turn
|
||||
@scene.pbDisplay(_INTL("{1} is making a move...",@opponentName))
|
||||
@scene.pbDisplay(_INTL("{1} is making a move...", @opponentName))
|
||||
scores = []
|
||||
for cardIndex in 0...opponentCards.length
|
||||
square = TriadSquare.new
|
||||
square.card = TriadCard.new(opponentCards[cardIndex])
|
||||
square.owner = 2
|
||||
for i in 0...@width*@height
|
||||
for i in 0...@width * @height
|
||||
x = i % @width
|
||||
y = i / @width
|
||||
square.type = @board[i].type
|
||||
flips = flipBoard(x,y,square)
|
||||
if flips!=nil
|
||||
scores.push([cardIndex,x,y,flips.length])
|
||||
flips = flipBoard(x, y, square)
|
||||
if flips != nil
|
||||
scores.push([cardIndex, x, y, flips.length])
|
||||
end
|
||||
end
|
||||
end
|
||||
# Sort by number of flips
|
||||
scores.sort! { |a,b| (b[3]==a[3]) ? rand(3)-1 : b[3]<=>a[3] }
|
||||
scores = scores[0,opponentCards.length] # Get the best results
|
||||
if scores.length==0
|
||||
@scene.pbDisplay(_INTL("{1} can't move somehow...",@opponentName))
|
||||
scores.sort! { |a, b| (b[3] == a[3]) ? rand(3) - 1 : b[3] <=> a[3] }
|
||||
scores = scores[0, opponentCards.length] # Get the best results
|
||||
if scores.length == 0
|
||||
@scene.pbDisplay(_INTL("{1} can't move somehow...", @opponentName))
|
||||
playerTurn = !playerTurn
|
||||
continue
|
||||
end
|
||||
result = scores[rand(scores.length)]
|
||||
cardIndex = result[0]
|
||||
triadCard = TriadCard.new(opponentCards[cardIndex])
|
||||
position = [result[1],result[2]]
|
||||
@scene.pbOpponentPlaceCard(triadCard,position,cardIndex)
|
||||
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])
|
||||
flipBoard(position[0], position[1])
|
||||
if playerTurn
|
||||
cards.delete_at(cardIndex)
|
||||
@scene.pbEndPlaceCard(position,cardIndex)
|
||||
@scene.pbEndPlaceCard(position, cardIndex)
|
||||
else
|
||||
opponentCards.delete_at(cardIndex)
|
||||
@scene.pbEndOpponentPlaceCard(position,cardIndex)
|
||||
@scene.pbEndOpponentPlaceCard(position, cardIndex)
|
||||
end
|
||||
playerTurn = !playerTurn
|
||||
end
|
||||
# Determine the winner
|
||||
playerCount = 0
|
||||
opponentCount = 0
|
||||
for i in 0...@width*@height
|
||||
playerCount += 1 if board[i].owner==1
|
||||
opponentCount += 1 if board[i].owner==2
|
||||
for i in 0...@width * @height
|
||||
playerCount += 1 if board[i].owner == 1
|
||||
opponentCount += 1 if board[i].owner == 2
|
||||
end
|
||||
if @countUnplayedCards
|
||||
playerCount += cards.length
|
||||
opponentCount += opponentCards.length
|
||||
end
|
||||
result = 0
|
||||
if playerCount==opponentCount
|
||||
if playerCount == opponentCount
|
||||
@scene.pbDisplayPaused(_INTL("The game is a draw."))
|
||||
result = 3
|
||||
if @trade==1
|
||||
if @trade == 1
|
||||
# Keep only cards of your color
|
||||
for card in originalCards
|
||||
$PokemonGlobal.triads.remove(card)
|
||||
@@ -882,16 +882,16 @@ class TriadScreen
|
||||
for i in cards
|
||||
$PokemonGlobal.triads.add(i)
|
||||
end
|
||||
for i in 0...@width*@height
|
||||
if board[i].owner==1
|
||||
for i in 0...@width * @height
|
||||
if board[i].owner == 1
|
||||
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
|
||||
$PokemonGlobal.triads.add(card)
|
||||
end
|
||||
end
|
||||
@scene.pbDisplayPaused(_INTL("Kept all cards of your color."))
|
||||
end
|
||||
elsif playerCount>opponentCount
|
||||
@scene.pbDisplayPaused(_INTL("{1} won against {2}.",@playerName,@opponentName))
|
||||
elsif playerCount > opponentCount
|
||||
@scene.pbDisplayPaused(_INTL("{1} won against {2}.", @playerName, @opponentName))
|
||||
result = 1
|
||||
if prize
|
||||
species_data = GameData::Species.try_get(prize)
|
||||
@@ -904,7 +904,7 @@ class TriadScreen
|
||||
card = originalOpponentCards[rand(originalOpponentCards.length)]
|
||||
if $PokemonGlobal.triads.add(card)
|
||||
cardname = GameData::Species.get(card).name
|
||||
@scene.pbDisplayPaused(_INTL("Got opponent's {1} card.",cardname))
|
||||
@scene.pbDisplayPaused(_INTL("Got opponent's {1} card.", cardname))
|
||||
end
|
||||
when 1 # Keep only cards of your color
|
||||
for card in originalCards
|
||||
@@ -913,8 +913,8 @@ class TriadScreen
|
||||
for i in cards
|
||||
$PokemonGlobal.triads.add(i)
|
||||
end
|
||||
for i in 0...@width*@height
|
||||
if board[i].owner==1
|
||||
for i in 0...@width * @height
|
||||
if board[i].owner == 1
|
||||
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
|
||||
$PokemonGlobal.triads.add(card)
|
||||
end
|
||||
@@ -928,14 +928,14 @@ class TriadScreen
|
||||
end
|
||||
end
|
||||
else
|
||||
@scene.pbDisplayPaused(_INTL("{1} lost against {2}.",@playerName,@opponentName))
|
||||
@scene.pbDisplayPaused(_INTL("{1} lost against {2}.", @playerName, @opponentName))
|
||||
result = 2
|
||||
case @trade
|
||||
when 0 # Lose 1 random card from your deck
|
||||
card = originalCards[rand(originalCards.length)]
|
||||
$PokemonGlobal.triads.remove(card)
|
||||
cardname = GameData::Species.get(card).name
|
||||
@scene.pbDisplayPaused(_INTL("Opponent won your {1} card.",cardname))
|
||||
@scene.pbDisplayPaused(_INTL("Opponent won your {1} card.", cardname))
|
||||
when 1 # Keep only cards of your color
|
||||
for card in originalCards
|
||||
$PokemonGlobal.triads.remove(card)
|
||||
@@ -943,13 +943,13 @@ class TriadScreen
|
||||
for i in cards
|
||||
$PokemonGlobal.triads.add(i)
|
||||
end
|
||||
for i in 0...@width*@height
|
||||
if board[i].owner==1
|
||||
for i in 0...@width * @height
|
||||
if board[i].owner == 1
|
||||
card = GameData::Species.get_species_form(board[i].card.species, board[i].card.form).id
|
||||
$PokemonGlobal.triads.add(card)
|
||||
end
|
||||
end
|
||||
@scene.pbDisplayPaused(_INTL("Kept all cards of your color.",cardname))
|
||||
@scene.pbDisplayPaused(_INTL("Kept all cards of your color.", cardname))
|
||||
when 2 # Lose all your cards
|
||||
for card in originalCards
|
||||
$PokemonGlobal.triads.remove(card)
|
||||
@@ -967,12 +967,12 @@ end
|
||||
#===============================================================================
|
||||
# Start duel
|
||||
#===============================================================================
|
||||
def pbTriadDuel(name,minLevel,maxLevel,rules = nil,oppdeck = nil,prize = nil)
|
||||
def pbTriadDuel(name, minLevel, maxLevel, rules = nil, oppdeck = nil, prize = nil)
|
||||
ret = 0
|
||||
pbFadeOutInWithMusic {
|
||||
scene = TriadScene.new
|
||||
screen = TriadScreen.new(scene)
|
||||
ret = screen.pbStartScreen(name,minLevel,maxLevel,rules,oppdeck,prize)
|
||||
ret = screen.pbStartScreen(name, minLevel, maxLevel, rules, oppdeck, prize)
|
||||
}
|
||||
return ret
|
||||
end
|
||||
@@ -1072,18 +1072,18 @@ def pbBuyTriads
|
||||
realcommands.push(command[2])
|
||||
end
|
||||
# Scroll right before showing screen
|
||||
pbScrollMap(4,3,5)
|
||||
cmdwindow = Window_CommandPokemonEx.newWithSize(realcommands,0,0,Graphics.width/2,Graphics.height)
|
||||
pbScrollMap(4, 3, 5)
|
||||
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)
|
||||
goldwindow.resizeToFit(goldwindow.text,Graphics.width)
|
||||
goldwindow.x = Graphics.width-goldwindow.width
|
||||
_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
|
||||
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]
|
||||
@@ -1094,7 +1094,7 @@ def pbBuyTriads
|
||||
cmdwindow.active = true
|
||||
cmdwindow.update
|
||||
goldwindow.update
|
||||
if commands[cmdwindow.index][3]!=olditem
|
||||
if commands[cmdwindow.index][3] != olditem
|
||||
preview.bitmap.dispose if preview.bitmap
|
||||
preview.bitmap = TriadCard.new(commands[cmdwindow.index][3]).createBitmap(1)
|
||||
olditem = commands[cmdwindow.index][3]
|
||||
@@ -1107,22 +1107,22 @@ def pbBuyTriads
|
||||
itemname = commands[cmdwindow.index][1]
|
||||
cmdwindow.active = false
|
||||
cmdwindow.update
|
||||
if $player.money<price
|
||||
if $player.money < price
|
||||
pbMessage(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
maxafford = (price<=0) ? 99 : $player.money/price
|
||||
maxafford = 99 if maxafford>99
|
||||
maxafford = (price <= 0) ? 99 : $player.money / price
|
||||
maxafford = 99 if maxafford > 99
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1,maxafford)
|
||||
params.setRange(1, maxafford)
|
||||
params.setInitialValue(1)
|
||||
params.setCancelValue(0)
|
||||
quantity = pbMessageChooseNumber(
|
||||
_INTL("The {1} card? Certainly. How many would you like?",itemname),params)
|
||||
next if quantity<=0
|
||||
_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))
|
||||
if $player.money<price
|
||||
next if !pbConfirmMessage(_INTL("{1}, and you want {2}. That will be ${3}. OK?", itemname, quantity, price.to_s_formatted))
|
||||
if $player.money < price
|
||||
pbMessage(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
@@ -1132,7 +1132,7 @@ def pbBuyTriads
|
||||
end
|
||||
$PokemonGlobal.triads.add(item, quantity)
|
||||
$player.money -= price
|
||||
goldwindow.text = _INTL("Money:\r\n{1}",pbGetGoldString)
|
||||
goldwindow.text = _INTL("Money:\r\n{1}", pbGetGoldString)
|
||||
pbMessage(_INTL("Here you are! Thank you!\\se[Mart buy item]"))
|
||||
end
|
||||
end
|
||||
@@ -1142,7 +1142,7 @@ def pbBuyTriads
|
||||
preview.dispose
|
||||
Graphics.frame_reset
|
||||
# Scroll right before showing screen
|
||||
pbScrollMap(6,3,5)
|
||||
pbScrollMap(6, 3, 5)
|
||||
end
|
||||
|
||||
def pbSellTriads
|
||||
@@ -1153,23 +1153,23 @@ def pbSellTriads
|
||||
commands.push(_INTL("{1} x{2}", speciesname, item[1]))
|
||||
end
|
||||
commands.push(_INTL("CANCEL"))
|
||||
if commands.length==1
|
||||
if commands.length == 1
|
||||
pbMessage(_INTL("You have no cards."))
|
||||
return
|
||||
end
|
||||
# Scroll right before showing screen
|
||||
pbScrollMap(4,3,5)
|
||||
cmdwindow = Window_CommandPokemonEx.newWithSize(commands,0,0,Graphics.width/2,Graphics.height)
|
||||
pbScrollMap(4, 3, 5)
|
||||
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)
|
||||
goldwindow.resizeToFit(goldwindow.text,Graphics.width)
|
||||
goldwindow.x = Graphics.width-goldwindow.width
|
||||
_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
|
||||
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)
|
||||
@@ -1196,7 +1196,7 @@ def pbSellTriads
|
||||
break
|
||||
end
|
||||
if Input.trigger?(Input::USE)
|
||||
if cmdwindow.index>=$PokemonGlobal.triads.length
|
||||
if cmdwindow.index >= $PokemonGlobal.triads.length
|
||||
done = true
|
||||
break
|
||||
end
|
||||
@@ -1204,33 +1204,33 @@ def pbSellTriads
|
||||
itemname = GameData::Species.get(item).name
|
||||
quantity = $PokemonGlobal.triads.quantity(item)
|
||||
price = TriadCard.new(item).price
|
||||
if price==0
|
||||
pbDisplayPaused(_INTL("The {1} card? Oh, no. I can't buy that.",itemname))
|
||||
if price == 0
|
||||
pbDisplayPaused(_INTL("The {1} card? Oh, no. I can't buy that.", itemname))
|
||||
break
|
||||
end
|
||||
cmdwindow.active = false
|
||||
cmdwindow.update
|
||||
if quantity>1
|
||||
if quantity > 1
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1,quantity)
|
||||
params.setRange(1, quantity)
|
||||
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
|
||||
if quantity > 0
|
||||
price /= 4
|
||||
price *= quantity
|
||||
if pbConfirmMessage(_INTL("I can pay ${1}. Would that be OK?",price.to_s_formatted))
|
||||
if pbConfirmMessage(_INTL("I can pay ${1}. Would that be OK?", price.to_s_formatted))
|
||||
$player.money += price
|
||||
goldwindow.text = _INTL("Money:\r\n{1}",pbGetGoldString)
|
||||
$PokemonGlobal.triads.remove(item,quantity)
|
||||
pbMessage(_INTL("Turned over the {1} card and received ${2}.\\se[Mart buy item]",itemname,price.to_s_formatted))
|
||||
goldwindow.text = _INTL("Money:\r\n{1}", pbGetGoldString)
|
||||
$PokemonGlobal.triads.remove(item, quantity)
|
||||
pbMessage(_INTL("Turned over the {1} card and received ${2}.\\se[Mart buy item]", itemname, price.to_s_formatted))
|
||||
commands = []
|
||||
for i in 0...$PokemonGlobal.triads.length
|
||||
item = $PokemonGlobal.triads[i]
|
||||
speciesname = GameData::Species.get(item[0]).name
|
||||
commands.push(_INTL("{1} x{2}",speciesname,item[1]))
|
||||
commands.push(_INTL("{1} x{2}", speciesname, item[1]))
|
||||
end
|
||||
commands.push(_INTL("CANCEL"))
|
||||
cmdwindow.commands = commands
|
||||
@@ -1246,7 +1246,7 @@ def pbSellTriads
|
||||
preview.dispose
|
||||
Graphics.frame_reset
|
||||
# Scroll right before showing screen
|
||||
pbScrollMap(6,3,5)
|
||||
pbScrollMap(6, 3, 5)
|
||||
end
|
||||
|
||||
def pbTriadList
|
||||
@@ -1254,17 +1254,17 @@ def pbTriadList
|
||||
for i in 0...$PokemonGlobal.triads.length
|
||||
item = $PokemonGlobal.triads[i]
|
||||
speciesname = GameData::Species.get(item[0]).name
|
||||
commands.push(_INTL("{1} x{2}",speciesname,item[1]))
|
||||
commands.push(_INTL("{1} x{2}", speciesname, item[1]))
|
||||
end
|
||||
commands.push(_INTL("CANCEL"))
|
||||
if commands.length==1
|
||||
if commands.length == 1
|
||||
pbMessage(_INTL("You have no cards."))
|
||||
return
|
||||
end
|
||||
cmdwindow = Window_CommandPokemonEx.newWithSize(commands,0,0,Graphics.width/2,Graphics.height)
|
||||
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
|
||||
@@ -1274,9 +1274,9 @@ def pbTriadList
|
||||
Graphics.update
|
||||
Input.update
|
||||
cmdwindow.update
|
||||
if lastIndex!=cmdwindow.index
|
||||
if lastIndex != cmdwindow.index
|
||||
sprite.bitmap.dispose if sprite.bitmap
|
||||
if cmdwindow.index<$PokemonGlobal.triads.length
|
||||
if cmdwindow.index < $PokemonGlobal.triads.length
|
||||
sprite.bitmap = TriadCard.new($PokemonGlobal.triads.get_item(cmdwindow.index)).createBitmap(1)
|
||||
end
|
||||
lastIndex = cmdwindow.index
|
||||
@@ -1286,7 +1286,7 @@ def pbTriadList
|
||||
break
|
||||
end
|
||||
if Input.trigger?(Input::USE)
|
||||
if cmdwindow.index>=$PokemonGlobal.triads.length
|
||||
if cmdwindow.index >= $PokemonGlobal.triads.length
|
||||
done = true
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user