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:
@@ -84,9 +84,9 @@ class Battle::Scene
|
||||
|
||||
def pbGraphicsUpdate
|
||||
# Update lineup animations
|
||||
if @animations.length>0
|
||||
if @animations.length > 0
|
||||
shouldCompact = false
|
||||
@animations.each_with_index do |a,i|
|
||||
@animations.each_with_index do |a, i|
|
||||
a.update
|
||||
if a.animDone?
|
||||
a.dispose
|
||||
@@ -100,7 +100,7 @@ class Battle::Scene
|
||||
@sprites["battle_bg"].update if @sprites["battle_bg"].respond_to?("update")
|
||||
Graphics.update
|
||||
@frameCounter += 1
|
||||
@frameCounter = @frameCounter%(Graphics.frame_rate*12/20)
|
||||
@frameCounter = @frameCounter % (Graphics.frame_rate * 12 / 20)
|
||||
end
|
||||
|
||||
def pbInputUpdate
|
||||
@@ -113,7 +113,7 @@ class Battle::Scene
|
||||
|
||||
def pbFrameUpdate(cw = nil)
|
||||
cw.update if cw
|
||||
@battle.battlers.each_with_index do |b,i|
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"].update(@frameCounter) if @sprites["dataBox_#{i}"]
|
||||
@sprites["pokemon_#{i}"].update(@frameCounter) if @sprites["pokemon_#{i}"]
|
||||
@@ -122,7 +122,7 @@ class Battle::Scene
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
@battle.battlers.each_with_index do |b,i|
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"].refresh if @sprites["dataBox_#{i}"]
|
||||
end
|
||||
@@ -147,7 +147,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Returns whether the party line-ups are currently coming on-screen
|
||||
def inPartyAnimation?
|
||||
return @animations.length>0
|
||||
return @animations.length > 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -157,11 +157,11 @@ class Battle::Scene
|
||||
# NOTE: If you are not using fancy graphics for the command/fight menus, you
|
||||
# will need to make "messageBox" also visible if the windowtype if
|
||||
# COMMAND_BOX/FIGHT_BOX respectively.
|
||||
@sprites["messageBox"].visible = (windowType==MESSAGE_BOX)
|
||||
@sprites["messageWindow"].visible = (windowType==MESSAGE_BOX)
|
||||
@sprites["commandWindow"].visible = (windowType==COMMAND_BOX)
|
||||
@sprites["fightWindow"].visible = (windowType==FIGHT_BOX)
|
||||
@sprites["targetWindow"].visible = (windowType==TARGET_BOX)
|
||||
@sprites["messageBox"].visible = (windowType == MESSAGE_BOX)
|
||||
@sprites["messageWindow"].visible = (windowType == MESSAGE_BOX)
|
||||
@sprites["commandWindow"].visible = (windowType == COMMAND_BOX)
|
||||
@sprites["fightWindow"].visible = (windowType == FIGHT_BOX)
|
||||
@sprites["targetWindow"].visible = (windowType == TARGET_BOX)
|
||||
end
|
||||
|
||||
# This is for the end of brief messages, which have been lingering on-screen
|
||||
@@ -185,7 +185,7 @@ class Battle::Scene
|
||||
|
||||
# NOTE: A regular message is displayed for 1 second after it fully appears (or
|
||||
# less if Back/Use is pressed). Disappears automatically after that time.
|
||||
def pbDisplayMessage(msg,brief = false)
|
||||
def pbDisplayMessage(msg, brief = false)
|
||||
pbWaitMessage
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
cw = @sprites["messageWindow"]
|
||||
@@ -235,7 +235,7 @@ class Battle::Scene
|
||||
pbWaitMessage
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
cw = @sprites["messageWindow"]
|
||||
cw.text = _INTL("{1}\1",msg)
|
||||
cw.text = _INTL("{1}\1", msg)
|
||||
PBDebug.log(msg)
|
||||
yielded = false
|
||||
timer = 0.0
|
||||
@@ -269,19 +269,19 @@ class Battle::Scene
|
||||
end
|
||||
|
||||
def pbDisplayConfirmMessage(msg)
|
||||
return pbShowCommands(msg,[_INTL("Yes"),_INTL("No")],1)==0
|
||||
return pbShowCommands(msg, [_INTL("Yes"), _INTL("No")], 1) == 0
|
||||
end
|
||||
|
||||
def pbShowCommands(msg,commands,defaultValue)
|
||||
def pbShowCommands(msg, commands, defaultValue)
|
||||
pbWaitMessage
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
dw = @sprites["messageWindow"]
|
||||
dw.text = msg
|
||||
cw = Window_CommandPokemon.new(commands)
|
||||
cw.height = Graphics.height - dw.height if cw.height > Graphics.height - dw.height
|
||||
cw.x = Graphics.width-cw.width
|
||||
cw.y = Graphics.height-cw.height-dw.height
|
||||
cw.z = dw.z+1
|
||||
cw.x = Graphics.width - cw.width
|
||||
cw.y = Graphics.height - cw.height - dw.height
|
||||
cw.z = dw.z + 1
|
||||
cw.index = 0
|
||||
cw.viewport = @viewport
|
||||
PBDebug.log(msg)
|
||||
@@ -289,7 +289,7 @@ class Battle::Scene
|
||||
cw.visible = (!dw.busy?)
|
||||
pbUpdate(cw)
|
||||
dw.update
|
||||
if Input.trigger?(Input::BACK) && defaultValue>=0
|
||||
if Input.trigger?(Input::BACK) && defaultValue >= 0
|
||||
if dw.busy?
|
||||
pbPlayDecisionSE if dw.pausing?
|
||||
dw.resume
|
||||
@@ -314,8 +314,8 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Sprites
|
||||
#=============================================================================
|
||||
def pbAddSprite(id,x,y,filename,viewport)
|
||||
sprite = @sprites[id] || IconSprite.new(x,y,viewport)
|
||||
def pbAddSprite(id, x, y, filename, viewport)
|
||||
sprite = @sprites[id] || IconSprite.new(x, y, viewport)
|
||||
if filename
|
||||
sprite.setBitmap(filename) rescue nil
|
||||
end
|
||||
@@ -323,7 +323,7 @@ class Battle::Scene
|
||||
return sprite
|
||||
end
|
||||
|
||||
def pbAddPlane(id,filename,viewport)
|
||||
def pbAddPlane(id, filename, viewport)
|
||||
sprite = AnimatedPlane.new(viewport)
|
||||
if filename
|
||||
sprite.setBitmap(filename)
|
||||
@@ -337,12 +337,12 @@ class Battle::Scene
|
||||
end
|
||||
|
||||
# Used by Ally Switch.
|
||||
def pbSwapBattlerSprites(idxA,idxB)
|
||||
def pbSwapBattlerSprites(idxA, idxB)
|
||||
@sprites["pokemon_#{idxA}"], @sprites["pokemon_#{idxB}"] = @sprites["pokemon_#{idxB}"], @sprites["pokemon_#{idxA}"]
|
||||
@sprites["shadow_#{idxA}"], @sprites["shadow_#{idxB}"] = @sprites["shadow_#{idxB}"], @sprites["shadow_#{idxA}"]
|
||||
@lastCmd[idxA], @lastCmd[idxB] = @lastCmd[idxB], @lastCmd[idxA]
|
||||
@lastMove[idxA], @lastMove[idxB] = @lastMove[idxB], @lastMove[idxA]
|
||||
[idxA,idxB].each do |i|
|
||||
[idxA, idxB].each do |i|
|
||||
@sprites["pokemon_#{i}"].index = i
|
||||
@sprites["pokemon_#{i}"].pbSetPosition
|
||||
@sprites["shadow_#{i}"].index = i
|
||||
@@ -379,22 +379,22 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
def pbSelectBattler(idxBattler,selectMode = 1)
|
||||
numWindows = @battle.sideSizes.max*2
|
||||
def pbSelectBattler(idxBattler, selectMode = 1)
|
||||
numWindows = @battle.sideSizes.max * 2
|
||||
for i in 0...numWindows
|
||||
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i==idxBattler
|
||||
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i == idxBattler
|
||||
selVal = (sel) ? selectMode : 0
|
||||
@sprites["dataBox_#{i}"].selected = selVal if @sprites["dataBox_#{i}"]
|
||||
@sprites["pokemon_#{i}"].selected = selVal if @sprites["pokemon_#{i}"]
|
||||
end
|
||||
end
|
||||
|
||||
def pbChangePokemon(idxBattler,pkmn)
|
||||
def pbChangePokemon(idxBattler, pkmn)
|
||||
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||
pkmnSprite = @sprites["pokemon_#{idxBattler}"]
|
||||
shadowSprite = @sprites["shadow_#{idxBattler}"]
|
||||
back = !@battle.opposes?(idxBattler)
|
||||
pkmnSprite.setPokemonBitmap(pkmn,back)
|
||||
pkmnSprite.setPokemonBitmap(pkmn, back)
|
||||
shadowSprite.setPokemonBitmap(pkmn)
|
||||
# Set visibility of battler's shadow
|
||||
shadowSprite.visible = pkmn.species_data.shows_shadow? if shadowSprite && !back
|
||||
|
||||
@@ -14,10 +14,10 @@ class Battle::Scene
|
||||
# Called whenever the battle begins.
|
||||
def pbStartBattle(battle)
|
||||
@battle = battle
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@lastCmd = Array.new(@battle.battlers.length,0)
|
||||
@lastMove = Array.new(@battle.battlers.length,0)
|
||||
@lastCmd = Array.new(@battle.battlers.length, 0)
|
||||
@lastMove = Array.new(@battle.battlers.length, 0)
|
||||
pbInitSprites
|
||||
pbBattleIntroAnimation
|
||||
end
|
||||
@@ -27,12 +27,12 @@ class Battle::Scene
|
||||
# The background image and each side's base graphic
|
||||
pbCreateBackdropSprites
|
||||
# Create message box graphic
|
||||
messageBox = pbAddSprite("messageBox",0,Graphics.height-96,
|
||||
"Graphics/Pictures/Battle/overlay_message",@viewport)
|
||||
messageBox = pbAddSprite("messageBox", 0, Graphics.height - 96,
|
||||
"Graphics/Pictures/Battle/overlay_message", @viewport)
|
||||
messageBox.z = 195
|
||||
# Create message window (displays the message)
|
||||
msgWindow = Window_AdvancedTextPokemon.newWithSize("",
|
||||
16,Graphics.height-96+2,Graphics.width-32,96,@viewport)
|
||||
16, Graphics.height - 96 + 2, Graphics.width - 32, 96, @viewport)
|
||||
msgWindow.z = 200
|
||||
msgWindow.opacity = 0
|
||||
msgWindow.baseColor = MESSAGE_BASE_COLOR
|
||||
@@ -40,52 +40,52 @@ class Battle::Scene
|
||||
msgWindow.letterbyletter = true
|
||||
@sprites["messageWindow"] = msgWindow
|
||||
# Create command window
|
||||
@sprites["commandWindow"] = CommandMenu.new(@viewport,200)
|
||||
@sprites["commandWindow"] = CommandMenu.new(@viewport, 200)
|
||||
# Create fight window
|
||||
@sprites["fightWindow"] = FightMenu.new(@viewport,200)
|
||||
@sprites["fightWindow"] = FightMenu.new(@viewport, 200)
|
||||
# Create targeting window
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport,200,@battle.sideSizes)
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport, 200, @battle.sideSizes)
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
# The party lineup graphics (bar and balls) for both sides
|
||||
for side in 0...2
|
||||
partyBar = pbAddSprite("partyBar_#{side}",0,0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup",@viewport)
|
||||
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.mirror = true if side==0 # Player's lineup bar only
|
||||
partyBar.mirror = true if side == 0 # Player's lineup bar only
|
||||
partyBar.visible = false
|
||||
for i in 0...NUM_BALLS
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}",0,0,nil,@viewport)
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
|
||||
ball.z = 121
|
||||
ball.visible = false
|
||||
end
|
||||
# Ability splash bars
|
||||
if USE_ABILITY_SPLASH
|
||||
@sprites["abilityBar_#{side}"] = AbilitySplashBar.new(side,@viewport)
|
||||
@sprites["abilityBar_#{side}"] = AbilitySplashBar.new(side, @viewport)
|
||||
end
|
||||
end
|
||||
# Player's and partner trainer's back sprite
|
||||
@battle.player.each_with_index do |p,i|
|
||||
pbCreateTrainerBackSprite(i,p.trainer_type,@battle.player.length)
|
||||
@battle.player.each_with_index do |p, i|
|
||||
pbCreateTrainerBackSprite(i, p.trainer_type, @battle.player.length)
|
||||
end
|
||||
# Opposing trainer(s) sprites
|
||||
if @battle.trainerBattle?
|
||||
@battle.opponent.each_with_index do |p,i|
|
||||
pbCreateTrainerFrontSprite(i,p.trainer_type,@battle.opponent.length)
|
||||
@battle.opponent.each_with_index do |p, i|
|
||||
pbCreateTrainerFrontSprite(i, p.trainer_type, @battle.opponent.length)
|
||||
end
|
||||
end
|
||||
# Data boxes and Pokémon sprites
|
||||
@battle.battlers.each_with_index do |b,i|
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"] = PokemonDataBox.new(b,@battle.pbSideSize(i),@viewport)
|
||||
@sprites["dataBox_#{i}"] = PokemonDataBox.new(b, @battle.pbSideSize(i), @viewport)
|
||||
pbCreatePokemonSprite(i)
|
||||
end
|
||||
# Wild battle, so set up the Pokémon sprite(s) accordingly
|
||||
if @battle.wildBattle?
|
||||
@battle.pbParty(1).each_with_index do |pkmn,i|
|
||||
index = i*2+1
|
||||
pbChangePokemon(index,pkmn)
|
||||
@battle.pbParty(1).each_with_index do |pkmn, i|
|
||||
index = i * 2 + 1
|
||||
pbChangePokemon(index, pkmn)
|
||||
pkmnSprite = @sprites["pokemon_#{index}"]
|
||||
pkmnSprite.tone = Tone.new(-80,-80,-80)
|
||||
pkmnSprite.tone = Tone.new(-80, -80, -80)
|
||||
pkmnSprite.visible = true
|
||||
end
|
||||
end
|
||||
@@ -99,92 +99,92 @@ class Battle::Scene
|
||||
# Put everything together into backdrop, bases and message bar filenames
|
||||
backdropFilename = @battle.backdrop
|
||||
baseFilename = @battle.backdrop
|
||||
baseFilename = sprintf("%s_%s",baseFilename,@battle.backdropBase) if @battle.backdropBase
|
||||
baseFilename = sprintf("%s_%s", baseFilename, @battle.backdropBase) if @battle.backdropBase
|
||||
messageFilename = @battle.backdrop
|
||||
if time
|
||||
trialName = sprintf("%s_%s",backdropFilename,time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_bg"))
|
||||
trialName = sprintf("%s_%s", backdropFilename, time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_bg"))
|
||||
backdropFilename = trialName
|
||||
end
|
||||
trialName = sprintf("%s_%s",baseFilename,time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_base0"))
|
||||
trialName = sprintf("%s_%s", baseFilename, time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_base0"))
|
||||
baseFilename = trialName
|
||||
end
|
||||
trialName = sprintf("%s_%s",messageFilename,time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_message"))
|
||||
trialName = sprintf("%s_%s", messageFilename, time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_message"))
|
||||
messageFilename = trialName
|
||||
end
|
||||
end
|
||||
if !pbResolveBitmap(sprintf("Graphics/Battlebacks/"+baseFilename+"_base0")) &&
|
||||
if !pbResolveBitmap(sprintf("Graphics/Battlebacks/" + baseFilename + "_base0")) &&
|
||||
@battle.backdropBase
|
||||
baseFilename = @battle.backdropBase
|
||||
if time
|
||||
trialName = sprintf("%s_%s",baseFilename,time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_base0"))
|
||||
trialName = sprintf("%s_%s", baseFilename, time)
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/" + trialName + "_base0"))
|
||||
baseFilename = trialName
|
||||
end
|
||||
end
|
||||
end
|
||||
# Finalise filenames
|
||||
battleBG = "Graphics/Battlebacks/"+backdropFilename+"_bg"
|
||||
playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0"
|
||||
enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1"
|
||||
messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
|
||||
battleBG = "Graphics/Battlebacks/" + backdropFilename + "_bg"
|
||||
playerBase = "Graphics/Battlebacks/" + baseFilename + "_base0"
|
||||
enemyBase = "Graphics/Battlebacks/" + baseFilename + "_base1"
|
||||
messageBG = "Graphics/Battlebacks/" + messageFilename + "_message"
|
||||
# Apply graphics
|
||||
bg = pbAddSprite("battle_bg",0,0,battleBG,@viewport)
|
||||
bg = pbAddSprite("battle_bg", 0, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg = pbAddSprite("battle_bg2",-Graphics.width,0,battleBG,@viewport)
|
||||
bg = pbAddSprite("battle_bg2", -Graphics.width, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.mirror = true
|
||||
for side in 0...2
|
||||
baseX, baseY = Battle::Scene.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}",baseX,baseY,
|
||||
(side==0) ? playerBase : enemyBase,@viewport)
|
||||
base.z = 1
|
||||
base = pbAddSprite("base_#{side}", baseX, baseY,
|
||||
(side == 0) ? playerBase : enemyBase, @viewport)
|
||||
base.z = 1
|
||||
if base.bitmap
|
||||
base.ox = base.bitmap.width/2
|
||||
base.oy = (side==0) ? base.bitmap.height : base.bitmap.height/2
|
||||
base.ox = base.bitmap.width / 2
|
||||
base.oy = (side == 0) ? base.bitmap.height : base.bitmap.height / 2
|
||||
end
|
||||
end
|
||||
cmdBarBG = pbAddSprite("cmdBar_bg",0,Graphics.height-96,messageBG,@viewport)
|
||||
cmdBarBG = pbAddSprite("cmdBar_bg", 0, Graphics.height - 96, messageBG, @viewport)
|
||||
cmdBarBG.z = 180
|
||||
end
|
||||
|
||||
def pbCreateTrainerBackSprite(idxTrainer,trainerType,numTrainers = 1)
|
||||
if idxTrainer==0 # Player's sprite
|
||||
def pbCreateTrainerBackSprite(idxTrainer, trainerType, numTrainers = 1)
|
||||
if idxTrainer == 0 # Player's sprite
|
||||
trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
|
||||
else # Partner trainer's sprite
|
||||
trainerFile = GameData::TrainerType.back_sprite_filename(trainerType)
|
||||
end
|
||||
spriteX, spriteY = Battle::Scene.pbTrainerPosition(0,idxTrainer,numTrainers)
|
||||
trainer = pbAddSprite("player_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
||||
spriteX, spriteY = Battle::Scene.pbTrainerPosition(0, idxTrainer, numTrainers)
|
||||
trainer = pbAddSprite("player_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 80+idxTrainer
|
||||
if trainer.bitmap.width>trainer.bitmap.height*2
|
||||
trainer.z = 80 + idxTrainer
|
||||
if trainer.bitmap.width > trainer.bitmap.height * 2
|
||||
trainer.src_rect.x = 0
|
||||
trainer.src_rect.width = trainer.bitmap.width/5
|
||||
trainer.src_rect.width = trainer.bitmap.width / 5
|
||||
end
|
||||
trainer.ox = trainer.src_rect.width/2
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
def pbCreateTrainerFrontSprite(idxTrainer,trainerType,numTrainers = 1)
|
||||
def pbCreateTrainerFrontSprite(idxTrainer, trainerType, numTrainers = 1)
|
||||
trainerFile = GameData::TrainerType.front_sprite_filename(trainerType)
|
||||
spriteX, spriteY = Battle::Scene.pbTrainerPosition(1,idxTrainer,numTrainers)
|
||||
trainer = pbAddSprite("trainer_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
||||
spriteX, spriteY = Battle::Scene.pbTrainerPosition(1, idxTrainer, numTrainers)
|
||||
trainer = pbAddSprite("trainer_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 7+idxTrainer
|
||||
trainer.ox = trainer.src_rect.width/2
|
||||
trainer.z = 7 + idxTrainer
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
def pbCreatePokemonSprite(idxBattler)
|
||||
sideSize = @battle.pbSideSize(idxBattler)
|
||||
batSprite = BattlerSprite.new(@viewport,sideSize,idxBattler,@animations)
|
||||
batSprite = BattlerSprite.new(@viewport, sideSize, idxBattler, @animations)
|
||||
@sprites["pokemon_#{idxBattler}"] = batSprite
|
||||
shaSprite = BattlerShadowSprite.new(@viewport,sideSize,idxBattler)
|
||||
shaSprite = BattlerShadowSprite.new(@viewport, sideSize, idxBattler)
|
||||
shaSprite.visible = false
|
||||
@sprites["shadow_#{idxBattler}"] = shaSprite
|
||||
end
|
||||
|
||||
@@ -3,18 +3,18 @@ class Battle::Scene
|
||||
# The player chooses a main command for a Pokémon
|
||||
# Return values: -1=Cancel, 0=Fight, 1=Bag, 2=Pokémon, 3=Run, 4=Call
|
||||
#=============================================================================
|
||||
def pbCommandMenu(idxBattler,firstAction)
|
||||
def pbCommandMenu(idxBattler, firstAction)
|
||||
shadowTrainer = (GameData::Type.exists?(:SHADOW) && @battle.trainerBattle?)
|
||||
cmds = [
|
||||
_INTL("What will\n{1} do?",@battle.battlers[idxBattler].name),
|
||||
_INTL("What will\n{1} do?", @battle.battlers[idxBattler].name),
|
||||
_INTL("Fight"),
|
||||
_INTL("Bag"),
|
||||
_INTL("Pokémon"),
|
||||
(shadowTrainer) ? _INTL("Call") : (firstAction) ? _INTL("Run") : _INTL("Cancel")
|
||||
]
|
||||
ret = pbCommandMenuEx(idxBattler,cmds,(shadowTrainer) ? 2 : (firstAction) ? 0 : 1)
|
||||
ret = 4 if ret==3 && shadowTrainer # Convert "Run" to "Call"
|
||||
ret = -1 if ret==3 && !firstAction # Convert "Run" to "Cancel"
|
||||
ret = pbCommandMenuEx(idxBattler, cmds, (shadowTrainer) ? 2 : (firstAction) ? 0 : 1)
|
||||
ret = 4 if ret == 3 && shadowTrainer # Convert "Run" to "Call"
|
||||
ret = -1 if ret == 3 && !firstAction # Convert "Run" to "Cancel"
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -23,11 +23,11 @@ class Battle::Scene
|
||||
# 2 = regular battle with "Call" (for Shadow Pokémon battles)
|
||||
# 3 = Safari Zone
|
||||
# 4 = Bug Catching Contest
|
||||
def pbCommandMenuEx(idxBattler,texts,mode = 0)
|
||||
def pbCommandMenuEx(idxBattler, texts, mode = 0)
|
||||
pbShowWindow(COMMAND_BOX)
|
||||
cw = @sprites["commandWindow"]
|
||||
cw.setTexts(texts)
|
||||
cw.setIndexAndMode(@lastCmd[idxBattler],mode)
|
||||
cw.setIndexAndMode(@lastCmd[idxBattler], mode)
|
||||
pbSelectBattler(idxBattler)
|
||||
ret = -1
|
||||
loop do
|
||||
@@ -35,22 +35,22 @@ class Battle::Scene
|
||||
pbUpdate(cw)
|
||||
# Update selected command
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index&1)==1
|
||||
cw.index -= 1 if (cw.index & 1) == 1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
cw.index += 1 if (cw.index&1)==0
|
||||
cw.index += 1 if (cw.index & 1) == 0
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index&2)==2
|
||||
cw.index -= 2 if (cw.index & 2) == 2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
cw.index += 2 if (cw.index&2)==0
|
||||
cw.index += 2 if (cw.index & 2) == 0
|
||||
end
|
||||
pbPlayCursorSE if cw.index!=oldIndex
|
||||
pbPlayCursorSE if cw.index != oldIndex
|
||||
# Actions
|
||||
if Input.trigger?(Input::USE) # Confirm choice
|
||||
pbPlayDecisionSE
|
||||
ret = cw.index
|
||||
@lastCmd[idxBattler] = ret
|
||||
break
|
||||
elsif Input.trigger?(Input::BACK) && mode==1 # Cancel
|
||||
elsif Input.trigger?(Input::BACK) && mode == 1 # Cancel
|
||||
pbPlayCancelSE
|
||||
break
|
||||
elsif Input.trigger?(Input::F9) && $DEBUG # Debug menu
|
||||
@@ -65,7 +65,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# The player chooses a move for a Pokémon to use
|
||||
#=============================================================================
|
||||
def pbFightMenu(idxBattler,megaEvoPossible = false)
|
||||
def pbFightMenu(idxBattler, megaEvoPossible = false)
|
||||
battler = @battle.battlers[idxBattler]
|
||||
cw = @sprites["fightWindow"]
|
||||
cw.battler = battler
|
||||
@@ -74,7 +74,7 @@ class Battle::Scene
|
||||
moveIndex = @lastMove[idxBattler]
|
||||
end
|
||||
cw.shiftMode = (@battle.pbCanShift?(idxBattler)) ? 1 : 0
|
||||
cw.setIndexAndMode(moveIndex,(megaEvoPossible) ? 1 : 0)
|
||||
cw.setIndexAndMode(moveIndex, (megaEvoPossible) ? 1 : 0)
|
||||
needFullRefresh = true
|
||||
needRefresh = false
|
||||
loop do
|
||||
@@ -87,7 +87,7 @@ class Battle::Scene
|
||||
if needRefresh
|
||||
if megaEvoPossible
|
||||
newMode = (@battle.pbRegisteredMegaEvolution?(idxBattler)) ? 2 : 1
|
||||
cw.mode = newMode if newMode!=cw.mode
|
||||
cw.mode = newMode if newMode != cw.mode
|
||||
end
|
||||
needRefresh = false
|
||||
end
|
||||
@@ -96,19 +96,19 @@ class Battle::Scene
|
||||
pbUpdate(cw)
|
||||
# Update selected command
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index&1)==1
|
||||
cw.index -= 1 if (cw.index & 1) == 1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id
|
||||
cw.index += 1 if (cw.index&1)==0
|
||||
if battler.moves[cw.index + 1] && battler.moves[cw.index + 1].id
|
||||
cw.index += 1 if (cw.index & 1) == 0
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index&2)==2
|
||||
cw.index -= 2 if (cw.index & 2) == 2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id
|
||||
cw.index += 2 if (cw.index&2)==0
|
||||
if battler.moves[cw.index + 2] && battler.moves[cw.index + 2].id
|
||||
cw.index += 2 if (cw.index & 2) == 0
|
||||
end
|
||||
end
|
||||
pbPlayCursorSE if cw.index!=oldIndex
|
||||
pbPlayCursorSE if cw.index != oldIndex
|
||||
# Actions
|
||||
if Input.trigger?(Input::USE) # Confirm choice
|
||||
pbPlayDecisionSE
|
||||
@@ -126,7 +126,7 @@ class Battle::Scene
|
||||
needRefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::SPECIAL) # Shift
|
||||
if cw.shiftMode>0
|
||||
if cw.shiftMode > 0
|
||||
pbPlayDecisionSE
|
||||
break if yield -3
|
||||
needRefresh = true
|
||||
@@ -140,7 +140,7 @@ class Battle::Scene
|
||||
# Opens the party screen to choose a Pokémon to switch in (or just view its
|
||||
# summary screens)
|
||||
#=============================================================================
|
||||
def pbPartyScreen(idxBattler,canCancel = false)
|
||||
def pbPartyScreen(idxBattler, canCancel = false)
|
||||
# Fade out and hide all sprites
|
||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||
# Get player's party
|
||||
@@ -149,14 +149,14 @@ class Battle::Scene
|
||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||
# Start party screen
|
||||
scene = PokemonParty_Scene.new
|
||||
switchScreen = PokemonPartyScreen.new(scene,modParty)
|
||||
switchScreen.pbStartScene(_INTL("Choose a Pokémon."),@battle.pbNumPositions(0,0))
|
||||
switchScreen = PokemonPartyScreen.new(scene, modParty)
|
||||
switchScreen.pbStartScene(_INTL("Choose a Pokémon."), @battle.pbNumPositions(0, 0))
|
||||
# Loop while in party screen
|
||||
loop do
|
||||
# Select a Pokémon
|
||||
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
|
||||
idxParty = switchScreen.pbChoosePokemon
|
||||
if idxParty<0
|
||||
if idxParty < 0
|
||||
next if !canCancel
|
||||
break
|
||||
end
|
||||
@@ -167,29 +167,29 @@ class Battle::Scene
|
||||
commands[cmdSwitch = commands.length] = _INTL("Switch In") if modParty[idxParty].able?
|
||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||
commands[commands.length] = _INTL("Cancel")
|
||||
command = scene.pbShowCommands(_INTL("Do what with {1}?",modParty[idxParty].name),commands)
|
||||
if cmdSwitch>=0 && command==cmdSwitch # Switch In
|
||||
command = scene.pbShowCommands(_INTL("Do what with {1}?", modParty[idxParty].name), commands)
|
||||
if cmdSwitch >= 0 && command == cmdSwitch # Switch In
|
||||
idxPartyRet = -1
|
||||
partyPos.each_with_index do |pos,i|
|
||||
next if pos!=idxParty+partyStart
|
||||
partyPos.each_with_index do |pos, i|
|
||||
next if pos != idxParty + partyStart
|
||||
idxPartyRet = i
|
||||
break
|
||||
end
|
||||
break if yield idxPartyRet, switchScreen
|
||||
elsif cmdSummary>=0 && command==cmdSummary # Summary
|
||||
scene.pbSummary(idxParty,true)
|
||||
elsif cmdSummary >= 0 && command == cmdSummary # Summary
|
||||
scene.pbSummary(idxParty, true)
|
||||
end
|
||||
end
|
||||
# Close party screen
|
||||
switchScreen.pbEndScene
|
||||
# Fade back into battle screen
|
||||
pbFadeInAndShow(@sprites,visibleSprites)
|
||||
pbFadeInAndShow(@sprites, visibleSprites)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Opens the Bag screen and chooses an item to use
|
||||
#=============================================================================
|
||||
def pbItemMenu(idxBattler,_firstAction)
|
||||
def pbItemMenu(idxBattler, _firstAction)
|
||||
# Fade out and hide all sprites
|
||||
visibleSprites = pbFadeOutAndHide(@sprites)
|
||||
# Set Bag starting positions
|
||||
@@ -216,10 +216,10 @@ class Battle::Scene
|
||||
useType = item.battle_use
|
||||
cmdUse = -1
|
||||
commands = []
|
||||
commands[cmdUse = commands.length] = _INTL("Use") if useType && useType!=0
|
||||
commands[cmdUse = commands.length] = _INTL("Use") if useType && useType != 0
|
||||
commands[commands.length] = _INTL("Cancel")
|
||||
command = itemScene.pbShowCommands(_INTL("{1} is selected.",itemName),commands)
|
||||
next unless cmdUse>=0 && command==cmdUse # Use
|
||||
command = itemScene.pbShowCommands(_INTL("{1} is selected.", itemName), commands)
|
||||
next unless cmdUse >= 0 && command == cmdUse # Use
|
||||
# Use types:
|
||||
# 0 = not usable in battle
|
||||
# 1 = use on Pokémon (lots of items, Blue Flute)
|
||||
@@ -233,11 +233,11 @@ class Battle::Scene
|
||||
# are the only available Pokémon/battler to use the item on
|
||||
case useType
|
||||
when 1 # Use on Pokémon
|
||||
if @battle.pbTeamLengthFromBattlerIndex(idxBattler)==1
|
||||
if @battle.pbTeamLengthFromBattlerIndex(idxBattler) == 1
|
||||
break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene
|
||||
end
|
||||
when 3 # Use on battler
|
||||
if @battle.pbPlayerBattlerCount==1
|
||||
if @battle.pbPlayerBattlerCount == 1
|
||||
break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene
|
||||
end
|
||||
end
|
||||
@@ -250,38 +250,38 @@ class Battle::Scene
|
||||
modParty = @battle.pbPlayerDisplayParty(idxBattler)
|
||||
# Start party screen
|
||||
pkmnScene = PokemonParty_Scene.new
|
||||
pkmnScreen = PokemonPartyScreen.new(pkmnScene,modParty)
|
||||
pkmnScreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.pbNumPositions(0,0))
|
||||
pkmnScreen = PokemonPartyScreen.new(pkmnScene, modParty)
|
||||
pkmnScreen.pbStartScene(_INTL("Use on which Pokémon?"), @battle.pbNumPositions(0, 0))
|
||||
idxParty = -1
|
||||
# Loop while in party screen
|
||||
loop do
|
||||
# Select a Pokémon
|
||||
pkmnScene.pbSetHelpText(_INTL("Use on which Pokémon?"))
|
||||
idxParty = pkmnScreen.pbChoosePokemon
|
||||
break if idxParty<0
|
||||
break if idxParty < 0
|
||||
idxPartyRet = -1
|
||||
partyPos.each_with_index do |pos,i|
|
||||
next if pos!=idxParty+partyStart
|
||||
partyPos.each_with_index do |pos, i|
|
||||
next if pos != idxParty + partyStart
|
||||
idxPartyRet = i
|
||||
break
|
||||
end
|
||||
next if idxPartyRet<0
|
||||
next if idxPartyRet < 0
|
||||
pkmn = party[idxPartyRet]
|
||||
next if !pkmn || pkmn.egg?
|
||||
idxMove = -1
|
||||
if useType==2 # Use on Pokémon's move
|
||||
idxMove = pkmnScreen.pbChooseMove(pkmn,_INTL("Restore which move?"))
|
||||
next if idxMove<0
|
||||
if useType == 2 # Use on Pokémon's move
|
||||
idxMove = pkmnScreen.pbChooseMove(pkmn, _INTL("Restore which move?"))
|
||||
next if idxMove < 0
|
||||
end
|
||||
break if yield item.id, useType, idxPartyRet, idxMove, pkmnScene
|
||||
end
|
||||
pkmnScene.pbEndScene
|
||||
break if idxParty>=0
|
||||
break if idxParty >= 0
|
||||
# Cancelled choosing a Pokémon; show the Bag screen again
|
||||
itemScene.pbFadeInScene
|
||||
when 4 # Use on opposing battler (Poké Balls)
|
||||
idxTarget = -1
|
||||
if @battle.pbOpposingBattlerCount(idxBattler)==1
|
||||
if @battle.pbOpposingBattlerCount(idxBattler) == 1
|
||||
@battle.allOtherSideBattlers(idxBattler).each { |b| idxTarget = b.index }
|
||||
break if yield item.id, useType, idxTarget, -1, itemScene
|
||||
else
|
||||
@@ -292,8 +292,8 @@ class Battle::Scene
|
||||
tempVisibleSprites = visibleSprites.clone
|
||||
tempVisibleSprites["commandWindow"] = false
|
||||
tempVisibleSprites["targetWindow"] = true
|
||||
idxTarget = pbChooseTarget(idxBattler,GameData::Target.get(:Foe),tempVisibleSprites)
|
||||
if idxTarget>=0
|
||||
idxTarget = pbChooseTarget(idxBattler, GameData::Target.get(:Foe), tempVisibleSprites)
|
||||
if idxTarget >= 0
|
||||
break if yield item.id, useType, idxTarget, -1, self
|
||||
end
|
||||
# Target invalid/cancelled choosing a target; show the Bag screen again
|
||||
@@ -312,7 +312,7 @@ class Battle::Scene
|
||||
# Close Bag screen
|
||||
itemScene.pbEndScene
|
||||
# Fade back into battle screen (if not already showing it)
|
||||
pbFadeInAndShow(@sprites,visibleSprites) if !wasTargeting
|
||||
pbFadeInAndShow(@sprites, visibleSprites) if !wasTargeting
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -322,7 +322,7 @@ class Battle::Scene
|
||||
# target.
|
||||
# nil means can't select that position, "" means can select that position but
|
||||
# there is no battler there, otherwise is a battler's name.
|
||||
def pbCreateTargetTexts(idxBattler,target_data)
|
||||
def pbCreateTargetTexts(idxBattler, target_data)
|
||||
texts = Array.new(@battle.battlers.length) do |i|
|
||||
next nil if !@battle.battlers[i]
|
||||
showName = false
|
||||
@@ -331,15 +331,15 @@ class Battle::Scene
|
||||
# other targets are handled by the "else" part.
|
||||
case target_data.id
|
||||
when :None, :User, :RandomNearFoe
|
||||
showName = (i==idxBattler)
|
||||
showName = (i == idxBattler)
|
||||
when :UserSide
|
||||
showName = !@battle.opposes?(i,idxBattler)
|
||||
showName = !@battle.opposes?(i, idxBattler)
|
||||
when :FoeSide
|
||||
showName = @battle.opposes?(i,idxBattler)
|
||||
showName = @battle.opposes?(i, idxBattler)
|
||||
when :BothSides
|
||||
showName = true
|
||||
else
|
||||
showName = @battle.pbMoveCanTarget?(i,idxBattler,target_data)
|
||||
showName = @battle.pbMoveCanTarget?(i, idxBattler, target_data)
|
||||
end
|
||||
next nil if !showName
|
||||
next (@battle.battlers[i].fainted?) ? "" : @battle.battlers[i].name
|
||||
@@ -349,22 +349,22 @@ class Battle::Scene
|
||||
|
||||
# Returns the initial position of the cursor when choosing a target for a move
|
||||
# in a non-single battle.
|
||||
def pbFirstTarget(idxBattler,target_data)
|
||||
def pbFirstTarget(idxBattler, target_data)
|
||||
case target_data.id
|
||||
when :NearAlly
|
||||
@battle.allSameSideBattlers(idxBattler).each do |b|
|
||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||
next if b.index == idxBattler || !@battle.nearBattlers?(b, idxBattler)
|
||||
next if b.fainted?
|
||||
return b.index
|
||||
end
|
||||
@battle.allSameSideBattlers(idxBattler).each do |b|
|
||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||
next if b.index == idxBattler || !@battle.nearBattlers?(b, idxBattler)
|
||||
return b.index
|
||||
end
|
||||
when :NearFoe, :NearOther
|
||||
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
||||
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && !@battle.battlers[i].fainted? }
|
||||
indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }
|
||||
indices.each { |i| return i if @battle.nearBattlers?(i, idxBattler) && !@battle.battlers[i].fainted? }
|
||||
indices.each { |i| return i if @battle.nearBattlers?(i, idxBattler) }
|
||||
when :Foe, :Other
|
||||
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
||||
indices.each { |i| return i if !@battle.battlers[i].fainted? }
|
||||
@@ -373,37 +373,37 @@ class Battle::Scene
|
||||
return idxBattler # Target the user initially
|
||||
end
|
||||
|
||||
def pbChooseTarget(idxBattler,target_data,visibleSprites = nil)
|
||||
def pbChooseTarget(idxBattler, target_data, visibleSprites = nil)
|
||||
pbShowWindow(TARGET_BOX)
|
||||
cw = @sprites["targetWindow"]
|
||||
# Create an array of battler names (only valid targets are named)
|
||||
texts = pbCreateTargetTexts(idxBattler,target_data)
|
||||
texts = pbCreateTargetTexts(idxBattler, target_data)
|
||||
# Determine mode based on target_data
|
||||
mode = (target_data.num_targets == 1) ? 0 : 1
|
||||
cw.setDetails(texts,mode)
|
||||
cw.index = pbFirstTarget(idxBattler,target_data)
|
||||
pbSelectBattler((mode==0) ? cw.index : texts,2) # Select initial battler/data box
|
||||
pbFadeInAndShow(@sprites,visibleSprites) if visibleSprites
|
||||
cw.setDetails(texts, mode)
|
||||
cw.index = pbFirstTarget(idxBattler, target_data)
|
||||
pbSelectBattler((mode == 0) ? cw.index : texts, 2) # Select initial battler/data box
|
||||
pbFadeInAndShow(@sprites, visibleSprites) if visibleSprites
|
||||
ret = -1
|
||||
loop do
|
||||
oldIndex = cw.index
|
||||
pbUpdate(cw)
|
||||
# Update selected command
|
||||
if mode==0 # Choosing just one target, can change index
|
||||
if mode == 0 # Choosing just one target, can change index
|
||||
if Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
|
||||
inc = ((cw.index%2)==0) ? -2 : 2
|
||||
inc = ((cw.index % 2) == 0) ? -2 : 2
|
||||
inc *= -1 if Input.trigger?(Input::RIGHT)
|
||||
indexLength = @battle.sideSizes[cw.index%2]*2
|
||||
indexLength = @battle.sideSizes[cw.index % 2] * 2
|
||||
newIndex = cw.index
|
||||
loop do
|
||||
newIndex += inc
|
||||
break if newIndex<0 || newIndex>=indexLength
|
||||
break if newIndex < 0 || newIndex >= indexLength
|
||||
next if texts[newIndex].nil?
|
||||
cw.index = newIndex
|
||||
break
|
||||
end
|
||||
elsif (Input.trigger?(Input::UP) && (cw.index%2)==0) ||
|
||||
(Input.trigger?(Input::DOWN) && (cw.index%2)==1)
|
||||
elsif (Input.trigger?(Input::UP) && (cw.index % 2) == 0) ||
|
||||
(Input.trigger?(Input::DOWN) && (cw.index % 2) == 1)
|
||||
tryIndex = @battle.pbGetOpposingIndicesInOrder(cw.index)
|
||||
tryIndex.each do |idxBattlerTry|
|
||||
next if texts[idxBattlerTry].nil?
|
||||
@@ -411,9 +411,9 @@ class Battle::Scene
|
||||
break
|
||||
end
|
||||
end
|
||||
if cw.index!=oldIndex
|
||||
if cw.index != oldIndex
|
||||
pbPlayCursorSE
|
||||
pbSelectBattler(cw.index,2) # Select the new battler/data box
|
||||
pbSelectBattler(cw.index, 2) # Select the new battler/data box
|
||||
end
|
||||
end
|
||||
if Input.trigger?(Input::USE) # Confirm
|
||||
@@ -436,12 +436,12 @@ class Battle::Scene
|
||||
# Called whenever a Pokémon should forget a move. It should return -1 if the
|
||||
# selection is canceled, or 0 to 3 to indicate the move to forget. It should
|
||||
# not allow HM moves to be forgotten.
|
||||
def pbForgetMove(pkmn,moveToLearn)
|
||||
def pbForgetMove(pkmn, moveToLearn)
|
||||
ret = -1
|
||||
pbFadeOutIn {
|
||||
scene = PokemonSummary_Scene.new
|
||||
screen = PokemonSummaryScreen.new(scene)
|
||||
ret = screen.pbStartForgetScreen([pkmn],0,moveToLearn)
|
||||
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
|
||||
}
|
||||
return ret
|
||||
end
|
||||
@@ -449,7 +449,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Opens the nicknaming screen for a newly caught Pokémon
|
||||
#=============================================================================
|
||||
def pbNameEntry(helpText,pkmn)
|
||||
def pbNameEntry(helpText, pkmn)
|
||||
return pbEnterPokemonName(helpText, 0, Pokemon::MAX_NAME_SIZE, "", pkmn)
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbBattleIntroAnimation
|
||||
# Make everything appear
|
||||
introAnim = Animation::Intro.new(@sprites,@viewport,@battle)
|
||||
introAnim = Animation::Intro.new(@sprites, @viewport, @battle)
|
||||
loop do
|
||||
introAnim.update
|
||||
pbUpdate
|
||||
@@ -19,8 +19,8 @@ class Battle::Scene
|
||||
# entrance animation. Be sure to set it up like a Pokémon entrance
|
||||
# animation, i.e. add them to @animations so that they can play out
|
||||
# while party lineups appear and messages show.
|
||||
pbShowPartyLineup(0,true)
|
||||
pbShowPartyLineup(1,true)
|
||||
pbShowPartyLineup(0, true)
|
||||
pbShowPartyLineup(1, true)
|
||||
return
|
||||
end
|
||||
# Wild battle: play wild Pokémon's intro animations (including cry), show
|
||||
@@ -28,14 +28,14 @@ class Battle::Scene
|
||||
# shiny animation(s)
|
||||
# Set up data box animation
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
idxBattler = 2*i+1
|
||||
idxBattler = 2 * i + 1
|
||||
next if !@battle.battlers[idxBattler]
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler)
|
||||
@animations.push(dataBoxAnim)
|
||||
end
|
||||
# Set up wild Pokémon returning to normal colour and playing intro
|
||||
# animations (including cry)
|
||||
@animations.push(Animation::Intro2.new(@sprites,@viewport,@battle.sideSizes[1]))
|
||||
@animations.push(Animation::Intro2.new(@sprites, @viewport, @battle.sideSizes[1]))
|
||||
# Play all the animations
|
||||
while inPartyAnimation?
|
||||
pbUpdate
|
||||
@@ -43,7 +43,7 @@ class Battle::Scene
|
||||
# Show shiny animation for wild Pokémon
|
||||
if @battle.showAnims
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
idxBattler = 2*i+1
|
||||
idxBattler = 2 * i + 1
|
||||
next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny?
|
||||
if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny?
|
||||
pbCommonAnimation("SuperShiny", @battle.battlers[idxBattler])
|
||||
@@ -57,9 +57,9 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates a party lineup appearing for the given side
|
||||
#=============================================================================
|
||||
def pbShowPartyLineup(side,fullAnim = false)
|
||||
@animations.push(Animation::LineupAppear.new(@sprites,@viewport,
|
||||
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
||||
def pbShowPartyLineup(side, fullAnim = false)
|
||||
@animations.push(Animation::LineupAppear.new(@sprites, @viewport,
|
||||
side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim))
|
||||
if !fullAnim
|
||||
while inPartyAnimation?
|
||||
pbUpdate
|
||||
@@ -74,7 +74,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbShowOpponent(idxTrainer)
|
||||
# Set up trainer appearing animation
|
||||
appearAnim = Animation::TrainerAppear.new(@sprites,@viewport,idxTrainer)
|
||||
appearAnim = Animation::TrainerAppear.new(@sprites, @viewport, idxTrainer)
|
||||
@animations.push(appearAnim)
|
||||
# Play the animation
|
||||
while inPartyAnimation?
|
||||
@@ -88,8 +88,8 @@ class Battle::Scene
|
||||
# animation for it if relevant.
|
||||
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
||||
#=============================================================================
|
||||
def pbSendOutBattlers(sendOuts,startBattle = false)
|
||||
return if sendOuts.length==0
|
||||
def pbSendOutBattlers(sendOuts, startBattle = false)
|
||||
return if sendOuts.length == 0
|
||||
# If party balls are still appearing, wait for them to finish showing up, as
|
||||
# the FadeAnimation will make them disappear.
|
||||
while inPartyAnimation?
|
||||
@@ -99,29 +99,29 @@ class Battle::Scene
|
||||
# Make all trainers and party lineups disappear (player-side trainers may
|
||||
# animate throwing a Poké Ball)
|
||||
if @battle.opposes?(sendOuts[0][0])
|
||||
fadeAnim = Animation::TrainerFade.new(@sprites,@viewport,startBattle)
|
||||
fadeAnim = Animation::TrainerFade.new(@sprites, @viewport, startBattle)
|
||||
else
|
||||
fadeAnim = Animation::PlayerFade.new(@sprites,@viewport,startBattle)
|
||||
fadeAnim = Animation::PlayerFade.new(@sprites, @viewport, startBattle)
|
||||
end
|
||||
# For each battler being sent out, set the battler's sprite and create two
|
||||
# animations (the Poké Ball moving and battler appearing from it, and its
|
||||
# data box appearing)
|
||||
sendOutAnims = []
|
||||
sendOuts.each_with_index do |b,i|
|
||||
sendOuts.each_with_index do |b, i|
|
||||
pkmn = @battle.battlers[b[0]].effects[PBEffects::Illusion] || b[1]
|
||||
pbChangePokemon(b[0],pkmn)
|
||||
pbChangePokemon(b[0], pkmn)
|
||||
pbRefresh
|
||||
if @battle.opposes?(b[0])
|
||||
sendOutAnim = Animation::PokeballTrainerSendOut.new(@sprites,@viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0])+1,
|
||||
@battle.battlers[b[0]],startBattle,i)
|
||||
sendOutAnim = Animation::PokeballTrainerSendOut.new(@sprites, @viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
|
||||
@battle.battlers[b[0]], startBattle, i)
|
||||
else
|
||||
sendOutAnim = Animation::PokeballPlayerSendOut.new(@sprites,@viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0])+1,
|
||||
@battle.battlers[b[0]],startBattle,i)
|
||||
sendOutAnim = Animation::PokeballPlayerSendOut.new(@sprites, @viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
|
||||
@battle.battlers[b[0]], startBattle, i)
|
||||
end
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites,@viewport,b[0])
|
||||
sendOutAnims.push([sendOutAnim,dataBoxAnim,false])
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, b[0])
|
||||
sendOutAnims.push([sendOutAnim, dataBoxAnim, false])
|
||||
end
|
||||
# Play all animations
|
||||
loop do
|
||||
@@ -159,7 +159,7 @@ class Battle::Scene
|
||||
def pbRecall(idxBattler)
|
||||
@briefMessage = false
|
||||
# Recall animation
|
||||
recallAnim = Animation::BattlerRecall.new(@sprites,@viewport,idxBattler)
|
||||
recallAnim = Animation::BattlerRecall.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
recallAnim.update if recallAnim
|
||||
pbUpdate
|
||||
@@ -167,7 +167,7 @@ class Battle::Scene
|
||||
end
|
||||
recallAnim.dispose
|
||||
# Data box disappear animation
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
dataBoxAnim.update
|
||||
pbUpdate
|
||||
@@ -181,10 +181,10 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbShowAbilitySplash(battler)
|
||||
return if !USE_ABILITY_SPLASH
|
||||
side = battler.index%2
|
||||
side = battler.index % 2
|
||||
pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
|
||||
@sprites["abilityBar_#{side}"].battler = battler
|
||||
abilitySplashAnim = Animation::AbilitySplashAppear.new(@sprites,@viewport,side)
|
||||
abilitySplashAnim = Animation::AbilitySplashAppear.new(@sprites, @viewport, side)
|
||||
loop do
|
||||
abilitySplashAnim.update
|
||||
pbUpdate
|
||||
@@ -195,9 +195,9 @@ class Battle::Scene
|
||||
|
||||
def pbHideAbilitySplash(battler)
|
||||
return if !USE_ABILITY_SPLASH
|
||||
side = battler.index%2
|
||||
side = battler.index % 2
|
||||
return if !@sprites["abilityBar_#{side}"].visible
|
||||
abilitySplashAnim = Animation::AbilitySplashDisappear.new(@sprites,@viewport,side)
|
||||
abilitySplashAnim = Animation::AbilitySplashDisappear.new(@sprites, @viewport, side)
|
||||
loop do
|
||||
abilitySplashAnim.update
|
||||
pbUpdate
|
||||
@@ -216,23 +216,23 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Shows a HP-changing common animation and animates a data box's HP bar.
|
||||
# Called by def pbReduceHP, def pbRecoverHP.
|
||||
def pbHPChanged(battler,oldHP,showAnim = false)
|
||||
def pbHPChanged(battler, oldHP, showAnim = false)
|
||||
@briefMessage = false
|
||||
if battler.hp>oldHP
|
||||
pbCommonAnimation("HealthUp",battler) if showAnim && @battle.showAnims
|
||||
elsif battler.hp<oldHP
|
||||
pbCommonAnimation("HealthDown",battler) if showAnim && @battle.showAnims
|
||||
if battler.hp > oldHP
|
||||
pbCommonAnimation("HealthUp", battler) if showAnim && @battle.showAnims
|
||||
elsif battler.hp < oldHP
|
||||
pbCommonAnimation("HealthDown", battler) if showAnim && @battle.showAnims
|
||||
end
|
||||
@sprites["dataBox_#{battler.index}"].animateHP(oldHP,battler.hp,battler.totalhp)
|
||||
@sprites["dataBox_#{battler.index}"].animateHP(oldHP, battler.hp, battler.totalhp)
|
||||
while @sprites["dataBox_#{battler.index}"].animatingHP
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
|
||||
def pbDamageAnimation(battler,effectiveness = 0)
|
||||
def pbDamageAnimation(battler, effectiveness = 0)
|
||||
@briefMessage = false
|
||||
# Damage animation
|
||||
damageAnim = Animation::BattlerDamage.new(@sprites,@viewport,battler.index,effectiveness)
|
||||
damageAnim = Animation::BattlerDamage.new(@sprites, @viewport, battler.index, effectiveness)
|
||||
loop do
|
||||
damageAnim.update
|
||||
pbUpdate
|
||||
@@ -249,9 +249,9 @@ class Battle::Scene
|
||||
# Set up animations
|
||||
damageAnims = []
|
||||
targets.each do |t|
|
||||
anim = Animation::BattlerDamage.new(@sprites,@viewport,t[0].index,t[2])
|
||||
anim = Animation::BattlerDamage.new(@sprites, @viewport, t[0].index, t[2])
|
||||
damageAnims.push(anim)
|
||||
@sprites["dataBox_#{t[0].index}"].animateHP(t[1],t[0].hp,t[0].totalhp)
|
||||
@sprites["dataBox_#{t[0].index}"].animateHP(t[1], t[0].hp, t[0].totalhp)
|
||||
end
|
||||
# Update loop
|
||||
loop do
|
||||
@@ -278,13 +278,13 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates a data box's Exp bar
|
||||
#=============================================================================
|
||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2)
|
||||
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2)
|
||||
return if !battler || endExp == startExp
|
||||
startExpLevel = tempExp1-startExp
|
||||
endExpLevel = tempExp2-startExp
|
||||
expRange = endExp-startExp
|
||||
startExpLevel = tempExp1 - startExp
|
||||
endExpLevel = tempExp2 - startExp
|
||||
expRange = endExp - startExp
|
||||
dataBox = @sprites["dataBox_#{battler.index}"]
|
||||
dataBox.animateExp(startExpLevel,endExpLevel,expRange)
|
||||
dataBox.animateExp(startExpLevel, endExpLevel, expRange)
|
||||
while dataBox.animatingExp
|
||||
pbUpdate
|
||||
end
|
||||
@@ -293,14 +293,14 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Shows stats windows upon a Pokémon levelling up
|
||||
#=============================================================================
|
||||
def pbLevelUp(pkmn,_battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
|
||||
def pbLevelUp(pkmn, _battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed)
|
||||
pbTopRightWindow(
|
||||
_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
|
||||
pkmn.totalhp-oldTotalHP,pkmn.attack-oldAttack,pkmn.defense-oldDefense,
|
||||
pkmn.spatk-oldSpAtk,pkmn.spdef-oldSpDef,pkmn.speed-oldSpeed))
|
||||
pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense,
|
||||
pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed))
|
||||
pbTopRightWindow(
|
||||
_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
|
||||
pkmn.totalhp,pkmn.attack,pkmn.defense,pkmn.spatk,pkmn.spdef,pkmn.speed))
|
||||
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed))
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -309,8 +309,8 @@ class Battle::Scene
|
||||
def pbFaintBattler(battler)
|
||||
@briefMessage = false
|
||||
# Pokémon plays cry and drops down, data box disappears
|
||||
faintAnim = Animation::BattlerFaint.new(@sprites,@viewport,battler.index,@battle)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,battler.index)
|
||||
faintAnim = Animation::BattlerFaint.new(@sprites, @viewport, battler.index, @battle)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, battler.index)
|
||||
loop do
|
||||
faintAnim.update
|
||||
dataBoxAnim.update
|
||||
@@ -324,10 +324,10 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates throwing a Poké Ball at a Pokémon in an attempt to catch it
|
||||
#=============================================================================
|
||||
def pbThrow(ball,shakes,critical,targetBattler,showPlayer = false)
|
||||
def pbThrow(ball, shakes, critical, targetBattler, showPlayer = false)
|
||||
@briefMessage = false
|
||||
captureAnim = Animation::PokeballThrowCapture.new(@sprites,@viewport,
|
||||
ball,shakes,critical,@battle.battlers[targetBattler],showPlayer)
|
||||
captureAnim = Animation::PokeballThrowCapture.new(@sprites, @viewport,
|
||||
ball, shakes, critical, @battle.battlers[targetBattler], showPlayer)
|
||||
loop do
|
||||
captureAnim.update
|
||||
pbUpdate
|
||||
@@ -343,7 +343,7 @@ class Battle::Scene
|
||||
i = 0
|
||||
loop do
|
||||
pbUpdate
|
||||
break if i>=Graphics.frame_rate*3.5 # 3.5 seconds
|
||||
break if i >= Graphics.frame_rate * 3.5 # 3.5 seconds
|
||||
i += 1
|
||||
end
|
||||
pbMEStop
|
||||
@@ -355,20 +355,20 @@ class Battle::Scene
|
||||
ball = @sprites["captureBall"]
|
||||
return if !ball
|
||||
# Data box disappear animation
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
dataBoxAnim.update
|
||||
ball.opacity -= 12*20/Graphics.frame_rate if ball.opacity>0
|
||||
ball.opacity -= 12 * 20 / Graphics.frame_rate if ball.opacity > 0
|
||||
pbUpdate
|
||||
break if dataBoxAnim.animDone? && ball.opacity<=0
|
||||
break if dataBoxAnim.animDone? && ball.opacity <= 0
|
||||
end
|
||||
dataBoxAnim.dispose
|
||||
end
|
||||
|
||||
def pbThrowAndDeflect(ball,idxBattler)
|
||||
def pbThrowAndDeflect(ball, idxBattler)
|
||||
@briefMessage = false
|
||||
throwAnim = Animation::PokeballThrowDeflect.new(@sprites,@viewport,
|
||||
ball,@battle.battlers[idxBattler])
|
||||
throwAnim = Animation::PokeballThrowDeflect.new(@sprites, @viewport,
|
||||
ball, @battle.battlers[idxBattler])
|
||||
loop do
|
||||
throwAnim.update
|
||||
pbUpdate
|
||||
@@ -403,17 +403,17 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum = 0)
|
||||
def pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum = 0)
|
||||
real_move_id = GameData::Move.get(moveID).id
|
||||
noFlip = false
|
||||
if (idxUser&1)==0 # On player's side
|
||||
if (idxUser & 1) == 0 # On player's side
|
||||
anim = move2anim[0][real_move_id]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][real_move_id]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][real_move_id] if !anim
|
||||
end
|
||||
return [anim+hitNum,noFlip] if anim
|
||||
return [anim + hitNum, noFlip] if anim
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -483,8 +483,8 @@ class Battle::Scene
|
||||
# Plays a move/common animation
|
||||
#=============================================================================
|
||||
# Plays a move animation.
|
||||
def pbAnimation(moveID,user,targets,hitNum = 0)
|
||||
animID = pbFindMoveAnimation(moveID,user.index,hitNum)
|
||||
def pbAnimation(moveID, user, targets, hitNum = 0)
|
||||
animID = pbFindMoveAnimation(moveID, user.index, hitNum)
|
||||
return if !animID
|
||||
anim = animID[0]
|
||||
target = (targets && targets.is_a?(Array)) ? targets[0] : targets
|
||||
@@ -492,27 +492,27 @@ class Battle::Scene
|
||||
return if !animations
|
||||
pbSaveShadows {
|
||||
if animID[1] # On opposing side and using OppMove animation
|
||||
pbAnimationCore(animations[anim],target,user,true)
|
||||
pbAnimationCore(animations[anim], target, user, true)
|
||||
else # On player's side, and/or using Move animation
|
||||
pbAnimationCore(animations[anim],user,target)
|
||||
pbAnimationCore(animations[anim], user, target)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName,user = nil,target = nil)
|
||||
def pbCommonAnimation(animName, user = nil, target = nil)
|
||||
return if nil_or_empty?(animName)
|
||||
target = target[0] if target && target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
animations.each do |a|
|
||||
next if !a || a.name!="Common:"+animName
|
||||
pbAnimationCore(a,user,(target!=nil) ? target : user)
|
||||
next if !a || a.name != "Common:" + animName
|
||||
pbAnimationCore(a, user, (target != nil) ? target : user)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def pbAnimationCore(animation,user,target,oppMove = false)
|
||||
def pbAnimationCore(animation, user, target, oppMove = false)
|
||||
return if !animation
|
||||
@briefMessage = false
|
||||
userSprite = (user) ? @sprites["pokemon_#{user.index}"] : nil
|
||||
@@ -523,7 +523,7 @@ class Battle::Scene
|
||||
oldTargetX = (targetSprite) ? targetSprite.x : oldUserX
|
||||
oldTargetY = (targetSprite) ? targetSprite.y : oldUserY
|
||||
# Create the animation player
|
||||
animPlayer = PBAnimationPlayerX.new(animation,user,target,self,oppMove)
|
||||
animPlayer = PBAnimationPlayerX.new(animation, user, target, self, oppMove)
|
||||
# Apply a transformation to the animation based on where the user and target
|
||||
# actually are. Get the centres of each sprite.
|
||||
userHeight = (userSprite && userSprite.bitmap && !userSprite.bitmap.disposed?) ? userSprite.bitmap.height : 128
|
||||
|
||||
@@ -20,7 +20,7 @@ class Battle::Scene::MenuBase
|
||||
@y = 0
|
||||
@z = 0
|
||||
@visible = false
|
||||
@color = Color.new(0,0,0,0)
|
||||
@color = Color.new(0, 0, 0, 0)
|
||||
@index = 0
|
||||
@mode = 0
|
||||
@disposed = false
|
||||
@@ -61,27 +61,27 @@ class Battle::Scene::MenuBase
|
||||
oldValue = @index
|
||||
@index = value
|
||||
@cmdWindow.index = @index if @cmdWindow
|
||||
refresh if @index!=oldValue
|
||||
refresh if @index != oldValue
|
||||
end
|
||||
|
||||
def mode=(value)
|
||||
oldValue = @mode
|
||||
@mode = value
|
||||
refresh if @mode!=oldValue
|
||||
refresh if @mode != oldValue
|
||||
end
|
||||
|
||||
def addSprite(key,sprite)
|
||||
def addSprite(key, sprite)
|
||||
@sprites[key] = sprite
|
||||
@visibility[key] = true
|
||||
end
|
||||
|
||||
def setIndexAndMode(index,mode)
|
||||
def setIndexAndMode(index, mode)
|
||||
oldIndex = @index
|
||||
oldMode = @mode
|
||||
@index = index
|
||||
@mode = mode
|
||||
@cmdWindow.index = @index if @cmdWindow
|
||||
refresh if @index!=oldIndex || @mode!=oldMode
|
||||
refresh if @index != oldIndex || @mode != oldMode
|
||||
end
|
||||
|
||||
def refresh; end
|
||||
@@ -106,52 +106,52 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
USE_GRAPHICS = true
|
||||
# Lists of which button graphics to use in different situations/types of battle.
|
||||
MODES = [
|
||||
[0,2,1,3], # 0 = Regular battle
|
||||
[0,2,1,9], # 1 = Regular battle with "Cancel" instead of "Run"
|
||||
[0,2,1,4], # 2 = Regular battle with "Call" instead of "Run"
|
||||
[5,7,6,3], # 3 = Safari Zone
|
||||
[0,8,1,3] # 4 = Bug Catching Contest
|
||||
[0, 2, 1, 3], # 0 = Regular battle
|
||||
[0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run"
|
||||
[0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run"
|
||||
[5, 7, 6, 3], # 3 = Safari Zone
|
||||
[0, 8, 1, 3] # 4 = Bug Catching Contest
|
||||
]
|
||||
|
||||
def initialize(viewport,z)
|
||||
def initialize(viewport, z)
|
||||
super(viewport)
|
||||
self.x = 0
|
||||
self.y = Graphics.height-96
|
||||
self.y = Graphics.height - 96
|
||||
# Create message box (shows "What will X do?")
|
||||
@msgBox = Window_UnformattedTextPokemon.newWithSize("",
|
||||
self.x+16,self.y+2,220,Graphics.height-self.y,viewport)
|
||||
self.x + 16, self.y + 2, 220, Graphics.height - self.y, viewport)
|
||||
@msgBox.baseColor = TEXT_BASE_COLOR
|
||||
@msgBox.shadowColor = TEXT_SHADOW_COLOR
|
||||
@msgBox.windowskin = nil
|
||||
addSprite("msgBox",@msgBox)
|
||||
addSprite("msgBox", @msgBox)
|
||||
if USE_GRAPHICS
|
||||
# Create background graphic
|
||||
background = IconSprite.new(self.x,self.y,viewport)
|
||||
background = IconSprite.new(self.x, self.y, viewport)
|
||||
background.setBitmap("Graphics/Pictures/Battle/overlay_command")
|
||||
addSprite("background",background)
|
||||
addSprite("background", background)
|
||||
# Create bitmaps
|
||||
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_command"))
|
||||
# Create action buttons
|
||||
@buttons = Array.new(4) do |i| # 4 command options, therefore 4 buttons
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.x = self.x+Graphics.width-260
|
||||
button.x += (((i%2)==0) ? 0 : @buttonBitmap.width/2-4)
|
||||
button.y = self.y+6
|
||||
button.y += (((i/2)==0) ? 0 : BUTTON_HEIGHT-4)
|
||||
button.src_rect.width = @buttonBitmap.width/2
|
||||
button.x = self.x + Graphics.width - 260
|
||||
button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4)
|
||||
button.y = self.y + 6
|
||||
button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4)
|
||||
button.src_rect.width = @buttonBitmap.width / 2
|
||||
button.src_rect.height = BUTTON_HEIGHT
|
||||
addSprite("button_#{i}",button)
|
||||
addSprite("button_#{i}", button)
|
||||
next button
|
||||
end
|
||||
else
|
||||
# Create command window (shows Fight/Bag/Pokémon/Run)
|
||||
@cmdWindow = Window_CommandPokemon.newWithSize([],
|
||||
self.x+Graphics.width-240,self.y,240,Graphics.height-self.y,viewport)
|
||||
self.x + Graphics.width - 240, self.y, 240, Graphics.height - self.y, viewport)
|
||||
@cmdWindow.columns = 2
|
||||
@cmdWindow.columnSpacing = 4
|
||||
@cmdWindow.ignore_input = true
|
||||
addSprite("cmdWindow",@cmdWindow)
|
||||
addSprite("cmdWindow", @cmdWindow)
|
||||
end
|
||||
self.z = z
|
||||
refresh
|
||||
@@ -173,7 +173,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
return if USE_GRAPHICS
|
||||
commands = []
|
||||
for i in 1..4
|
||||
commands.push(value[i]) if value[i] && value[i]!=nil
|
||||
commands.push(value[i]) if value[i] && value[i] != nil
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
end
|
||||
@@ -182,9 +182,9 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
return if !USE_GRAPHICS
|
||||
for i in 0...@buttons.length
|
||||
button = @buttons[i]
|
||||
button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0
|
||||
button.src_rect.y = MODES[@mode][i]*BUTTON_HEIGHT
|
||||
button.z = self.z + ((i==@index) ? 3 : 2)
|
||||
button.src_rect.x = (i == @index) ? @buttonBitmap.width / 2 : 0
|
||||
button.src_rect.y = MODES[@mode][i] * BUTTON_HEIGHT
|
||||
button.z = self.z + ((i == @index) ? 3 : 2)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -216,16 +216,16 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
TYPE_ICON_HEIGHT = 28
|
||||
# Text colours of PP of selected move
|
||||
PP_COLORS = [
|
||||
Color.new(248,72,72),Color.new(136,48,48), # Red, zero PP
|
||||
Color.new(248,136,32),Color.new(144,72,24), # Orange, 1/4 of total PP or less
|
||||
Color.new(248,192,0),Color.new(144,104,0), # Yellow, 1/2 of total PP or less
|
||||
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP
|
||||
Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP
|
||||
Color.new(248, 136, 32), Color.new(144, 72, 24), # Orange, 1/4 of total PP or less
|
||||
Color.new(248, 192, 0), Color.new(144, 104, 0), # Yellow, 1/2 of total PP or less
|
||||
TEXT_BASE_COLOR, TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP
|
||||
]
|
||||
|
||||
def initialize(viewport,z)
|
||||
def initialize(viewport, z)
|
||||
super(viewport)
|
||||
self.x = 0
|
||||
self.y = Graphics.height-96
|
||||
self.y = Graphics.height - 96
|
||||
@battler = nil
|
||||
@shiftMode = 0
|
||||
# NOTE: @mode is for the display of the Mega Evolution button.
|
||||
@@ -237,70 +237,70 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
@megaEvoBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_mega"))
|
||||
@shiftBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_shift"))
|
||||
# Create background graphic
|
||||
background = IconSprite.new(0,Graphics.height-96,viewport)
|
||||
background = IconSprite.new(0, Graphics.height - 96, viewport)
|
||||
background.setBitmap("Graphics/Pictures/Battle/overlay_fight")
|
||||
addSprite("background",background)
|
||||
addSprite("background", background)
|
||||
# Create move buttons
|
||||
@buttons = Array.new(Pokemon::MAX_MOVES) do |i|
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.x = self.x+4
|
||||
button.x += (((i%2)==0) ? 0 : @buttonBitmap.width/2-4)
|
||||
button.y = self.y+6
|
||||
button.y += (((i/2)==0) ? 0 : BUTTON_HEIGHT-4)
|
||||
button.src_rect.width = @buttonBitmap.width/2
|
||||
button.x = self.x + 4
|
||||
button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4)
|
||||
button.y = self.y + 6
|
||||
button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4)
|
||||
button.src_rect.width = @buttonBitmap.width / 2
|
||||
button.src_rect.height = BUTTON_HEIGHT
|
||||
addSprite("button_#{i}",button)
|
||||
addSprite("button_#{i}", button)
|
||||
next button
|
||||
end
|
||||
# Create overlay for buttons (shows move names)
|
||||
@overlay = BitmapSprite.new(Graphics.width,Graphics.height-self.y,viewport)
|
||||
@overlay = BitmapSprite.new(Graphics.width, Graphics.height - self.y, viewport)
|
||||
@overlay.x = self.x
|
||||
@overlay.y = self.y
|
||||
pbSetNarrowFont(@overlay.bitmap)
|
||||
addSprite("overlay",@overlay)
|
||||
addSprite("overlay", @overlay)
|
||||
# Create overlay for selected move's info (shows move's PP)
|
||||
@infoOverlay = BitmapSprite.new(Graphics.width,Graphics.height-self.y,viewport)
|
||||
@infoOverlay = BitmapSprite.new(Graphics.width, Graphics.height - self.y, viewport)
|
||||
@infoOverlay.x = self.x
|
||||
@infoOverlay.y = self.y
|
||||
pbSetNarrowFont(@infoOverlay.bitmap)
|
||||
addSprite("infoOverlay",@infoOverlay)
|
||||
addSprite("infoOverlay", @infoOverlay)
|
||||
# Create type icon
|
||||
@typeIcon = SpriteWrapper.new(viewport)
|
||||
@typeIcon.bitmap = @typeBitmap.bitmap
|
||||
@typeIcon.x = self.x+416
|
||||
@typeIcon.y = self.y+20
|
||||
@typeIcon.x = self.x + 416
|
||||
@typeIcon.y = self.y + 20
|
||||
@typeIcon.src_rect.height = TYPE_ICON_HEIGHT
|
||||
addSprite("typeIcon",@typeIcon)
|
||||
addSprite("typeIcon", @typeIcon)
|
||||
# Create Mega Evolution button
|
||||
@megaButton = SpriteWrapper.new(viewport)
|
||||
@megaButton.bitmap = @megaEvoBitmap.bitmap
|
||||
@megaButton.x = self.x+120
|
||||
@megaButton.y = self.y-@megaEvoBitmap.height/2
|
||||
@megaButton.src_rect.height = @megaEvoBitmap.height/2
|
||||
addSprite("megaButton",@megaButton)
|
||||
@megaButton.x = self.x + 120
|
||||
@megaButton.y = self.y - @megaEvoBitmap.height / 2
|
||||
@megaButton.src_rect.height = @megaEvoBitmap.height / 2
|
||||
addSprite("megaButton", @megaButton)
|
||||
# Create Shift button
|
||||
@shiftButton = SpriteWrapper.new(viewport)
|
||||
@shiftButton.bitmap = @shiftBitmap.bitmap
|
||||
@shiftButton.x = self.x+4
|
||||
@shiftButton.y = self.y-@shiftBitmap.height
|
||||
addSprite("shiftButton",@shiftButton)
|
||||
@shiftButton.x = self.x + 4
|
||||
@shiftButton.y = self.y - @shiftBitmap.height
|
||||
addSprite("shiftButton", @shiftButton)
|
||||
else
|
||||
# Create message box (shows type and PP of selected move)
|
||||
@msgBox = Window_AdvancedTextPokemon.newWithSize("",
|
||||
self.x+320,self.y,Graphics.width-320,Graphics.height-self.y,viewport)
|
||||
self.x + 320, self.y, Graphics.width - 320, Graphics.height - self.y, viewport)
|
||||
@msgBox.baseColor = TEXT_BASE_COLOR
|
||||
@msgBox.shadowColor = TEXT_SHADOW_COLOR
|
||||
pbSetNarrowFont(@msgBox.contents)
|
||||
addSprite("msgBox",@msgBox)
|
||||
addSprite("msgBox", @msgBox)
|
||||
# Create command window (shows moves)
|
||||
@cmdWindow = Window_CommandPokemon.newWithSize([],
|
||||
self.x,self.y,320,Graphics.height-self.y,viewport)
|
||||
self.x, self.y, 320, Graphics.height - self.y, viewport)
|
||||
@cmdWindow.columns = 2
|
||||
@cmdWindow.columnSpacing = 4
|
||||
@cmdWindow.ignore_input = true
|
||||
pbSetNarrowFont(@cmdWindow.contents)
|
||||
addSprite("cmdWindow",@cmdWindow)
|
||||
addSprite("cmdWindow", @cmdWindow)
|
||||
end
|
||||
self.z = z
|
||||
end
|
||||
@@ -331,7 +331,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
def shiftMode=(value)
|
||||
oldValue = @shiftMode
|
||||
@shiftMode = value
|
||||
refreshShiftButton if @shiftMode!=oldValue
|
||||
refreshShiftButton if @shiftMode != oldValue
|
||||
end
|
||||
|
||||
def refreshButtonNames
|
||||
@@ -348,10 +348,10 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
# Draw move names onto overlay
|
||||
@overlay.bitmap.clear
|
||||
textPos = []
|
||||
@buttons.each_with_index do |button,i|
|
||||
@buttons.each_with_index do |button, i|
|
||||
next if !@visibility["button_#{i}"]
|
||||
x = button.x-self.x+button.src_rect.width/2
|
||||
y = button.y-self.y+2
|
||||
x = button.x - self.x + button.src_rect.width / 2
|
||||
y = button.y - self.y + 2
|
||||
moveNameBase = TEXT_BASE_COLOR
|
||||
if GET_MOVE_TEXT_COLOR_FROM_MOVE_BUTTON && moves[i].display_type(@battler)
|
||||
# NOTE: This takes a color from a particular pixel in the button
|
||||
@@ -359,26 +359,26 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
# The pixel is at coordinates 10,34 in the button box. If you
|
||||
# change the graphic, you may want to change the below line of
|
||||
# code to ensure the font is an appropriate color.
|
||||
moveNameBase = button.bitmap.get_pixel(10,button.src_rect.y+34)
|
||||
moveNameBase = button.bitmap.get_pixel(10, button.src_rect.y + 34)
|
||||
end
|
||||
textPos.push([moves[i].name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
|
||||
textPos.push([moves[i].name, x, y, 2, moveNameBase, TEXT_SHADOW_COLOR])
|
||||
end
|
||||
pbDrawTextPositions(@overlay.bitmap,textPos)
|
||||
pbDrawTextPositions(@overlay.bitmap, textPos)
|
||||
end
|
||||
|
||||
def refreshSelection
|
||||
moves = (@battler) ? @battler.moves : []
|
||||
if USE_GRAPHICS
|
||||
# Choose appropriate button graphics and z positions
|
||||
@buttons.each_with_index do |button,i|
|
||||
@buttons.each_with_index do |button, i|
|
||||
if !moves[i]
|
||||
@visibility["button_#{i}"] = false
|
||||
next
|
||||
end
|
||||
@visibility["button_#{i}"] = true
|
||||
button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0
|
||||
button.src_rect.x = (i == @index) ? @buttonBitmap.width / 2 : 0
|
||||
button.src_rect.y = GameData::Type.get(moves[i].display_type(@battler)).icon_position * BUTTON_HEIGHT
|
||||
button.z = self.z + ((i==@index) ? 4 : 3)
|
||||
button.z = self.z + ((i == @index) ? 4 : 3)
|
||||
end
|
||||
end
|
||||
refreshMoveData(moves[@index])
|
||||
@@ -388,11 +388,11 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
# Write PP and type of the selected move
|
||||
if !USE_GRAPHICS
|
||||
moveType = GameData::Type.get(move.display_type(@battler)).name
|
||||
if move.total_pp<=0
|
||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}",moveType)
|
||||
if move.total_pp <= 0
|
||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}", moveType)
|
||||
else
|
||||
@msgBox.text = _ISPRINTF("PP: {1: 2d}/{2: 2d}<br>TYPE/{3:s}",
|
||||
move.pp,move.total_pp,moveType)
|
||||
move.pp, move.total_pp, moveType)
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -406,12 +406,12 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
type_number = GameData::Type.get(move.display_type(@battler)).icon_position
|
||||
@typeIcon.src_rect.y = type_number * TYPE_ICON_HEIGHT
|
||||
# PP text
|
||||
if move.total_pp>0
|
||||
ppFraction = [(4.0*move.pp/move.total_pp).ceil,3].min
|
||||
if move.total_pp > 0
|
||||
ppFraction = [(4.0 * move.pp / move.total_pp).ceil, 3].min
|
||||
textPos = []
|
||||
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.total_pp),
|
||||
448,44,2,PP_COLORS[ppFraction*2],PP_COLORS[ppFraction*2+1]])
|
||||
pbDrawTextPositions(@infoOverlay.bitmap,textPos)
|
||||
textPos.push([_INTL("PP: {1}/{2}", move.pp, move.total_pp),
|
||||
448, 44, 2, PP_COLORS[ppFraction * 2], PP_COLORS[ppFraction * 2 + 1]])
|
||||
pbDrawTextPositions(@infoOverlay.bitmap, textPos)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -450,57 +450,57 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
|
||||
# Lists of which button graphics to use in different situations/types of battle.
|
||||
MODES = [
|
||||
[0,2,1,3], # 0 = Regular battle
|
||||
[0,2,1,9], # 1 = Regular battle with "Cancel" instead of "Run"
|
||||
[0,2,1,4], # 2 = Regular battle with "Call" instead of "Run"
|
||||
[5,7,6,3], # 3 = Safari Zone
|
||||
[0,8,1,3] # 4 = Bug Catching Contest
|
||||
[0, 2, 1, 3], # 0 = Regular battle
|
||||
[0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run"
|
||||
[0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run"
|
||||
[5, 7, 6, 3], # 3 = Safari Zone
|
||||
[0, 8, 1, 3] # 4 = Bug Catching Contest
|
||||
]
|
||||
CMD_BUTTON_WIDTH_SMALL = 170
|
||||
TEXT_BASE_COLOR = Color.new(240,248,224)
|
||||
TEXT_SHADOW_COLOR = Color.new(64,64,64)
|
||||
TEXT_BASE_COLOR = Color.new(240, 248, 224)
|
||||
TEXT_SHADOW_COLOR = Color.new(64, 64, 64)
|
||||
|
||||
def initialize(viewport,z,sideSizes)
|
||||
def initialize(viewport, z, sideSizes)
|
||||
super(viewport)
|
||||
@sideSizes = sideSizes
|
||||
maxIndex = (@sideSizes[0]>@sideSizes[1]) ? (@sideSizes[0]-1)*2 : @sideSizes[1]*2-1
|
||||
@smallButtons = (@sideSizes.max>2)
|
||||
maxIndex = (@sideSizes[0] > @sideSizes[1]) ? (@sideSizes[0] - 1) * 2 : @sideSizes[1] * 2 - 1
|
||||
@smallButtons = (@sideSizes.max > 2)
|
||||
self.x = 0
|
||||
self.y = Graphics.height-96
|
||||
self.y = Graphics.height - 96
|
||||
@texts = []
|
||||
# NOTE: @mode is for which buttons are shown as selected.
|
||||
# 0=select 1 button (@index), 1=select all buttons with text
|
||||
# Create bitmaps
|
||||
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_target"))
|
||||
# Create target buttons
|
||||
@buttons = Array.new(maxIndex+1) do |i|
|
||||
numButtons = @sideSizes[i%2]
|
||||
next if numButtons<=i/2
|
||||
@buttons = Array.new(maxIndex + 1) do |i|
|
||||
numButtons = @sideSizes[i % 2]
|
||||
next if numButtons <= i / 2
|
||||
# NOTE: Battler indexes go from left to right from the perspective of
|
||||
# that side's trainer, so inc is different for each side for the
|
||||
# same value of i/2.
|
||||
inc = ((i%2)==0) ? i/2 : numButtons-1-i/2
|
||||
inc = ((i % 2) == 0) ? i / 2 : numButtons - 1 - i / 2
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.src_rect.width = (@smallButtons) ? CMD_BUTTON_WIDTH_SMALL : @buttonBitmap.width/2
|
||||
button.src_rect.width = (@smallButtons) ? CMD_BUTTON_WIDTH_SMALL : @buttonBitmap.width / 2
|
||||
button.src_rect.height = BUTTON_HEIGHT
|
||||
if @smallButtons
|
||||
button.x = self.x+170-[0,82,166][numButtons-1]
|
||||
button.x = self.x + 170 - [0, 82, 166][numButtons - 1]
|
||||
else
|
||||
button.x = self.x+138-[0,116][numButtons-1]
|
||||
button.x = self.x + 138 - [0, 116][numButtons - 1]
|
||||
end
|
||||
button.x += (button.src_rect.width-4)*inc
|
||||
button.y = self.y+6
|
||||
button.y += (BUTTON_HEIGHT-4)*((i+1)%2)
|
||||
addSprite("button_#{i}",button)
|
||||
button.x += (button.src_rect.width - 4) * inc
|
||||
button.y = self.y + 6
|
||||
button.y += (BUTTON_HEIGHT - 4) * ((i + 1) % 2)
|
||||
addSprite("button_#{i}", button)
|
||||
next button
|
||||
end
|
||||
# Create overlay (shows target names)
|
||||
@overlay = BitmapSprite.new(Graphics.width,Graphics.height-self.y,viewport)
|
||||
@overlay = BitmapSprite.new(Graphics.width, Graphics.height - self.y, viewport)
|
||||
@overlay.x = self.x
|
||||
@overlay.y = self.y
|
||||
pbSetNarrowFont(@overlay.bitmap)
|
||||
addSprite("overlay",@overlay)
|
||||
addSprite("overlay", @overlay)
|
||||
self.z = z
|
||||
refresh
|
||||
end
|
||||
@@ -515,7 +515,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
@overlay.z += 5 if @overlay
|
||||
end
|
||||
|
||||
def setDetails(texts,mode)
|
||||
def setDetails(texts, mode)
|
||||
@texts = texts
|
||||
@mode = mode
|
||||
refresh
|
||||
@@ -523,30 +523,30 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
|
||||
def refreshButtons
|
||||
# Choose appropriate button graphics and z positions
|
||||
@buttons.each_with_index do |button,i|
|
||||
@buttons.each_with_index do |button, i|
|
||||
next if !button
|
||||
sel = false
|
||||
buttonType = 0
|
||||
if @texts[i]
|
||||
sel ||= (@mode==0 && i==@index)
|
||||
sel ||= (@mode==1)
|
||||
buttonType = ((i%2)==0) ? 1 : 2
|
||||
sel ||= (@mode == 0 && i == @index)
|
||||
sel ||= (@mode == 1)
|
||||
buttonType = ((i % 2) == 0) ? 1 : 2
|
||||
end
|
||||
buttonType = 2*buttonType + ((@smallButtons) ? 1 : 0)
|
||||
button.src_rect.x = (sel) ? @buttonBitmap.width/2 : 0
|
||||
button.src_rect.y = buttonType*BUTTON_HEIGHT
|
||||
buttonType = 2 * buttonType + ((@smallButtons) ? 1 : 0)
|
||||
button.src_rect.x = (sel) ? @buttonBitmap.width / 2 : 0
|
||||
button.src_rect.y = buttonType * BUTTON_HEIGHT
|
||||
button.z = self.z + ((sel) ? 3 : 2)
|
||||
end
|
||||
# Draw target names onto overlay
|
||||
@overlay.bitmap.clear
|
||||
textpos = []
|
||||
@buttons.each_with_index do |button,i|
|
||||
@buttons.each_with_index do |button, i|
|
||||
next if !button || nil_or_empty?(@texts[i])
|
||||
x = button.x-self.x+button.src_rect.width/2
|
||||
y = button.y-self.y+2
|
||||
textpos.push([@texts[i],x,y,2,TEXT_BASE_COLOR,TEXT_SHADOW_COLOR])
|
||||
x = button.x - self.x + button.src_rect.width / 2
|
||||
y = button.y - self.y + 2
|
||||
textpos.push([@texts[i], x, y, 2, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR])
|
||||
end
|
||||
pbDrawTextPositions(@overlay.bitmap,textpos)
|
||||
pbDrawTextPositions(@overlay.bitmap, textpos)
|
||||
end
|
||||
|
||||
def refresh
|
||||
|
||||
@@ -12,14 +12,14 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
# Maximum time in seconds to make a change to the HP bar.
|
||||
HP_BAR_CHANGE_TIME = 1.0
|
||||
STATUS_ICON_HEIGHT = 16
|
||||
NAME_BASE_COLOR = Color.new(72,72,72)
|
||||
NAME_SHADOW_COLOR = Color.new(184,184,184)
|
||||
MALE_BASE_COLOR = Color.new(48,96,216)
|
||||
NAME_BASE_COLOR = Color.new(72, 72, 72)
|
||||
NAME_SHADOW_COLOR = Color.new(184, 184, 184)
|
||||
MALE_BASE_COLOR = Color.new(48, 96, 216)
|
||||
MALE_SHADOW_COLOR = NAME_SHADOW_COLOR
|
||||
FEMALE_BASE_COLOR = Color.new(248,88,40)
|
||||
FEMALE_BASE_COLOR = Color.new(248, 88, 40)
|
||||
FEMALE_SHADOW_COLOR = NAME_SHADOW_COLOR
|
||||
|
||||
def initialize(battler,sideSize,viewport = nil)
|
||||
def initialize(battler, sideSize, viewport = nil)
|
||||
super(viewport)
|
||||
@battler = battler
|
||||
@sprites = {}
|
||||
@@ -39,18 +39,18 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
end
|
||||
|
||||
def initializeDataBoxGraphic(sideSize)
|
||||
onPlayerSide = ((@battler.index%2)==0)
|
||||
onPlayerSide = ((@battler.index % 2) == 0)
|
||||
# Get the data box graphic and set whether the HP numbers/Exp bar are shown
|
||||
if sideSize==1 # One Pokémon on side, use the regular dara box BG
|
||||
if sideSize == 1 # One Pokémon on side, use the regular dara box BG
|
||||
bgFilename = ["Graphics/Pictures/Battle/databox_normal",
|
||||
"Graphics/Pictures/Battle/databox_normal_foe"][@battler.index%2]
|
||||
"Graphics/Pictures/Battle/databox_normal_foe"][@battler.index % 2]
|
||||
if onPlayerSide
|
||||
@showHP = true
|
||||
@showExp = true
|
||||
end
|
||||
else # Multiple Pokémon on side, use the thin dara box BG
|
||||
bgFilename = ["Graphics/Pictures/Battle/databox_thin",
|
||||
"Graphics/Pictures/Battle/databox_thin_foe"][@battler.index%2]
|
||||
"Graphics/Pictures/Battle/databox_thin_foe"][@battler.index % 2]
|
||||
end
|
||||
@databoxBitmap.dispose if @databoxBitmap
|
||||
@databoxBitmap = AnimatedBitmap.new(bgFilename)
|
||||
@@ -80,23 +80,23 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
@hpBarBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/overlay_hp"))
|
||||
@expBarBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/overlay_exp"))
|
||||
# Create sprite to draw HP numbers on
|
||||
@hpNumbers = BitmapSprite.new(124,16,viewport)
|
||||
@hpNumbers = BitmapSprite.new(124, 16, viewport)
|
||||
pbSetSmallFont(@hpNumbers.bitmap)
|
||||
@sprites["hpNumbers"] = @hpNumbers
|
||||
# Create sprite wrapper that displays HP bar
|
||||
@hpBar = SpriteWrapper.new(viewport)
|
||||
@hpBar.bitmap = @hpBarBitmap.bitmap
|
||||
@hpBar.src_rect.height = @hpBarBitmap.height/3
|
||||
@hpBar.src_rect.height = @hpBarBitmap.height / 3
|
||||
@sprites["hpBar"] = @hpBar
|
||||
# Create sprite wrapper that displays Exp bar
|
||||
@expBar = SpriteWrapper.new(viewport)
|
||||
@expBar.bitmap = @expBarBitmap.bitmap
|
||||
@sprites["expBar"] = @expBar
|
||||
# Create sprite wrapper that displays everything except the above
|
||||
@contents = BitmapWrapper.new(@databoxBitmap.width,@databoxBitmap.height)
|
||||
@contents = BitmapWrapper.new(@databoxBitmap.width, @databoxBitmap.height)
|
||||
self.bitmap = @contents
|
||||
self.visible = false
|
||||
self.z = 150+((@battler.index)/2)*5
|
||||
self.z = 150 + ((@battler.index) / 2) * 5
|
||||
pbSetSystemFont(self.bitmap)
|
||||
end
|
||||
|
||||
@@ -112,23 +112,23 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def x=(value)
|
||||
super
|
||||
@hpBar.x = value+@spriteBaseX+102
|
||||
@expBar.x = value+@spriteBaseX+6
|
||||
@hpNumbers.x = value+@spriteBaseX+80
|
||||
@hpBar.x = value + @spriteBaseX + 102
|
||||
@expBar.x = value + @spriteBaseX + 6
|
||||
@hpNumbers.x = value + @spriteBaseX + 80
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
super
|
||||
@hpBar.y = value+40
|
||||
@expBar.y = value+74
|
||||
@hpNumbers.y = value+52
|
||||
@hpBar.y = value + 40
|
||||
@expBar.y = value + 74
|
||||
@hpNumbers.y = value + 52
|
||||
end
|
||||
|
||||
def z=(value)
|
||||
super
|
||||
@hpBar.z = value+1
|
||||
@expBar.z = value+1
|
||||
@hpNumbers.z = value+2
|
||||
@hpBar.z = value + 1
|
||||
@expBar.z = value + 1
|
||||
@hpNumbers.z = value + 2
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
@@ -164,43 +164,43 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def exp_fraction
|
||||
return 0.0 if @rangeExp == 0
|
||||
return (@animatingExp) ? @currentExp.to_f/@rangeExp : @battler.pokemon.exp_fraction
|
||||
return (@animatingExp) ? @currentExp.to_f / @rangeExp : @battler.pokemon.exp_fraction
|
||||
end
|
||||
|
||||
def animateHP(oldHP,newHP,rangeHP)
|
||||
def animateHP(oldHP, newHP, rangeHP)
|
||||
@currentHP = oldHP
|
||||
@endHP = newHP
|
||||
@rangeHP = rangeHP
|
||||
# NOTE: A change in HP takes the same amount of time to animate, no matter
|
||||
# how big a change it is.
|
||||
@hpIncPerFrame = (newHP-oldHP).abs/(HP_BAR_CHANGE_TIME*Graphics.frame_rate)
|
||||
@hpIncPerFrame = (newHP - oldHP).abs / (HP_BAR_CHANGE_TIME * Graphics.frame_rate)
|
||||
# minInc is the smallest amount that HP is allowed to change per frame.
|
||||
# This avoids a tiny change in HP still taking HP_BAR_CHANGE_TIME seconds.
|
||||
minInc = (rangeHP*4)/(@hpBarBitmap.width*HP_BAR_CHANGE_TIME*Graphics.frame_rate)
|
||||
@hpIncPerFrame = minInc if @hpIncPerFrame<minInc
|
||||
minInc = (rangeHP * 4) / (@hpBarBitmap.width * HP_BAR_CHANGE_TIME * Graphics.frame_rate)
|
||||
@hpIncPerFrame = minInc if @hpIncPerFrame < minInc
|
||||
@animatingHP = true
|
||||
end
|
||||
|
||||
def animateExp(oldExp,newExp,rangeExp)
|
||||
def animateExp(oldExp, newExp, rangeExp)
|
||||
return if rangeExp == 0
|
||||
@currentExp = oldExp
|
||||
@endExp = newExp
|
||||
@rangeExp = rangeExp
|
||||
# NOTE: Filling the Exp bar from empty to full takes EXP_BAR_FILL_TIME
|
||||
# seconds no matter what. Filling half of it takes half as long, etc.
|
||||
@expIncPerFrame = rangeExp/(EXP_BAR_FILL_TIME*Graphics.frame_rate)
|
||||
@expIncPerFrame = rangeExp / (EXP_BAR_FILL_TIME * Graphics.frame_rate)
|
||||
@animatingExp = true
|
||||
pbSEPlay("Pkmn exp gain") if @showExp
|
||||
end
|
||||
|
||||
def pbDrawNumber(number,btmp,startX,startY,align = 0)
|
||||
def pbDrawNumber(number, btmp, startX, startY, align = 0)
|
||||
# -1 means draw the / character
|
||||
n = (number == -1) ? [10] : number.to_i.digits.reverse
|
||||
charWidth = @numbersBitmap.width/11
|
||||
charWidth = @numbersBitmap.width / 11
|
||||
charHeight = @numbersBitmap.height
|
||||
startX -= charWidth*n.length if align==1
|
||||
startX -= charWidth * n.length if align == 1
|
||||
n.each do |i|
|
||||
btmp.blt(startX,startY,@numbersBitmap.bitmap,Rect.new(i*charWidth,0,charWidth,charHeight))
|
||||
btmp.blt(startX, startY, @numbersBitmap.bitmap, Rect.new(i * charWidth, 0, charWidth, charHeight))
|
||||
startX += charWidth
|
||||
end
|
||||
end
|
||||
@@ -211,42 +211,42 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
textPos = []
|
||||
imagePos = []
|
||||
# Draw background panel
|
||||
self.bitmap.blt(0,0,@databoxBitmap.bitmap,Rect.new(0,0,@databoxBitmap.width,@databoxBitmap.height))
|
||||
self.bitmap.blt(0, 0, @databoxBitmap.bitmap, Rect.new(0, 0, @databoxBitmap.width, @databoxBitmap.height))
|
||||
# Draw Pokémon's name
|
||||
nameWidth = self.bitmap.text_size(@battler.name).width
|
||||
nameOffset = 0
|
||||
nameOffset = nameWidth-116 if nameWidth>116
|
||||
textPos.push([@battler.name,@spriteBaseX+8-nameOffset,0,false,NAME_BASE_COLOR,NAME_SHADOW_COLOR])
|
||||
nameOffset = nameWidth - 116 if nameWidth > 116
|
||||
textPos.push([@battler.name, @spriteBaseX + 8 - nameOffset, 0, false, NAME_BASE_COLOR, NAME_SHADOW_COLOR])
|
||||
# Draw Pokémon's gender symbol
|
||||
case @battler.displayGender
|
||||
when 0 # Male
|
||||
textPos.push([_INTL("♂"),@spriteBaseX+126,0,false,MALE_BASE_COLOR,MALE_SHADOW_COLOR])
|
||||
textPos.push([_INTL("♂"), @spriteBaseX + 126, 0, false, MALE_BASE_COLOR, MALE_SHADOW_COLOR])
|
||||
when 1 # Female
|
||||
textPos.push([_INTL("♀"),@spriteBaseX+126,0,false,FEMALE_BASE_COLOR,FEMALE_SHADOW_COLOR])
|
||||
textPos.push([_INTL("♀"), @spriteBaseX + 126, 0, false, FEMALE_BASE_COLOR, FEMALE_SHADOW_COLOR])
|
||||
end
|
||||
pbDrawTextPositions(self.bitmap,textPos)
|
||||
pbDrawTextPositions(self.bitmap, textPos)
|
||||
# Draw Pokémon's level
|
||||
imagePos.push(["Graphics/Pictures/Battle/overlay_lv",@spriteBaseX+140,16])
|
||||
pbDrawNumber(@battler.level,self.bitmap,@spriteBaseX+162,16)
|
||||
imagePos.push(["Graphics/Pictures/Battle/overlay_lv", @spriteBaseX + 140, 16])
|
||||
pbDrawNumber(@battler.level, self.bitmap, @spriteBaseX + 162, 16)
|
||||
# Draw shiny icon
|
||||
if @battler.shiny?
|
||||
shinyX = (@battler.opposes?(0)) ? 206 : -6 # Foe's/player's
|
||||
imagePos.push(["Graphics/Pictures/shiny",@spriteBaseX+shinyX,36])
|
||||
imagePos.push(["Graphics/Pictures/shiny", @spriteBaseX + shinyX, 36])
|
||||
end
|
||||
# Draw Mega Evolution/Primal Reversion icon
|
||||
if @battler.mega?
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_mega",@spriteBaseX+8,34])
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_mega", @spriteBaseX + 8, 34])
|
||||
elsif @battler.primal?
|
||||
primalX = (@battler.opposes?) ? 208 : -28 # Foe's/player's
|
||||
if @battler.isSpecies?(:KYOGRE)
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Kyogre",@spriteBaseX+primalX,4])
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Kyogre", @spriteBaseX + primalX, 4])
|
||||
elsif @battler.isSpecies?(:GROUDON)
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Groudon",@spriteBaseX+primalX,4])
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_primal_Groudon", @spriteBaseX + primalX, 4])
|
||||
end
|
||||
end
|
||||
# Draw owned icon (foe Pokémon only)
|
||||
if @battler.owned? && @battler.opposes?(0)
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX+8,36])
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_own", @spriteBaseX + 8, 36])
|
||||
end
|
||||
# Draw status icon
|
||||
if @battler.status != :NONE
|
||||
@@ -255,10 +255,10 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
else
|
||||
s = GameData::Status.get(@battler.status).icon_position
|
||||
end
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,36,
|
||||
imagePos.push(["Graphics/Pictures/Battle/icon_statuses", @spriteBaseX + 24, 36,
|
||||
0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT]) if s >= 0
|
||||
end
|
||||
pbDrawImagePositions(self.bitmap,imagePos)
|
||||
pbDrawImagePositions(self.bitmap, imagePos)
|
||||
refreshHP
|
||||
refreshExp
|
||||
end
|
||||
@@ -268,24 +268,24 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
return if !@battler.pokemon
|
||||
# Show HP numbers
|
||||
if @showHP
|
||||
pbDrawNumber(self.hp,@hpNumbers.bitmap,54,2,1)
|
||||
pbDrawNumber(-1,@hpNumbers.bitmap,54,2) # / char
|
||||
pbDrawNumber(@battler.totalhp,@hpNumbers.bitmap,70,2)
|
||||
pbDrawNumber(self.hp, @hpNumbers.bitmap, 54, 2, 1)
|
||||
pbDrawNumber(-1, @hpNumbers.bitmap, 54, 2) # / char
|
||||
pbDrawNumber(@battler.totalhp, @hpNumbers.bitmap, 70, 2)
|
||||
end
|
||||
# Resize HP bar
|
||||
w = 0
|
||||
if self.hp>0
|
||||
w = @hpBarBitmap.width.to_f*self.hp/@battler.totalhp
|
||||
w = 1 if w<1
|
||||
if self.hp > 0
|
||||
w = @hpBarBitmap.width.to_f * self.hp / @battler.totalhp
|
||||
w = 1 if w < 1
|
||||
# NOTE: The line below snaps the bar's width to the nearest 2 pixels, to
|
||||
# fit in with the rest of the graphics which are doubled in size.
|
||||
w = ((w/2.0).round)*2
|
||||
w = ((w / 2.0).round) * 2
|
||||
end
|
||||
@hpBar.src_rect.width = w
|
||||
hpColor = 0 # Green bar
|
||||
hpColor = 1 if self.hp<=@battler.totalhp/2 # Yellow bar
|
||||
hpColor = 2 if self.hp<=@battler.totalhp/4 # Red bar
|
||||
@hpBar.src_rect.y = hpColor*@hpBarBitmap.height/3
|
||||
hpColor = 1 if self.hp <= @battler.totalhp / 2 # Yellow bar
|
||||
hpColor = 2 if self.hp <= @battler.totalhp / 4 # Red bar
|
||||
@hpBar.src_rect.y = hpColor * @hpBarBitmap.height / 3
|
||||
end
|
||||
|
||||
def refreshExp
|
||||
@@ -293,22 +293,22 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
w = exp_fraction * @expBarBitmap.width
|
||||
# NOTE: The line below snaps the bar's width to the nearest 2 pixels, to
|
||||
# fit in with the rest of the graphics which are doubled in size.
|
||||
w = ((w/2).round)*2
|
||||
w = ((w / 2).round) * 2
|
||||
@expBar.src_rect.width = w
|
||||
end
|
||||
|
||||
def updateHPAnimation
|
||||
return if !@animatingHP
|
||||
if @currentHP<@endHP # Gaining HP
|
||||
if @currentHP < @endHP # Gaining HP
|
||||
@currentHP += @hpIncPerFrame
|
||||
@currentHP = @endHP if @currentHP>=@endHP
|
||||
elsif @currentHP>@endHP # Losing HP
|
||||
@currentHP = @endHP if @currentHP >= @endHP
|
||||
elsif @currentHP > @endHP # Losing HP
|
||||
@currentHP -= @hpIncPerFrame
|
||||
@currentHP = @endHP if @currentHP<=@endHP
|
||||
@currentHP = @endHP if @currentHP <= @endHP
|
||||
end
|
||||
# Refresh the HP bar/numbers
|
||||
refreshHP
|
||||
@animatingHP = false if @currentHP==@endHP
|
||||
@animatingHP = false if @currentHP == @endHP
|
||||
end
|
||||
|
||||
def updateExpAnimation
|
||||
@@ -318,29 +318,29 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
@animatingExp = false
|
||||
return
|
||||
end
|
||||
if @currentExp<@endExp # Gaining Exp
|
||||
if @currentExp < @endExp # Gaining Exp
|
||||
@currentExp += @expIncPerFrame
|
||||
@currentExp = @endExp if @currentExp>=@endExp
|
||||
elsif @currentExp>@endExp # Losing Exp
|
||||
@currentExp = @endExp if @currentExp >= @endExp
|
||||
elsif @currentExp > @endExp # Losing Exp
|
||||
@currentExp -= @expIncPerFrame
|
||||
@currentExp = @endExp if @currentExp<=@endExp
|
||||
@currentExp = @endExp if @currentExp <= @endExp
|
||||
end
|
||||
# Refresh the Exp bar
|
||||
refreshExp
|
||||
return if @currentExp!=@endExp # Exp bar still has more to animate
|
||||
return if @currentExp != @endExp # Exp bar still has more to animate
|
||||
# Exp bar is completely filled, level up with a flash and sound effect
|
||||
if @currentExp>=@rangeExp
|
||||
if @expFlash==0
|
||||
if @currentExp >= @rangeExp
|
||||
if @expFlash == 0
|
||||
pbSEStop
|
||||
@expFlash = Graphics.frame_rate/5
|
||||
@expFlash = Graphics.frame_rate / 5
|
||||
pbSEPlay("Pkmn exp full")
|
||||
self.flash(Color.new(64,200,248,192),@expFlash)
|
||||
self.flash(Color.new(64, 200, 248, 192), @expFlash)
|
||||
for i in @sprites
|
||||
i[1].flash(Color.new(64,200,248,192),@expFlash) if !i[1].disposed?
|
||||
i[1].flash(Color.new(64, 200, 248, 192), @expFlash) if !i[1].disposed?
|
||||
end
|
||||
else
|
||||
@expFlash -= 1
|
||||
@animatingExp = false if @expFlash==0
|
||||
@animatingExp = false if @expFlash == 0
|
||||
end
|
||||
else
|
||||
pbSEStop
|
||||
@@ -349,16 +349,16 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
end
|
||||
end
|
||||
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate * 3 / 20
|
||||
|
||||
def updatePositions(frameCounter)
|
||||
self.x = @spriteX
|
||||
self.y = @spriteY
|
||||
# Data box bobbing while Pokémon is selected
|
||||
if @selected==1 || @selected==2 # Choosing commands/targeted or damaged
|
||||
case (frameCounter/QUARTER_ANIM_PERIOD).floor
|
||||
when 1 then self.y = @spriteY-2
|
||||
when 3 then self.y = @spriteY+2
|
||||
if @selected == 1 || @selected == 2 # Choosing commands/targeted or damaged
|
||||
case (frameCounter / QUARTER_ANIM_PERIOD).floor
|
||||
when 1 then self.y = @spriteY - 2
|
||||
when 3 then self.y = @spriteY + 2
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -383,10 +383,10 @@ end
|
||||
class Battle::Scene::AbilitySplashBar < SpriteWrapper
|
||||
attr_reader :battler
|
||||
|
||||
TEXT_BASE_COLOR = Color.new(0,0,0)
|
||||
TEXT_SHADOW_COLOR = Color.new(248,248,248)
|
||||
TEXT_BASE_COLOR = Color.new(0, 0, 0)
|
||||
TEXT_SHADOW_COLOR = Color.new(248, 248, 248)
|
||||
|
||||
def initialize(side,viewport = nil)
|
||||
def initialize(side, viewport = nil)
|
||||
super(viewport)
|
||||
@side = side
|
||||
@battler = nil
|
||||
@@ -394,15 +394,15 @@ class Battle::Scene::AbilitySplashBar < SpriteWrapper
|
||||
@bgBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/ability_bar"))
|
||||
@bgSprite = SpriteWrapper.new(viewport)
|
||||
@bgSprite.bitmap = @bgBitmap.bitmap
|
||||
@bgSprite.src_rect.y = (side==0) ? 0 : @bgBitmap.height/2
|
||||
@bgSprite.src_rect.height = @bgBitmap.height/2
|
||||
@bgSprite.src_rect.y = (side == 0) ? 0 : @bgBitmap.height / 2
|
||||
@bgSprite.src_rect.height = @bgBitmap.height / 2
|
||||
# Create bitmap that displays the text
|
||||
@contents = BitmapWrapper.new(@bgBitmap.width,@bgBitmap.height/2)
|
||||
@contents = BitmapWrapper.new(@bgBitmap.width, @bgBitmap.height / 2)
|
||||
self.bitmap = @contents
|
||||
pbSetSystemFont(self.bitmap)
|
||||
# Position the bar
|
||||
self.x = (side==0) ? -Graphics.width/2 : Graphics.width
|
||||
self.y = (side==0) ? 180 : 80
|
||||
self.x = (side == 0) ? -Graphics.width / 2 : Graphics.width
|
||||
self.y = (side == 0) ? 180 : 80
|
||||
self.z = 120
|
||||
self.visible = false
|
||||
end
|
||||
@@ -426,7 +426,7 @@ class Battle::Scene::AbilitySplashBar < SpriteWrapper
|
||||
|
||||
def z=(value)
|
||||
super
|
||||
@bgSprite.z = value-1
|
||||
@bgSprite.z = value - 1
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
@@ -453,14 +453,14 @@ class Battle::Scene::AbilitySplashBar < SpriteWrapper
|
||||
self.bitmap.clear
|
||||
return if !@battler
|
||||
textPos = []
|
||||
textX = (@side==0) ? 10 : self.bitmap.width-8
|
||||
textX = (@side == 0) ? 10 : self.bitmap.width - 8
|
||||
# Draw Pokémon's name
|
||||
textPos.push([_INTL("{1}'s",@battler.name),textX,-4,@side==1,
|
||||
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR,true])
|
||||
textPos.push([_INTL("{1}'s", @battler.name), textX, -4, @side == 1,
|
||||
TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true])
|
||||
# Draw Pokémon's ability
|
||||
textPos.push([@battler.abilityName,textX,26,@side==1,
|
||||
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR,true])
|
||||
pbDrawTextPositions(self.bitmap,textPos)
|
||||
textPos.push([@battler.abilityName, textX, 26, @side == 1,
|
||||
TEXT_BASE_COLOR, TEXT_SHADOW_COLOR, true])
|
||||
pbDrawTextPositions(self.bitmap, textPos)
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -480,7 +480,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
attr_accessor :selected
|
||||
attr_reader :sideSize
|
||||
|
||||
def initialize(viewport,sideSize,index,battleAnimations)
|
||||
def initialize(viewport, sideSize, index, battleAnimations)
|
||||
super(viewport)
|
||||
@pkmn = nil
|
||||
@sideSize = sideSize
|
||||
@@ -511,12 +511,12 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
|
||||
def x=(value)
|
||||
@spriteX = value
|
||||
super(value+@spriteXExtra)
|
||||
super(value + @spriteXExtra)
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
@spriteY = value
|
||||
super(value+@spriteYExtra)
|
||||
super(value + @spriteYExtra)
|
||||
end
|
||||
|
||||
def width; return (self.bitmap) ? self.bitmap.width : 0; end
|
||||
@@ -530,27 +530,27 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
# Set sprite's origin to bottom middle
|
||||
def pbSetOrigin
|
||||
return if !@_iconBitmap
|
||||
self.ox = @_iconBitmap.width/2
|
||||
self.ox = @_iconBitmap.width / 2
|
||||
self.oy = @_iconBitmap.height
|
||||
end
|
||||
|
||||
def pbSetPosition
|
||||
return if !@_iconBitmap
|
||||
pbSetOrigin
|
||||
if (@index%2)==0
|
||||
self.z = 50+5*@index/2
|
||||
if (@index % 2) == 0
|
||||
self.z = 50 + 5 * @index / 2
|
||||
else
|
||||
self.z = 50-5*(@index+1)/2
|
||||
self.z = 50 - 5 * (@index + 1) / 2
|
||||
end
|
||||
# Set original position
|
||||
p = Battle::Scene.pbBattlerPosition(@index,@sideSize)
|
||||
p = Battle::Scene.pbBattlerPosition(@index, @sideSize)
|
||||
@spriteX = p[0]
|
||||
@spriteY = p[1]
|
||||
# Apply metrics
|
||||
@pkmn.species_data.apply_metrics_to_sprite(self, @index)
|
||||
end
|
||||
|
||||
def setPokemonBitmap(pkmn,back = false)
|
||||
def setPokemonBitmap(pkmn, back = false)
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
||||
@@ -566,8 +566,8 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
@pkmn.play_cry if @pkmn
|
||||
end
|
||||
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate*3/20
|
||||
SIXTH_ANIM_PERIOD = Graphics.frame_rate*2/20
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate * 3 / 20
|
||||
SIXTH_ANIM_PERIOD = Graphics.frame_rate * 2 / 20
|
||||
|
||||
def update(frameCounter = 0)
|
||||
return if !@_iconBitmap
|
||||
@@ -577,8 +577,8 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
self.bitmap = @_iconBitmap.bitmap
|
||||
# Pokémon sprite bobbing while Pokémon is selected
|
||||
@spriteYExtra = 0
|
||||
if @selected==1 # When choosing commands for this Pokémon
|
||||
case (frameCounter/QUARTER_ANIM_PERIOD).floor
|
||||
if @selected == 1 # When choosing commands for this Pokémon
|
||||
case (frameCounter / QUARTER_ANIM_PERIOD).floor
|
||||
when 1 then @spriteYExtra = 2
|
||||
when 3 then @spriteYExtra = -2
|
||||
end
|
||||
@@ -587,8 +587,8 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
self.y = self.y
|
||||
self.visible = @spriteVisible
|
||||
# Pokémon sprite blinking when targeted
|
||||
if @selected==2 && @spriteVisible
|
||||
case (frameCounter/SIXTH_ANIM_PERIOD).floor
|
||||
if @selected == 2 && @spriteVisible
|
||||
case (frameCounter / SIXTH_ANIM_PERIOD).floor
|
||||
when 2, 5 then self.visible = false
|
||||
else self.visible = true
|
||||
end
|
||||
@@ -607,7 +607,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
attr_accessor :index
|
||||
attr_accessor :selected
|
||||
|
||||
def initialize(viewport,sideSize,index)
|
||||
def initialize(viewport, sideSize, index)
|
||||
super(viewport)
|
||||
@pkmn = nil
|
||||
@sideSize = sideSize
|
||||
@@ -629,8 +629,8 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
# Set sprite's origin to centre
|
||||
def pbSetOrigin
|
||||
return if !@_iconBitmap
|
||||
self.ox = @_iconBitmap.width/2
|
||||
self.oy = @_iconBitmap.height/2
|
||||
self.ox = @_iconBitmap.width / 2
|
||||
self.oy = @_iconBitmap.height / 2
|
||||
end
|
||||
|
||||
def pbSetPosition
|
||||
@@ -638,7 +638,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
pbSetOrigin
|
||||
self.z = 3
|
||||
# Set original position
|
||||
p = Battle::Scene.pbBattlerPosition(@index,@sideSize)
|
||||
p = Battle::Scene.pbBattlerPosition(@index, @sideSize)
|
||||
self.x = p[0]
|
||||
self.y = p[1]
|
||||
# Apply metrics
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Battle::Scene::Animation
|
||||
def initialize(sprites,viewport)
|
||||
def initialize(sprites, viewport)
|
||||
@sprites = sprites
|
||||
@viewport = viewport
|
||||
@pictureEx = [] # For all the PictureEx
|
||||
@@ -14,10 +14,10 @@ class Battle::Scene::Animation
|
||||
end
|
||||
|
||||
def createProcesses; end
|
||||
def empty?; return @pictureEx.length==0; end
|
||||
def empty?; return @pictureEx.length == 0; end
|
||||
def animDone?; return @animDone; end
|
||||
|
||||
def addSprite(s,origin = PictureOrigin::TopLeft)
|
||||
def addSprite(s, origin = PictureOrigin::TopLeft)
|
||||
num = @pictureEx.length
|
||||
picture = PictureEx.new(s.z)
|
||||
picture.x = s.x
|
||||
@@ -25,20 +25,20 @@ class Battle::Scene::Animation
|
||||
picture.visible = s.visible
|
||||
picture.color = s.color.clone
|
||||
picture.tone = s.tone.clone
|
||||
picture.setOrigin(0,origin)
|
||||
picture.setOrigin(0, origin)
|
||||
@pictureEx[num] = picture
|
||||
@pictureSprites[num] = s
|
||||
return picture
|
||||
end
|
||||
|
||||
def addNewSprite(x,y,name,origin = PictureOrigin::TopLeft)
|
||||
def addNewSprite(x, y, name, origin = PictureOrigin::TopLeft)
|
||||
num = @pictureEx.length
|
||||
picture = PictureEx.new(num)
|
||||
picture.setXY(0,x,y)
|
||||
picture.setName(0,name)
|
||||
picture.setOrigin(0,origin)
|
||||
picture.setXY(0, x, y)
|
||||
picture.setName(0, name)
|
||||
picture.setOrigin(0, origin)
|
||||
@pictureEx[num] = picture
|
||||
s = IconSprite.new(x,y,@viewport)
|
||||
s = IconSprite.new(x, y, @viewport)
|
||||
s.setBitmap(name)
|
||||
@pictureSprites[num] = s
|
||||
@tempSprites.push(s)
|
||||
@@ -49,11 +49,11 @@ class Battle::Scene::Animation
|
||||
return if @animDone
|
||||
@tempSprites.each { |s| s.update if s }
|
||||
finished = true
|
||||
@pictureEx.each_with_index do |p,i|
|
||||
@pictureEx.each_with_index do |p, i|
|
||||
next if !p.running?
|
||||
finished = false
|
||||
p.update
|
||||
setPictureIconSprite(@pictureSprites[i],p)
|
||||
setPictureIconSprite(@pictureSprites[i], p)
|
||||
end
|
||||
@animDone = true if finished
|
||||
end
|
||||
@@ -96,110 +96,110 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
return ball
|
||||
end
|
||||
|
||||
def ballTracksHand(ball,traSprite,safariThrow = false)
|
||||
def ballTracksHand(ball, traSprite, safariThrow = false)
|
||||
# Back sprite isn't animated, no hand-tracking needed
|
||||
if traSprite.bitmap.width<traSprite.bitmap.height*2
|
||||
ball.setVisible(7,true)
|
||||
if traSprite.bitmap.width < traSprite.bitmap.height * 2
|
||||
ball.setVisible(7, true)
|
||||
ballStartX = traSprite.x
|
||||
ballStartX -= ball.totalDuration*(Graphics.width/(2*16)) if !safariThrow
|
||||
ballStartY = traSprite.y-traSprite.bitmap.height/2
|
||||
ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow
|
||||
ballStartY = traSprite.y - traSprite.bitmap.height / 2
|
||||
return ballStartX, ballStartY
|
||||
end
|
||||
# Back sprite is animated, make the Poké Ball track the trainer's hand
|
||||
coordSets = [[traSprite.x-44,traSprite.y-32],[-10,-36],[118,-4]]
|
||||
coordSets = [[traSprite.x - 44, traSprite.y - 32], [-10, -36], [118, -4]]
|
||||
case @trainer.trainer_type
|
||||
when :POKEMONTRAINER_Leaf
|
||||
coordSets = [[traSprite.x-30,traSprite.y-30],[-18,-36],[118,-6]]
|
||||
coordSets = [[traSprite.x - 30, traSprite.y - 30], [-18, -36], [118, -6]]
|
||||
when :POKEMONTRAINER_Brendan
|
||||
coordSets = [[traSprite.x-46,traSprite.y-40],[-4,-30],[118,-2]]
|
||||
coordSets = [[traSprite.x - 46, traSprite.y - 40], [-4, -30], [118, -2]]
|
||||
when :POKEMONTRAINER_May
|
||||
coordSets = [[traSprite.x-44,traSprite.y-38],[-8,-30],[122,0]]
|
||||
coordSets = [[traSprite.x - 44, traSprite.y - 38], [-8, -30], [122, 0]]
|
||||
end
|
||||
# Arm stretched out behind player
|
||||
ball.setVisible(0,true)
|
||||
ball.setXY(0,coordSets[0][0],coordSets[0][1])
|
||||
ball.moveDelta(0,5,-5*(Graphics.width/(2*16)),0) if !safariThrow
|
||||
ball.setDelta(0,-12,0) if safariThrow
|
||||
ball.setVisible(0, true)
|
||||
ball.setXY(0, coordSets[0][0], coordSets[0][1])
|
||||
ball.moveDelta(0, 5, -5 * (Graphics.width / (2 * 16)), 0) if !safariThrow
|
||||
ball.setDelta(0, -12, 0) if safariThrow
|
||||
# Arm mid throw
|
||||
ball.setDelta(5,coordSets[1][0],coordSets[1][1])
|
||||
ball.moveDelta(5,2,-2*(Graphics.width/(2*16)),0) if !safariThrow
|
||||
ball.setDelta(5,34,0) if safariThrow
|
||||
ball.setDelta(5, coordSets[1][0], coordSets[1][1])
|
||||
ball.moveDelta(5, 2, -2 * (Graphics.width / (2 * 16)), 0) if !safariThrow
|
||||
ball.setDelta(5, 34, 0) if safariThrow
|
||||
# Start of throw
|
||||
ball.setDelta(7,coordSets[2][0],coordSets[2][1])
|
||||
ball.setDelta(7,-14,0) if safariThrow
|
||||
ball.setDelta(7, coordSets[2][0], coordSets[2][1])
|
||||
ball.setDelta(7, -14, 0) if safariThrow
|
||||
# Update Poké Ball trajectory's start position
|
||||
ballStartX = ballStartY = 0
|
||||
coordSets.each do |c|
|
||||
ballStartX += c[0]
|
||||
ballStartY += c[1]
|
||||
end
|
||||
ballStartX -= ball.totalDuration*(Graphics.width/(2*16)) if !safariThrow
|
||||
ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow
|
||||
ballStartX += 8 if safariThrow # -12 + 34 - 14
|
||||
return ballStartX, ballStartY
|
||||
end
|
||||
|
||||
def trainerThrowingFrames(ball,trainer,traSprite)
|
||||
ball.setZ(0,traSprite.z-1)
|
||||
def trainerThrowingFrames(ball, trainer, traSprite)
|
||||
ball.setZ(0, traSprite.z - 1)
|
||||
# Change trainer's frames
|
||||
size = traSprite.src_rect.width # Width per frame
|
||||
trainer.setSrc(0,size,0)
|
||||
trainer.setSrc(5,size*2,0)
|
||||
trainer.setSrc(7,size*3,0)
|
||||
trainer.setSrc(9,size*4,0)
|
||||
trainer.setSrc(18,0,0)
|
||||
trainer.setSrc(0, size, 0)
|
||||
trainer.setSrc(5, size * 2, 0)
|
||||
trainer.setSrc(7, size * 3, 0)
|
||||
trainer.setSrc(9, size * 4, 0)
|
||||
trainer.setSrc(18, 0, 0)
|
||||
# Alter trainer's positioning
|
||||
trainer.setDelta(0,-12,0)
|
||||
trainer.setDelta(5,34,0)
|
||||
trainer.setDelta(7,-14,0)
|
||||
trainer.setDelta(9,28,0)
|
||||
trainer.moveDelta(10,3,-6,6)
|
||||
trainer.setDelta(18,-4,0)
|
||||
trainer.setDelta(19,-26,-6)
|
||||
trainer.setDelta(0, -12, 0)
|
||||
trainer.setDelta(5, 34, 0)
|
||||
trainer.setDelta(7, -14, 0)
|
||||
trainer.setDelta(9, 28, 0)
|
||||
trainer.moveDelta(10, 3, -6, 6)
|
||||
trainer.setDelta(18, -4, 0)
|
||||
trainer.setDelta(19, -26, -6)
|
||||
# Make ball track the trainer's hand
|
||||
ballStartX, ballStartY = ballTracksHand(ball,traSprite,true)
|
||||
ballStartX, ballStartY = ballTracksHand(ball, traSprite, true)
|
||||
return ballStartX, ballStartY
|
||||
end
|
||||
|
||||
def createBallTrajectory(ball,delay,duration,startX,startY,midX,midY,endX,endY)
|
||||
def createBallTrajectory(ball, delay, duration, startX, startY, midX, midY, endX, endY)
|
||||
# NOTE: This trajectory is the same regardless of whether the player's
|
||||
# sprite is being shown on-screen (and sliding off while animating a
|
||||
# throw). Instead, that throw animation and initialDelay are designed
|
||||
# to make sure the Ball's trajectory starts at the same position.
|
||||
ball.setVisible(delay,true)
|
||||
a = 2*startY - 4*midY + 2*endY
|
||||
b = 4*midY - 3*startY - endY
|
||||
ball.setVisible(delay, true)
|
||||
a = 2 * startY - 4 * midY + 2 * endY
|
||||
b = 4 * midY - 3 * startY - endY
|
||||
c = startY
|
||||
for i in 1..duration
|
||||
t = i.to_f/duration # t ranges from 0 to 1
|
||||
x = startX + (endX-startX)*t # Linear in t
|
||||
y = a*t**2 + b*t + c # Quadratic in t
|
||||
ball.moveXY(delay+i-1,1,x,y)
|
||||
t = i.to_f / duration # t ranges from 0 to 1
|
||||
x = startX + (endX - startX) * t # Linear in t
|
||||
y = a * t**2 + b * t + c # Quadratic in t
|
||||
ball.moveXY(delay + i - 1, 1, x, y)
|
||||
end
|
||||
createBallTumbling(ball,delay,duration)
|
||||
createBallTumbling(ball, delay, duration)
|
||||
end
|
||||
|
||||
def createBallTumbling(ball,delay,duration)
|
||||
def createBallTumbling(ball, delay, duration)
|
||||
# Animate ball frames
|
||||
numTumbles = 1
|
||||
numFrames = 1
|
||||
if @ballSprite && @ballSprite.bitmap.width>=@ballSprite.bitmap.height
|
||||
if @ballSprite && @ballSprite.bitmap.width >= @ballSprite.bitmap.height
|
||||
# 2* because each frame is twice as tall as it is wide
|
||||
numFrames = 2*@ballSprite.bitmap.width/@ballSprite.bitmap.height
|
||||
numFrames = 2 * @ballSprite.bitmap.width / @ballSprite.bitmap.height
|
||||
end
|
||||
if numFrames>1
|
||||
if numFrames > 1
|
||||
curFrame = 0
|
||||
for i in 1..duration
|
||||
thisFrame = numFrames*numTumbles*i/duration
|
||||
if thisFrame>curFrame
|
||||
thisFrame = numFrames * numTumbles * i / duration
|
||||
if thisFrame > curFrame
|
||||
curFrame = thisFrame
|
||||
ball.setSrc(delay+i-1,(curFrame%numFrames)*@ballSprite.bitmap.height/2,0)
|
||||
ball.setSrc(delay + i - 1, (curFrame % numFrames) * @ballSprite.bitmap.height / 2, 0)
|
||||
end
|
||||
end
|
||||
ball.setSrc(delay+duration,0,0)
|
||||
ball.setSrc(delay + duration, 0, 0)
|
||||
end
|
||||
# Rotate ball
|
||||
ball.moveAngle(delay,duration,360*3)
|
||||
ball.setAngle(delay+duration,0)
|
||||
ball.moveAngle(delay, duration, 360 * 3)
|
||||
ball.setAngle(delay + duration, 0)
|
||||
end
|
||||
|
||||
def ballSetOpen(ball, delay, poke_ball)
|
||||
@@ -228,24 +228,24 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
ballSetOpen(ball, delay, poke_ball)
|
||||
end
|
||||
|
||||
def battlerAppear(battler,delay,battlerX,battlerY,batSprite,color)
|
||||
battler.setVisible(delay,true)
|
||||
battler.setOpacity(delay,255)
|
||||
battler.moveXY(delay,5,battlerX,battlerY)
|
||||
battler.moveZoom(delay,5,100,[batSprite,:pbPlayIntroAnimation])
|
||||
def battlerAppear(battler, delay, battlerX, battlerY, batSprite, color)
|
||||
battler.setVisible(delay, true)
|
||||
battler.setOpacity(delay, 255)
|
||||
battler.moveXY(delay, 5, battlerX, battlerY)
|
||||
battler.moveZoom(delay, 5, 100, [batSprite, :pbPlayIntroAnimation])
|
||||
# NOTE: As soon as the battler sprite finishes zooming, and just as it
|
||||
# starts changing its tone to normal, it plays its intro animation.
|
||||
color.alpha = 0
|
||||
battler.moveColor(delay+5,10,color)
|
||||
battler.moveColor(delay + 5, 10, color)
|
||||
end
|
||||
|
||||
def battlerAbsorb(battler,delay,battlerX,battlerY,color)
|
||||
def battlerAbsorb(battler, delay, battlerX, battlerY, color)
|
||||
color.alpha = 255
|
||||
battler.moveColor(delay,10,color)
|
||||
battler.moveColor(delay, 10, color)
|
||||
delay = battler.totalDuration
|
||||
battler.moveXY(delay,5,battlerX,battlerY)
|
||||
battler.moveZoom(delay,5,0)
|
||||
battler.setVisible(delay+5,false)
|
||||
battler.moveXY(delay, 5, battlerX, battlerY)
|
||||
battler.moveZoom(delay, 5, 0)
|
||||
battler.setVisible(delay + 5, false)
|
||||
end
|
||||
|
||||
# The regular Poké Ball burst animation.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,15 +4,15 @@
|
||||
class Battle::DebugSceneNoLogging
|
||||
def initialize
|
||||
@battle = nil
|
||||
@lastCmd = [0,0,0,0]
|
||||
@lastMove = [0,0,0,0]
|
||||
@lastCmd = [0, 0, 0, 0]
|
||||
@lastMove = [0, 0, 0, 0]
|
||||
end
|
||||
|
||||
# Called whenever the battle begins.
|
||||
def pbStartBattle(battle)
|
||||
@battle = battle
|
||||
@lastCmd = [0,0,0,0]
|
||||
@lastMove = [0,0,0,0]
|
||||
@lastCmd = [0, 0, 0, 0]
|
||||
@lastMove = [0, 0, 0, 0]
|
||||
end
|
||||
|
||||
def pbBlitz(keys)
|
||||
@@ -23,61 +23,61 @@ class Battle::DebugSceneNoLogging
|
||||
def pbBeginCommandPhase; end
|
||||
def pbBeginAttackPhase; end
|
||||
def pbShowOpponent(idxTrainer); end
|
||||
def pbDamageAnimation(battler,effectiveness = 0); end
|
||||
def pbCommonAnimation(animName,user = nil,target = nil); end
|
||||
def pbAnimation(moveID,user,targets,hitNum = 0); end
|
||||
def pbDamageAnimation(battler, effectiveness = 0); end
|
||||
def pbCommonAnimation(animName, user = nil, target = nil); end
|
||||
def pbAnimation(moveID, user, targets, hitNum = 0); end
|
||||
def pbEndBattle(result); end
|
||||
def pbWildBattleSuccess; end
|
||||
def pbTrainerBattleSuccess; end
|
||||
def pbBattleArenaJudgment(b1,b2,r1,r2); end
|
||||
def pbBattleArenaBattlers(b1,b2); end
|
||||
def pbBattleArenaJudgment(b1, b2, r1, r2); end
|
||||
def pbBattleArenaBattlers(b1, b2); end
|
||||
|
||||
def pbRefresh; end
|
||||
|
||||
def pbDisplayMessage(msg,brief = false); end
|
||||
def pbDisplayMessage(msg, brief = false); end
|
||||
def pbDisplayPausedMessage(msg); end
|
||||
def pbDisplayConfirmMessage(msg); return true; end
|
||||
def pbShowCommands(msg,commands,defaultValue); return 0; end
|
||||
def pbShowCommands(msg, commands, defaultValue); return 0; end
|
||||
|
||||
def pbSendOutBattlers(sendOuts,startBattle = false); end
|
||||
def pbSendOutBattlers(sendOuts, startBattle = false); end
|
||||
def pbRecall(idxBattler); end
|
||||
def pbItemMenu(idxBattler,firstAction); return -1; end
|
||||
def pbItemMenu(idxBattler, firstAction); return -1; end
|
||||
def pbResetMoveIndex(idxBattler); end
|
||||
|
||||
def pbHPChanged(battler,oldHP,showAnim = false); end
|
||||
def pbHPChanged(battler, oldHP, showAnim = false); end
|
||||
def pbFaintBattler(battler); end
|
||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2); end
|
||||
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2); end
|
||||
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
|
||||
oldSpAtk, oldSpDef, oldSpeed); end
|
||||
def pbForgetMove(pkmn,moveToLearn); return 0; end # Always forget first move
|
||||
def pbForgetMove(pkmn, moveToLearn); return 0; end # Always forget first move
|
||||
|
||||
def pbCommandMenu(idxBattler,firstAction)
|
||||
return 1 if rand(15)==0 # Bag
|
||||
return 4 if rand(10)==0 # Call
|
||||
return 0 # Fight
|
||||
def pbCommandMenu(idxBattler, firstAction)
|
||||
return 1 if rand(15) == 0 # Bag
|
||||
return 4 if rand(10) == 0 # Call
|
||||
return 0 # Fight
|
||||
end
|
||||
|
||||
def pbFightMenu(idxBattler,megaEvoPossible = false)
|
||||
def pbFightMenu(idxBattler, megaEvoPossible = false)
|
||||
battler = @battle.battlers[idxBattler]
|
||||
50.times do
|
||||
break if yield rand(battler.move.length)
|
||||
end
|
||||
end
|
||||
|
||||
def pbChooseTarget(idxBattler,target_data,visibleSprites = nil)
|
||||
def pbChooseTarget(idxBattler, target_data, visibleSprites = nil)
|
||||
targets = @battle.allOtherSideBattlers(idxBattler).map { |b| b.index }
|
||||
return -1 if targets.length==0
|
||||
return -1 if targets.length == 0
|
||||
return targets.sample
|
||||
end
|
||||
|
||||
def pbPartyScreen(idxBattler,canCancel = false)
|
||||
def pbPartyScreen(idxBattler, canCancel = false)
|
||||
replacements = []
|
||||
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b,idxParty|
|
||||
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty,idxBattler)
|
||||
@battle.eachInTeamFromBattlerIndex(idxBattler) do |_b, idxParty|
|
||||
replacements.push(idxParty) if !@battle.pbFindBattler(idxParty, idxBattler)
|
||||
end
|
||||
return if replacements.length==0
|
||||
return if replacements.length == 0
|
||||
50.times do
|
||||
break if yield replacements[rand(replacements.length)],self
|
||||
break if yield replacements[rand(replacements.length)], self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user