Iniciado por Drimer
Puedes hacerlo en un script de tipo Escena, de hecho es lo mejor que puedes hacer xD
Una vez que tengas preparado tu menú, ve al script Scene_Map y cambia lo siguiente:
def call_menu
$game_temp.menu_calling = false
$game_player.straighten
$game_map.update
sscene=PokemonMenu_Scene.new
sscreen=PokemonMenu.new(sscene)
sscreen.pbStartPokemonMenu
end
Lo cambiarás por lo correspondiente al menú que hiciste.
Sobre los combates
Todo está en el script: PokeBattle_ActualScene.
Si quieres editar únicamente la introducción al combate entonces busca:
def pbStartBattle(battle)
Si quieres hacer escena BW entonces edita todo el script
con respecto al battle system nose como hacer lo que necesito
aca tengo el pokebattle_actualscene el que esta en mi essentials
=begin
- def pbChooseNewEnemy(index,party)
Use this method to choose a new Pokémon for the enemy
The enemy's party is guaranteed to have at least one
choosable member.
index - Index to the battler to be replaced (use e.g. @battle.battlers[index] to
access the battler)
party - Enemy's party
- def pbWildBattleSuccess
This method is called when the player wins a wild Pokémon battle.
This method can change the battle's music for example.
- def pbTrainerBattleSuccess
This method is called when the player wins a Trainer battle.
This method can change the battle's music for example.
- def pbFainted(pkmn)
This method is called whenever a Pokémon faints.
pkmn - PokeBattle_Battler object indicating the Pokémon that fainted
- def pbChooseEnemyCommand(index)
Use this method to choose a command for the enemy.
index - Index of enemy battler (use e.g. @battle.battlers[index] to
access the battler)
- def pbCommandMenu(index)
Use this method to display the list of commands and choose
a command for the player.
index - Index of battler (use e.g. @battle.battlers[index] to
access the battler)
Return values:
0 - Fight
1 - Pokémon
2 - Bag
3 - Run
=end
################################################
class CommandMenuDisplay
def initialize(viewport=nil)
@display=nil
if PokeBattle_Scene::USECOMMANDBOX
@display=IconSprite.new(0,Graphics.height-96,viewport)
@display.setBitmap("Graphics/Pictures/commandbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
Graphics.width-240,Graphics.height-96,240,96);
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
[MENTION=24700]Wind[/MENTION]ow.viewport=viewport
@msgbox=Window_UnformattedTextPokemon.newWithSize(
"",4,Graphics.height-96,
[email]Graphics.width [MENTION=24700]Wind[/MENTION]ow.width[/email]-4,
96,viewport)
@msgbox.baseColor=PokeBattle_Scene::MESSAGEBASECOLOR
@msgbox.shadowColor=PokeBattle_Scene::MESSAGESHADOWCOLOR
@msgbox.windowskin=nil
if PokeBattle_Scene::USECOMMANDBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
end
@title=""
end
def index; [MENTION=24700]Wind[/MENTION]ow.index; end
def index=(value); [MENTION=24700]Wind[/MENTION]ow.index=value; end
def setTexts(value)
@msgbox.text=value[0]
# Note 2 and 3 were intentionally switched
commands=[]
[1,3,2,4].each{|i|
commands.push(value) if value && value!=nil
}
[MENTION=24700]Wind[/MENTION]ow.commands=commands
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@msgbox.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@msgbox.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@msgbox.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@msgbox.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@msgbox.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@msgbox.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@msgbox.z=value
@display.z=value if @display
end
def disposed?
return @msgbox.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@msgbox.dispose
[MENTION=24700]Wind[/MENTION]ow.dispose
@display.dispose if @display
end
def update
@msgbox.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def refresh
@msgbox.refresh
[MENTION=24700]Wind[/MENTION]ow.refresh
end
end
class FightMenuDisplay
attr_reader :battler
attr_reader :index
def battler=(value)
@battler=value
refresh
end
def setIndex(value)
if @battler && @battler.moves[value].id!=0
@index=value
[MENTION=24700]Wind[/MENTION]ow.index=value
refresh
end
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@info.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@info.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@info.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@info.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@info.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@info.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@info.z=value
@display.z=value if @display
end
def disposed?
return @info.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@info.dispose
@display.dispose if @display
[MENTION=24700]Wind[/MENTION]ow.dispose
end
def update
@info.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def initialize(battler,viewport=nil)
@display=nil
if PokeBattle_Scene::USEFIGHTBOX
@display=IconSprite.new(0,Graphics.height-96,viewport)
@display.setBitmap("Graphics/Pictures/fightbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
0,Graphics.height-96,320,96,viewport)
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
@info=Window_AdvancedTextPokemon.newWithSize(
"",320,Graphics.height-96,Graphics.width-320,96,viewport)
@ctag=shadowctag(PokeBattle_Scene::MENUBASECOLOR,
PokeBattle_Scene::MENUSHADOWCOLOR)
if PokeBattle_Scene::USEFIGHTBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
@info.opacity=0
end
@battler=battler
@index=0
refresh
end
def refresh
return if !@battler
pbSetNarrowFont [MENTION=24700]Wind[/MENTION]ow.contents)
commands=[]
for i in 0...4
if @battler.moves.id!=0
commands.push(@battler.moves.name)
else
break
end
end
[MENTION=24700]Wind[/MENTION]ow.commands=commands
selmove=@battler.moves[@index]
movetype=PBTypes.getName(selmove.type)
pbSetNarrowFont(@info.contents)
@info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
@ctag,selmove.pp,selmove.totalpp,movetype)
end
end
class PokemonBattlerSprite < RPG::Sprite
attr_accessor :selected
def initialize(doublebattle,index,viewport=nil)
super(viewport)
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@index=index
@updating=false
@doublebattle=doublebattle
@index=index
[MENTION=24071]Sprite[/MENTION]X=0
[MENTION=24071]Sprite[/MENTION]Y=0
[MENTION=24071]Sprite[/MENTION]XExtra=0
[MENTION=24071]Sprite[/MENTION]YExtra=0
[MENTION=24071]Sprite[/MENTION]Visible=false
@_iconbitmap=nil
self.visible=false
end
def selected=(value)
if @selected==1 && value!=1 && [MENTION=24071]Sprite[/MENTION]YExtra>0
[MENTION=24071]Sprite[/MENTION]YExtra=0
self.y [MENTION=24071]Sprite[/MENTION]Y
end
@selected=value
end
def visible=(value)
[MENTION=24071]Sprite[/MENTION]Visible=value if !@updating
super
end
def x
return [MENTION=24071]Sprite[/MENTION]X
end
def y
return [MENTION=24071]Sprite[/MENTION]Y
end
def x=(value)
[MENTION=24071]Sprite[/MENTION]X=value
super(value [MENTION=24071]Sprite[/MENTION]XExtra)
end
def y=(value)
[MENTION=24071]Sprite[/MENTION]Y=value
super(value [MENTION=24071]Sprite[/MENTION]YExtra)
end
def update
[MENTION=19010]Frame[/MENTION]+=1
@updating=true
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
[MENTION=24071]Sprite[/MENTION]YExtra=2
else
[MENTION=24071]Sprite[/MENTION]YExtra=0
end
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
elsif @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible= [MENTION=19010]Frame[/MENTION]%10<7)
elsif
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
end
if @_iconbitmap
@_iconbitmap.update
self.bitmap=@_iconbitmap.bitmap
end
@updating=false
end
def dispose
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=nil
self.bitmap=nil if !self.disposed?
super
end
def setPokemonBitmap(pokemon,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmap(pokemon,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
def setPokemonBitmapSpecies(pokemon,species,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmapSpecies(pokemon,species,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
end
class SafariDataBox < SpriteWrapper
attr_accessor :selected
attr_reader :appearing
def initialize(battle,viewport=nil)
super(viewport)
@selected=0
@battle=battle
@databox=AnimatedBitmap.new("Graphics/Pictures/safariPlayerBox")
[MENTION=24071]Sprite[/MENTION]X=254
[MENTION=24071]Sprite[/MENTION]Y=148+(Graphics.height-320)
[MENTION=24071]Sprite[/MENTION]baseY=0
[MENTION=24071]Sprite[/MENTION]baseX=16
@appearing=false
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=2
refresh
end
def appear
refresh
self.visible=true
self.opacity=255
self.x [MENTION=24071]Sprite[/MENTION]X+320
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
textpos=[]
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
textpos.push([_INTL("SAFARI BALLS") [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+6,false,base,shadow])
textpos.push([_INTL("Left: {1}",@battle.ballcount) [MENTION=24071]Sprite[/MENTION]baseX+170 [MENTION=24071]Sprite[/MENTION]baseY+40,
true,base,shadow])
pbDrawTextPositions(self.bitmap,textpos)
end
def update
super
if @appearing
self.x-=8
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
class PokemonDataBox < SpriteWrapper
attr_reader :battler
attr_accessor :selected
attr_accessor :appearing
attr_reader :animatingHP
attr_reader :animatingEXP
def initialize(battler,doublebattle,viewport=nil)
super(viewport)
@explevel=0
@battler=battler
[MENTION=24071]Sprite[/MENTION]baseY=0
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@showhp=false
@showexp=false
@appearing=false
@animatingHP=false
@currenthp=0
@endhp=0
@expflash=0
@statusCX=64
@statusY=28
if (@battler.index&1)==0 # if player's Pokémon
[MENTION=24071]Sprite[/MENTION]baseX=16
else
[MENTION=24071]Sprite[/MENTION]baseX=0
end
yoffset=(Graphics.height-320)
if doublebattle
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=256
[MENTION=24071]Sprite[/MENTION]Y=124+yoffset
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26
[MENTION=24071]Sprite[/MENTION]Y=10+yoffset
[MENTION=24071]Sprite[/MENTION]baseX=0
[MENTION=24071]Sprite[/MENTION]baseY=0
when 2
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=280
[MENTION=24071]Sprite[/MENTION]Y=174+yoffset
when 3
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=2
[MENTION=24071]Sprite[/MENTION]Y=60+yoffset
end
else
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/singlePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=254
[MENTION=24071]Sprite[/MENTION]Y=148
@showhp=true
@showexp=true
@statusCX=40
@statusY=44
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/singleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26
[MENTION=24071]Sprite[/MENTION]Y=32+yoffset
end
end
@statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/boxstatuses"))
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=2
refreshExpLevel
refresh
end
def dispose
@statuses.dispose
@databox.dispose
@contents.dispose
super
end
def refreshExpLevel
if !@battler.pokemon
@explevel=0
else
growthrate=@battler.pokemon.growthrate
startexp=PBExperience.pbGetStartExperience(@battler.pokemon.level,growthrate)
endexp=PBExperience.pbGetStartExperience(@battler.pokemon.level+1,growthrate)
if startexp==endexp
@explevel=0
else
@explevel=(@battler.pokemon.exp-startexp)*PokeBattle_Scene::EXPGAUGESIZE/(endexp-startexp)
end
end
end
def exp
return @animatingEXP ? @currentexp : @explevel
end
def hp
return @animatingHP ? @currenthp : @battler.hp
end
def animateHP(oldhp,newhp)
@currenthp=oldhp
@endhp=newhp
@animatingHP=true
end
def animateEXP(oldexp,newexp)
@currentexp=oldexp
@endexp=newexp
@animatingEXP=true
end
def appear
refreshExpLevel
refresh
self.visible=true
self.opacity=255
if (@battler.index&1)==0 # if player's Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X+320
else
self.x [MENTION=24071]Sprite[/MENTION]X-320
end
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
return if !@battler.pokemon
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
textpos=[]
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
genderX=self.bitmap.text_size(@battler.name).width
genderX+ [MENTION=24071]Sprite[/MENTION]baseX+14
textpos.push([@battler.name [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+6,false,base,shadow])
if @battler.gender==0 # Male
textpos.push([_INTL("?"),genderX [MENTION=24071]Sprite[/MENTION]baseY+6,false,Color.new(8*8,25*8,31*8),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("?"),genderX [MENTION=24071]Sprite[/MENTION]baseY+6,false,Color.new(31*8,19*8,18*8),shadow])
end
textpos.push([_INTL("Lv{1}",@battler.level) [MENTION=24071]Sprite[/MENTION]baseX+170 [MENTION=24071]Sprite[/MENTION]baseY+6,true,base,shadow])
if @showhp
textpos.push([hpstring [MENTION=24071]Sprite[/MENTION]baseX+170 [MENTION=24071]Sprite[/MENTION]baseY+40,true,base,shadow])
end
pbDrawTextPositions(self.bitmap,textpos)
if @battler.status>0
self.bitmap.blt [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+@statusY,@statuses.bitmap,
Rect.new(0,(@battler.status-1)*16,@statusCX,16))
end
hpGaugeSize=PokeBattle_Scene::HPGAUGESIZE
hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
hpgauge=1 if hpgauge==0 && self.hp>0
hpzone=0
hpzone=1 if self.hp<=(@battler.totalhp/2).floor
hpzone=2 if self.hp<=(@battler.totalhp/4).floor
hpcolors=[
PokeBattle_Scene::HPCOLORSHADOW1,
PokeBattle_Scene::HPCOLORBASE1,
PokeBattle_Scene::HPCOLORSHADOW2,
PokeBattle_Scene::HPCOLORBASE2,
PokeBattle_Scene::HPCOLORSHADOW3,
PokeBattle_Scene::HPCOLORBASE3
]
# fill with HP color
hpGaugeX=PokeBattle_Scene::HPGAUGE_X
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y
expGaugeX=PokeBattle_Scene::EXPGAUGE_X
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpgauge,2,hpcolors[hpzone*2])
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpgauge,2,hpcolors[hpzone*2+1])
# fill with black
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORSHADOW4)
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORBASE4)
if @showexp
# fill with EXP color
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+expGaugeX [MENTION=24071]Sprite[/MENTION]baseY+expGaugeY,self.exp,4,PokeBattle_Scene::EXPCOLOR)
end
end
def update
super
[MENTION=19010]Frame[/MENTION]+=1
if @animatingHP
if @currenthp<@endhp
@currenthp+=1
elsif @currenthp>@endhp
@currenthp-=1
end
refresh
@animatingHP=false if @currenthp==@endhp
end
if @animatingEXP
if !@showexp
@currentexp=@endexp
elsif @currentexp<@endexp
@currentexp+=1
elsif @currentexp>@endexp
@currentexp-=1
end
refresh
if @currentexp==@endexp
if @currentexp==PokeBattle_Scene::EXPGAUGESIZE
if @expflash==0
pbSEPlay("expfull")
self.flash(Color.new(64,200,248),8)
@expflash=8
else
@expflash-=1
if @expflash==0
@animatingEXP=false
refreshExpLevel
end
end
else
@animatingEXP=false
end
end
end
if @appearing
if (@battler.index&1)==0 # if player's Pokémon
self.x-=8
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
else
self.x+=8
@appearing=false if self.x> [MENTION=24071]Sprite[/MENTION]X
end
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
if ( [MENTION=19010]Frame[/MENTION]/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
elsif ( [MENTION=19010]Frame[/MENTION]/5).floor&1)==1 && @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
else
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
end
def showShadow?(species)
metrics=load_data("Data/metrics.dat")
return metrics[2][species]>0
end
def adjustBattleSpriteY(sprite,species,index)
ret=0
metrics=load_data("Data/metrics.dat")
if index==1 || index==3
factor=metrics[1][species] # enemy Y
factor-=metrics[2][species] # altitude (affects shadows)
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret=factor*2+(64-halfY)
ret+=16 if index==1
else
ret=(index==0) ? 96 : 112
ret+=(metrics[0][species])*2
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret+=(64-halfY)
end
return ret+(Graphics.height-320)
end
class PokeballSendOutAnimation
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
@ballused=pkmn.pokemon ? pkmn.pokemon.ballused : 0
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(31*8,22*8,30*8)
[MENTION=19050]poke[/MENTION]ballsprite=IconSprite.new(0,0,sprite.viewport)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_0",@ballused))
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==1 ? 400 : 304
else
[MENTION=24071]Sprite[/MENTION]x=344
end
[MENTION=24071]Sprite[/MENTION]y=120+(Graphics.height-320)
[MENTION=24071]Sprite[/MENTION]hash=spritehash
[MENTION=19050]poke[/MENTION]ballsprite.x [MENTION=24071]Sprite[/MENTION]x-8
[MENTION=19050]poke[/MENTION]ballsprite.y [MENTION=24071]Sprite[/MENTION]y-8
[MENTION=28203]pkmn[/MENTION]=pkmn
@endspritey=adjustBattleSpriteY(sprite,pkmn.species,pkmn.index)
[MENTION=12804]Shadow[/MENTION]Y [MENTION=24071]Sprite[/MENTION]y+18 # from top
[MENTION=12804]Shadow[/MENTION]X [MENTION=24071]Sprite[/MENTION]x-32 # from left
[MENTION=12804]Shadow[/MENTION]Visible=showShadow?(pkmn.species)
[MENTION=12804]Shadow[/MENTION]Y-=16 if doublebattle && pkmn.index==3
@stepspritey= [MENTION=24071]Sprite[/MENTION]y-@endspritey)
@zoomstep=(1.0-STARTZOOM)/SPRITESTEPS
@animdone=false
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
[MENTION=19050]poke[/MENTION]ballsprite.dispose
@disposed=true
end
def update
return if disposed?
[MENTION=19050]poke[/MENTION]ballsprite.update
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==2
pbSEPlay("recall")
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_1",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_2",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==8
[MENTION=19050]poke[/MENTION]ballsprite.visible=false
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<1.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=1.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 1.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=1.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 1.0
currentY [MENTION=24071]Sprite[/MENTION]y-(@stepspritey [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y)
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,currentY)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y=currentY
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 &&
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=1.0
@animdone=true
if [MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"]
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].x [MENTION=12804]Shadow[/MENTION]X
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].y [MENTION=12804]Shadow[/MENTION]Y
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].visible [MENTION=12804]Shadow[/MENTION]Visible
end
end
end
end
def pokeballThrow(ball,shakes,targetBattler)
balltype=@battle.pbGetBallType(ball)
oldvisible [MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=false
ball0=sprintf("Graphics/Pictures/ball%02d_0",balltype)
ball1=sprintf("Graphics/Pictures/ball%02d_1",balltype)
ball2=sprintf("Graphics/Pictures/ball%02d_2",balltype)
# sprites
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"]
# pictures
pictureBall=PictureEx.new(0)
picturePoke=PictureEx.new(0)
pokeball=[360,32]
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"])
# starting positions
pictureBall.moveVisible(1,true)
pictureBall.moveName(1,ball0)
pictureBall.moveOrigin(1,PictureOrigin::Center)
pictureBall.moveXY(0,1,83,103)
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveSE(1,"Audio/SE/throw")
pictureBall.moveCurve(20,1,233,47,314,33,360,32)
delay=pictureBall.totalDuration+2
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,pokeball[0],pokeball[1])
picturePoke.moveSE(delay+10,"Audio/SE/jumptoball")
picturePoke.moveVisible(delay+15,false)
pictureBall.moveName(picturePoke.totalDuration+2,ball0)
delay=picturePoke.totalDuration+6
pictureBall.moveXY(15,delay,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(8,pictureBall.totalDuration+2,pokeball[0],80)
pictureBall.moveXY(7,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(6,pictureBall.totalDuration+2,pokeball[0],96)
pictureBall.moveXY(5,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(4,pictureBall.totalDuration+2,pokeball[0],112)
pictureBall.moveXY(3,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
picturePoke.moveXY(0,pictureBall.totalDuration,pokeball[0],128)
delay=pictureBall.totalDuration+18 if shakes==0
[shakes,3].min.times do
delay=pictureBall.totalDuration+18
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(4,delay,pokeball[0]-8,128)
pictureBall.moveAngle(4,delay,20) # positive means counterclockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(8,delay,pokeball[0]+8,128)
pictureBall.moveAngle(8,delay,-20) # negative means clockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(4,delay,pokeball[0],128)
pictureBall.moveAngle(4,delay,0)
end
if shakes<4
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
pictureBall.moveVisible(delay+10,false)
picturePoke.moveVisible(delay,true)
picturePoke.moveZoom(15,delay,100)
picturePoke.moveXY(15,delay,center[0],center[1])
delay=picturePoke.totalDuration
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8,0))
end
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
picturePoke.moveXY(0,picturePoke.totalDuration,dims[0],dims[1])
loop do
pictureBall.update
picturePoke.update
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !pictureBall.running? && !picturePoke.running?
end
if shakes<4
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=oldvisible
end
spriteBall.dispose
end
class PokeballPlayerSendOutAnimation
# Ball curve: 8,52; 22,44; 52, 96
# Player: Color.new(16*8,23*8,30*8)
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=28203]pkmn[/MENTION]=pkmn
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(16*8,23*8,30*8)
[MENTION=24071]Sprite[/MENTION]hash=spritehash
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==0 ? 64 : 180
else
[MENTION=24071]Sprite[/MENTION]x=128
end
[MENTION=24071]Sprite[/MENTION]y=Graphics.height-64
@endspritey=adjustBattleSpriteY [MENTION=12671]pokemon[/MENTION]BattlerSprite,
pkmn.species,pkmn.index)
@animdone=false
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
@disposed=true
end
def update
return if disposed?
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSEPlay("recall")
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<1.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=1.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 1.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=1.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 1.0
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,0)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y [MENTION=24071]Sprite[/MENTION]y+(@endspritey [MENTION=24071]Sprite[/MENTION]y) [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 &&
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=1.0
@animdone=true
end
end
end
class TrainerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=8
[MENTION=24071]Sprite[/MENTION]s["trainer2"].x+=8 if [MENTION=24071]Sprite[/MENTION]s["trainer2"]
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=8
[MENTION=24071]Sprite[/MENTION]s["partybase1"].opacity-=12
for i in 0...6
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].x+=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
@animdone=true if [MENTION=24071]Sprite[/MENTION]s["trainer"].x>=480 &&
( [MENTION=24071]Sprite[/MENTION]s["trainer2"]| [MENTION=24071]Sprite[/MENTION]s["trainer2"].x>=480)
end
end
class PlayerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["player"].x-=8
[MENTION=24071]Sprite[/MENTION]s["playerB"].x-=8 if [MENTION=24071]Sprite[/MENTION]s["playerB"]
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=8
[MENTION=24071]Sprite[/MENTION]s["partybase2"].opacity-=12
for i in 0...6
if [MENTION=24071]Sprite[/MENTION]s["player#{i}"]
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].x-=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
end
pa [MENTION=24071]Sprite[/MENTION]s["player"]
pb [MENTION=24071]Sprite[/MENTION]s["playerB"]
pawidth=224
pbwidth=224
if (pa && pa.bitmap && !pa.bitmap.disposed?)
if pa.bitmap.height<pa.bitmap.width
numframes=pa.bitmap.width/pa.bitmap.height # Number of frames
pawidth=pa.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
else
pawidth=pa.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
end
end
if (pb && pb.bitmap && !pb.bitmap.disposed?)
if pb.bitmap.height<pb.bitmap.width
numframes=pb.bitmap.width/pb.bitmap.height # Number of frames
pbwidth=pb.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
else
pbwidth=pb.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
end
end
if pb
@animdone=true if pb.x<=-pbwidth
else
@animdone=true if pa.x<=-pawidth
end
end
end
####################################################
class PokeBattle_Scene
USECOMMANDBOX=false # If true, expects a file named Graphics/Pictures/commandbox.png
USEFIGHTBOX=false # If true, expects a file named Graphics/Pictures/fightbox.png
MESSAGEBASECOLOR=Color.new(248,248,248)
MESSAGESHADOWCOLOR=Color.new(104,88,112)
MENUBASECOLOR=Color.new(255,255,255)
MENUSHADOWCOLOR=Color.new(0,0,0)
BOXTEXTBASECOLOR=Color.new(255,255,255)
BOXTEXTSHADOWCOLOR=Color.new(0,0,0)
EXPCOLOR=Color.new(64,200,248)
# Green HP color
HPCOLORBASE1=Color.new(14*8,31*8,21*8)
HPCOLORSHADOW1=Color.new(11*8,26*8,16*8)
# Orange HP color
HPCOLORBASE2=Color.new(31*8,28*8,7*8)
HPCOLORSHADOW2=Color.new(25*8,21*8,1*8)
# Red HP color
HPCOLORBASE3=Color.new(31*8,11*8,7*8)
HPCOLORSHADOW3=Color.new(21*8,8*8,9*8)
# Blank HP color
HPCOLORBASE4=Color.new(0,0,0)
HPCOLORSHADOW4=Color.new(0,0,0)
# Position of HP gauge
HPGAUGE_X=78
HPGAUGE_Y=34
# Position of EXP gauge
EXPGAUGE_X=46
EXPGAUGE_Y=66
# Size of gauges
EXPGAUGESIZE=128
HPGAUGESIZE=96
BLANK=0
MESSAGEBOX=1
COMMANDBOX=2
FIGHTBOX=3
attr_accessor :abortable
def initialize
@battle=nil
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=28203]pkmn[/MENTION]windows=[nil,nil,nil,nil]
[MENTION=24071]Sprite[/MENTION]s={}
@battlestart=true
@messagemode=false
@abortable=false
@aborted=false
end
def pbUpdate
partyAnimationUpdate
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
end
def pbGraphicsUpdate
partyAnimationUpdate
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
Graphics.update
end
def pbInputUpdate
Input.update
if Input.trigger?(Input::B) && @abortable && !@aborted
@aborted=true
@battle.pbAbort
end
end
def pbShowWindow(windowtype)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=(windowtype==MESSAGEBOX||windowtype==COMMANDBOX||windowtype==FIGHTBOX||
windowtype==BLANK)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].visible=(windowtype==MESSAGEBOX)
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].visible=(windowtype==COMMANDBOX)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].visible=(windowtype==FIGHTBOX)
end
def pbSetMessageMode(mode)
@messagemode=mode
msgwindow [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
if mode # Within Pokémon command
msgwindow.baseColor=MENUBASECOLOR
msgwindow.shadowColor=MENUSHADOWCOLOR
msgwindow.opacity=255
msgwindow.x=0
msgwindow.width=Graphics.width
msgwindow.height=96
msgwindow.y=Graphics.height-msgwindow.height
else
msgwindow.baseColor=MESSAGEBASECOLOR
msgwindow.shadowColor=MESSAGESHADOWCOLOR
msgwindow.opacity=0
msgwindow.x=16
msgwindow.width=Graphics.width-32
msgwindow.height=96
msgwindow.y=Graphics.height-msgwindow.height
end
end
def pbWaitMessage
if @briefmessage
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
60.times do
pbGraphicsUpdate
pbInputUpdate
end
cw.text=""
cw.visible=false
@briefmessage=false
end
end
def pbDisplayMessage(msg,brief=false)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
cw.text=msg
i=0
loop do
pbGraphicsUpdate
pbInputUpdate
cw.update
if i==60
cw.text=""
cw.visible=false
return
end
if Input.trigger?(Input::C) || @abortable
if cw.pausing?
pbPlayDecisionSE() if !@abortable
cw.resume
end
end
if !cw.busy?
if brief
@briefmessage=true
return
end
i+=1
end
end
end
def pbDisplayPausedMessage(msg)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
if @messagemode
@switchscreen.pbDisplay(msg)
return
end
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
cw.text=_ISPRINTF("{1:s}\1",msg)
loop do
pbGraphicsUpdate
pbInputUpdate
if Input.trigger?(Input::C) || @abortable
if cw.busy?
pbPlayDecisionSE() if cw.pausing? && !@abortable
cw.resume
else
cw.text=""
pbPlayDecisionSE()
cw.visible=false if @messagemode
return
end
end
cw.update
end
end
def pbDisplayConfirmMessage(msg)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
dw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
dw.text=msg
commands=[_INTL("YES"),_INTL("NO")]
cw = Window_CommandPokemon.new(commands)
cw.x=Graphics.width-cw.width
cw.y=Graphics.height-cw.height-dw.height
cw.index=0
cw.viewport=@viewport
pbRefresh
loop do
cw.visible=!dw.busy?
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw)
dw.update
if Input.trigger?(Input::B)
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return false
end
end
if Input.trigger?(Input::C)
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return (cw.index==0)?true:false
end
end
end
end
def pbFrameUpdate(cw)
cw.update if cw
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
end
if [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
end
def pbRefresh
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
end
def pbAddSprite(id,x,y,filename,viewport)
sprite=IconSprite.new(x,y,viewport)
if filename
sprite.setBitmap(filename) rescue nil
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbAddPlane(id,filename,viewport)
sprite=AnimatedPlane.new(viewport)
if filename
sprite.setBitmap(filename)
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbDisposeSprites
pbDisposeSpriteHash [MENTION=24071]Sprite[/MENTION]s)
end
def pbBeginCommandPhase
# Called whenever a new round begins.
@battlestart=false
end
def pbShowOpponent(index)
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[index].trainertype)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
end
else
trainerfile="Graphics/Pictures/trfront"
end
pbAddSprite("trainer",Graphics.width,16+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x-=6
end
end
def pbHideOpponent
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=6
end
end
def pbShowHelp(text)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].resizeToFit(text,Graphics.width)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].y=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].x=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].text=text
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=true
end
def pbHideHelp
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
end
def pbBackdrop
outdoor=false
if $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
outdoor=true
end
case @battle.environment
when PBEnvironment::Grass
id=1
when PBEnvironment::TallGrass
id=2
when PBEnvironment::MovingWater
id=3
when PBEnvironment::StillWater
id=4
when PBEnvironment::Underwater
id=5
when PBEnvironment::Rock
id=7
when PBEnvironment::Cave
id=8
when PBEnvironment::Sand
id=9
else
id=(outdoor) ? 0 : 6
end
if $PokemonGlobal && $PokemonGlobal.nextBattleBack
id=$PokemonGlobal.nextBattleBack
elsif $game_map
back=pbGetMetadata($game_map.map_id,MetadataBattleBack)
if back && back!=""
id=pbGetMetadata($game_map.map_id,MetadataBattleBack)
end
end
battlebg="Graphics/Pictures/battlebg#{id}"
enemybase="Graphics/Pictures/enemybase#{id}"
playerbase="Graphics/Pictures/playerbase#{id}"
pbAddPlane("battlebg",battlebg,@viewport)
pbAddSprite("enemybase",-256,96+@yoffset,enemybase,@viewport) # ends at (224,96)
pbAddSprite("playerbase",Graphics.width,192+@yoffset,playerbase,@viewport) # ends at (0,192)
[MENTION=24071]Sprite[/MENTION]s["enemybase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["playerbase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["battlebg"].z=-1 # For compatibility with RGSS2
=begin
if outdoor
tone = $HourlyTones[Time.now.hour]
[MENTION=24071]Sprite[/MENTION]s["battlebg"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["enemybase"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["playerbase"].tone=tone
end
=end
end
def inPartyAnimation?
return @enablePartyAnim && @partyAnimPhase<4
end
def partyAnimationUpdate
return if !inPartyAnimation?
if @partyAnimPhase==0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=16
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=16
@partyAnimPhase=1 if [MENTION=24071]Sprite[/MENTION]s["partybase1"].x [MENTION=24071]Sprite[/MENTION]s["partybase1"].bitmap.width>=208
return
end
if @partyAnimPhase==1
@enemyendpos=152
@playerendpos=312
@partyAnimPhase=2
@partyAnimI=0
end
if @partyAnimPhase==2
if @partyAnimI>=6
@partyAnimPhase=4
return
end
if @partyAnimI>=@battle.party2.length || !@battle.party2[@partyAnimI]
pbAddSprite("enemy#{@partyAnimI}",-28,64+@yoffset,"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party2[@partyAnimI].hp<=0 || @battle.party2[@partyAnimI].status>0 || @battle.party2[@partyAnimI].egg?
pbAddSprite("enemy#{@partyAnimI}",-28,64+@yoffset,"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("enemy#{@partyAnimI}",-28,64+@yoffset,"Graphics/Pictures/ballnormal",@viewport)
end
if @partyAnimI==@battle.party1.length || !@battle.party1[@partyAnimI]
pbAddSprite("player#{@partyAnimI}",492,176+@yoffset,"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party1[@partyAnimI].hp<=0 || @battle.party1[@partyAnimI].status>0 || @battle.party1[@partyAnimI].egg?
pbAddSprite("player#{@partyAnimI}",492,176+@yoffset,"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("player#{@partyAnimI}",492,176+@yoffset,"Graphics/Pictures/ballnormal",@viewport)
end
@partyAnimPhase=3
end
if @partyAnimPhase==3
[MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x+=20
[MENTION=24071]Sprite[/MENTION]s["player#{@partyAnimI}"].x-=20
if [MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x>=@enemyendpos
@partyAnimPhase=2
@partyAnimI+=1
@enemyendpos-=20
@playerendpos+=20
end
end
end
def pbStartBattle(battle)
# Called whenever the battle begins
@battle=battle
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=24071]Sprite[/MENTION]s.clear
[MENTION=24071]Sprite[/MENTION]s.clear
@viewport=Viewport.new(0,Graphics.height/2,Graphics.width,0)
@viewport.z=99999
@battleboxvp=Viewport.new(0,0,Graphics.width,Graphics.height)
@battleboxvp.z=99999
@showingplayer=true
@showingenemy=true
@yoffset=(Graphics.height-320)
pbBackdrop
pbAddSprite("partybase1",-400,80+@yoffset,"Graphics/Pictures/pbarrow",@viewport)
pbAddSprite("partybase2",480,192+@yoffset,"Graphics/Pictures/pbarrow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["partybase2"].mirror=true
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=false
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[0].trainertype)
pbAddSprite("trainer",-144,16+@yoffset,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[1].trainertype)
pbAddSprite("trainer2",-240,16+@yoffset,trainerfile,@viewport)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
pbAddSprite("trainer",-192,16+@yoffset,trainerfile,@viewport)
end
else
trainerfile="Graphics/Pictures/trfront"
pbAddSprite("trainer",-192,16+@yoffset,trainerfile,@viewport)
end
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
if [MENTION=24071]Sprite[/MENTION]s["trainer2"] && [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer2"].y- [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap.height-128
end
[MENTION=24071]Sprite[/MENTION]s["shadow0"]=IconSprite.new(0,0,@viewport)
pbAddSprite("shadow1",0,0+@yoffset,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["pokemon0"]=PokemonBattlerSprite.new(battle.doublebattle,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"]=PokemonBattlerSprite.new(battle.doublebattle,1,@viewport)
if battle.doublebattle
pbAddSprite("shadow3",0,0+@yoffset,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=false
[MENTION=24071]Sprite[/MENTION]s["shadow2"]=IconSprite.new(0,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"]=PokemonBattlerSprite.new(battle.doublebattle,3,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon2"]=PokemonBattlerSprite.new(battle.doublebattle,2,@viewport)
end
[MENTION=24071]Sprite[/MENTION]s["battler0"]=PokemonDataBox.new(battle.battlers[0],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler1"]=PokemonDataBox.new(battle.battlers[1],battle.doublebattle,@viewport)
if battle.doublebattle
[MENTION=24071]Sprite[/MENTION]s["battler2"]=PokemonDataBox.new(battle.battlers[2],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler3"]=PokemonDataBox.new(battle.battlers[3],battle.doublebattle,@viewport)
end
if @battle.player.is_a?(Array)
trainerfile=sprintf("Graphics/Pictures/trback%03d",@battle.player[0].trainertype)
pbAddSprite("player",576-48,96+@yoffset,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Pictures/trback%03d",@battle.player[1].trainertype)
pbAddSprite("playerB",576+48,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/4
end
end
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width/4
end
end
else
trainerfile=sprintf("Graphics/Pictures/trback%03d",@battle.player.trainertype)
pbAddSprite("player",576,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/4
end
end
end
pbAddSprite("messagebox",0,Graphics.height-96,"Graphics/Pictures/messagebox",@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
[MENTION=24071]Sprite[/MENTION]s["messagewindow"]=Window_AdvancedTextPokemon.new("")
[MENTION=24071]Sprite[/MENTION]s["commandwindow"]=CommandMenuDisplay.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"]=FightMenuDisplay.new(nil,@viewport)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].letterbyletter=true
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].viewport=@viewport
[MENTION=24071]Sprite[/MENTION]s["messagebox"].z=50
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].z=100
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].z=100
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].z=100
pbShowWindow(MESSAGEBOX)
pbSetMessageMode(false)
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["trainer"]
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["trainer2"]
if !@battle.opponent
[MENTION=24071]Sprite[/MENTION]s["trainer"].visible=false
if @battle.party2.length>=1
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,128)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=-192 # ends at 144*2
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-192+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2+@yoffset
species=@battle.party2[0].species
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"],
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x,
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"],species,1)
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
end
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=-144
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-144+16*2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y+=8
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2+@yoffset+8
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].setPokemonBitmap(@battle.party2[1],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].x=-240
[MENTION=24071]Sprite[/MENTION]s["shadow3"].x=-240+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow3"].y=65*2+@yoffset
species=@battle.party2[1].species
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"],
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].x,
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"],species,3)
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["pokemon3"]
end
end
loop do
if @viewport.rect.y>Graphics.height/4
@viewport.rect.y-=2
@viewport.rect.height+=4
elsif @viewport.rect.y>0
@viewport.rect.y-=4
@viewport.rect.height+=8
end
for i in [MENTION=24071]Sprite[/MENTION]s
i[1].ox=@viewport.rect.x
i[1].oy=@viewport.rect.y
end
[MENTION=24071]Sprite[/MENTION]s["enemybase"].x+=4
[MENTION=24071]Sprite[/MENTION]s["playerbase"].x-=4
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x+=4
[MENTION=24071]Sprite[/MENTION]s["shadow3"].x+=4 if [MENTION=24071]Sprite[/MENTION]s["shadow3"]
trainersprite1.x+=4
trainersprite2.x+=4 if trainersprite2
[MENTION=24071]Sprite[/MENTION]s["player"].x-=4
[MENTION=24071]Sprite[/MENTION]s["playerB"].x-=4 if [MENTION=24071]Sprite[/MENTION]s["playerB"]
pbGraphicsUpdate
pbInputUpdate
break if [MENTION=24071]Sprite[/MENTION]s["enemybase"].x>=224
end
# Show shiny animation
if !@battle.opponent
pbPlayCry(@battle.party2[0])
if @battle.party2[0].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[1],nil)
end
if @battle.party2.length==2
if @battle.party2[1].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[3],nil)
end
end
end
if @battle.opponent
@enablePartyAnim=true
@partyAnimPhase=0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=true
else
[MENTION=24071]Sprite[/MENTION]s["battler1"].appear
[MENTION=24071]Sprite[/MENTION]s["battler3"].appear if @battle.party2.length==2
appearing=true
begin
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler1"].update
appearing [MENTION=24071]Sprite[/MENTION]s["battler1"].appearing
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color [MENTION=24071]Sprite[/MENTION]s["pokemon1"].color
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["battler3"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color [MENTION=24071]Sprite[/MENTION]s["pokemon3"].color
appearing=(appearing| [MENTION=24071]Sprite[/MENTION]s["battler3"].appearing)
end
end while appearing
end
end
def pbEndBattle(result)
@abortable=false
pbShowWindow(BLANK)
# Fade out all sprites
pbBGMFade(1.0)
pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
pbDisposeSprites
end
def pbRecall(battlerindex)
@briefmessage=false
if @battle.pbIsOpposing?(battlerindex)
[MENTION=24071]Sprite[/MENTION]s["shadow#{battlerindex}"].visible=false
else
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"]
picturePoke=PictureEx.new(0)
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter(spritePoke)
# starting positions
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveColor(10,1,Color.new(16*8,23*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],Graphics.height-80)
picturePoke.moveVisible(picturePoke.totalDuration,false)
picturePoke.moveColor(0,picturePoke.totalDuration,Color.new(0,0,0,0))
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
loop do
picturePoke.update
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !picturePoke.running?
end
end
end
def pbTrainerSendOut(battlerindex,pkmn)
@briefmessage=false
fadeanim=nil
while inPartyAnimation?; end
if @showingenemy
fadeanim=TrainerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,false)
sendout=PokeballSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
pbGraphicsUpdate
pbInputUpdate
fadeanim.update if fadeanim
frame+=1
if frame==1
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=10
sendout.update
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
break if
(!fadeanim || fadeanim.animdone?) &&
sendout.animdone? &&
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
end
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
sendout.dispose
if @showingenemy
@showingenemy=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"trainer")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase1")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"enemy#{i}")
end
end
pbRefresh
end
def pbSendOut(battlerindex,pkmn)
while inPartyAnimation?; end
balltype=pkmn.ballused
ballbitmap=sprintf("Graphics/Pictures/ball%02d_0",balltype)
pictureBall=PictureEx.new(0)
delay=1
pictureBall.moveVisible(delay,true)
pictureBall.moveName(delay,ballbitmap)
pictureBall.moveOrigin(delay,PictureOrigin::Center)
# Setting the ball's movement path
path=[[111, 164], [113, 154], [115, 145], [118, 136],
[122, 128], [130, 124], [137, 129], [140, 138],
[142, 147], [143, 156], [144, 166], [145, 175],
[145, 185], [146, 194], [146, 203], [146, 213],
[147, 222], [147, 232], [147, 241], [147, 250]]
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
angle=0
for coord in path
delay=pictureBall.totalDuration
pictureBall.moveAngle(0,delay,angle)
pictureBall.moveXY(1,delay,coord[0],coord[1])
angle+=80
angle%=360
end
pictureBall.adjustPosition(0,Graphics.height-320)
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].visible=false
@briefmessage=false
fadeanim=nil
if @showingplayer
fadeanim=PlayerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,true)
sendout=PokeballPlayerSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
fadeanim.update if fadeanim
frame+=1
if frame>1 && !pictureBall.running? &&
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=3 && !pictureBall.running?
sendout.update
end
if (frame>=10 || !fadeanim) && pictureBall.running?
pictureBall.update
setPictureIconSprite(spriteBall,pictureBall)
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
pbGraphicsUpdate
pbInputUpdate
break if
(!fadeanim || fadeanim.animdone?) &&
sendout.animdone? &&
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
end
spriteBall.dispose
sendout.dispose
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
if @showingplayer
@showingplayer=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase2")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player#{i}")
end
end
pbRefresh
end
def pbTrainerWithdraw(battle,pkmn)
pbRefresh
end
def pbWithdraw(battle,pkmn)
pbRefresh
end
def pbForgetMove(pokemon,moveToLearn)
# 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. The function should not
# allow HM moves to be forgotten.
ret=-1
pbFadeOutIn(99999){
scene=PokemonSummaryScene.new
screen=PokemonSummary.new(scene)
ret=screen.pbStartForgetScreen([pokemon],0,moveToLearn)
}
return ret
end
def pbBeginAttackPhase
pbSelectBattler(-1)
end
def pbSafariStart
@briefmessage=false
[MENTION=24071]Sprite[/MENTION]s["battler0"]=SafariDataBox.new(@battle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler0"].appear
loop do
[MENTION=24071]Sprite[/MENTION]s["battler0"].update
pbGraphicsUpdate
pbInputUpdate
break if
[MENTION=24071]Sprite[/MENTION]s["battler0"].appearing
end
pbRefresh
end
def pbCommandMenuEx(index,texts)
pbShowWindow(COMMANDBOX)
cw2 [MENTION=24071]Sprite[/MENTION]s["commandwindow"]
cw2.setTexts(texts)
cw2.index=[0,2,1,3][@lastcmd[index]]
pbSelectBattler(index)
pbRefresh
loop do
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw2)
if Input.trigger?(Input::C)
ret=[0,2,1,3][cw2.index]
pbPlayDecisionSE()
@lastcmd[index]=ret
return ret
end
nextindex=pbNextIndex(cw2.index)
if cw2.index!=nextindex
pbPlayCursorSE()
cw2.index=nextindex
end
end
end
def pbSafariCommandMenu(index)
pbCommandMenuEx(index,[
_INTL("¿Qué lanzará \n{1}?",@battle.pbPlayer.name),
_INTL("BALL"),
_INTL("ROCA"),
_INTL("CEBO"),
_INTL("HUIR")
])
end
def pbCommandMenu(index)
# Use this method to display the list of commands.
# Return values:
# 0 - Fight
# 1 - Pokémon
# 2 - Bag
# 3 - Run
shadowTrainer=(hasConst?(PBTypes,:SHADOW) && @opponent)
ret=pbCommandMenuEx(index,[
_INTL("¿Qué hará \n{1}?",@battle.battlers[index].name),
_INTL("LUCHAR"),
_INTL("POKéMON"),
_INTL("BOLSA"),
shadowTrainer ? _INTL("LLAMAR") : _INTL("HUIR")
])
if ret==3 && shadowTrainer
ret=4 # convert "Run" to "Call"
end
return ret
end
def pbMoveString(move)
ret=_INTL("{1}",move.name)
typename=PBTypes.getName(move.type)
if move.id>0
ret+=_INTL(" ({1}) PP: {2}/{3}",typename,move.pp,move.totalpp)
end
return ret
end
def pbNameEntry(helptext)
return pbEnterText(helptext,0,10)
end
def pbFightMenu(index)
# Use this method to display the list of moves for a Pokémon
pbShowWindow(FIGHTBOX)
cw = [MENTION=24071]Sprite[/MENTION]s["fightwindow"]
battler=@battle.battlers[index]
cw.battler=battler
lastIndex=@lastmove[index]
if battler.moves[lastIndex].id!=0
cw.setIndex(lastIndex)
else
cw.setIndex(0)
end
pbSelectBattler(index)
pbRefresh
loop do
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw)
if Input.trigger?(Input::B) # Cancel fight menu
@lastmove[index]=cw.index
pbPlayCancelSE()
return -1
end
if Input.trigger?(Input::C)# Confirm choice
ret=cw.index
pbPlayDecisionSE()
@lastmove[index]=ret
return ret
end
nextindex=pbNextIndex(cw.index)
if cw.index!=nextindex # Move cursor
pbPlayCursorSE()
cw.setIndex(nextindex)
end
end
end
def pbItemMenu(index)
# Use this method to display the inventory
# The return value is the item chosen, or 0 if the choice was canceled.
ret=0
endscene=true
oldsprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
itemscene=PokemonBag_Scene.new
itemscene.pbStartScene($PokemonBag)
loop do
item=itemscene.pbChooseItem
break if item==0
usetype=$ItemData[item][ITEMBATTLEUSE]
cmdUse=-1
commands=[]
if usetype==0
commands[commands.length]=_INTL("CANCELAR")
else
commands[cmdUse=commands.length]=_INTL("USAR")
commands[commands.length]=_INTL("CANCELAR")
end
itemname=PBItems.getName(item)
command=itemscene.pbShowCommands(_INTL("{1} es seleccionado.",itemname),commands)
if cmdUse>=0 && command==cmdUse
if usetype==1
pkmnlist=PokemonScreen_Scene.new
pkmnscreen=PokemonScreen.new(pkmnlist,@battle.party1)
itemscene.pbEndScene
pkmnlist.pbStartScene(@battle.party1,_INTL("¿Usar en qué pokémon?"))
pkmnid=pkmnlist.pbChoosePokemon
if pkmnid>=0 && @battle.pbUseItemOnPokemon(item,pkmnid,pkmnscreen)
pkmnscreen.pbRefresh
pkmnlist.pbEndScene
ret=item
endscene=false
break
end
pkmnlist.pbEndScene
itemscene.pbStartScene($PokemonBag)
elsif usetype==2
if @battle.pbUseItemOnBattler(item,index,itemscene)
ret=item
break
end
end
end
end
if ret!=0 && $ItemData[ret][ITEMBATTLEUSE]!=3
# Delete the item just used from stock
$PokemonBag.pbDeleteItem(ret)
end
itemscene.pbEndScene if endscene
for i in 0..4
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,oldsprites)
return ret
end
def pbSelectBattler(index,selectmode=1)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
sprite.selected=(i==index) ? selectmode : 0
sprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
sprite.selected=(i==index) ? selectmode : 0
end
end
def pbFirstTarget(index)
for i in 0..3
if i!=index && @battle.battlers.hp>0 &&
@battle.battlers[index].pbIsOpposing?(i)
return i
end
end
return -1
end
def pbNextIndex(curindex)
if Input.trigger?(Input::LEFT) && (curindex&1)==1
return curindex-1
elsif Input.trigger?(Input::RIGHT) && (curindex&1)==0
return curindex+1
elsif Input.trigger?(Input::UP) && (curindex&2)==2
return curindex-2
elsif Input.trigger?(Input::DOWN) && (curindex&2)==0
return curindex+2
end
return curindex
end
def pbUpdateSelected(index)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
if i==index
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=2
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=2
else
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=0
end
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
def pbChooseTarget(index)
# Use this method to make the player choose a target
# for certain moves in double battles.
pbShowWindow(FIGHTBOX)
curwindow=pbFirstTarget(index)
if curwindow==-1
raise RuntimeError.new(_INTL("No targets somehow..."))
end
loop do
pbGraphicsUpdate
pbInputUpdate
pbUpdateSelected(curwindow)
if Input.trigger?(Input::C)
pbUpdateSelected(-1)
return curwindow
end
if Input.trigger?(Input::B)
pbUpdateSelected(-1)
return -1
end
if curwindow>=0
if Input.trigger?(Input::RIGHT) || Input.trigger?(Input::DOWN)
loop do
newcurwindow=3 if curwindow==0
newcurwindow=1 if curwindow==3
newcurwindow=2 if curwindow==1
newcurwindow=0 if curwindow==2
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::UP)
loop do
newcurwindow=2 if curwindow==0
newcurwindow=1 if curwindow==2
newcurwindow=3 if curwindow==1
newcurwindow=0 if curwindow==3
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
end
end
end
end
def pbSwitch(index,lax,cancancel)
party=@battle.pbParty(index)
inactives=[1,1,1,1,1,1]
partypos=[]
switchsprites={}
activecmd=0
ret=-1
numactive=(@doublebattle)?2:1
pbShowWindow(BLANK)
pbSetMessageMode(true)
# Fade out and hide all sprites
visiblesprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
battler=@battle.battlers[0]
activecmd=0 if battler.index==index
inactives=0
partypos[0]=battler.pokemonIndex
if @battle.doublebattle && !@battle.fullparty1
battler=@battle.battlers[2]
activecmd=1 if battler.index==index
inactives=0
partypos[1]=battler.pokemonIndex
end
# Add all non-active Pokémon
for i in 0...6
partypos[partypos.length]=i if inactives==1
end
modparty=[]
for i in 0...6
modparty.push(party[partypos])
end
scene=PokemonScreen_Scene.new
@switchscreen=PokemonScreen.new(scene,modparty)
@switchscreen.pbStartScene(_INTL("Escoge un pokémon."),
@battle.doublebattle && !@battle.fullparty1)
loop do
scene.pbSetHelpText(_INTL("Escoge un pokémon."))
activecmd=@switchscreen.pbChoosePokemon
if cancancel && activecmd==-1
ret=-1
break
end
if activecmd>=0
commands=[]
cmdShift=-1
cmdSummary=-1
pkmnindex=partypos[activecmd]
commands[cmdShift=commands.length]=_INTL("MOVER") if !party[pkmnindex].egg?
commands[cmdSummary=commands.length]=_INTL("DATOS")
commands[commands.length]=_INTL("CANCELAR")
command=scene.pbShowCommands(_INTL("¿Qué hacer con {1}?",party[pkmnindex].name),commands)
if cmdShift>=0 && command==cmdShift
canswitch=lax ?
@battle.pbCanSwitchLax?(index,pkmnindex,true) :
@battle.pbCanSwitch?(index,pkmnindex,true)
if canswitch
ret=pkmnindex
break
end
elsif cmdSummary>=0 && command==cmdSummary
scene.pbSummary(activecmd)
end
end
end
@switchscreen.pbEndScene
@switchscreen=nil
pbSetMessageMode(false)
# back to main battle screen
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,visiblesprites)
return ret
end
def pbDamageAnimation(pkmn,effectiveness)
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
shadowsprite [MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"]
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
oldshadowvisible=shadowsprite.visible
oldvisible=sprite.visible
sprite.selected=2
@briefmessage=false
6.times do
pbGraphicsUpdate
pbInputUpdate
end
case effectiveness
when 0
pbSEPlay("normaldamage")
when 1
pbSEPlay("notverydamage")
when 2
pbSEPlay("superdamage")
end
8.times do
pkmnsprite.visible=!pkmnsprite.visible
if oldshadowvisible
shadowsprite.visible=!shadowsprite.visible
end
4.times do
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
sprite.selected=0
sprite.visible=oldvisible
end
def pbHPChanged(pkmn,oldhp)
# This method is called whenever a Pokémon's HP changes.
# Used to animate the HP bar.
@briefmessage=false
hpchange=pkmn.hp-oldhp
if hpchange<0
hpchange=-hpchange
PBDebug.log("[#{pkmn.pbThis} perdió #{hpchange} PS, ahora tiene #{pkmn.hp} PS]") if @battle.debug
else
PBDebug.log("[#{pkmn.pbThis} ganó #{hpchange} PS, ahora tiene #{pkmn.hp} PS]") if @battle.debug
end
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
sprite.animateHP(oldhp,pkmn.hp)
while sprite.animatingHP
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
def pbFainted(pkmn)
# This method is called whenever a Pokémon faints
frames=pbCryFrameLength(pkmn.pokemon)
pbPlayCry(pkmn.pokemon)
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"].visible=false
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
pkmnsprite.visible=false
if @battle.pbIsOpposing?(pkmn.index)
tempvp=Viewport.new(0,0,480,144+@yoffset)
else
tempvp=Viewport.new(0,0,480,224+@yoffset)
end
tempvp.z=@viewport.z
tempsprite=SpriteWrapper.new(tempvp)
tempsprite.x=pkmnsprite.x
tempsprite.y=pkmnsprite.y
tempsprite.bitmap=pkmnsprite.bitmap
tempsprite.visible=true
pbSEPlay("faint")
16.times do
tempsprite.y+=8
pbGraphicsUpdate
pbInputUpdate
end
tempsprite.dispose
tempvp.dispose
8.times do
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].opacity=32
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].visible=false
end
def pbChooseEnemyCommand(index)
# Use this method to choose a command for the enemy.
@battle.pbDefaultChooseEnemyCommand(index)
end
def pbChooseNewEnemy(index,party)
# Use this method to choose a new Pokémon for the enemy
# The enemy's party is guaranteed to have at least one choosable member.
for i in 0..party.length-1
return i if @battle.pbCanSwitchLax?(index,i,false)
end
return -1
end
def pbWildBattleSuccess
# This method is called when the player wins a wild Pokémon battle.
# This method can change the battle's music for example.
pbBGMPlay(pbGetWildVictoryME())
end
def pbTrainerBattleSuccess
# This method is called when the player wins a Trainer battle.
# This method can change the battle's music for example.
pbBGMPlay(pbGetTrainerVictoryME(@battle.opponent))
end
def pbEXPBar(pokemon,battler,startexp,endexp,tempexp1,tempexp2)
if battler
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].refreshExpLevel
exprange=(endexp-startexp)
startexplevel=0
endexplevel=0
if exprange!=0
startexplevel=(tempexp1-startexp)*128/exprange
endexplevel=(tempexp2-startexp)*128/exprange
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animateEXP(startexplevel,endexplevel)
while [MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animatingEXP
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].update
end
end
end
def pbShowPokedex(species)
pbFadeOutIn(99999){
scene=PokemonPokedexScene.new
screen=PokemonPokedex.new(scene)
screen.pbDexEntry(species)
}
end
def pbFindAnimation(moveid)
begin
move2anim=load_data("Data/move2anim.dat")
anim=move2anim[0][moveid]
return anim if anim
if hasConst?(PBMoves,:TACKLE)
anim=move2anim[0][getConst(PBMoves,:TACKLE)]
return anim if anim
end
rescue
return nil
end
return nil
end
def pbCommonAnimation(animname,attacker,opponent,side=true)
animations=load_data("Data/PkmnAnimations.rxdata")
for i in 0...animations.length
if animations && animations.name=="Common:"+animname
pbAnimationCore(animations,attacker,opponent,side)
return
end
end
end
def pbChangeSpecies(attacker,species)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmapSpecies(
attacker.pokemon,species,back
)
pkmn.y=adjustBattleSpriteY(pkmn,species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(species)
end
end
def pbChangePokemon(attacker,pokemon)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmap(pokemon,back
)
pkmn.y=adjustBattleSpriteY(pkmn,pokemon.species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(pokemon.species)
end
end
def pbAnimation(moveid,attacker,opponent,side=true)
animid=pbFindAnimation(moveid)
return if !animid
animations=load_data("Data/PkmnAnimations.rxdata")
pbSaveShadows {
pbAnimationCore(animations[animid],attacker,opponent,side)
}
if isConst?(moveid,PBMoves,:TRANSFORM) && attacker && opponent
# Change form to transformed version
pbChangePokemon(attacker,opponent.pokemon)
end
end
def pbSaveShadows
shadows=[]
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
shadows=s ? s.visible : false
s.visible=false if s
end
yield
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
s.visible=shadows if s
end
end
def pbAnimationCore(animation,attacker,opponent,side=true)
if !attacker || !animation
return
end
@briefmessage=false
user=(attacker) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"] : nil
target=(opponent) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{opponent.index}"] : nil
olduserx=user.x
oldusery=user.y
oldtargetx=target ? target.x : 0
oldtargety=target ? target.y : 0
if !target
animplayer=PBAnimationPlayer.new(
animation,user,user,@viewport
)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
animplayer.setLineTransform(
144,188,352,108,
user.x+(userwidth/2),
user.y+(userheight/2),
user.x+(userwidth/2),
user.y+(userheight/2)
)
else
animplayer=PBAnimationPlayer.new(
animation,user,target,@viewport
)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
targetwidth=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
targetheight=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.height
animplayer.setLineTransform(
144,188,352,108,
user.x+(userwidth/2),
user.y+(userheight/2),
target.x+(targetwidth/2),
target.y+(targetheight/2)
)
end
animplayer.start
while animplayer.playing?
animplayer.update
pbGraphicsUpdate
pbInputUpdate
end
user.ox=0
user.oy=0
target.ox=0 if target
target.oy=0 if target
user.x=olduserx
user.y=oldusery
target.x=oldtargetx if target
target.y=oldtargety if target
animplayer.dispose
end
def pbLevelUp(pokemon,battler,oldtotalhp,oldattack,
olddefense,oldspeed,oldspatk,oldspdef)
pbTopRightWindow(_INTL("MaxHP<r>+{1}\r\nATTACK<r>+{2}\r\nDEFENSE<r>+{3}\r\nSP. ATK<r>+{4}\r\nSP. DEF<r>+{5}\r\nSPEED<r>+{6}",
pokemon.totalhp-oldtotalhp,
pokemon.attack-oldattack,
pokemon.defense-olddefense,
pokemon.spatk-oldspatk,
pokemon.spdef-oldspdef,
pokemon.speed-oldspeed
))
pbTopRightWindow(_INTL("MaxHP<r>{1}\r\nATTACK<r>{2}\r\nDEFENSE<r>{3}\r\nSP. ATK<r>{4}\r\nSP. DEF<r>{5}\r\nSPEED<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
end
def pbThrowAndDeflect(ball,targetBattler)
end
def pbThrow(ball,shakes,targetBattler)
@briefmessage=false
pokeballThrow(ball,shakes,targetBattler)
end
def pbThrowSuccess
if !@opponent
@briefmessage=false
pbBGMPlay("../ME/PkmRS-Caught")
frames=(3.5*Graphics.frame_rate).to_i
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
end
end
end
Mi modo de batalla que viene en el essentials muestra al sprite del enemigo moviendose de izquierda a derecha y al entrenador tambien, y al jugador lo muestra de derecha a izquierda como en los juegos de pokemon rubi.
En el otro script que encontré aparece el entrenador desde cerca luego se aleja la pantalla y lanza su pokemon, cuando son salvajes igual pasa eso,
y el jugador cuando saca su pokemon hce tambien ese acercamiento de pantalla y luego vuelve a su posicion, cosa que quiero lograr hacer pero ese script no es compatible con mi essentials.
=begin
- def pbChooseNewEnemy(index,party)
Use this method to choose a new Pokémon for the enemy
The enemy's party is guaranteed to have at least one
choosable member.
index - Index to the battler to be replaced (use e.g. @battle.battlers[index] to
access the battler)
party - Enemy's party
- def pbWildBattleSuccess
This method is called when the player wins a wild Pokémon battle.
This method can change the battle's music for example.
- def pbTrainerBattleSuccess
This method is called when the player wins a Trainer battle.
This method can change the battle's music for example.
- def pbFainted(pkmn)
This method is called whenever a Pokémon faints.
pkmn - PokeBattle_Battler object indicating the Pokémon that fainted
- def pbChooseEnemyCommand(index)
Use this method to choose a command for the enemy.
index - Index of enemy battler (use e.g. @battle.battlers[index] to
access the battler)
- def pbCommandMenu(index)
Use this method to display the list of commands and choose
a command for the player.
index - Index of battler (use e.g. @battle.battlers[index] to
access the battler)
Return values:
0 - Fight
1 - Pokémon
2 - Bag
3 - Run
=end
################################################
class CommandMenuDisplay
def initialize(viewport=nil)
@display=nil
if PokeBattle_Scene::USECOMMANDBOX
@display=IconSprite.new(0,384-96,viewport)
@display.setBitmap("Graphics/Pictures/commandbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
Graphics.width-240,0-96,5,96);
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
[MENTION=24700]Wind[/MENTION]ow.viewport=viewport
@msgbox=Window_UnformattedTextPokemon.newWithSize(
"",4,384-96,Graphics.width [MENTION=24700]Wind[/MENTION]ow.width-4, 296,viewport) # [MENTION=24700]Wind[/MENTION]ow.width-4
@msgbox.baseColor=PokeBattle_Scene::MESSAGEBASECOLOR
@msgbox.shadowColor=PokeBattle_Scene::MESSAGESHADOWCOLOR
@msgbox.windowskin=nil
if PokeBattle_Scene::USECOMMANDBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
end
@title=""
end
def index; [MENTION=24700]Wind[/MENTION]ow.index; end
def index=(value); [MENTION=24700]Wind[/MENTION]ow.index=value; end
def setTexts(value)
@msgbox.text=value[0]
# Note 2 and 3 were intentionally switched
commands=[]
[1,3,2,4].each{|i|
commands.push(value) if value && value!=nil
}
[MENTION=24700]Wind[/MENTION]ow.commands=commands
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@msgbox.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@msgbox.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@msgbox.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@msgbox.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@msgbox.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@msgbox.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@msgbox.z=value
@display.z=value if @display
end
def disposed?
return @msgbox.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@msgbox.dispose
[MENTION=24700]Wind[/MENTION]ow.dispose
@display.dispose if @display
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
@msgbox.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def refresh
@msgbox.refresh
[MENTION=24700]Wind[/MENTION]ow.refresh
end
end
class FightMenuDisplay
attr_reader :battler
attr_reader :index
def battler=(value)
@battler=value
refresh
end
def setIndex(value)
if @battler && @battler.moves[value].id!=0
@index=value
[MENTION=24700]Wind[/MENTION]ow.index=value
refresh
end
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@info.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@info.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@info.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@info.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@info.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@info.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@info.z=value
@display.z=value if @display
end
def disposed?
return @info.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@info.dispose
@display.dispose if @display
[MENTION=24700]Wind[/MENTION]ow.dispose
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
@info.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def initialize(battler,viewport=nil)
@display=nil
if PokeBattle_Scene::USEFIGHTBOX
@display=IconSprite.new(0,384-96,viewport)
@display.setBitmap("Graphics/Pictures/fightbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
0,384-96,320,96,viewport)
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
@info=Window_AdvancedTextPokemon.newWithSize(
"",320,384-96,Graphics.width-320,96,viewport)
@ctag=shadowctag(PokeBattle_Scene::MENUBASECOLOR,
PokeBattle_Scene::MENUSHADOWCOLOR)
if PokeBattle_Scene::USEFIGHTBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
@info.opacity=0
end
@battler=battler
@index=0
refresh
end
def refresh
return if !@battler
pbSetNarrowFont [MENTION=24700]Wind[/MENTION]ow.contents)
commands=[]
for i in 0...4
if @battler.moves.id!=0
commands.push(@battler.moves.name)
else
break
end
end
[MENTION=24700]Wind[/MENTION]ow.commands=commands
selmove=@battler.moves[@index]
movetype=PBTypes.getName(selmove.type)
pbSetNarrowFont(@info.contents)
@info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
@ctag,selmove.pp,selmove.totalpp,movetype)
end
end
class PokemonBattlerSprite < RPG::Sprite
attr_accessor :selected
def initialize(doublebattle,index,viewport=nil)
super(viewport)
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@index=index
@updating=false
@doublebattle=doublebattle
@index=index
[MENTION=24071]Sprite[/MENTION]X=0
[MENTION=24071]Sprite[/MENTION]Y=0
[MENTION=24071]Sprite[/MENTION]XExtra=0
[MENTION=24071]Sprite[/MENTION]YExtra=0
[MENTION=24071]Sprite[/MENTION]Visible=false
@_iconbitmap=nil
self.visible=false
end
def selected=(value)
if @selected==1 && value!=1 && [MENTION=24071]Sprite[/MENTION]YExtra>0
[MENTION=24071]Sprite[/MENTION]YExtra=0
self.y [MENTION=24071]Sprite[/MENTION]Y
end
@selected=value
end
def visible=(value)
[MENTION=24071]Sprite[/MENTION]Visible=value if !@updating
super
end
def x
return [MENTION=24071]Sprite[/MENTION]X
end
def y
return [MENTION=24071]Sprite[/MENTION]Y
end
def x=(value)
[MENTION=24071]Sprite[/MENTION]X=value
super(value [MENTION=24071]Sprite[/MENTION]XExtra)
end
def y=(value)
[MENTION=24071]Sprite[/MENTION]Y=value
super(value [MENTION=24071]Sprite[/MENTION]YExtra)
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19010]Frame[/MENTION]+=1
@updating=true
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
[MENTION=24071]Sprite[/MENTION]YExtra=2
else
[MENTION=24071]Sprite[/MENTION]YExtra=0
end
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
elsif @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible= [MENTION=19010]Frame[/MENTION]%10<7)
elsif
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
end
if @_iconbitmap
@_iconbitmap.update
self.bitmap=@_iconbitmap.bitmap
end
@updating=false
end
def dispose
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=nil
self.bitmap=nil if !self.disposed?
super
end
def setPokemonBitmap(pokemon,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmap(pokemon,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
def setPokemonBitmapSpecies(pokemon,species,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmapSpecies(pokemon,species,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
end
class SafariDataBox < SpriteWrapper
attr_accessor :selected
attr_reader :appearing
def initialize(battle,viewport=nil)
super(viewport)
@selected=0
@battle=battle
@databox=AnimatedBitmap.new("Graphics/Pictures/safariPlayerBox")
[MENTION=24071]Sprite[/MENTION]X=254
[MENTION=24071]Sprite[/MENTION]Y=148+(384-320)
[MENTION=24071]Sprite[/MENTION]baseY=0
[MENTION=24071]Sprite[/MENTION]baseX=16
@appearing=false
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=2
refresh
end
def appear
refresh
self.visible=true
self.opacity=255
self.x [MENTION=24071]Sprite[/MENTION]X+320
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
textpos=[]
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
textpos.push([_INTL("SAFARI BALLS") [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+6,false,base,shadow])
textpos.push([_INTL("Left: {1}",@battle.ballcount) [MENTION=24071]Sprite[/MENTION]baseX+170 [MENTION=24071]Sprite[/MENTION]baseY+40,
true,base,shadow])
pbDrawTextPositions(self.bitmap,textpos)
end
def update
super
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
if @appearing
self.x-=8
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
class PokemonDataBox < SpriteWrapper
attr_reader :battler
attr_accessor :selected
attr_accessor :appearing
attr_reader :animatingHP
attr_reader :animatingEXP
def initialize(battler,doublebattle,viewport=nil)
super(viewport)
@explevel=0
@battler=battler
[MENTION=24071]Sprite[/MENTION]baseY=0
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@showhp=false
@showexp=false
@appearing=false
@animatingHP=false
@currenthp=0
@endhp=0
@expflash=0
@statusCX=64
@statusY=28
if (@battler.index&1)==0 # if player's Pokémon
[MENTION=24071]Sprite[/MENTION]baseX=16
else
[MENTION=24071]Sprite[/MENTION]baseX=0
end
yoffset=(384-320)
if doublebattle
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=256
[MENTION=24071]Sprite[/MENTION]Y=124+yoffset
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26
[MENTION=24071]Sprite[/MENTION]Y=10+yoffset
[MENTION=24071]Sprite[/MENTION]baseX=0
[MENTION=24071]Sprite[/MENTION]baseY=0
when 2
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=280
[MENTION=24071]Sprite[/MENTION]Y=174+yoffset
when 3
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=2
[MENTION=24071]Sprite[/MENTION]Y=60+yoffset
end
else
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/singlePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=278-11
[MENTION=24071]Sprite[/MENTION]Y=148+yoffset+4
@showhp=true
@showexp=true
@statusCX=40
@statusY=44
@tubox = true
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/singleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26-36+10
[MENTION=24071]Sprite[/MENTION]Y=32+yoffset-36
@rivalbox = true
end
end
@statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/boxstatuses"))
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=99999
refreshExpLevel
refresh
end
def dispose
@statuses.dispose
@databox.dispose
@contents.dispose
super
end
def refreshExpLevel
if !@battler.pokemon
@explevel=0
else
growthrate=@battler.pokemon.growthrate
startexp=PBExperience.pbGetStartExperience(@battler.pokemon.level,growthrate)
endexp=PBExperience.pbGetStartExperience(@battler.pokemon.level+1,growthrate)
if startexp==endexp
@explevel=0
else
@explevel=(@battler.pokemon.exp-startexp)*PokeBattle_Scene::EXPGAUGESIZE/(endexp-startexp)
end
end
end
def exp
return @animatingEXP ? @currentexp : @explevel
end
def hp
return @animatingHP ? @currenthp : @battler.hp
end
def animateHP(oldhp,newhp)
@currenthp=oldhp
@endhp=newhp
@animatingHP=true
end
def animateEXP(oldexp,newexp)
@currentexp=oldexp
@endexp=newexp
@animatingEXP=true
end
def appear
refreshExpLevel
refresh
self.visible=true
self.opacity=255
if (@battler.index&1)==0 # if player's Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X+320
else
self.x [MENTION=24071]Sprite[/MENTION]X-320
end
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
return if !@battler.pokemon
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
textpos=[]
base=Color.new(255,255,255)
shadow=Color.new(33,33,33)
genderX=self.bitmap.text_size(@battler.name).width
genderX+ [MENTION=24071]Sprite[/MENTION]baseX+14
if @tubox == true
textpos.push([@battler.name [MENTION=24071]Sprite[/MENTION]baseX+18 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
else
textpos.push([@battler.name [MENTION=24071]Sprite[/MENTION]baseX+14+28 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
end
if @battler.index == 0
if @battler.gender==0 # Male genderX+40-2
textpos.push([_INTL("♂"),156-8 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(8*8,25*8,31*8),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("♀"),156-8 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(31*8,19*8,18*8),shadow])
end
else
if @battler.gender==0 # Male
textpos.push([_INTL("♂"),156 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(8*8,25*8,31*8),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("♀"),156 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(31*8,19*8,18*8),shadow])
end
end
if @tubox == true
textpos.push([_INTL("{1}",@battler.level) [MENTION=24071]Sprite[/MENTION]baseX+188-24 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
else
textpos.push([_INTL("{1}",@battler.level) [MENTION=24071]Sprite[/MENTION]baseX+198-10 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
end
if @showhp
textpos.push([hpstring [MENTION=24071]Sprite[/MENTION]baseX+154 [MENTION=24071]Sprite[/MENTION]baseY+26,true,base,shadow])
end
pbDrawTextPositionsTB(self.bitmap,textpos)
if @battler.status>0
self.bitmap.blt [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+@statusY,@statuses.bitmap,
Rect.new(0,(@battler.status-1)*16,@statusCX,16))
end
hpGaugeSize=PokeBattle_Scene::HPGAUGESIZE
hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
hpgauge=1 if hpgauge==0 && self.hp>0
hpzone=0
hpzone=1 if self.hp<=(@battler.totalhp/2).floor
hpzone=2 if self.hp<=(@battler.totalhp/4).floor
hpcolors=[
PokeBattle_Scene::HPCOLORSHADOW1,
PokeBattle_Scene::HPCOLORBASE1,
PokeBattle_Scene::HPCOLORSHADOW2,
PokeBattle_Scene::HPCOLORBASE2,
PokeBattle_Scene::HPCOLORSHADOW3,
PokeBattle_Scene::HPCOLORBASE3
]
# fill with HP color
if @tubox == true
hpGaugeX=PokeBattle_Scene::HPGAUGE_X+18
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y-10
expGaugeX=PokeBattle_Scene::EXPGAUGE_X+2
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y-14
else
hpGaugeX=PokeBattle_Scene::HPGAUGE_X+10
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y-10
expGaugeX=PokeBattle_Scene::EXPGAUGE_X
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y
end
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpgauge,2,hpcolors[hpzone*2+1])
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpgauge,2,hpcolors[hpzone*2])
# fill with black
#self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORSHADOW4)
#self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORBASE4)
if @showexp
# fill with EXP color
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+expGaugeX [MENTION=24071]Sprite[/MENTION]baseY+expGaugeY,self.exp,2,PokeBattle_Scene::EXPCOLOR)
end
end
def update
super
[MENTION=19010]Frame[/MENTION]+=1
if @animatingHP
if @currenthp<@endhp
@currenthp+=1
elsif @currenthp>@endhp
@currenthp-=1
end
refresh
@animatingHP=false if @currenthp==@endhp
end
if @animatingEXP
if !@showexp
@currentexp=@endexp
elsif @currentexp<@endexp
@currentexp+=1
elsif @currentexp>@endexp
@currentexp-=1
end
refresh
if @currentexp==@endexp
if @currentexp==PokeBattle_Scene::EXPGAUGESIZE
if @expflash==0
pbSEPlay("expfull")
self.flash(Color.new(64,200,248),8)
@expflash=8
else
@expflash-=1
if @expflash==0
@animatingEXP=false
refreshExpLevel
end
end
else
@animatingEXP=false
end
end
end
if @appearing
if (@battler.index&1)==0 # if player's Pokémon
self.x-=8 if $esperahp != true
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
else
self.x+=8
@appearing=false if self.x> [MENTION=24071]Sprite[/MENTION]X
end
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
if ( [MENTION=19010]Frame[/MENTION]/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
elsif ( [MENTION=19010]Frame[/MENTION]/5).floor&1)==1 && @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
else
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
end
def adjustBattleSpriteYBattle(sprite,species,index)
ret=0
metrics=load_data("Data/metrics.dat")
if index==1 || index==3
factor=metrics[1][species] # enemy Y
factor-=metrics[2][species] # altitude (affects shadows)
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret=factor*2+(64-halfY)
ret+=16 if index==1
else
ret=(index==0) ? 96 : 112
ret+=(metrics[0][species])*2
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret+=(64-halfY)
end
return ret+(384-320)
end
def showShadow?(species)
metrics=load_data("Data/metrics.dat")
return metrics[2][species]>0
end
class PokeballSendOutAnimation
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
@ballused=pkmn.pokemon ? pkmn.pokemon.ballused : 0
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(31*8,22*8,30*8)
[MENTION=19050]poke[/MENTION]ballsprite=IconSprite.new(0,0,sprite.viewport)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_0",@ballused))
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==1 ? 400 : 304
else
[MENTION=24071]Sprite[/MENTION]x=344
end
[MENTION=24071]Sprite[/MENTION]x+=Graphics.width-480
[MENTION=24071]Sprite[/MENTION]y=120
[MENTION=24071]Sprite[/MENTION]hash=spritehash
[MENTION=19050]poke[/MENTION]ballsprite.x [MENTION=24071]Sprite[/MENTION]x-8
[MENTION=19050]poke[/MENTION]ballsprite.y [MENTION=24071]Sprite[/MENTION]y-8
[MENTION=28203]pkmn[/MENTION]=pkmn
@endspritey=adjustBattleSpriteY(sprite,pkmn.species,pkmn.index)
[MENTION=12804]Shadow[/MENTION]Y [MENTION=24071]Sprite[/MENTION]y+18 # from top
[MENTION=12804]Shadow[/MENTION]X [MENTION=24071]Sprite[/MENTION]x-32 # from left
[MENTION=12804]Shadow[/MENTION]Visible=showShadow?(pkmn.species)
[MENTION=12804]Shadow[/MENTION]Y-=16 if doublebattle && pkmn.index==3
@stepspritey= [MENTION=24071]Sprite[/MENTION]y-@endspritey)
@zoomstep=(2.0-STARTZOOM)/SPRITESTEPS
@animdone=false
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
[MENTION=19050]poke[/MENTION]ballsprite.dispose
@disposed=true
end
def update
return if disposed?
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19050]poke[/MENTION]ballsprite.update
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==2
pbSEPlay("recall")
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_1",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_2",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==8
[MENTION=19050]poke[/MENTION]ballsprite.visible=false
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 2.0
currentY [MENTION=24071]Sprite[/MENTION]y-(@stepspritey [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y)
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,currentY)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y=currentY
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=2.0
@animdone=true
if [MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"]
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].x [MENTION=12804]Shadow[/MENTION]X
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].y [MENTION=12804]Shadow[/MENTION]Y
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].visible [MENTION=12804]Shadow[/MENTION]Visible
end
end
end
end
def pokeballThrow(ball,shakes,targetBattler)
balltype=@battle.pbGetBallType(ball)
oldvisible [MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=false
ball0=sprintf("Graphics/Pictures/ball%02d_0",balltype)
ball1=sprintf("Graphics/Pictures/ball%02d_1",balltype)
ball2=sprintf("Graphics/Pictures/ball%02d_2",balltype)
# sprites
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"]
# pictures
pictureBall=PictureEx.new(0)
picturePoke=PictureEx.new(0)
pokeball=[Graphics.width-130,64]
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"])
# starting positions
pictureBall.moveVisible(1,true)
pictureBall.moveName(1,ball0)
pictureBall.moveOrigin(1,PictureOrigin::Center)
pictureBall.moveXY(0,1,10,180)
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveSE(1,"Audio/SE/throw")
pictureBall.moveCurve(20,1,150,70,30+Graphics.width/2,10,Graphics.width-130,48)
delay=pictureBall.totalDuration+2
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,pokeball[0],pokeball[1])
picturePoke.moveSE(delay+10,"Audio/SE/jumptoball")
picturePoke.moveVisible(delay+15,false)
pictureBall.moveName(picturePoke.totalDuration+2,ball0)
delay=picturePoke.totalDuration+6
pictureBall.moveXY(15,delay,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(8,pictureBall.totalDuration+2,pokeball[0],80)
pictureBall.moveXY(7,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(6,pictureBall.totalDuration+2,pokeball[0],96)
pictureBall.moveXY(5,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(4,pictureBall.totalDuration+2,pokeball[0],112)
pictureBall.moveXY(3,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
picturePoke.moveXY(0,pictureBall.totalDuration,pokeball[0],128)
delay=pictureBall.totalDuration+18 if shakes==0
[shakes,3].min.times do
delay=pictureBall.totalDuration+18
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(4,delay,pokeball[0]-8,128)
pictureBall.moveAngle(4,delay,20) # positive means counterclockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(8,delay,pokeball[0]+8,128)
pictureBall.moveAngle(8,delay,-20) # negative means clockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(4,delay,pokeball[0],128)
pictureBall.moveAngle(4,delay,0)
end
if shakes<4
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
pictureBall.moveVisible(delay+10,false)
picturePoke.moveVisible(delay,true)
picturePoke.moveZoom(15,delay,100)
picturePoke.moveXY(15,delay,center[0],center[1])
delay=picturePoke.totalDuration
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8,0))
end
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
picturePoke.moveXY(0,picturePoke.totalDuration,dims[0],dims[1])
loop do
pictureBall.update
picturePoke.update
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !pictureBall.running? && !picturePoke.running?
end
if shakes<4
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=oldvisible
end
spriteBall.dispose
end
class PokeballPlayerSendOutAnimation # SACA TU POKéMON
# Ball curve: 8,52; 22,44; 52, 96
# Player: Color.new(16*8,23*8,30*8)
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=28203]pkmn[/MENTION]=pkmn
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(16*8,23*8,30*8)
[MENTION=24071]Sprite[/MENTION]hash=spritehash
$tupkmn [MENTION=12671]pokemon[/MENTION]BattlerSprite
[MENTION=12671]pokemon[/MENTION]BattlerSprite.z=99999
@sumandoplayer = 814
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==0 ? 64 : 180
else
[MENTION=24071]Sprite[/MENTION]x=232+26
end
[MENTION=24071]Sprite[/MENTION]y=384-64+30
@endspritey=adjustBattleSpriteYBattle [MENTION=12671]pokemon[/MENTION]BattlerSprite,
pkmn.species,pkmn.index)
@animdone=false
[MENTION=26553]lol[/MENTION]sal = 0
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
@disposed=true
end
def update
return if disposed?
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSEPlay("recall")
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 2.0
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,0)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y [MENTION=24071]Sprite[/MENTION]y+(@endspritey [MENTION=24071]Sprite[/MENTION]y) [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 &&
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=2.0
@animdone=true
$canupdate5 = false
[MENTION=26553]lol[/MENTION]sal +=1
if [MENTION=26553]lol[/MENTION]sal>=16
$esperahp = true
end
if [MENTION=26553]lol[/MENTION]sal>=50
$enemybase.zoom_x+=0.125 if $enemybase.zoom_x != 2.0
$enemybase.zoom_y+=0.125 if $enemybase.zoom_x != 2.0
$enemybase.y+=2 if $enemybase.zoom_x != 2.0
$enemybase.x-=12 if $enemybase.zoom_x != 2.0
$playerbase.zoom_x+=0.125 if $playerbase.zoom_x != 3.0
$playerbase.zoom_y+=0.125 if $playerbase.zoom_y != 3.0
$playerbase.y+=16 if $playerbase.zoom_x != 3.0
$playerbase.x-=26 if $playerbase.zoom_x != 3.0
$pokemon1.zoom_x+=0.125 if $enemybase.zoom_x != 2.0
$pokemon1.zoom_y+=0.125 if $enemybase.zoom_x != 2.0
$pokemon1.y-=5.5 if $enemybase.zoom_x != 2.0
$pokemon1.x-=8.5 if $enemybase.zoom_x != 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.x-=20 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0 [MENTION=12671]pokemon[/MENTION]BattlerSprite.y+=10 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=0.125 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0 [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=0.125 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0
end
end
end
end
class TrainerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=8
[MENTION=24071]Sprite[/MENTION]s["trainer2"].x+=8 if [MENTION=24071]Sprite[/MENTION]s["trainer2"]
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=8
[MENTION=24071]Sprite[/MENTION]s["partybase1"].opacity-=12
for i in 0...6
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].x+=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
@animdone=true if [MENTION=24071]Sprite[/MENTION]s["trainer"].x>=Graphics.width &&
( [MENTION=24071]Sprite[/MENTION]s["trainer2"]| [MENTION=24071]Sprite[/MENTION]s["trainer2"].x>=Graphics.width )
end
end
class PlayerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
@salpokemon1 = 0
@salpokemon2 = 0
@salpokemon3 = 0
@salpokemon4 = 0
@salpokemon5 = 0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.0
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["enemybase"].y-=2 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].x+=12 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y != 2.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].y-=16 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].x+=26 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y+=5.5 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+=8.5 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
$pokemon1 = [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["player"].x-=8
[MENTION=24071]Sprite[/MENTION]s["playerB"].x-=8 if [MENTION=24071]Sprite[/MENTION]s["playerB"]
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=8
[MENTION=24071]Sprite[/MENTION]s["partybase2"].opacity-=12
for i in 0...6
if [MENTION=24071]Sprite[/MENTION]s["player#{i}"]
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].x-=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
end
pa [MENTION=24071]Sprite[/MENTION]s["player"]
pb [MENTION=24071]Sprite[/MENTION]s["playerB"]
pawidth=128
pbwidth=128
if (pa && pa.bitmap && !pa.bitmap.disposed?)
if pa.bitmap.height<pa.bitmap.width
numframes=pa.bitmap.width/pa.bitmap.height # Number of frames
pawidth=pa.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
else
pawidth=pa.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
end
end
if (pb && pb.bitmap && !pb.bitmap.disposed?)
if pb.bitmap.height<pb.bitmap.width
numframes=pb.bitmap.width/pb.bitmap.height # Number of frames
pbwidth=pb.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
else
pbwidth=pb.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
end
end
if pb
@animdone=true if pb.x<=-pbwidth
else
@animdone=true if pa.x<=-pawidth
end
end
end
####################################################
class PokeBattle_Scene
USECOMMANDBOX=false # If true, expects a file named Graphics/Pictures/commandbox.png
USEFIGHTBOX=false # If true, expects a file named Graphics/Pictures/fightbox.png
MESSAGEBASECOLOR=Color.new(255,255,255)
MESSAGESHADOWCOLOR=Color.new(173,165,140)
MENUBASECOLOR=Color.new(72,72,72)
MENUSHADOWCOLOR=Color.new(208,208,208)
BOXTEXTBASECOLOR=Color.new(64,64,64)
BOXTEXTSHADOWCOLOR=Color.new(216,208,176)
EXPCOLOR=Color.new(64,200,248)
# Green HP color
HPCOLORBASE1=Color.new(1,255,74)
HPCOLORSHADOW1=Color.new(0,189,33)
# Orange HP color
HPCOLORBASE2=Color.new(255,173,0)
HPCOLORSHADOW2=Color.new(165,132,41)
# Red HP color
HPCOLORBASE3=Color.new(255,66,115)
HPCOLORSHADOW3=Color.new(165,74,90)
# Blank HP color
HPCOLORBASE4=Color.new(49,49,49)
HPCOLORSHADOW4=Color.new(49,49,49)
# Position of HP gauge
HPGAUGE_X=78
HPGAUGE_Y=34
# Position of EXP gauge
EXPGAUGE_X=46
EXPGAUGE_Y=66
# Size of gauges
EXPGAUGESIZE=160
HPGAUGESIZE=96
BLANK=0
MESSAGEBOX=1
COMMANDBOX=2
FIGHTBOX=3
attr_accessor :abortable
def initialize
@battle=nil
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=28203]pkmn[/MENTION]windows=[nil,nil,nil,nil]
[MENTION=24071]Sprite[/MENTION]s={}
@battlestart=true
@messagemode=false
@abortable=false
@aborted=false
end
def pbUpdate
partyAnimationUpdate
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
end
def pbGraphicsUpdate
partyAnimationUpdate
if $pokemon1
#$pokemon1.update if $pokemon1.respond_to?("update")
end
if $tupkmn
#$tupkmn.update if $tupkmn.respond_to?("update")
end
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
Graphics.update
end
def pbInputUpdate
Input.update
$mouse.visible
$mouse.update
if Input.trigger?(Input::B) && @abortable && !@aborted
@aborted=true
@battle.pbAbort
end
end
def pbShowWindow(windowtype)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=(windowtype==MESSAGEBOX||windowtype==COMMANDBOX||windowtype==FIGHTBOX||
windowtype==BLANK)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=false
[MENTION=24071]Sprite[/MENTION]s["messagebox"].z=99999
[MENTION=24071]Sprite[/MENTION]s["messagebox"].opacity=150
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].visible=(windowtype==MESSAGEBOX)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].visible=(windowtype==COMMANDBOX)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].visible=(windowtype==FIGHTBOX)
end
def pbSetMessageMode(mode)
@messagemode=mode
msgwindow [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
if mode # Within Pokémon command
msgwindow.baseColor=MENUBASECOLOR
msgwindow.shadowColor=MENUSHADOWCOLOR
msgwindow.opacity=255
msgwindow.x=0
msgwindow.width=Graphics.width
msgwindow.height=96
msgwindow.y=384-msgwindow.height
else
msgwindow.baseColor=MESSAGEBASECOLOR
msgwindow.shadowColor=MESSAGESHADOWCOLOR
msgwindow.opacity=0
msgwindow.x=16
msgwindow.width=Graphics.width-32
msgwindow.height=96
msgwindow.y=384-msgwindow.height
end
end
def pbWaitMessage
if @briefmessage
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
60.times do
pbGraphicsUpdate
pbInputUpdate
end
cw.text=""
cw.visible=false
@briefmessage=false
end
end
def pbDisplayMessage(msg,brief=false)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
cw.text=msg
i=0
loop do
pbGraphicsUpdate
pbInputUpdate
cw.update
if i==60
cw.text=""
cw.visible=false
return
end
if Input.trigger?(Input::C) || @abortable
if cw.pausing?
pbPlayDecisionSE() if !@abortable
cw.resume
end
end
if !cw.busy?
if brief
@briefmessage=true
return
end
i+=1
end
end
end
def pbDisplayPausedMessage(msg)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
if @messagemode
@switchscreen.pbDisplay(msg)
return
end
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
cw.text=_ISPRINTF("{1:s}\1",msg)
loop do
pbGraphicsUpdate
pbInputUpdate
if Input.trigger?(Input::C) || @abortable
if cw.busy?
pbPlayDecisionSE() if cw.pausing? && !@abortable
cw.resume
else
cw.text=""
pbPlayDecisionSE()
cw.visible=false if @messagemode
return
end
end
cw.update
end
end
def pbDisplayConfirmMessage(msg)
return pbShowCommands(msg,[_INTL("YES"),_INTL("NO")],1)==0
end
def pbShowCommands(msg,commands,defaultValue)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
dw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
dw.text=msg
cw = Window_CommandPokemon.new(commands)
cw.x=Graphics.width-cw.width
cw.y=384-cw.height-dw.height
cw.index=0
cw.viewport=@viewport
pbRefresh
loop do
cw.visible=!dw.busy?
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw)
dw.update
if Input.trigger?(Input::B) && defaultValue>=0
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return defaultValue
end
end
if Input.trigger?(Input::C)
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return cw.index
end
end
end
end
def pbFrameUpdate(cw)
cw.update if cw
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
end
if [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
end
def pbRefresh
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
end
def pbAddSprite(id,x,y,filename,viewport)
sprite=IconSprite.new(x,y,viewport)
if filename
sprite.setBitmap(filename) rescue nil
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbAddPlane(id,filename,viewport)
sprite=AnimatedPlane.new(viewport)
if filename
sprite.setBitmap(filename)
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbDisposeSprites
pbDisposeSpriteHash [MENTION=24071]Sprite[/MENTION]s)
end
def pbBeginCommandPhase
# Called whenever a new round begins.
@battlestart=false
end
def pbShowOpponent(index)
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[index].trainertype)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
end
else
trainerfile="Graphics/Characters/trfront"
end
pbAddSprite("trainer",Graphics.width,16,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x-=6
end
end
def pbHideOpponent
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=6
end
end
def pbShowHelp(text)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].resizeToFit(text,Graphics.width)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].y=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].x=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].text=text
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=true
end
def pbHideHelp
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
end
def pbBackdrop
outdoor=false
if $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
outdoor=true
end
case @battle.environment
when PBEnvironment::Grass
id=1
when PBEnvironment::TallGrass
id=2
when PBEnvironment::MovingWater
id=3
when PBEnvironment::StillWater
id=4
when PBEnvironment::Underwater
id=5
when PBEnvironment::Rock
id=7
when PBEnvironment::Cave
id=8
when PBEnvironment::Sand
id=9
else
id=(outdoor) ? 0 : 6
end
if $PokemonGlobal && $PokemonGlobal.nextBattleBack
id=$PokemonGlobal.nextBattleBack
elsif $game_map
back=pbGetMetadata($game_map.map_id,MetadataBattleBack)
if back && back!=""
id=pbGetMetadata($game_map.map_id,MetadataBattleBack)
end
end
battlebg="Graphics/Battlebacks/battlebg#{id}"
bases="Graphics/Battlebacks/base#{id}"
pbAddPlane("battlebg",battlebg,@viewport)
pbAddSprite("enemybase",100,210,bases,@viewport) # ends at (224,96)
pbAddSprite("playerbase",-544,500,bases,@viewport) # ends at (0,192)
[MENTION=24071]Sprite[/MENTION]s["enemybase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["playerbase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["battlebg"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y = 3.6
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.9
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_y = 3.0
=begin
if outdoor
tone = $HourlyTones[Time.now.hour]
[MENTION=24071]Sprite[/MENTION]s["battlebg"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["enemybase"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["playerbase"].tone=tone
end
=end
end
def inPartyAnimation?
return @enablePartyAnim && @partyAnimPhase<4
end
def partyAnimationUpdate
return if !inPartyAnimation?
if @partyAnimPhase==0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=16
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=16
@partyAnimPhase=1 if [MENTION=24071]Sprite[/MENTION]s["partybase1"].x [MENTION=24071]Sprite[/MENTION]s["partybase1"].bitmap.width>=208
return
end
if @partyAnimPhase==1
@enemyendpos=152
@playerendpos=312
@partyAnimPhase=2
@partyAnimI=0
end
if @partyAnimPhase==2
if @partyAnimI>=6
@partyAnimPhase=4
return
end
if @partyAnimI>=@battle.party2.length || !@battle.party2[@partyAnimI]
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party2[@partyAnimI].hp<=0 || @battle.party2[@partyAnimI].status>0 ||
@battle.party2[@partyAnimI].egg?
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballnormal",@viewport)
end
if @partyAnimI==@battle.party1.length || !@battle.party1[@partyAnimI]
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party1[@partyAnimI].hp<=0 || @battle.party1[@partyAnimI].status>0 ||
@battle.party1[@partyAnimI].egg?
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballnormal",@viewport)
end
@partyAnimPhase=3
end
if @partyAnimPhase==3
[MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x+=20
[MENTION=24071]Sprite[/MENTION]s["player#{@partyAnimI}"].x-=20
if [MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x>=@enemyendpos
@partyAnimPhase=2
@partyAnimI+=1
@enemyendpos-=20
@playerendpos+=20
end
end
end
def pbStartBattle(battle)
# Called whenever the battle begins
@battle=battle
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=24071]Sprite[/MENTION]s.clear
[MENTION=24071]Sprite[/MENTION]s.clear
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@viewport3=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport3.z=99999999
# @viewport.rect.y=0
# @viewport.rect.height=384
@viewport2=Viewport.new(0,384,Graphics.width,0)
@viewport2.z=999999
@viewport2.rect.y=400
@viewport2.rect.height=384
@battleboxvp=Viewport.new(0,0,Graphics.width,384)
@battleboxvp.z=99999
@showingplayer=true
@showingenemy=true
@yoffset=(384-320)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"] = Sprite.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap=RPG::Cache.picture("battleballbg")
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].y = 400
@tpb = 0
@tpb9 = 0
pbBackdrop
pbAddSprite("partybase1",-400,80,"Graphics/Pictures/pbarrow",@viewport)
pbAddSprite("partybase2",Graphics.width,192+@yoffset,"Graphics/Pictures/pbarrow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["partybase2"].mirror=true
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=false
$enemybase = [MENTION=24071]Sprite[/MENTION]s["enemybase"]
$playerbase = [MENTION=24071]Sprite[/MENTION]s["playerbase"]
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[0].trainertype)
pbAddSprite("trainer",-144,16,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[1].trainertype)
pbAddSprite("trainer2",-240,16,trainerfile,@viewport)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
pbAddSprite("trainer",-192,16,trainerfile,@viewport)
end
else
trainerfile="Graphics/Characters/trfront"
pbAddSprite("trainer",-192,16,trainerfile,@viewport)
end
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
if [MENTION=24071]Sprite[/MENTION]s["trainer2"] && [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer2"].y- [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap.height-128
end
[MENTION=24071]Sprite[/MENTION]s["shadow0"]=IconSprite.new(0,0,@viewport)
pbAddSprite("shadow1",0,0,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["pokemon0"]=PokemonBattlerSprite.new(battle.doublebattle,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"]=PokemonBattlerSprite.new(battle.doublebattle,1,@viewport)
if battle.doublebattle
pbAddSprite("shadow3",0,0,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=false
[MENTION=24071]Sprite[/MENTION]s["shadow2"]=IconSprite.new(0,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"]=PokemonBattlerSprite.new(battle.doublebattle,3,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon2"]=PokemonBattlerSprite.new(battle.doublebattle,2,@viewport)
end
[MENTION=24071]Sprite[/MENTION]s["battler0"]=PokemonDataBox.new(battle.battlers[0],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler1"]=PokemonDataBox.new(battle.battlers[1],battle.doublebattle,@viewport)
if battle.doublebattle
[MENTION=24071]Sprite[/MENTION]s["battler2"]=PokemonDataBox.new(battle.battlers[2],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler3"]=PokemonDataBox.new(battle.battlers[3],battle.doublebattle,@viewport)
end
if @battle.player.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player[0].trainertype)
pbAddSprite("player",Graphics.width+96-48,96+@yoffset,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player[1].trainertype)
pbAddSprite("playerB",Graphics.width+96+48,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/5
end
end
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width/5
end
end
else
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player.trainertype)
pbAddSprite("player",Graphics.width+96,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/5
end
end
end
pbAddSprite("messagebox",0,384-90,"Graphics/Pictures/messagebox",@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
[MENTION=24071]Sprite[/MENTION]s["messagewindow"]=Window_AdvancedTextPokemon.new("")
[MENTION=24071]Sprite[/MENTION]s["commandwindow"]=CommandMenuDisplay.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"]=FightMenuDisplay.new(nil,@viewport)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].letterbyletter=true
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].viewport=@viewport
[MENTION=24071]Sprite[/MENTION]s["messagebox"].z=99999
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].z=999999
pbShowWindow(MESSAGEBOX)
pbSetMessageMode(false)
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["trainer"]
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["trainer2"]
if !@battle.opponent
$batallasalvaje = true
[MENTION=24071]Sprite[/MENTION]s["trainer"].visible=false
if @battle.party2.length>=1
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,128)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=180-40 # ends at 144*2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y = 3.0
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-192+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2
species=@battle.party2[0].species
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"] [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"],species,1)+10
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
if [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
[MENTION=24071]Sprite[/MENTION]s["wildshadow"]=Sprite.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].bitmap [MENTION=24071]Sprite[/MENTION]s["pokemon1"].bitmap
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].y [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y*3+20
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+10
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_y [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y/3
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].tone=Tone.new(-255,-255,-255,-255)
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].opacity=0
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].z [MENTION=24071]Sprite[/MENTION]s["pokemon1"].z-1
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].angle=-10
end
end
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=-144
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-144+16*2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y+=8
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2+8
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].setPokemonBitmap(@battle.party2[1],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].x=-240
[MENTION=24071]Sprite[/MENTION]s["shadow3"].x=-240+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow3"].y=65*2
species=@battle.party2[1].species
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"] [MENTION=24071]Sprite[/MENTION]s["pokemon3"].x [MENTION=24071]Sprite[/MENTION]s["pokemon3"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"],species,3)
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["pokemon3"]
end
end
loop do
appearspeed=4
@tpb += 1
pbGraphicsUpdate
pbInputUpdate
if @tpb >= 20
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y/3 [MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_x = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["enemybase"].x += 20 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].y -= 10 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].x += 68 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].y -= 30 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x += 17 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y -= 5 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y*3+20 [MENTION=24071]Sprite[/MENTION]s["wildshadow"].x = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+20
end
break if @tpb == 48
end
# Show shiny animation
if !@battle.opponent
pbPlayCry(@battle.party2[0])
if @battle.party2[0].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[1],nil)
end
if @battle.party2.length==2
if @battle.party2[1].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[3],nil)
end
end
end
if @battle.opponent
@enablePartyAnim=true
@partyAnimPhase=0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=true
else
[MENTION=24071]Sprite[/MENTION]s["battler1"].appear
[MENTION=24071]Sprite[/MENTION]s["battler3"].appear if @battle.party2.length==2
appearing=true
begin
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler1"].update
appearing [MENTION=24071]Sprite[/MENTION]s["battler1"].appearing
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color [MENTION=24071]Sprite[/MENTION]s["pokemon1"].color
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["battler3"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color [MENTION=24071]Sprite[/MENTION]s["pokemon3"].color
appearing=(appearing| [MENTION=24071]Sprite[/MENTION]s["battler3"].appearing)
end
end while appearing
end
end
def pbEndBattle(result)
@abortable=false
pbShowWindow(BLANK)
# Fade out all sprites
pbBGMFade(2.0)
pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
pbDisposeSprites
end
def pbRecall(battlerindex)
@briefmessage=false
if @battle.pbIsOpposing?(battlerindex)
[MENTION=24071]Sprite[/MENTION]s["shadow#{battlerindex}"].visible=false
else
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"]
picturePoke=PictureEx.new(0)
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter(spritePoke)
# starting positions
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveColor(10,1,Color.new(16*8,23*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],384-80)
picturePoke.moveVisible(picturePoke.totalDuration,false)
picturePoke.moveColor(0,picturePoke.totalDuration,Color.new(0,0,0,0))
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
loop do
picturePoke.update
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !picturePoke.running?
end
end
end
def pbTrainerSendOut(battlerindex,pkmn)
@briefmessage=false
fadeanim=nil
while inPartyAnimation?; end
if @showingenemy
fadeanim=TrainerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,false)
sendout=PokeballSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
pbGraphicsUpdate
pbInputUpdate
fadeanim.update if fadeanim
frame+=1
if frame==1
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=10
sendout.update
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
end
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
sendout.dispose
if @showingenemy
@showingenemy=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"trainer")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase1")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"enemy#{i}")
end
end
pbRefresh
end
def pbSendOut(battlerindex,pkmn)
while inPartyAnimation?; end
balltype=pkmn.ballused
ballbitmap=sprintf("Graphics/Pictures/ball%02d_0",balltype)
pictureBall=PictureEx.new(0)
delay=1
pictureBall.moveVisible(delay,true)
pictureBall.moveName(delay,ballbitmap)
pictureBall.moveOrigin(delay,PictureOrigin::Center)
# Setting the ball's movement path
path=[[111, 164], [113, 154], [115, 145], [118, 136],
[122, 128], [130, 124], [137, 129], [140, 138],
[142, 147], [143, 156], [144, 166], [145, 175],
[145, 185], [146, 194], [146, 203], [146, 213],
[147, 222], [147, 232], [147, 241], [147, 250]]
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
angle=0
for coord in path
delay=pictureBall.totalDuration
pictureBall.moveAngle(0,delay,angle)
pictureBall.moveXY(1,delay,coord[0],coord[1])
angle+=80
angle%=360
end
pictureBall.adjustPosition(0,@yoffset)
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].visible=false
@briefmessage=false
fadeanim=nil
if @showingplayer
fadeanim=PlayerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,true)
sendout=PokeballPlayerSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
@tpb9 +=1
fadeanim.update if fadeanim
frame+=1
if frame>1 && !pictureBall.running? && [MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=3 && !pictureBall.running?
sendout.update
end
if (frame>=10 || !fadeanim) && pictureBall.running?
pictureBall.update
setPictureIconSprite(spriteBall,pictureBall)
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
pictureBall.moveVisible(1,false) if @tpb9 ==60
pbGraphicsUpdate
pbInputUpdate
$mouse.visible
$mouse.update
if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y >= 3.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.9
end
break if @tpb9 == 130
end
@tpb9 = 0
spriteBall.dispose
sendout.dispose
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
if @showingplayer
@showingplayer=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase2")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player#{i}")
end
end
pbRefresh
end
def pbTrainerWithdraw(battle,pkmn)
pbRefresh
end
def pbWithdraw(battle,pkmn)
pbRefresh
end
# 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. The function
# should not allow HM moves to be forgotten.
def pbForgetMove(pokemon,moveToLearn)
ret=-1
pbFadeOutIn(99999){
scene=PokemonSummaryScene.new
screen=PokemonSummary.new(scene)
ret=screen.pbStartForgetScreen([pokemon],0,moveToLearn)
}
return ret
end
def pbBeginAttackPhase
pbSelectBattler(-1)
end
def pbSafariStart
@briefmessage=false
[MENTION=24071]Sprite[/MENTION]s["battler0"]=SafariDataBox.new(@battle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler0"].appear
loop do
[MENTION=24071]Sprite[/MENTION]s["battler0"].update
pbGraphicsUpdate
pbInputUpdate
break if [MENTION=24071]Sprite[/MENTION]s["battler0"].appearing
end
pbRefresh
end
def pbCommandMenuEx(index,texts)
pbShowWindow(COMMANDBOX)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=true
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battlebg2")
cw2 [MENTION=24071]Sprite[/MENTION]s["commandwindow"]
texts=[
_INTL("¿Qué debería hacer {1}?",@battle.battlers[index].name)
]
cw2.setTexts(texts)
cw2.index=[0,2,1,3][@lastcmd[index]]
#pbSelectBattler(index)
pbRefresh
loop do
pbWait(3)
pbGraphicsUpdate
pbInputUpdate
#pbFrameUpdate(cw2)
if pbMouseClick?(91,119+400,323,114)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battlebg3")
pbPlayDecisionSE()
return 0
end
if pbMouseClick?(0,266+400,156,120)
pbPlayDecisionSE()
return 2
end
if pbMouseClick?(180,296+400,152,88)
pbPlayDecisionSE()
return 3
end
if pbMouseClick?(356,266+400,156,120)
pbPlayDecisionSE()
return 1
end
end
end
def pbSafariCommandMenu(index)
pbCommandMenuEx(index,[
_INTL("What will {1} throw?",@battle.pbPlayer.name),
_INTL("BALL"),
_INTL("ROCK"),
_INTL("BAIT"),
_INTL("RUN")
])
end
def pbCommandMenu(index)
# Use this method to display the list of commands.
# Return values:
# 0 - Fight
# 1 - Pokémon
# 2 - Bag
# 3 - Run
shadowTrainer=(hasConst?(PBTypes,:SHADOW) && @opponent)
ret=pbCommandMenuEx(index,[
_INTL("¿Qué debería hacer {1}?",@battle.battlers[index].name),
_INTL("FIGHT"),
_INTL("POKéMON"),
_INTL("BAG"),
shadowTrainer ? _INTL("CALL") : _INTL("RUN")
])
if ret==3 && shadowTrainer
ret=4 # convert "Run" to "Call"
end
return ret
end
def pbMoveString(move)
ret=_INTL("{1}",move.name)
typename=PBTypes.getName(move.type)
if move.id>0
ret+=_INTL(" ({1}) PP: {2}/{3}",typename,move.pp,move.totalpp)
end
return ret
end
def MoveType(move)
typename=PBTypes.getName(move.type)
if move.id>0
ret=_INTL(typename)
else
ret="testbox"
end
return ret
end
def MoveName(move)
if move.id>0
ret=_INTL("{1}",move.name)
else
ret=""
end
return ret
end
def MovePP(move)
if move.id>0
ret=_INTL("PP {1}/{2}",move.pp,move.totalpp)
else
ret=""
end
return ret
end
def pbNameEntry(helptext)
return pbEnterText(helptext,0,10)
end
# Use this method to display the list of moves for a Pokémon
def pbFightMenu(index)
#pbShowWindow(FIGHTBOX)
@ret=0
moves=@battle.battlers[index].moves
types=[
MoveType(moves[0]),
MoveType(moves[1]),
MoveType(moves[2]),
MoveType(moves[3])
]
movenames=[
MoveName(moves[0]),
MoveName(moves[1]),
MoveName(moves[2]),
MoveName(moves[3])
]
movepp=[
MovePP(moves[0]),
MovePP(moves[1]),
MovePP(moves[2]),
MovePP(moves[3])
]
move1 = Window_UnformattedTextPokemon.new(movenames[0].to_s)
#move1.baseColor = Color.new(248,248,248)
#move1.shadowColor = Color.new(104,88,112)
move1.x=34+68-6-64
move1.y=458+20-$ResizeOffsetY-20
move1.opacity = 0
move1.z=99999
move1.baseColor=Color.new(255,255,255)
move2 = Window_UnformattedTextPokemon.new(movenames[1].to_s)
move2.x=288+68-8-64
move2.y=458+20-$ResizeOffsetY-20
move2.opacity = 0
move2.z=99999
move2.baseColor=Color.new(255,255,255)
move3 = Window_UnformattedTextPokemon.new(movenames[2].to_s)
move3.x=34+75-14-64
move3.y=591-14-$ResizeOffsetY-20
move3.opacity = 0
move3.z=99999
move3.baseColor=Color.new(255,255,255)
move4 = Window_UnformattedTextPokemon.new(movenames[3].to_s)
move4.x=288+75-14-64
move4.y=591-14-$ResizeOffsetY-20
move4.opacity = 0
move4.z=99999
move4.baseColor=Color.new(255,255,255)
pp1 = Window_UnformattedTextPokemon.new(movepp[0].to_s)
pp1.x=100+75-64
pp1.y=490+26-$ResizeOffsetY-20
pp1.opacity = 0
pp1.z=99999
pp1.baseColor=Color.new(255,255,255)
pp2 = Window_UnformattedTextPokemon.new(movepp[1].to_s)
pp2.x=357+75-64
pp2.y=490+26-$ResizeOffsetY-20
pp2.opacity = 0
pp2.z=99999
pp2.baseColor=Color.new(255,255,255)
pp3 = Window_UnformattedTextPokemon.new(movepp[2].to_s)
pp3.x=100+75-64
pp3.y=614-$ResizeOffsetY-20
pp3.opacity = 0
pp3.z=99999
pp3.baseColor=Color.new(255,255,255)
pp4 = Window_UnformattedTextPokemon.new(movepp[3].to_s)
pp4.x=357+75-64
pp4.y=614-$ResizeOffsetY-20
pp4.opacity = 0
pp4.z=99999
pp4.baseColor=Color.new(255,255,255)
@movesprites={}
@movesprites["move1"]=IconSprite.new(4+75-80, 480-18,@viewport)
@movesprites["move1"].setBitmap("Graphics/Pictures/move_" + types[0].to_s)
@movesprites["move1"].z=999999991
@movesprites["move2"]=IconSprite.new(260+75-80, 480-18,@viewport)
@movesprites["move2"].setBitmap("Graphics/Pictures/move_" + types[1].to_s)
@movesprites["move2"].z=999999991
@movesprites["move3"]=IconSprite.new(4+75-80, 578-18,@viewport)
@movesprites["move3"].setBitmap("Graphics/Pictures/move_" + types[2].to_s)
@movesprites["move3"].z=999999991
@movesprites["move4"]=IconSprite.new(260+75-80, 578-18,@viewport)
@movesprites["move4"].setBitmap("Graphics/Pictures/move_" + types[3].to_s)
@movesprites["move4"].z=999999991
@movesprites["cancel"]=IconSprite.new(18, 706)
@movesprites["cancel"].setBitmap("Graphics/Pictures/botoncancelar")
@movesprites["cancel"].z=999999
cw = [MENTION=24071]Sprite[/MENTION]s["fightwindow"]
battler=@battle.battlers[index]
cw.battler=battler
lastIndex=@lastmove[index]
if battler.moves[lastIndex].id!=0
cw.setIndex(lastIndex)
else
cw.setIndex(0)
end
#pbSelectBattler(index)
pbRefresh
loop do
pbWait(3)
$mouse.visible
$mouse.update
pbGraphicsUpdate
pbInputUpdate
#pbFrameUpdate(cw)
if Input.trigger?(Input::B) or pbMouseClick?(356,264+400,156,120)
pbPlayCancelSE()
Graphics.wait(2)
pbDisposeSpriteHash(@movesprites)
move1.dispose
move2.dispose
move3.dispose
move4.dispose
[MENTION=12671]pokemon[/MENTION]no.dispose if [MENTION=12671]pokemon[/MENTION]no
pp1.dispose
pp2.dispose
pp3.dispose
pp4.dispose
@lastmove[index]=cw.index
return -1
end
if @battle.battlers[index].moves[0].id != 0
if pbMouseClickImage?(@movesprites["move1"])
@command=0
@ret=1
end
elsif @battle.battlers[index].moves[1].id != 0
if pbMouseClickImage?(@movesprites["move2"])
@command=1
@ret=1
end
elsif @battle.battlers[index].moves[2].id != 0
if pbMouseClickImage?(@movesprites["move3"])
@command=2
@ret=1
end
elsif @battle.battlers[index].moves[3].id != 0
if pbMouseClickImage?(@movesprites["move4"])
@command=3
@ret=1
end
end
if @ret == 1
ret=@command
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battleballbg")
pbDisposeSpriteHash(@movesprites)
move1.dispose
move2.dispose
move3.dispose
move4.dispose
pp1.dispose
pp2.dispose
pp3.dispose
pp4.dispose
pbPlayDecisionSE()
return ret
end
nextindex=pbNextIndex(cw.index)
if cw.index!=nextindex # Move cursor
pbPlayCursorSE()
cw.setIndex(nextindex)
end
end
end
# Use this method to display the inventory
# The return value is the item chosen, or 0 if the choice was canceled.
def pbItemMenu(index)
ret=0
endscene=true
oldsprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
itemscene=PokemonBag_Scene.new
itemscene.pbStartScene($PokemonBag)
loop do
item=itemscene.pbChooseItem
break if item==0
usetype=$ItemData[item][ITEMBATTLEUSE]
cmdUse=-1
commands=[]
if usetype==0
commands[commands.length]=_INTL("CANCEL")
else
commands[cmdUse=commands.length]=_INTL("USE")
commands[commands.length]=_INTL("CANCEL")
end
itemname=PBItems.getName(item)
command=itemscene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
if cmdUse>=0 && command==cmdUse
if usetype==1
pkmnlist=PokemonScreen_Scene.new
pkmnscreen=PokemonScreen.new(pkmnlist,@battle.party1)
itemscene.pbEndScene
pkmnlist.pbStartScene(@battle.party1,_INTL("Use on which Pokémon?"),@battle.doublebattle)
pkmnid=pkmnlist.pbChoosePokemon
if pkmnid>=0 && @battle.pbUseItemOnPokemon(item,pkmnid,pkmnscreen)
pkmnscreen.pbRefresh
pkmnlist.pbEndScene
ret=item
endscene=false
break
end
pkmnlist.pbEndScene
itemscene.pbStartScene($PokemonBag)
elsif usetype==2
if @battle.pbUseItemOnBattler(item,index,itemscene)
ret=item
break
end
end
end
end
pbConsumeItemInBattle($PokemonBag,ret)
itemscene.pbEndScene if endscene
for i in 0..4
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,oldsprites)
return ret
end
def pbSelectBattler(index,selectmode=1)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
sprite.selected=(i==index) ? selectmode : 0
sprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
sprite.selected=(i==index) ? selectmode : 0
end
end
def pbFirstTarget(index)
for i in 0..3
if i!=index && @battle.battlers.hp>0 &&
@battle.battlers[index].pbIsOpposing?(i)
return i
end
end
return -1
end
def pbNextIndex(curindex)
if Input.trigger?(Input::LEFT) && (curindex&1)==1
return curindex-1
elsif Input.trigger?(Input::RIGHT) && (curindex&1)==0
return curindex+1
elsif Input.trigger?(Input::UP) && (curindex&2)==2
return curindex-2
elsif Input.trigger?(Input::DOWN) && (curindex&2)==0
return curindex+2
end
return curindex
end
def pbUpdateSelected(index)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
if i==index
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=2
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=2
else
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=0
end
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
# Use this method to make the player choose a target
# for certain moves in double battles.
def pbChooseTarget(index)
pbShowWindow(FIGHTBOX)
curwindow=pbFirstTarget(index)
if curwindow==-1
raise RuntimeError.new(_INTL("No targets somehow..."))
end
loop do
pbGraphicsUpdate
pbInputUpdate
pbUpdateSelected(curwindow)
if Input.trigger?(Input::C)
pbUpdateSelected(-1)
return curwindow
end
if Input.trigger?(Input::B)
pbUpdateSelected(-1)
return -1
end
if curwindow>=0
if Input.trigger?(Input::RIGHT) || Input.trigger?(Input::DOWN)
loop do
newcurwindow=3 if curwindow==0
newcurwindow=1 if curwindow==3
newcurwindow=2 if curwindow==1
newcurwindow=0 if curwindow==2
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::UP)
loop do
newcurwindow=2 if curwindow==0
newcurwindow=1 if curwindow==2
newcurwindow=3 if curwindow==1
newcurwindow=0 if curwindow==3
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
end
end
end
end
def pbSwitch(index,lax,cancancel)
party=@battle.pbParty(index)
inactives=[1,1,1,1,1,1]
partypos=[]
switchsprites={}
activecmd=0
ret=-1
numactive=(@doublebattle)?2:1
pbShowWindow(BLANK)
pbSetMessageMode(true)
# Fade out and hide all sprites
visiblesprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
battler=@battle.battlers[0]
activecmd=0 if battler.index==index
inactives=0
partypos[0]=battler.pokemonIndex
if @battle.doublebattle && !@battle.fullparty1
battler=@battle.battlers[2]
activecmd=1 if battler.index==index
inactives=0
partypos[1]=battler.pokemonIndex
end
# Add all non-active Pokémon
for i in 0...6
partypos[partypos.length]=i if inactives==1
end
modparty=[]
for i in 0...6
modparty.push(party[partypos])
end
scene=PokemonScreen_Scene.new
@switchscreen=PokemonScreen.new(scene,modparty)
@switchscreen.pbStartScene(_INTL("Choose a Pokémon."),
@battle.doublebattle && !@battle.fullparty1)
loop do
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
activecmd=@switchscreen.pbChoosePokemon
if cancancel && activecmd==-1
ret=-1
break
end
if activecmd>=0
commands=[]
cmdShift=-1
cmdSummary=-1
pkmnindex=partypos[activecmd]
commands[cmdShift=commands.length]=_INTL("SHIFT") if !party[pkmnindex].egg?
commands[cmdSummary=commands.length]=_INTL("SUMMARY")
commands[commands.length]=_INTL("CANCEL")
command=scene.pbShowCommands(_INTL("Do what with {1}?",party[pkmnindex].name),commands)
if cmdShift>=0 && command==cmdShift
canswitch=lax ? @battle.pbCanSwitchLax?(index,pkmnindex,true) :
@battle.pbCanSwitch?(index,pkmnindex,true)
if canswitch
ret=pkmnindex
break
end
elsif cmdSummary>=0 && command==cmdSummary
scene.pbSummary(activecmd)
end
end
end
@switchscreen.pbEndScene
@switchscreen=nil
pbSetMessageMode(false)
# back to main battle screen
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,visiblesprites)
return ret
end
def pbDamageAnimation(pkmn,effectiveness)
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
shadowsprite [MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"]
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
oldshadowvisible=shadowsprite.visible
oldvisible=sprite.visible
sprite.selected=2
@briefmessage=false
6.times do
pbGraphicsUpdate
pbInputUpdate
end
case effectiveness
when 0
pbSEPlay("normaldamage")
when 1
pbSEPlay("notverydamage")
when 2
pbSEPlay("superdamage")
end
8.times do
pkmnsprite.visible=!pkmnsprite.visible
if oldshadowvisible
shadowsprite.visible=!shadowsprite.visible
end
4.times do
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
sprite.selected=0
sprite.visible=oldvisible
end
# This method is called whenever a Pokémon's HP changes.
# Used to animate the HP bar.
def pbHPChanged(pkmn,oldhp)
@briefmessage=false
hpchange=pkmn.hp-oldhp
if hpchange<0
hpchange=-hpchange
PBDebug.log("[#{pkmn.pbThis} lost #{hpchange} HP, now has #{pkmn.hp} HP]") if @battle.debug
else
PBDebug.log("[#{pkmn.pbThis} gained #{hpchange} HP, now has #{pkmn.hp} HP]") if @battle.debug
end
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
sprite.animateHP(oldhp,pkmn.hp)
while sprite.animatingHP
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
# This method is called whenever a Pokémon faints
def pbFainted(pkmn)
frames=pbCryFrameLength(pkmn.pokemon)
pbPlayCry(pkmn.pokemon)
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"].visible=false
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
pkmnsprite.visible=false
if @battle.pbIsOpposing?(pkmn.index)
tempvp=Viewport.new(0,0,Graphics.width,144)
else
tempvp=Viewport.new(0,0,Graphics.width,224+@yoffset)
end
tempvp.z=@viewport.z
tempsprite=SpriteWrapper.new(tempvp)
tempsprite.x=pkmnsprite.x
tempsprite.y=pkmnsprite.y
tempsprite.bitmap=pkmnsprite.bitmap
tempsprite.visible=true
pbSEPlay("faint")
16.times do
tempsprite.y+=8
pbGraphicsUpdate
pbInputUpdate
end
tempsprite.dispose
tempvp.dispose
8.times do
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].opacity=32
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].visible=false
end
# Use this method to choose a command for the enemy.
def pbChooseEnemyCommand(index)
@battle.pbDefaultChooseEnemyCommand(index)
end
# Use this method to choose a new Pokémon for the enemy
# The enemy's party is guaranteed to have at least one choosable member.
def pbChooseNewEnemy(index,party)
@battle.pbDefaultChooseNewEnemy(index,party)
end
# This method is called when the player wins a wild Pokémon battle.
# This method can change the battle's music for example.
def pbWildBattleSuccess
pbBGMPlay(pbGetWildVictoryME())
end
# This method is called when the player wins a Trainer battle.
# This method can change the battle's music for example.
def pbTrainerBattleSuccess
pbBGMPlay(pbGetTrainerVictoryME(@battle.opponent))
end
def pbEXPBar(pokemon,battler,startexp,endexp,tempexp1,tempexp2)
if battler
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].refreshExpLevel
exprange=(endexp-startexp)
startexplevel=0
endexplevel=0
if exprange!=0
startexplevel=(tempexp1-startexp)*EXPGAUGESIZE/exprange
endexplevel=(tempexp2-startexp)*EXPGAUGESIZE/exprange
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animateEXP(startexplevel,endexplevel)
while [MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animatingEXP
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].update
end
end
end
def pbShowPokedex(species)
pbFadeOutIn(99999){
scene=PokemonPokedexScene.new
screen=PokemonPokedex.new(scene)
screen.pbDexEntry(species)
}
end
def pbFindAnimation(moveid)
begin
move2anim=load_data("Data/move2anim.dat")
anim=move2anim[0][moveid]
return anim if anim
if hasConst?(PBMoves,:TACKLE)
anim=move2anim[0][getConst(PBMoves,:TACKLE)]
return anim if anim
end
rescue
return nil
end
return nil
end
def pbCommonAnimation(animname,attacker,opponent,side=true)
animations=load_data("Data/PkmnAnimations.rxdata")
for i in 0...animations.length
if animations && animations.name=="Common:"+animname
pbAnimationCore(animations,attacker,opponent,side)
return
end
end
end
def pbChangeSpecies(attacker,species)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmapSpecies(attacker.pokemon,species,back)
pkmn.y=adjustBattleSpriteY(pkmn,species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(species)
end
end
def pbChangePokemon(attacker,pokemon)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmap(pokemon,back)
pkmn.y=adjustBattleSpriteY(pkmn,pokemon.species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(pokemon.species)
end
end
def pbAnimation(moveid,attacker,opponent,side=true)
animid=pbFindAnimation(moveid)
return if !animid
animations=load_data("Data/PkmnAnimations.rxdata")
pbSaveShadows {
pbAnimationCore(animations[animid],attacker,opponent,side)
}
if isConst?(moveid,PBMoves,:TRANSFORM) && attacker && opponent
# Change form to transformed version
pbChangePokemon(attacker,opponent.pokemon)
end
end
def pbSaveShadows
shadows=[]
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
shadows=s ? s.visible : false
s.visible=false if s
end
yield
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
s.visible=shadows if s
end
end
def pbAnimationCore(animation,attacker,opponent,side=true)
if !attacker || !animation
return
end
@briefmessage=false
user=(attacker) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"] : nil
target=(opponent) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{opponent.index}"] : nil
olduserx=user.x
oldusery=user.y
oldtargetx=target ? target.x : 0
oldtargety=target ? target.y : 0
if !target
animplayer=PBAnimationPlayer.new(animation,user,user,@viewport3)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
animplayer.setLineTransform(144,188,352,108,
user.x+(userwidth/2),user.y+(userheight/2),
user.x+(userwidth/2),user.y+(userheight/2))
else
animplayer=PBAnimationPlayer.new(animation,user,target,@viewport3)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
targetwidth=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
targetheight=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.height
animplayer.setLineTransform(144,188,352,108,
user.x+(userwidth/2),user.y+(userheight/2),
target.x+(targetwidth/2),target.y+(targetheight/2))
end
animplayer.start
while animplayer.playing?
animplayer.update
pbGraphicsUpdate
pbInputUpdate
end
user.ox=0
user.oy=0
target.ox=0 if target
target.oy=0 if target
user.x=olduserx
user.y=oldusery
target.x=oldtargetx if target
target.y=oldtargety if target
animplayer.dispose
end
def pbLevelUp(pokemon,battler,oldtotalhp,oldattack,olddefense,oldspeed,
oldspatk,oldspdef)
pbTopRightWindow(_INTL("MaxHP<r>+{1}\r\nATTACK<r>+{2}\r\nDEFENSE<r>+{3}\r\nSP. ATK<r>+{4}\r\nSP. DEF<r>+{5}\r\nSPEED<r>+{6}",
pokemon.totalhp-oldtotalhp,
pokemon.attack-oldattack,
pokemon.defense-olddefense,
pokemon.spatk-oldspatk,
pokemon.spdef-oldspdef,
pokemon.speed-oldspeed))
pbTopRightWindow(_INTL("MaxHP<r>{1}\r\nATTACK<r>{2}\r\nDEFENSE<r>{3}\r\nSP. ATK<r>{4}\r\nSP. DEF<r>{5}\r\nSPEED<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
end
def pbThrowAndDeflect(ball,targetBattler)
end
def pbThrow(ball,shakes,targetBattler)
@briefmessage=false
pokeballThrow(ball,shakes,targetBattler)
end
def pbThrowSuccess
if !@opponent
@briefmessage=false
pbBGMPlay("../ME/PkmRS-Caught")
frames=(3.5*Graphics.frame_rate).to_i
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
end
end
end
- def pbChooseNewEnemy(index,party)
Use this method to choose a new Pokémon for the enemy
The enemy's party is guaranteed to have at least one
choosable member.
index - Index to the battler to be replaced (use e.g. @battle.battlers[index] to
access the battler)
party - Enemy's party
- def pbWildBattleSuccess
This method is called when the player wins a wild Pokémon battle.
This method can change the battle's music for example.
- def pbTrainerBattleSuccess
This method is called when the player wins a Trainer battle.
This method can change the battle's music for example.
- def pbFainted(pkmn)
This method is called whenever a Pokémon faints.
pkmn - PokeBattle_Battler object indicating the Pokémon that fainted
- def pbChooseEnemyCommand(index)
Use this method to choose a command for the enemy.
index - Index of enemy battler (use e.g. @battle.battlers[index] to
access the battler)
- def pbCommandMenu(index)
Use this method to display the list of commands and choose
a command for the player.
index - Index of battler (use e.g. @battle.battlers[index] to
access the battler)
Return values:
0 - Fight
1 - Pokémon
2 - Bag
3 - Run
=end
################################################
class CommandMenuDisplay
def initialize(viewport=nil)
@display=nil
if PokeBattle_Scene::USECOMMANDBOX
@display=IconSprite.new(0,384-96,viewport)
@display.setBitmap("Graphics/Pictures/commandbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
Graphics.width-240,0-96,5,96);
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
[MENTION=24700]Wind[/MENTION]ow.viewport=viewport
@msgbox=Window_UnformattedTextPokemon.newWithSize(
"",4,384-96,Graphics.width [MENTION=24700]Wind[/MENTION]ow.width-4, 296,viewport) # [MENTION=24700]Wind[/MENTION]ow.width-4
@msgbox.baseColor=PokeBattle_Scene::MESSAGEBASECOLOR
@msgbox.shadowColor=PokeBattle_Scene::MESSAGESHADOWCOLOR
@msgbox.windowskin=nil
if PokeBattle_Scene::USECOMMANDBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
end
@title=""
end
def index; [MENTION=24700]Wind[/MENTION]ow.index; end
def index=(value); [MENTION=24700]Wind[/MENTION]ow.index=value; end
def setTexts(value)
@msgbox.text=value[0]
# Note 2 and 3 were intentionally switched
commands=[]
[1,3,2,4].each{|i|
commands.push(value) if value && value!=nil
}
[MENTION=24700]Wind[/MENTION]ow.commands=commands
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@msgbox.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@msgbox.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@msgbox.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@msgbox.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@msgbox.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@msgbox.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@msgbox.z=value
@display.z=value if @display
end
def disposed?
return @msgbox.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@msgbox.dispose
[MENTION=24700]Wind[/MENTION]ow.dispose
@display.dispose if @display
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
@msgbox.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def refresh
@msgbox.refresh
[MENTION=24700]Wind[/MENTION]ow.refresh
end
end
class FightMenuDisplay
attr_reader :battler
attr_reader :index
def battler=(value)
@battler=value
refresh
end
def setIndex(value)
if @battler && @battler.moves[value].id!=0
@index=value
[MENTION=24700]Wind[/MENTION]ow.index=value
refresh
end
end
def visible; [MENTION=24700]Wind[/MENTION]ow.visible; end
def visible=(value)
[MENTION=24700]Wind[/MENTION]ow.visible=value
@info.visible=value
@display.visible=value if @display
end
def x; [MENTION=24700]Wind[/MENTION]ow.x; end
def x=(value)
[MENTION=24700]Wind[/MENTION]ow.x=value
@info.x=value
@display.x=value if @display
end
def y; [MENTION=24700]Wind[/MENTION]ow.y; end
def y=(value)
[MENTION=24700]Wind[/MENTION]ow.y=value
@info.y=value
@display.y=value if @display
end
def oy; [MENTION=24700]Wind[/MENTION]ow.oy; end
def oy=(value)
[MENTION=24700]Wind[/MENTION]ow.oy=value
@info.oy=value
@display.oy=value if @display
end
def color; [MENTION=24700]Wind[/MENTION]ow.color; end
def color=(value)
[MENTION=24700]Wind[/MENTION]ow.color=value
@info.color=value
@display.color=value if @display
end
def ox; [MENTION=24700]Wind[/MENTION]ow.ox; end
def ox=(value)
[MENTION=24700]Wind[/MENTION]ow.ox=value
@info.ox=value
@display.ox=value if @display
end
def z; [MENTION=24700]Wind[/MENTION]ow.z; end
def z=(value)
[MENTION=24700]Wind[/MENTION]ow.z=value
@info.z=value
@display.z=value if @display
end
def disposed?
return @info.disposed? || [MENTION=24700]Wind[/MENTION]ow.disposed?
end
def dispose
return if disposed?
@info.dispose
@display.dispose if @display
[MENTION=24700]Wind[/MENTION]ow.dispose
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
@info.update
[MENTION=24700]Wind[/MENTION]ow.update
@display.update if @display
end
def initialize(battler,viewport=nil)
@display=nil
if PokeBattle_Scene::USEFIGHTBOX
@display=IconSprite.new(0,384-96,viewport)
@display.setBitmap("Graphics/Pictures/fightbox")
end
[MENTION=24700]Wind[/MENTION]ow=Window_CommandPokemon.newWithSize([],
0,384-96,320,96,viewport)
[MENTION=24700]Wind[/MENTION]ow.columns=2
[MENTION=24700]Wind[/MENTION]ow.columnSpacing=4
@info=Window_AdvancedTextPokemon.newWithSize(
"",320,384-96,Graphics.width-320,96,viewport)
@ctag=shadowctag(PokeBattle_Scene::MENUBASECOLOR,
PokeBattle_Scene::MENUSHADOWCOLOR)
if PokeBattle_Scene::USEFIGHTBOX
[MENTION=24700]Wind[/MENTION]ow.opacity=0
@info.opacity=0
end
@battler=battler
@index=0
refresh
end
def refresh
return if !@battler
pbSetNarrowFont [MENTION=24700]Wind[/MENTION]ow.contents)
commands=[]
for i in 0...4
if @battler.moves.id!=0
commands.push(@battler.moves.name)
else
break
end
end
[MENTION=24700]Wind[/MENTION]ow.commands=commands
selmove=@battler.moves[@index]
movetype=PBTypes.getName(selmove.type)
pbSetNarrowFont(@info.contents)
@info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
@ctag,selmove.pp,selmove.totalpp,movetype)
end
end
class PokemonBattlerSprite < RPG::Sprite
attr_accessor :selected
def initialize(doublebattle,index,viewport=nil)
super(viewport)
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@index=index
@updating=false
@doublebattle=doublebattle
@index=index
[MENTION=24071]Sprite[/MENTION]X=0
[MENTION=24071]Sprite[/MENTION]Y=0
[MENTION=24071]Sprite[/MENTION]XExtra=0
[MENTION=24071]Sprite[/MENTION]YExtra=0
[MENTION=24071]Sprite[/MENTION]Visible=false
@_iconbitmap=nil
self.visible=false
end
def selected=(value)
if @selected==1 && value!=1 && [MENTION=24071]Sprite[/MENTION]YExtra>0
[MENTION=24071]Sprite[/MENTION]YExtra=0
self.y [MENTION=24071]Sprite[/MENTION]Y
end
@selected=value
end
def visible=(value)
[MENTION=24071]Sprite[/MENTION]Visible=value if !@updating
super
end
def x
return [MENTION=24071]Sprite[/MENTION]X
end
def y
return [MENTION=24071]Sprite[/MENTION]Y
end
def x=(value)
[MENTION=24071]Sprite[/MENTION]X=value
super(value [MENTION=24071]Sprite[/MENTION]XExtra)
end
def y=(value)
[MENTION=24071]Sprite[/MENTION]Y=value
super(value [MENTION=24071]Sprite[/MENTION]YExtra)
end
def update
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19010]Frame[/MENTION]+=1
@updating=true
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
[MENTION=24071]Sprite[/MENTION]YExtra=2
else
[MENTION=24071]Sprite[/MENTION]YExtra=0
end
if ( [MENTION=19010]Frame[/MENTION]/9).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
elsif @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible= [MENTION=19010]Frame[/MENTION]%10<7)
elsif
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
self.visible [MENTION=24071]Sprite[/MENTION]Visible
end
if @_iconbitmap
@_iconbitmap.update
self.bitmap=@_iconbitmap.bitmap
end
@updating=false
end
def dispose
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=nil
self.bitmap=nil if !self.disposed?
super
end
def setPokemonBitmap(pokemon,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmap(pokemon,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
def setPokemonBitmapSpecies(pokemon,species,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmapSpecies(pokemon,species,back)
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
end
end
class SafariDataBox < SpriteWrapper
attr_accessor :selected
attr_reader :appearing
def initialize(battle,viewport=nil)
super(viewport)
@selected=0
@battle=battle
@databox=AnimatedBitmap.new("Graphics/Pictures/safariPlayerBox")
[MENTION=24071]Sprite[/MENTION]X=254
[MENTION=24071]Sprite[/MENTION]Y=148+(384-320)
[MENTION=24071]Sprite[/MENTION]baseY=0
[MENTION=24071]Sprite[/MENTION]baseX=16
@appearing=false
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=2
refresh
end
def appear
refresh
self.visible=true
self.opacity=255
self.x [MENTION=24071]Sprite[/MENTION]X+320
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
textpos=[]
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
textpos.push([_INTL("SAFARI BALLS") [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+6,false,base,shadow])
textpos.push([_INTL("Left: {1}",@battle.ballcount) [MENTION=24071]Sprite[/MENTION]baseX+170 [MENTION=24071]Sprite[/MENTION]baseY+40,
true,base,shadow])
pbDrawTextPositions(self.bitmap,textpos)
end
def update
super
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
if @appearing
self.x-=8
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
class PokemonDataBox < SpriteWrapper
attr_reader :battler
attr_accessor :selected
attr_accessor :appearing
attr_reader :animatingHP
attr_reader :animatingEXP
def initialize(battler,doublebattle,viewport=nil)
super(viewport)
@explevel=0
@battler=battler
[MENTION=24071]Sprite[/MENTION]baseY=0
@selected=0
[MENTION=19010]Frame[/MENTION]=0
@showhp=false
@showexp=false
@appearing=false
@animatingHP=false
@currenthp=0
@endhp=0
@expflash=0
@statusCX=64
@statusY=28
if (@battler.index&1)==0 # if player's Pokémon
[MENTION=24071]Sprite[/MENTION]baseX=16
else
[MENTION=24071]Sprite[/MENTION]baseX=0
end
yoffset=(384-320)
if doublebattle
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=256
[MENTION=24071]Sprite[/MENTION]Y=124+yoffset
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26
[MENTION=24071]Sprite[/MENTION]Y=10+yoffset
[MENTION=24071]Sprite[/MENTION]baseX=0
[MENTION=24071]Sprite[/MENTION]baseY=0
when 2
@databox=AnimatedBitmap.new("Graphics/Pictures/doublePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=280
[MENTION=24071]Sprite[/MENTION]Y=174+yoffset
when 3
@databox=AnimatedBitmap.new("Graphics/Pictures/doubleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=2
[MENTION=24071]Sprite[/MENTION]Y=60+yoffset
end
else
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/singlePlayerBox")
[MENTION=24071]Sprite[/MENTION]X=278-11
[MENTION=24071]Sprite[/MENTION]Y=148+yoffset+4
@showhp=true
@showexp=true
@statusCX=40
@statusY=44
@tubox = true
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/singleEnemyBox")
[MENTION=24071]Sprite[/MENTION]X=26-36+10
[MENTION=24071]Sprite[/MENTION]Y=32+yoffset-36
@rivalbox = true
end
end
@statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/boxstatuses"))
@contents=BitmapWrapper.new(@databox.width,@databox.height)
self.bitmap=@contents
self.visible=false
self.z=99999
refreshExpLevel
refresh
end
def dispose
@statuses.dispose
@databox.dispose
@contents.dispose
super
end
def refreshExpLevel
if !@battler.pokemon
@explevel=0
else
growthrate=@battler.pokemon.growthrate
startexp=PBExperience.pbGetStartExperience(@battler.pokemon.level,growthrate)
endexp=PBExperience.pbGetStartExperience(@battler.pokemon.level+1,growthrate)
if startexp==endexp
@explevel=0
else
@explevel=(@battler.pokemon.exp-startexp)*PokeBattle_Scene::EXPGAUGESIZE/(endexp-startexp)
end
end
end
def exp
return @animatingEXP ? @currentexp : @explevel
end
def hp
return @animatingHP ? @currenthp : @battler.hp
end
def animateHP(oldhp,newhp)
@currenthp=oldhp
@endhp=newhp
@animatingHP=true
end
def animateEXP(oldexp,newexp)
@currentexp=oldexp
@endexp=newexp
@animatingEXP=true
end
def appear
refreshExpLevel
refresh
self.visible=true
self.opacity=255
if (@battler.index&1)==0 # if player's Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X+320
else
self.x [MENTION=24071]Sprite[/MENTION]X-320
end
self.y [MENTION=24071]Sprite[/MENTION]Y
@appearing=true
end
def refresh
self.bitmap.clear
return if !@battler.pokemon
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSmallFont(self.bitmap)
hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
textpos=[]
base=Color.new(255,255,255)
shadow=Color.new(33,33,33)
genderX=self.bitmap.text_size(@battler.name).width
genderX+ [MENTION=24071]Sprite[/MENTION]baseX+14
if @tubox == true
textpos.push([@battler.name [MENTION=24071]Sprite[/MENTION]baseX+18 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
else
textpos.push([@battler.name [MENTION=24071]Sprite[/MENTION]baseX+14+28 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
end
if @battler.index == 0
if @battler.gender==0 # Male genderX+40-2
textpos.push([_INTL("♂"),156-8 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(8*8,25*8,31*8),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("♀"),156-8 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(31*8,19*8,18*8),shadow])
end
else
if @battler.gender==0 # Male
textpos.push([_INTL("♂"),156 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(8*8,25*8,31*8),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("♀"),156 [MENTION=24071]Sprite[/MENTION]baseY-2,false,Color.new(31*8,19*8,18*8),shadow])
end
end
if @tubox == true
textpos.push([_INTL("{1}",@battler.level) [MENTION=24071]Sprite[/MENTION]baseX+188-24 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
else
textpos.push([_INTL("{1}",@battler.level) [MENTION=24071]Sprite[/MENTION]baseX+198-10 [MENTION=24071]Sprite[/MENTION]baseY-2,false,base,shadow])
end
if @showhp
textpos.push([hpstring [MENTION=24071]Sprite[/MENTION]baseX+154 [MENTION=24071]Sprite[/MENTION]baseY+26,true,base,shadow])
end
pbDrawTextPositionsTB(self.bitmap,textpos)
if @battler.status>0
self.bitmap.blt [MENTION=24071]Sprite[/MENTION]baseX+14 [MENTION=24071]Sprite[/MENTION]baseY+@statusY,@statuses.bitmap,
Rect.new(0,(@battler.status-1)*16,@statusCX,16))
end
hpGaugeSize=PokeBattle_Scene::HPGAUGESIZE
hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
hpgauge=1 if hpgauge==0 && self.hp>0
hpzone=0
hpzone=1 if self.hp<=(@battler.totalhp/2).floor
hpzone=2 if self.hp<=(@battler.totalhp/4).floor
hpcolors=[
PokeBattle_Scene::HPCOLORSHADOW1,
PokeBattle_Scene::HPCOLORBASE1,
PokeBattle_Scene::HPCOLORSHADOW2,
PokeBattle_Scene::HPCOLORBASE2,
PokeBattle_Scene::HPCOLORSHADOW3,
PokeBattle_Scene::HPCOLORBASE3
]
# fill with HP color
if @tubox == true
hpGaugeX=PokeBattle_Scene::HPGAUGE_X+18
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y-10
expGaugeX=PokeBattle_Scene::EXPGAUGE_X+2
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y-14
else
hpGaugeX=PokeBattle_Scene::HPGAUGE_X+10
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y-10
expGaugeX=PokeBattle_Scene::EXPGAUGE_X
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y
end
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpgauge,2,hpcolors[hpzone*2+1])
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpgauge,2,hpcolors[hpzone*2])
# fill with black
#self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORSHADOW4)
#self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+hpGaugeX+hpgauge [MENTION=24071]Sprite[/MENTION]baseY+hpGaugeY+2,hpGaugeSize-hpgauge,2,PokeBattle_Scene::HPCOLORBASE4)
if @showexp
# fill with EXP color
self.bitmap.fill_rect [MENTION=24071]Sprite[/MENTION]baseX+expGaugeX [MENTION=24071]Sprite[/MENTION]baseY+expGaugeY,self.exp,2,PokeBattle_Scene::EXPCOLOR)
end
end
def update
super
[MENTION=19010]Frame[/MENTION]+=1
if @animatingHP
if @currenthp<@endhp
@currenthp+=1
elsif @currenthp>@endhp
@currenthp-=1
end
refresh
@animatingHP=false if @currenthp==@endhp
end
if @animatingEXP
if !@showexp
@currentexp=@endexp
elsif @currentexp<@endexp
@currentexp+=1
elsif @currentexp>@endexp
@currentexp-=1
end
refresh
if @currentexp==@endexp
if @currentexp==PokeBattle_Scene::EXPGAUGESIZE
if @expflash==0
pbSEPlay("expfull")
self.flash(Color.new(64,200,248),8)
@expflash=8
else
@expflash-=1
if @expflash==0
@animatingEXP=false
refreshExpLevel
end
end
else
@animatingEXP=false
end
end
end
if @appearing
if (@battler.index&1)==0 # if player's Pokémon
self.x-=8 if $esperahp != true
@appearing=false if self.x< [MENTION=24071]Sprite[/MENTION]X
else
self.x+=8
@appearing=false if self.x> [MENTION=24071]Sprite[/MENTION]X
end
self.y [MENTION=24071]Sprite[/MENTION]Y
return
end
if ( [MENTION=19010]Frame[/MENTION]/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
elsif ( [MENTION=19010]Frame[/MENTION]/5).floor&1)==1 && @selected==2 # When targeted or damaged
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y+2
else
self.x [MENTION=24071]Sprite[/MENTION]X
self.y [MENTION=24071]Sprite[/MENTION]Y
end
end
end
def adjustBattleSpriteYBattle(sprite,species,index)
ret=0
metrics=load_data("Data/metrics.dat")
if index==1 || index==3
factor=metrics[1][species] # enemy Y
factor-=metrics[2][species] # altitude (affects shadows)
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret=factor*2+(64-halfY)
ret+=16 if index==1
else
ret=(index==0) ? 96 : 112
ret+=(metrics[0][species])*2
halfY=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 64
ret+=(64-halfY)
end
return ret+(384-320)
end
def showShadow?(species)
metrics=load_data("Data/metrics.dat")
return metrics[2][species]>0
end
class PokeballSendOutAnimation
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
@ballused=pkmn.pokemon ? pkmn.pokemon.ballused : 0
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(31*8,22*8,30*8)
[MENTION=19050]poke[/MENTION]ballsprite=IconSprite.new(0,0,sprite.viewport)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_0",@ballused))
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==1 ? 400 : 304
else
[MENTION=24071]Sprite[/MENTION]x=344
end
[MENTION=24071]Sprite[/MENTION]x+=Graphics.width-480
[MENTION=24071]Sprite[/MENTION]y=120
[MENTION=24071]Sprite[/MENTION]hash=spritehash
[MENTION=19050]poke[/MENTION]ballsprite.x [MENTION=24071]Sprite[/MENTION]x-8
[MENTION=19050]poke[/MENTION]ballsprite.y [MENTION=24071]Sprite[/MENTION]y-8
[MENTION=28203]pkmn[/MENTION]=pkmn
@endspritey=adjustBattleSpriteY(sprite,pkmn.species,pkmn.index)
[MENTION=12804]Shadow[/MENTION]Y [MENTION=24071]Sprite[/MENTION]y+18 # from top
[MENTION=12804]Shadow[/MENTION]X [MENTION=24071]Sprite[/MENTION]x-32 # from left
[MENTION=12804]Shadow[/MENTION]Visible=showShadow?(pkmn.species)
[MENTION=12804]Shadow[/MENTION]Y-=16 if doublebattle && pkmn.index==3
@stepspritey= [MENTION=24071]Sprite[/MENTION]y-@endspritey)
@zoomstep=(2.0-STARTZOOM)/SPRITESTEPS
@animdone=false
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
[MENTION=19050]poke[/MENTION]ballsprite.dispose
@disposed=true
end
def update
return if disposed?
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19050]poke[/MENTION]ballsprite.update
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==2
pbSEPlay("recall")
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_1",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
[MENTION=19050]poke[/MENTION]ballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_2",@ballused))
end
if [MENTION=19010]Frame[/MENTION]==8
[MENTION=19050]poke[/MENTION]ballsprite.visible=false
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=@zoomstep
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 2.0
currentY [MENTION=24071]Sprite[/MENTION]y-(@stepspritey [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y)
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,currentY)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y=currentY
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=2.0
@animdone=true
if [MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"]
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].x [MENTION=12804]Shadow[/MENTION]X
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].y [MENTION=12804]Shadow[/MENTION]Y
[MENTION=24071]Sprite[/MENTION]hash["shadow# [MENTION=28203]pkmn[/MENTION].index}"].visible [MENTION=12804]Shadow[/MENTION]Visible
end
end
end
end
def pokeballThrow(ball,shakes,targetBattler)
balltype=@battle.pbGetBallType(ball)
oldvisible [MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=false
ball0=sprintf("Graphics/Pictures/ball%02d_0",balltype)
ball1=sprintf("Graphics/Pictures/ball%02d_1",balltype)
ball2=sprintf("Graphics/Pictures/ball%02d_2",balltype)
# sprites
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"]
# pictures
pictureBall=PictureEx.new(0)
picturePoke=PictureEx.new(0)
pokeball=[Graphics.width-130,64]
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter [MENTION=24071]Sprite[/MENTION]s["pokemon#{targetBattler}"])
# starting positions
pictureBall.moveVisible(1,true)
pictureBall.moveName(1,ball0)
pictureBall.moveOrigin(1,PictureOrigin::Center)
pictureBall.moveXY(0,1,10,180)
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveSE(1,"Audio/SE/throw")
pictureBall.moveCurve(20,1,150,70,30+Graphics.width/2,10,Graphics.width-130,48)
delay=pictureBall.totalDuration+2
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,pokeball[0],pokeball[1])
picturePoke.moveSE(delay+10,"Audio/SE/jumptoball")
picturePoke.moveVisible(delay+15,false)
pictureBall.moveName(picturePoke.totalDuration+2,ball0)
delay=picturePoke.totalDuration+6
pictureBall.moveXY(15,delay,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(8,pictureBall.totalDuration+2,pokeball[0],80)
pictureBall.moveXY(7,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(6,pictureBall.totalDuration+2,pokeball[0],96)
pictureBall.moveXY(5,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(4,pictureBall.totalDuration+2,pokeball[0],112)
pictureBall.moveXY(3,pictureBall.totalDuration+2,pokeball[0],128)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
picturePoke.moveXY(0,pictureBall.totalDuration,pokeball[0],128)
delay=pictureBall.totalDuration+18 if shakes==0
[shakes,3].min.times do
delay=pictureBall.totalDuration+18
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(4,delay,pokeball[0]-8,128)
pictureBall.moveAngle(4,delay,20) # positive means counterclockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(8,delay,pokeball[0]+8,128)
pictureBall.moveAngle(8,delay,-20) # negative means clockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(4,delay,pokeball[0],128)
pictureBall.moveAngle(4,delay,0)
end
if shakes<4
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ball1)
pictureBall.moveName(delay+4,ball2)
pictureBall.moveVisible(delay+10,false)
picturePoke.moveVisible(delay,true)
picturePoke.moveZoom(15,delay,100)
picturePoke.moveXY(15,delay,center[0],center[1])
delay=picturePoke.totalDuration
picturePoke.moveColor(10,delay,Color.new(31*8,22*8,30*8,0))
end
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
picturePoke.moveXY(0,picturePoke.totalDuration,dims[0],dims[1])
loop do
pictureBall.update
picturePoke.update
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !pictureBall.running? && !picturePoke.running?
end
if shakes<4
[MENTION=24071]Sprite[/MENTION]s["shadow#{targetBattler}"].visible=oldvisible
end
spriteBall.dispose
end
class PokeballPlayerSendOutAnimation # SACA TU POKéMON
# Ball curve: 8,52; 22,44; 52, 96
# Player: Color.new(16*8,23*8,30*8)
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite=sprite
[MENTION=28203]pkmn[/MENTION]=pkmn
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=false
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color=Color.new(16*8,23*8,30*8)
[MENTION=24071]Sprite[/MENTION]hash=spritehash
$tupkmn [MENTION=12671]pokemon[/MENTION]BattlerSprite
[MENTION=12671]pokemon[/MENTION]BattlerSprite.z=99999
@sumandoplayer = 814
if doublebattle
[MENTION=24071]Sprite[/MENTION]x=pkmn.index==0 ? 64 : 180
else
[MENTION=24071]Sprite[/MENTION]x=232+26
end
[MENTION=24071]Sprite[/MENTION]y=384-64+30
@endspritey=adjustBattleSpriteYBattle [MENTION=12671]pokemon[/MENTION]BattlerSprite,
pkmn.species,pkmn.index)
@animdone=false
[MENTION=26553]lol[/MENTION]sal = 0
[MENTION=19010]Frame[/MENTION]=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
@disposed=true
end
def update
return if disposed?
[MENTION=19010]Frame[/MENTION]+=1
if [MENTION=19010]Frame[/MENTION]==4
[MENTION=12671]pokemon[/MENTION]BattlerSprite.visible=true
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=STARTZOOM
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=STARTZOOM
pbSEPlay("recall")
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x [MENTION=24071]Sprite[/MENTION]y)
pbPlayCry [MENTION=28203]pkmn[/MENTION].pokemon ? [MENTION=28203]pkmn[/MENTION].pokemon : [MENTION=28203]pkmn[/MENTION].species)
end
if [MENTION=19010]Frame[/MENTION]>8 && [MENTION=19010]Frame[/MENTION]<=16
color=Color.new(248,248,248,256-(16 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>16 && [MENTION=19010]Frame[/MENTION]<=24
color=Color.new(248,248,248,(24 [MENTION=19010]Frame[/MENTION])*32)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha=(24 [MENTION=19010]Frame[/MENTION])*32
[MENTION=24071]Sprite[/MENTION]hash["enemybase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["playerbase"].color=color
[MENTION=24071]Sprite[/MENTION]hash["battlebg"].color=color
end
if [MENTION=19010]Frame[/MENTION]>5 && [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x<2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=0.1
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x > 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y=2.0 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y > 2.0
pbSpriteSetCenter [MENTION=12671]pokemon[/MENTION]BattlerSprite [MENTION=24071]Sprite[/MENTION]x,0)
[MENTION=12671]pokemon[/MENTION]BattlerSprite.y [MENTION=24071]Sprite[/MENTION]y+(@endspritey [MENTION=24071]Sprite[/MENTION]y) [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y
end
if [MENTION=12671]pokemon[/MENTION]BattlerSprite.color.alpha<=0 &&
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x>=2.0
@animdone=true
$canupdate5 = false
[MENTION=26553]lol[/MENTION]sal +=1
if [MENTION=26553]lol[/MENTION]sal>=16
$esperahp = true
end
if [MENTION=26553]lol[/MENTION]sal>=50
$enemybase.zoom_x+=0.125 if $enemybase.zoom_x != 2.0
$enemybase.zoom_y+=0.125 if $enemybase.zoom_x != 2.0
$enemybase.y+=2 if $enemybase.zoom_x != 2.0
$enemybase.x-=12 if $enemybase.zoom_x != 2.0
$playerbase.zoom_x+=0.125 if $playerbase.zoom_x != 3.0
$playerbase.zoom_y+=0.125 if $playerbase.zoom_y != 3.0
$playerbase.y+=16 if $playerbase.zoom_x != 3.0
$playerbase.x-=26 if $playerbase.zoom_x != 3.0
$pokemon1.zoom_x+=0.125 if $enemybase.zoom_x != 2.0
$pokemon1.zoom_y+=0.125 if $enemybase.zoom_x != 2.0
$pokemon1.y-=5.5 if $enemybase.zoom_x != 2.0
$pokemon1.x-=8.5 if $enemybase.zoom_x != 2.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.x-=20 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0 [MENTION=12671]pokemon[/MENTION]BattlerSprite.y+=10 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0
[MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x+=0.125 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0 [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_y+=0.125 if [MENTION=12671]pokemon[/MENTION]BattlerSprite.zoom_x != 3.0
end
end
end
end
class TrainerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].update if @sprit
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=8
[MENTION=24071]Sprite[/MENTION]s["trainer2"].x+=8 if [MENTION=24071]Sprite[/MENTION]s["trainer2"]
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=8
[MENTION=24071]Sprite[/MENTION]s["partybase1"].opacity-=12
for i in 0...6
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["enemy#{i}"].x+=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
@animdone=true if [MENTION=24071]Sprite[/MENTION]s["trainer"].x>=Graphics.width &&
( [MENTION=24071]Sprite[/MENTION]s["trainer2"]| [MENTION=24071]Sprite[/MENTION]s["trainer2"].x>=Graphics.width )
end
end
class PlayerFadeAnimation
def initialize(sprites)
[MENTION=19010]Frame[/MENTION]=0
[MENTION=24071]Sprite[/MENTION]s=sprites
@animdone=false
@salpokemon1 = 0
@salpokemon2 = 0
@salpokemon3 = 0
@salpokemon4 = 0
@salpokemon5 = 0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.0
end
def animdone?
return @animdone
end
def update
return if @animdone
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["enemybase"].y-=2 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].x+=12 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y != 2.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].y-=16 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].x+=26 if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y-=0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y+=5.5 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+=8.5 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 1.0
$pokemon1 = [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
[MENTION=19010]Frame[/MENTION]+=1
[MENTION=24071]Sprite[/MENTION]s["player"].x-=8
[MENTION=24071]Sprite[/MENTION]s["playerB"].x-=8 if [MENTION=24071]Sprite[/MENTION]s["playerB"]
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=8
[MENTION=24071]Sprite[/MENTION]s["partybase2"].opacity-=12
for i in 0...6
if [MENTION=24071]Sprite[/MENTION]s["player#{i}"]
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].opacity-=12
[MENTION=24071]Sprite[/MENTION]s["player#{i}"].x-=8 if [MENTION=19010]Frame[/MENTION]>=i*4
end
end
pa [MENTION=24071]Sprite[/MENTION]s["player"]
pb [MENTION=24071]Sprite[/MENTION]s["playerB"]
pawidth=128
pbwidth=128
if (pa && pa.bitmap && !pa.bitmap.disposed?)
if pa.bitmap.height<pa.bitmap.width
numframes=pa.bitmap.width/pa.bitmap.height # Number of frames
pawidth=pa.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=pawidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
else
pawidth=pa.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width=pawidth
end
end
if (pb && pb.bitmap && !pb.bitmap.disposed?)
if pb.bitmap.height<pb.bitmap.width
numframes=pb.bitmap.width/pb.bitmap.height # Number of frames
pbwidth=pb.bitmap.width/numframes # Width per frame
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*1 if [MENTION=19010]Frame[/MENTION]>0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*2 if [MENTION=19010]Frame[/MENTION]>8
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=pbwidth*3 if [MENTION=19010]Frame[/MENTION]>11
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
else
pbwidth=pb.bitmap.width
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width=pbwidth
end
end
if pb
@animdone=true if pb.x<=-pbwidth
else
@animdone=true if pa.x<=-pawidth
end
end
end
####################################################
class PokeBattle_Scene
USECOMMANDBOX=false # If true, expects a file named Graphics/Pictures/commandbox.png
USEFIGHTBOX=false # If true, expects a file named Graphics/Pictures/fightbox.png
MESSAGEBASECOLOR=Color.new(255,255,255)
MESSAGESHADOWCOLOR=Color.new(173,165,140)
MENUBASECOLOR=Color.new(72,72,72)
MENUSHADOWCOLOR=Color.new(208,208,208)
BOXTEXTBASECOLOR=Color.new(64,64,64)
BOXTEXTSHADOWCOLOR=Color.new(216,208,176)
EXPCOLOR=Color.new(64,200,248)
# Green HP color
HPCOLORBASE1=Color.new(1,255,74)
HPCOLORSHADOW1=Color.new(0,189,33)
# Orange HP color
HPCOLORBASE2=Color.new(255,173,0)
HPCOLORSHADOW2=Color.new(165,132,41)
# Red HP color
HPCOLORBASE3=Color.new(255,66,115)
HPCOLORSHADOW3=Color.new(165,74,90)
# Blank HP color
HPCOLORBASE4=Color.new(49,49,49)
HPCOLORSHADOW4=Color.new(49,49,49)
# Position of HP gauge
HPGAUGE_X=78
HPGAUGE_Y=34
# Position of EXP gauge
EXPGAUGE_X=46
EXPGAUGE_Y=66
# Size of gauges
EXPGAUGESIZE=160
HPGAUGESIZE=96
BLANK=0
MESSAGEBOX=1
COMMANDBOX=2
FIGHTBOX=3
attr_accessor :abortable
def initialize
@battle=nil
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=28203]pkmn[/MENTION]windows=[nil,nil,nil,nil]
[MENTION=24071]Sprite[/MENTION]s={}
@battlestart=true
@messagemode=false
@abortable=false
@aborted=false
end
def pbUpdate
partyAnimationUpdate
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
end
def pbGraphicsUpdate
partyAnimationUpdate
if $pokemon1
#$pokemon1.update if $pokemon1.respond_to?("update")
end
if $tupkmn
#$tupkmn.update if $tupkmn.respond_to?("update")
end
[MENTION=24071]Sprite[/MENTION]s["battlebg"].update if [MENTION=24071]Sprite[/MENTION]s["battlebg"].respond_to?("update")
Graphics.update
end
def pbInputUpdate
Input.update
$mouse.visible
$mouse.update
if Input.trigger?(Input::B) && @abortable && !@aborted
@aborted=true
@battle.pbAbort
end
end
def pbShowWindow(windowtype)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=(windowtype==MESSAGEBOX||windowtype==COMMANDBOX||windowtype==FIGHTBOX||
windowtype==BLANK)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=false
[MENTION=24071]Sprite[/MENTION]s["messagebox"].z=99999
[MENTION=24071]Sprite[/MENTION]s["messagebox"].opacity=150
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].visible=(windowtype==MESSAGEBOX)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].visible=(windowtype==COMMANDBOX)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].visible=(windowtype==FIGHTBOX)
end
def pbSetMessageMode(mode)
@messagemode=mode
msgwindow [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
if mode # Within Pokémon command
msgwindow.baseColor=MENUBASECOLOR
msgwindow.shadowColor=MENUSHADOWCOLOR
msgwindow.opacity=255
msgwindow.x=0
msgwindow.width=Graphics.width
msgwindow.height=96
msgwindow.y=384-msgwindow.height
else
msgwindow.baseColor=MESSAGEBASECOLOR
msgwindow.shadowColor=MESSAGESHADOWCOLOR
msgwindow.opacity=0
msgwindow.x=16
msgwindow.width=Graphics.width-32
msgwindow.height=96
msgwindow.y=384-msgwindow.height
end
end
def pbWaitMessage
if @briefmessage
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
60.times do
pbGraphicsUpdate
pbInputUpdate
end
cw.text=""
cw.visible=false
@briefmessage=false
end
end
def pbDisplayMessage(msg,brief=false)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
cw.text=msg
i=0
loop do
pbGraphicsUpdate
pbInputUpdate
cw.update
if i==60
cw.text=""
cw.visible=false
return
end
if Input.trigger?(Input::C) || @abortable
if cw.pausing?
pbPlayDecisionSE() if !@abortable
cw.resume
end
end
if !cw.busy?
if brief
@briefmessage=true
return
end
i+=1
end
end
end
def pbDisplayPausedMessage(msg)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
if @messagemode
@switchscreen.pbDisplay(msg)
return
end
cw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible = true
cw.text=_ISPRINTF("{1:s}\1",msg)
loop do
pbGraphicsUpdate
pbInputUpdate
if Input.trigger?(Input::C) || @abortable
if cw.busy?
pbPlayDecisionSE() if cw.pausing? && !@abortable
cw.resume
else
cw.text=""
pbPlayDecisionSE()
cw.visible=false if @messagemode
return
end
end
cw.update
end
end
def pbDisplayConfirmMessage(msg)
return pbShowCommands(msg,[_INTL("YES"),_INTL("NO")],1)==0
end
def pbShowCommands(msg,commands,defaultValue)
pbWaitMessage
pbRefresh
pbShowWindow(MESSAGEBOX)
dw [MENTION=24071]Sprite[/MENTION]s["messagewindow"]
dw.text=msg
cw = Window_CommandPokemon.new(commands)
cw.x=Graphics.width-cw.width
cw.y=384-cw.height-dw.height
cw.index=0
cw.viewport=@viewport
pbRefresh
loop do
cw.visible=!dw.busy?
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw)
dw.update
if Input.trigger?(Input::B) && defaultValue>=0
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return defaultValue
end
end
if Input.trigger?(Input::C)
if dw.busy?
pbPlayDecisionSE() if dw.pausing?
dw.resume
else
cw.dispose
dw.text=""
return cw.index
end
end
end
end
def pbFrameUpdate(cw)
cw.update if cw
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
end
if [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
end
def pbRefresh
for i in 0..3
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
end
def pbAddSprite(id,x,y,filename,viewport)
sprite=IconSprite.new(x,y,viewport)
if filename
sprite.setBitmap(filename) rescue nil
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbAddPlane(id,filename,viewport)
sprite=AnimatedPlane.new(viewport)
if filename
sprite.setBitmap(filename)
end
[MENTION=24071]Sprite[/MENTION]s[id]=sprite
return sprite
end
def pbDisposeSprites
pbDisposeSpriteHash [MENTION=24071]Sprite[/MENTION]s)
end
def pbBeginCommandPhase
# Called whenever a new round begins.
@battlestart=false
end
def pbShowOpponent(index)
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[index].trainertype)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
end
else
trainerfile="Graphics/Characters/trfront"
end
pbAddSprite("trainer",Graphics.width,16,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x-=6
end
end
def pbHideOpponent
20.times do
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["trainer"].x+=6
end
end
def pbShowHelp(text)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].resizeToFit(text,Graphics.width)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].y=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].x=0
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].text=text
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=true
end
def pbHideHelp
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
end
def pbBackdrop
outdoor=false
if $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
outdoor=true
end
case @battle.environment
when PBEnvironment::Grass
id=1
when PBEnvironment::TallGrass
id=2
when PBEnvironment::MovingWater
id=3
when PBEnvironment::StillWater
id=4
when PBEnvironment::Underwater
id=5
when PBEnvironment::Rock
id=7
when PBEnvironment::Cave
id=8
when PBEnvironment::Sand
id=9
else
id=(outdoor) ? 0 : 6
end
if $PokemonGlobal && $PokemonGlobal.nextBattleBack
id=$PokemonGlobal.nextBattleBack
elsif $game_map
back=pbGetMetadata($game_map.map_id,MetadataBattleBack)
if back && back!=""
id=pbGetMetadata($game_map.map_id,MetadataBattleBack)
end
end
battlebg="Graphics/Battlebacks/battlebg#{id}"
bases="Graphics/Battlebacks/base#{id}"
pbAddPlane("battlebg",battlebg,@viewport)
pbAddSprite("enemybase",100,210,bases,@viewport) # ends at (224,96)
pbAddSprite("playerbase",-544,500,bases,@viewport) # ends at (0,192)
[MENTION=24071]Sprite[/MENTION]s["enemybase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["playerbase"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["battlebg"].z=-1 # For compatibility with RGSS2
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y = 3.6
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.9
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_y = 3.0
=begin
if outdoor
tone = $HourlyTones[Time.now.hour]
[MENTION=24071]Sprite[/MENTION]s["battlebg"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["enemybase"].tone=tone
[MENTION=24071]Sprite[/MENTION]s["playerbase"].tone=tone
end
=end
end
def inPartyAnimation?
return @enablePartyAnim && @partyAnimPhase<4
end
def partyAnimationUpdate
return if !inPartyAnimation?
if @partyAnimPhase==0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].x+=16
[MENTION=24071]Sprite[/MENTION]s["partybase2"].x-=16
@partyAnimPhase=1 if [MENTION=24071]Sprite[/MENTION]s["partybase1"].x [MENTION=24071]Sprite[/MENTION]s["partybase1"].bitmap.width>=208
return
end
if @partyAnimPhase==1
@enemyendpos=152
@playerendpos=312
@partyAnimPhase=2
@partyAnimI=0
end
if @partyAnimPhase==2
if @partyAnimI>=6
@partyAnimPhase=4
return
end
if @partyAnimI>=@battle.party2.length || !@battle.party2[@partyAnimI]
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party2[@partyAnimI].hp<=0 || @battle.party2[@partyAnimI].status>0 ||
@battle.party2[@partyAnimI].egg?
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("enemy#{@partyAnimI}",-28,64,
"Graphics/Pictures/ballnormal",@viewport)
end
if @partyAnimI==@battle.party1.length || !@battle.party1[@partyAnimI]
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party1[@partyAnimI].hp<=0 || @battle.party1[@partyAnimI].status>0 ||
@battle.party1[@partyAnimI].egg?
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballfainted",@viewport)
else
pbAddSprite("player#{@partyAnimI}",Graphics.width+12,176+@yoffset,
"Graphics/Pictures/ballnormal",@viewport)
end
@partyAnimPhase=3
end
if @partyAnimPhase==3
[MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x+=20
[MENTION=24071]Sprite[/MENTION]s["player#{@partyAnimI}"].x-=20
if [MENTION=24071]Sprite[/MENTION]s["enemy#{@partyAnimI}"].x>=@enemyendpos
@partyAnimPhase=2
@partyAnimI+=1
@enemyendpos-=20
@playerendpos+=20
end
end
end
def pbStartBattle(battle)
# Called whenever the battle begins
@battle=battle
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
[MENTION=24071]Sprite[/MENTION]s.clear
[MENTION=24071]Sprite[/MENTION]s.clear
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@viewport3=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport3.z=99999999
# @viewport.rect.y=0
# @viewport.rect.height=384
@viewport2=Viewport.new(0,384,Graphics.width,0)
@viewport2.z=999999
@viewport2.rect.y=400
@viewport2.rect.height=384
@battleboxvp=Viewport.new(0,0,Graphics.width,384)
@battleboxvp.z=99999
@showingplayer=true
@showingenemy=true
@yoffset=(384-320)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"] = Sprite.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap=RPG::Cache.picture("battleballbg")
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].y = 400
@tpb = 0
@tpb9 = 0
pbBackdrop
pbAddSprite("partybase1",-400,80,"Graphics/Pictures/pbarrow",@viewport)
pbAddSprite("partybase2",Graphics.width,192+@yoffset,"Graphics/Pictures/pbarrow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["partybase2"].mirror=true
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=false
$enemybase = [MENTION=24071]Sprite[/MENTION]s["enemybase"]
$playerbase = [MENTION=24071]Sprite[/MENTION]s["playerbase"]
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[0].trainertype)
pbAddSprite("trainer",-144,16,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent[1].trainertype)
pbAddSprite("trainer2",-240,16,trainerfile,@viewport)
else
trainerfile=sprintf("Graphics/Characters/trainer%03d",@battle.opponent.trainertype)
pbAddSprite("trainer",-192,16,trainerfile,@viewport)
end
else
trainerfile="Graphics/Characters/trfront"
pbAddSprite("trainer",-192,16,trainerfile,@viewport)
end
if [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer"].y- [MENTION=24071]Sprite[/MENTION]s["trainer"].bitmap.height-128
end
if [MENTION=24071]Sprite[/MENTION]s["trainer2"] && [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap
[MENTION=24071]Sprite[/MENTION]s["trainer2"].y- [MENTION=24071]Sprite[/MENTION]s["trainer2"].bitmap.height-128
end
[MENTION=24071]Sprite[/MENTION]s["shadow0"]=IconSprite.new(0,0,@viewport)
pbAddSprite("shadow1",0,0,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=false
[MENTION=24071]Sprite[/MENTION]s["pokemon0"]=PokemonBattlerSprite.new(battle.doublebattle,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"]=PokemonBattlerSprite.new(battle.doublebattle,1,@viewport)
if battle.doublebattle
pbAddSprite("shadow3",0,0,"Graphics/Pictures/enemyshadow",@viewport)
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=false
[MENTION=24071]Sprite[/MENTION]s["shadow2"]=IconSprite.new(0,0,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"]=PokemonBattlerSprite.new(battle.doublebattle,3,@viewport)
[MENTION=24071]Sprite[/MENTION]s["pokemon2"]=PokemonBattlerSprite.new(battle.doublebattle,2,@viewport)
end
[MENTION=24071]Sprite[/MENTION]s["battler0"]=PokemonDataBox.new(battle.battlers[0],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler1"]=PokemonDataBox.new(battle.battlers[1],battle.doublebattle,@viewport)
if battle.doublebattle
[MENTION=24071]Sprite[/MENTION]s["battler2"]=PokemonDataBox.new(battle.battlers[2],battle.doublebattle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler3"]=PokemonDataBox.new(battle.battlers[3],battle.doublebattle,@viewport)
end
if @battle.player.is_a?(Array)
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player[0].trainertype)
pbAddSprite("player",Graphics.width+96-48,96+@yoffset,trainerfile,@viewport)
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player[1].trainertype)
pbAddSprite("playerB",Graphics.width+96+48,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/5
end
end
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["playerB"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["playerB"].bitmap.width/5
end
end
else
trainerfile=sprintf("Graphics/Characters/trback%03d",@battle.player.trainertype)
pbAddSprite("player",Graphics.width+96,96+@yoffset,trainerfile,@viewport)
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap
if [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.height
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.x=0
[MENTION=24071]Sprite[/MENTION]s["player"].src_rect.width [MENTION=24071]Sprite[/MENTION]s["player"].bitmap.width/5
end
end
end
pbAddSprite("messagebox",0,384-90,"Graphics/Pictures/messagebox",@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
[MENTION=24071]Sprite[/MENTION]s["helpwindow"].visible=false
[MENTION=24071]Sprite[/MENTION]s["messagewindow"]=Window_AdvancedTextPokemon.new("")
[MENTION=24071]Sprite[/MENTION]s["commandwindow"]=CommandMenuDisplay.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["fightwindow"]=FightMenuDisplay.new(nil,@viewport)
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].letterbyletter=true
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].viewport=@viewport
[MENTION=24071]Sprite[/MENTION]s["messagebox"].z=99999
[MENTION=24071]Sprite[/MENTION]s["messagewindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["commandwindow"].z=999999
[MENTION=24071]Sprite[/MENTION]s["fightwindow"].z=999999
pbShowWindow(MESSAGEBOX)
pbSetMessageMode(false)
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["trainer"]
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["trainer2"]
if !@battle.opponent
$batallasalvaje = true
[MENTION=24071]Sprite[/MENTION]s["trainer"].visible=false
if @battle.party2.length>=1
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,128)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=180-40 # ends at 144*2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x = 3.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y = 3.0
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-192+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2
species=@battle.party2[0].species
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow1"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"] [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon1"],species,1)+10
trainersprite1 [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
if [MENTION=24071]Sprite[/MENTION]s["pokemon1"]
[MENTION=24071]Sprite[/MENTION]s["wildshadow"]=Sprite.new(@viewport)
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].bitmap [MENTION=24071]Sprite[/MENTION]s["pokemon1"].bitmap
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].y [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y*3+20
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+10
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_y [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y/3
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_x [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].tone=Tone.new(-255,-255,-255,-255)
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].opacity=0
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].z [MENTION=24071]Sprite[/MENTION]s["pokemon1"].z-1
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].angle=-10
end
end
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color=Color.new(0,0,0,160)
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x=-144
[MENTION=24071]Sprite[/MENTION]s["shadow1"].x=-144+16*2
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].y+=8
[MENTION=24071]Sprite[/MENTION]s["shadow1"].y=65*2+8
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].setPokemonBitmap(@battle.party2[1],false)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].x=-240
[MENTION=24071]Sprite[/MENTION]s["shadow3"].x=-240+16*2
[MENTION=24071]Sprite[/MENTION]s["shadow3"].y=65*2
species=@battle.party2[1].species
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].visible=true
[MENTION=24071]Sprite[/MENTION]s["shadow3"].visible=showShadow?(species)
pbPositionPokemonSprite(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"] [MENTION=24071]Sprite[/MENTION]s["pokemon3"].x [MENTION=24071]Sprite[/MENTION]s["pokemon3"].y
)
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].y=adjustBattleSpriteY(
[MENTION=24071]Sprite[/MENTION]s["pokemon3"],species,3)
trainersprite2 [MENTION=24071]Sprite[/MENTION]s["pokemon3"]
end
end
loop do
appearspeed=4
@tpb += 1
pbGraphicsUpdate
pbInputUpdate
if @tpb >= 20
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_y/3 [MENTION=24071]Sprite[/MENTION]s["wildshadow"].zoom_x = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x -= 0.125 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_y = [MENTION=24071]Sprite[/MENTION]s["battlebg"].zoom_x
[MENTION=24071]Sprite[/MENTION]s["enemybase"].x += 20 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["enemybase"].y -= 10 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].x += 68 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["playerbase"].y -= 30 if [MENTION=24071]Sprite[/MENTION]s["enemybase"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].x += 17 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0 [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y -= 5 if [MENTION=24071]Sprite[/MENTION]s["pokemon1"].zoom_x != 2.0
[MENTION=24071]Sprite[/MENTION]s["wildshadow"].y = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].y*3+20 [MENTION=24071]Sprite[/MENTION]s["wildshadow"].x = [MENTION=24071]Sprite[/MENTION]s["pokemon1"].x+20
end
break if @tpb == 48
end
# Show shiny animation
if !@battle.opponent
pbPlayCry(@battle.party2[0])
if @battle.party2[0].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[1],nil)
end
if @battle.party2.length==2
if @battle.party2[1].isShiny?
pbCommonAnimation("Shiny",@battle.battlers[3],nil)
end
end
end
if @battle.opponent
@enablePartyAnim=true
@partyAnimPhase=0
[MENTION=24071]Sprite[/MENTION]s["partybase1"].visible=true
[MENTION=24071]Sprite[/MENTION]s["partybase2"].visible=true
else
[MENTION=24071]Sprite[/MENTION]s["battler1"].appear
[MENTION=24071]Sprite[/MENTION]s["battler3"].appear if @battle.party2.length==2
appearing=true
begin
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler1"].update
appearing [MENTION=24071]Sprite[/MENTION]s["battler1"].appearing
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon1"].color [MENTION=24071]Sprite[/MENTION]s["pokemon1"].color
if @battle.party2.length==2
[MENTION=24071]Sprite[/MENTION]s["battler3"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color.alpha-=16
[MENTION=24071]Sprite[/MENTION]s["pokemon3"].color [MENTION=24071]Sprite[/MENTION]s["pokemon3"].color
appearing=(appearing| [MENTION=24071]Sprite[/MENTION]s["battler3"].appearing)
end
end while appearing
end
end
def pbEndBattle(result)
@abortable=false
pbShowWindow(BLANK)
# Fade out all sprites
pbBGMFade(2.0)
pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
pbDisposeSprites
end
def pbRecall(battlerindex)
@briefmessage=false
if @battle.pbIsOpposing?(battlerindex)
[MENTION=24071]Sprite[/MENTION]s["shadow#{battlerindex}"].visible=false
else
spritePoke [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"]
picturePoke=PictureEx.new(0)
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter(spritePoke)
# starting positions
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
# directives
picturePoke.moveColor(10,1,Color.new(16*8,23*8,30*8))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],384-80)
picturePoke.moveVisible(picturePoke.totalDuration,false)
picturePoke.moveColor(0,picturePoke.totalDuration,Color.new(0,0,0,0))
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
loop do
picturePoke.update
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !picturePoke.running?
end
end
end
def pbTrainerSendOut(battlerindex,pkmn)
@briefmessage=false
fadeanim=nil
while inPartyAnimation?; end
if @showingenemy
fadeanim=TrainerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,false)
sendout=PokeballSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
pbGraphicsUpdate
pbInputUpdate
fadeanim.update if fadeanim
frame+=1
if frame==1
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=10
sendout.update
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
end
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
sendout.dispose
if @showingenemy
@showingenemy=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"trainer")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase1")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"enemy#{i}")
end
end
pbRefresh
end
def pbSendOut(battlerindex,pkmn)
while inPartyAnimation?; end
balltype=pkmn.ballused
ballbitmap=sprintf("Graphics/Pictures/ball%02d_0",balltype)
pictureBall=PictureEx.new(0)
delay=1
pictureBall.moveVisible(delay,true)
pictureBall.moveName(delay,ballbitmap)
pictureBall.moveOrigin(delay,PictureOrigin::Center)
# Setting the ball's movement path
path=[[111, 164], [113, 154], [115, 145], [118, 136],
[122, 128], [130, 124], [137, 129], [140, 138],
[142, 147], [143, 156], [144, 166], [145, 175],
[145, 185], [146, 194], [146, 203], [146, 213],
[147, 222], [147, 232], [147, 241], [147, 250]]
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
angle=0
for coord in path
delay=pictureBall.totalDuration
pictureBall.moveAngle(0,delay,angle)
pictureBall.moveXY(1,delay,coord[0],coord[1])
angle+=80
angle%=360
end
pictureBall.adjustPosition(0,@yoffset)
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].visible=false
@briefmessage=false
fadeanim=nil
if @showingplayer
fadeanim=PlayerFadeAnimation.new [MENTION=24071]Sprite[/MENTION]s)
end
frame=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,true)
sendout=PokeballPlayerSendOutAnimation.new [MENTION=24071]Sprite[/MENTION]s["pokemon#{battlerindex}"],
[MENTION=24071]Sprite[/MENTION]s,@battle.battlers,@battle.doublebattle)
loop do
@tpb9 +=1
fadeanim.update if fadeanim
frame+=1
if frame>1 && !pictureBall.running? && [MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appearing
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].appear
end
if frame>=3 && !pictureBall.running?
sendout.update
end
if (frame>=10 || !fadeanim) && pictureBall.running?
pictureBall.update
setPictureIconSprite(spriteBall,pictureBall)
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battlerindex}"].update
pictureBall.moveVisible(1,false) if @tpb9 ==60
pbGraphicsUpdate
pbInputUpdate
$mouse.visible
$mouse.update
if [MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y >= 3.0
[MENTION=24071]Sprite[/MENTION]s["playerbase"].zoom_y = 3.9
end
break if @tpb9 == 130
end
@tpb9 = 0
spriteBall.dispose
sendout.dispose
if @battle.battlers.pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers,nil)
end
if @showingplayer
@showingplayer=false
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player")
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"partybase2")
for i in 0...6
pbDisposeSprite [MENTION=24071]Sprite[/MENTION]s,"player#{i}")
end
end
pbRefresh
end
def pbTrainerWithdraw(battle,pkmn)
pbRefresh
end
def pbWithdraw(battle,pkmn)
pbRefresh
end
# 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. The function
# should not allow HM moves to be forgotten.
def pbForgetMove(pokemon,moveToLearn)
ret=-1
pbFadeOutIn(99999){
scene=PokemonSummaryScene.new
screen=PokemonSummary.new(scene)
ret=screen.pbStartForgetScreen([pokemon],0,moveToLearn)
}
return ret
end
def pbBeginAttackPhase
pbSelectBattler(-1)
end
def pbSafariStart
@briefmessage=false
[MENTION=24071]Sprite[/MENTION]s["battler0"]=SafariDataBox.new(@battle,@viewport)
[MENTION=24071]Sprite[/MENTION]s["battler0"].appear
loop do
[MENTION=24071]Sprite[/MENTION]s["battler0"].update
pbGraphicsUpdate
pbInputUpdate
break if [MENTION=24071]Sprite[/MENTION]s["battler0"].appearing
end
pbRefresh
end
def pbCommandMenuEx(index,texts)
pbShowWindow(COMMANDBOX)
[MENTION=24071]Sprite[/MENTION]s["messagebox"].visible=true
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battlebg2")
cw2 [MENTION=24071]Sprite[/MENTION]s["commandwindow"]
texts=[
_INTL("¿Qué debería hacer {1}?",@battle.battlers[index].name)
]
cw2.setTexts(texts)
cw2.index=[0,2,1,3][@lastcmd[index]]
#pbSelectBattler(index)
pbRefresh
loop do
pbWait(3)
pbGraphicsUpdate
pbInputUpdate
#pbFrameUpdate(cw2)
if pbMouseClick?(91,119+400,323,114)
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battlebg3")
pbPlayDecisionSE()
return 0
end
if pbMouseClick?(0,266+400,156,120)
pbPlayDecisionSE()
return 2
end
if pbMouseClick?(180,296+400,152,88)
pbPlayDecisionSE()
return 3
end
if pbMouseClick?(356,266+400,156,120)
pbPlayDecisionSE()
return 1
end
end
end
def pbSafariCommandMenu(index)
pbCommandMenuEx(index,[
_INTL("What will {1} throw?",@battle.pbPlayer.name),
_INTL("BALL"),
_INTL("ROCK"),
_INTL("BAIT"),
_INTL("RUN")
])
end
def pbCommandMenu(index)
# Use this method to display the list of commands.
# Return values:
# 0 - Fight
# 1 - Pokémon
# 2 - Bag
# 3 - Run
shadowTrainer=(hasConst?(PBTypes,:SHADOW) && @opponent)
ret=pbCommandMenuEx(index,[
_INTL("¿Qué debería hacer {1}?",@battle.battlers[index].name),
_INTL("FIGHT"),
_INTL("POKéMON"),
_INTL("BAG"),
shadowTrainer ? _INTL("CALL") : _INTL("RUN")
])
if ret==3 && shadowTrainer
ret=4 # convert "Run" to "Call"
end
return ret
end
def pbMoveString(move)
ret=_INTL("{1}",move.name)
typename=PBTypes.getName(move.type)
if move.id>0
ret+=_INTL(" ({1}) PP: {2}/{3}",typename,move.pp,move.totalpp)
end
return ret
end
def MoveType(move)
typename=PBTypes.getName(move.type)
if move.id>0
ret=_INTL(typename)
else
ret="testbox"
end
return ret
end
def MoveName(move)
if move.id>0
ret=_INTL("{1}",move.name)
else
ret=""
end
return ret
end
def MovePP(move)
if move.id>0
ret=_INTL("PP {1}/{2}",move.pp,move.totalpp)
else
ret=""
end
return ret
end
def pbNameEntry(helptext)
return pbEnterText(helptext,0,10)
end
# Use this method to display the list of moves for a Pokémon
def pbFightMenu(index)
#pbShowWindow(FIGHTBOX)
@ret=0
moves=@battle.battlers[index].moves
types=[
MoveType(moves[0]),
MoveType(moves[1]),
MoveType(moves[2]),
MoveType(moves[3])
]
movenames=[
MoveName(moves[0]),
MoveName(moves[1]),
MoveName(moves[2]),
MoveName(moves[3])
]
movepp=[
MovePP(moves[0]),
MovePP(moves[1]),
MovePP(moves[2]),
MovePP(moves[3])
]
move1 = Window_UnformattedTextPokemon.new(movenames[0].to_s)
#move1.baseColor = Color.new(248,248,248)
#move1.shadowColor = Color.new(104,88,112)
move1.x=34+68-6-64
move1.y=458+20-$ResizeOffsetY-20
move1.opacity = 0
move1.z=99999
move1.baseColor=Color.new(255,255,255)
move2 = Window_UnformattedTextPokemon.new(movenames[1].to_s)
move2.x=288+68-8-64
move2.y=458+20-$ResizeOffsetY-20
move2.opacity = 0
move2.z=99999
move2.baseColor=Color.new(255,255,255)
move3 = Window_UnformattedTextPokemon.new(movenames[2].to_s)
move3.x=34+75-14-64
move3.y=591-14-$ResizeOffsetY-20
move3.opacity = 0
move3.z=99999
move3.baseColor=Color.new(255,255,255)
move4 = Window_UnformattedTextPokemon.new(movenames[3].to_s)
move4.x=288+75-14-64
move4.y=591-14-$ResizeOffsetY-20
move4.opacity = 0
move4.z=99999
move4.baseColor=Color.new(255,255,255)
pp1 = Window_UnformattedTextPokemon.new(movepp[0].to_s)
pp1.x=100+75-64
pp1.y=490+26-$ResizeOffsetY-20
pp1.opacity = 0
pp1.z=99999
pp1.baseColor=Color.new(255,255,255)
pp2 = Window_UnformattedTextPokemon.new(movepp[1].to_s)
pp2.x=357+75-64
pp2.y=490+26-$ResizeOffsetY-20
pp2.opacity = 0
pp2.z=99999
pp2.baseColor=Color.new(255,255,255)
pp3 = Window_UnformattedTextPokemon.new(movepp[2].to_s)
pp3.x=100+75-64
pp3.y=614-$ResizeOffsetY-20
pp3.opacity = 0
pp3.z=99999
pp3.baseColor=Color.new(255,255,255)
pp4 = Window_UnformattedTextPokemon.new(movepp[3].to_s)
pp4.x=357+75-64
pp4.y=614-$ResizeOffsetY-20
pp4.opacity = 0
pp4.z=99999
pp4.baseColor=Color.new(255,255,255)
@movesprites={}
@movesprites["move1"]=IconSprite.new(4+75-80, 480-18,@viewport)
@movesprites["move1"].setBitmap("Graphics/Pictures/move_" + types[0].to_s)
@movesprites["move1"].z=999999991
@movesprites["move2"]=IconSprite.new(260+75-80, 480-18,@viewport)
@movesprites["move2"].setBitmap("Graphics/Pictures/move_" + types[1].to_s)
@movesprites["move2"].z=999999991
@movesprites["move3"]=IconSprite.new(4+75-80, 578-18,@viewport)
@movesprites["move3"].setBitmap("Graphics/Pictures/move_" + types[2].to_s)
@movesprites["move3"].z=999999991
@movesprites["move4"]=IconSprite.new(260+75-80, 578-18,@viewport)
@movesprites["move4"].setBitmap("Graphics/Pictures/move_" + types[3].to_s)
@movesprites["move4"].z=999999991
@movesprites["cancel"]=IconSprite.new(18, 706)
@movesprites["cancel"].setBitmap("Graphics/Pictures/botoncancelar")
@movesprites["cancel"].z=999999
cw = [MENTION=24071]Sprite[/MENTION]s["fightwindow"]
battler=@battle.battlers[index]
cw.battler=battler
lastIndex=@lastmove[index]
if battler.moves[lastIndex].id!=0
cw.setIndex(lastIndex)
else
cw.setIndex(0)
end
#pbSelectBattler(index)
pbRefresh
loop do
pbWait(3)
$mouse.visible
$mouse.update
pbGraphicsUpdate
pbInputUpdate
#pbFrameUpdate(cw)
if Input.trigger?(Input::B) or pbMouseClick?(356,264+400,156,120)
pbPlayCancelSE()
Graphics.wait(2)
pbDisposeSpriteHash(@movesprites)
move1.dispose
move2.dispose
move3.dispose
move4.dispose
[MENTION=12671]pokemon[/MENTION]no.dispose if [MENTION=12671]pokemon[/MENTION]no
pp1.dispose
pp2.dispose
pp3.dispose
pp4.dispose
@lastmove[index]=cw.index
return -1
end
if @battle.battlers[index].moves[0].id != 0
if pbMouseClickImage?(@movesprites["move1"])
@command=0
@ret=1
end
elsif @battle.battlers[index].moves[1].id != 0
if pbMouseClickImage?(@movesprites["move2"])
@command=1
@ret=1
end
elsif @battle.battlers[index].moves[2].id != 0
if pbMouseClickImage?(@movesprites["move3"])
@command=2
@ret=1
end
elsif @battle.battlers[index].moves[3].id != 0
if pbMouseClickImage?(@movesprites["move4"])
@command=3
@ret=1
end
end
if @ret == 1
ret=@command
[MENTION=24071]Sprite[/MENTION]s["battlebg2"].bitmap = RPG::Cache.picture("battleballbg")
pbDisposeSpriteHash(@movesprites)
move1.dispose
move2.dispose
move3.dispose
move4.dispose
pp1.dispose
pp2.dispose
pp3.dispose
pp4.dispose
pbPlayDecisionSE()
return ret
end
nextindex=pbNextIndex(cw.index)
if cw.index!=nextindex # Move cursor
pbPlayCursorSE()
cw.setIndex(nextindex)
end
end
end
# Use this method to display the inventory
# The return value is the item chosen, or 0 if the choice was canceled.
def pbItemMenu(index)
ret=0
endscene=true
oldsprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
itemscene=PokemonBag_Scene.new
itemscene.pbStartScene($PokemonBag)
loop do
item=itemscene.pbChooseItem
break if item==0
usetype=$ItemData[item][ITEMBATTLEUSE]
cmdUse=-1
commands=[]
if usetype==0
commands[commands.length]=_INTL("CANCEL")
else
commands[cmdUse=commands.length]=_INTL("USE")
commands[commands.length]=_INTL("CANCEL")
end
itemname=PBItems.getName(item)
command=itemscene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
if cmdUse>=0 && command==cmdUse
if usetype==1
pkmnlist=PokemonScreen_Scene.new
pkmnscreen=PokemonScreen.new(pkmnlist,@battle.party1)
itemscene.pbEndScene
pkmnlist.pbStartScene(@battle.party1,_INTL("Use on which Pokémon?"),@battle.doublebattle)
pkmnid=pkmnlist.pbChoosePokemon
if pkmnid>=0 && @battle.pbUseItemOnPokemon(item,pkmnid,pkmnscreen)
pkmnscreen.pbRefresh
pkmnlist.pbEndScene
ret=item
endscene=false
break
end
pkmnlist.pbEndScene
itemscene.pbStartScene($PokemonBag)
elsif usetype==2
if @battle.pbUseItemOnBattler(item,index,itemscene)
ret=item
break
end
end
end
end
pbConsumeItemInBattle($PokemonBag,ret)
itemscene.pbEndScene if endscene
for i in 0..4
if [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].refresh
end
end
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,oldsprites)
return ret
end
def pbSelectBattler(index,selectmode=1)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{i}"]
sprite.selected=(i==index) ? selectmode : 0
sprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"]
sprite.selected=(i==index) ? selectmode : 0
end
end
def pbFirstTarget(index)
for i in 0..3
if i!=index && @battle.battlers.hp>0 &&
@battle.battlers[index].pbIsOpposing?(i)
return i
end
end
return -1
end
def pbNextIndex(curindex)
if Input.trigger?(Input::LEFT) && (curindex&1)==1
return curindex-1
elsif Input.trigger?(Input::RIGHT) && (curindex&1)==0
return curindex+1
elsif Input.trigger?(Input::UP) && (curindex&2)==2
return curindex-2
elsif Input.trigger?(Input::DOWN) && (curindex&2)==0
return curindex+2
end
return curindex
end
def pbUpdateSelected(index)
numwindows=@battle.doublebattle ? 4 : 2
for i in 0...numwindows
if i==index
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=2
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=2
else
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].selected=0
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].selected=0
end
[MENTION=24071]Sprite[/MENTION]s["battler#{i}"].update
[MENTION=24071]Sprite[/MENTION]s["pokemon#{i}"].update
end
end
# Use this method to make the player choose a target
# for certain moves in double battles.
def pbChooseTarget(index)
pbShowWindow(FIGHTBOX)
curwindow=pbFirstTarget(index)
if curwindow==-1
raise RuntimeError.new(_INTL("No targets somehow..."))
end
loop do
pbGraphicsUpdate
pbInputUpdate
pbUpdateSelected(curwindow)
if Input.trigger?(Input::C)
pbUpdateSelected(-1)
return curwindow
end
if Input.trigger?(Input::B)
pbUpdateSelected(-1)
return -1
end
if curwindow>=0
if Input.trigger?(Input::RIGHT) || Input.trigger?(Input::DOWN)
loop do
newcurwindow=3 if curwindow==0
newcurwindow=1 if curwindow==3
newcurwindow=2 if curwindow==1
newcurwindow=0 if curwindow==2
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::UP)
loop do
newcurwindow=2 if curwindow==0
newcurwindow=1 if curwindow==2
newcurwindow=3 if curwindow==1
newcurwindow=0 if curwindow==3
curwindow=newcurwindow
next if curwindow==index
break if @battle.battlers[curwindow].hp>0
end
end
end
end
end
def pbSwitch(index,lax,cancancel)
party=@battle.pbParty(index)
inactives=[1,1,1,1,1,1]
partypos=[]
switchsprites={}
activecmd=0
ret=-1
numactive=(@doublebattle)?2:1
pbShowWindow(BLANK)
pbSetMessageMode(true)
# Fade out and hide all sprites
visiblesprites=pbFadeOutAndHide [MENTION=24071]Sprite[/MENTION]s)
battler=@battle.battlers[0]
activecmd=0 if battler.index==index
inactives=0
partypos[0]=battler.pokemonIndex
if @battle.doublebattle && !@battle.fullparty1
battler=@battle.battlers[2]
activecmd=1 if battler.index==index
inactives=0
partypos[1]=battler.pokemonIndex
end
# Add all non-active Pokémon
for i in 0...6
partypos[partypos.length]=i if inactives==1
end
modparty=[]
for i in 0...6
modparty.push(party[partypos])
end
scene=PokemonScreen_Scene.new
@switchscreen=PokemonScreen.new(scene,modparty)
@switchscreen.pbStartScene(_INTL("Choose a Pokémon."),
@battle.doublebattle && !@battle.fullparty1)
loop do
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
activecmd=@switchscreen.pbChoosePokemon
if cancancel && activecmd==-1
ret=-1
break
end
if activecmd>=0
commands=[]
cmdShift=-1
cmdSummary=-1
pkmnindex=partypos[activecmd]
commands[cmdShift=commands.length]=_INTL("SHIFT") if !party[pkmnindex].egg?
commands[cmdSummary=commands.length]=_INTL("SUMMARY")
commands[commands.length]=_INTL("CANCEL")
command=scene.pbShowCommands(_INTL("Do what with {1}?",party[pkmnindex].name),commands)
if cmdShift>=0 && command==cmdShift
canswitch=lax ? @battle.pbCanSwitchLax?(index,pkmnindex,true) :
@battle.pbCanSwitch?(index,pkmnindex,true)
if canswitch
ret=pkmnindex
break
end
elsif cmdSummary>=0 && command==cmdSummary
scene.pbSummary(activecmd)
end
end
end
@switchscreen.pbEndScene
@switchscreen=nil
pbSetMessageMode(false)
# back to main battle screen
pbFadeInAndShow [MENTION=24071]Sprite[/MENTION]s,visiblesprites)
return ret
end
def pbDamageAnimation(pkmn,effectiveness)
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
shadowsprite [MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"]
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
oldshadowvisible=shadowsprite.visible
oldvisible=sprite.visible
sprite.selected=2
@briefmessage=false
6.times do
pbGraphicsUpdate
pbInputUpdate
end
case effectiveness
when 0
pbSEPlay("normaldamage")
when 1
pbSEPlay("notverydamage")
when 2
pbSEPlay("superdamage")
end
8.times do
pkmnsprite.visible=!pkmnsprite.visible
if oldshadowvisible
shadowsprite.visible=!shadowsprite.visible
end
4.times do
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
sprite.selected=0
sprite.visible=oldvisible
end
# This method is called whenever a Pokémon's HP changes.
# Used to animate the HP bar.
def pbHPChanged(pkmn,oldhp)
@briefmessage=false
hpchange=pkmn.hp-oldhp
if hpchange<0
hpchange=-hpchange
PBDebug.log("[#{pkmn.pbThis} lost #{hpchange} HP, now has #{pkmn.hp} HP]") if @battle.debug
else
PBDebug.log("[#{pkmn.pbThis} gained #{hpchange} HP, now has #{pkmn.hp} HP]") if @battle.debug
end
sprite [MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"]
sprite.animateHP(oldhp,pkmn.hp)
while sprite.animatingHP
pbGraphicsUpdate
pbInputUpdate
sprite.update
end
end
# This method is called whenever a Pokémon faints
def pbFainted(pkmn)
frames=pbCryFrameLength(pkmn.pokemon)
pbPlayCry(pkmn.pokemon)
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["shadow#{pkmn.index}"].visible=false
pkmnsprite [MENTION=24071]Sprite[/MENTION]s["pokemon#{pkmn.index}"]
pkmnsprite.visible=false
if @battle.pbIsOpposing?(pkmn.index)
tempvp=Viewport.new(0,0,Graphics.width,144)
else
tempvp=Viewport.new(0,0,Graphics.width,224+@yoffset)
end
tempvp.z=@viewport.z
tempsprite=SpriteWrapper.new(tempvp)
tempsprite.x=pkmnsprite.x
tempsprite.y=pkmnsprite.y
tempsprite.bitmap=pkmnsprite.bitmap
tempsprite.visible=true
pbSEPlay("faint")
16.times do
tempsprite.y+=8
pbGraphicsUpdate
pbInputUpdate
end
tempsprite.dispose
tempvp.dispose
8.times do
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].opacity=32
pbGraphicsUpdate
pbInputUpdate
end
[MENTION=24071]Sprite[/MENTION]s["battler#{pkmn.index}"].visible=false
end
# Use this method to choose a command for the enemy.
def pbChooseEnemyCommand(index)
@battle.pbDefaultChooseEnemyCommand(index)
end
# Use this method to choose a new Pokémon for the enemy
# The enemy's party is guaranteed to have at least one choosable member.
def pbChooseNewEnemy(index,party)
@battle.pbDefaultChooseNewEnemy(index,party)
end
# This method is called when the player wins a wild Pokémon battle.
# This method can change the battle's music for example.
def pbWildBattleSuccess
pbBGMPlay(pbGetWildVictoryME())
end
# This method is called when the player wins a Trainer battle.
# This method can change the battle's music for example.
def pbTrainerBattleSuccess
pbBGMPlay(pbGetTrainerVictoryME(@battle.opponent))
end
def pbEXPBar(pokemon,battler,startexp,endexp,tempexp1,tempexp2)
if battler
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].refreshExpLevel
exprange=(endexp-startexp)
startexplevel=0
endexplevel=0
if exprange!=0
startexplevel=(tempexp1-startexp)*EXPGAUGESIZE/exprange
endexplevel=(tempexp2-startexp)*EXPGAUGESIZE/exprange
end
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animateEXP(startexplevel,endexplevel)
while [MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].animatingEXP
pbGraphicsUpdate
pbInputUpdate
[MENTION=24071]Sprite[/MENTION]s["battler#{battler.index}"].update
end
end
end
def pbShowPokedex(species)
pbFadeOutIn(99999){
scene=PokemonPokedexScene.new
screen=PokemonPokedex.new(scene)
screen.pbDexEntry(species)
}
end
def pbFindAnimation(moveid)
begin
move2anim=load_data("Data/move2anim.dat")
anim=move2anim[0][moveid]
return anim if anim
if hasConst?(PBMoves,:TACKLE)
anim=move2anim[0][getConst(PBMoves,:TACKLE)]
return anim if anim
end
rescue
return nil
end
return nil
end
def pbCommonAnimation(animname,attacker,opponent,side=true)
animations=load_data("Data/PkmnAnimations.rxdata")
for i in 0...animations.length
if animations && animations.name=="Common:"+animname
pbAnimationCore(animations,attacker,opponent,side)
return
end
end
end
def pbChangeSpecies(attacker,species)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmapSpecies(attacker.pokemon,species,back)
pkmn.y=adjustBattleSpriteY(pkmn,species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(species)
end
end
def pbChangePokemon(attacker,pokemon)
pkmn [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"]
shadow [MENTION=24071]Sprite[/MENTION]s["shadow#{attacker.index}"]
back=!@battle.pbIsOpposing?(attacker.index)
pkmn.setPokemonBitmap(pokemon,back)
pkmn.y=adjustBattleSpriteY(pkmn,pokemon.species,attacker.index)
if shadow && !back
shadow.visible=showShadow?(pokemon.species)
end
end
def pbAnimation(moveid,attacker,opponent,side=true)
animid=pbFindAnimation(moveid)
return if !animid
animations=load_data("Data/PkmnAnimations.rxdata")
pbSaveShadows {
pbAnimationCore(animations[animid],attacker,opponent,side)
}
if isConst?(moveid,PBMoves,:TRANSFORM) && attacker && opponent
# Change form to transformed version
pbChangePokemon(attacker,opponent.pokemon)
end
end
def pbSaveShadows
shadows=[]
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
shadows=s ? s.visible : false
s.visible=false if s
end
yield
for i in 0...4
s [MENTION=24071]Sprite[/MENTION]s["shadow#{i}"]
s.visible=shadows if s
end
end
def pbAnimationCore(animation,attacker,opponent,side=true)
if !attacker || !animation
return
end
@briefmessage=false
user=(attacker) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{attacker.index}"] : nil
target=(opponent) ? [MENTION=24071]Sprite[/MENTION]s["pokemon#{opponent.index}"] : nil
olduserx=user.x
oldusery=user.y
oldtargetx=target ? target.x : 0
oldtargety=target ? target.y : 0
if !target
animplayer=PBAnimationPlayer.new(animation,user,user,@viewport3)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
animplayer.setLineTransform(144,188,352,108,
user.x+(userwidth/2),user.y+(userheight/2),
user.x+(userwidth/2),user.y+(userheight/2))
else
animplayer=PBAnimationPlayer.new(animation,user,target,@viewport3)
userwidth=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.width
targetwidth=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.width
userheight=(!user.bitmap || user.bitmap.disposed?) ? 128 : user.bitmap.height
targetheight=(!target.bitmap || target.bitmap.disposed?) ? 128 : target.bitmap.height
animplayer.setLineTransform(144,188,352,108,
user.x+(userwidth/2),user.y+(userheight/2),
target.x+(targetwidth/2),target.y+(targetheight/2))
end
animplayer.start
while animplayer.playing?
animplayer.update
pbGraphicsUpdate
pbInputUpdate
end
user.ox=0
user.oy=0
target.ox=0 if target
target.oy=0 if target
user.x=olduserx
user.y=oldusery
target.x=oldtargetx if target
target.y=oldtargety if target
animplayer.dispose
end
def pbLevelUp(pokemon,battler,oldtotalhp,oldattack,olddefense,oldspeed,
oldspatk,oldspdef)
pbTopRightWindow(_INTL("MaxHP<r>+{1}\r\nATTACK<r>+{2}\r\nDEFENSE<r>+{3}\r\nSP. ATK<r>+{4}\r\nSP. DEF<r>+{5}\r\nSPEED<r>+{6}",
pokemon.totalhp-oldtotalhp,
pokemon.attack-oldattack,
pokemon.defense-olddefense,
pokemon.spatk-oldspatk,
pokemon.spdef-oldspdef,
pokemon.speed-oldspeed))
pbTopRightWindow(_INTL("MaxHP<r>{1}\r\nATTACK<r>{2}\r\nDEFENSE<r>{3}\r\nSP. ATK<r>{4}\r\nSP. DEF<r>{5}\r\nSPEED<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
end
def pbThrowAndDeflect(ball,targetBattler)
end
def pbThrow(ball,shakes,targetBattler)
@briefmessage=false
pokeballThrow(ball,shakes,targetBattler)
end
def pbThrowSuccess
if !@opponent
@briefmessage=false
pbBGMPlay("../ME/PkmRS-Caught")
frames=(3.5*Graphics.frame_rate).to_i
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
end
end
end
busque lo que dices drimer pero no doy bien con la parte que hace esos acercamientos de pantalla, solo necesito la introduccion al combate