Rayd12smitty
Shadow Maker
Last Activity: February 20th, 2016 10:44 PM
Visitor Messages
Showing Visitor Messages 1 to 15 of 87
-
February 18th, 2015 12:24 PMFlorioHey bro, are you still working on a new script for the Hidden Grottos? You said in the thread that you were.
-
December 25th, 2014 11:01 PMRukarioHappy Anniversary, Happy Anniversary, Happy Anniversary!
-
November 6th, 2014 10:43 AMjmp172hi could you do a tutorial on how to add the pokemon follow you script i followed everything but failed can you please help me
-
September 28th, 2014 6:24 PMDedenne1Hey im a big fan of ur game and i was just wondering if ur still working on it it has great potential and i hope to see more of it in the future
-
May 9th, 2014 2:29 AMTheUltimateG.Jhi bro i am a great fan of your game pokemon melanite version i just wanted to know are you still working on it?If yes then when can we play further?And if no why you stopped working on this?I just love your game.
-
April 4th, 2014 4:11 PMMarunoNo, it's not a feature of RMXP. It was just in Essentials before I took over its development. I'm sure there are various Neo-H-Mode 7 whatever-they're-called scripts out there that work better than what Essentials has, but the trick is to figure out how they work to implement them.
-
April 4th, 2014 3:57 AMMarunoThe ability to change the perspective was taken out of the Options menu because it really shouldn't have been in there in the first place. As far as I know about perspective mode (which is very little), the way you map is completely different than for orthographic (the regular view) maps, so changing it will almost certainly make things look bad. The choice of view is also very much something the game maker should decide, not the player.
I've never looked at how perspective mode actually works, because I'm not interested in it. As far as I'm concerned, it's incomplete and buggy and not worth using, and I don't feel like trying to remove or improve it. I don't even know how to map with it. -
February 14th, 2014 8:41 PMpokemonjsHi~Friend,would you like to help me about a question?Here is the website:
http://www.pokecommunity.com/showthread.php?t=319381 -
January 27th, 2014 12:52 PMvenom12Ahh i started the World Tournament script but still nothing XD
-
January 27th, 2014 2:49 AMvenom12Nice man :D I trying to do something too but cant get it really XD
-
January 25th, 2014 8:23 PMnorthroneIt would definitely be an interesting thing to do...
The biggest problem is our changes in the pbs/pokemon.txt file. I have delta pokemon and different stats, so it may not work out 100%. -
November 2nd, 2013 1:37 PMBadSamaritanHaha, maybe if I made the original scripts I would mind sharing, but all I did was edit somebody else's actual work....so here's my "ActualScene"
=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
attr_accessor :mode
def initialize(viewport=nil)
@display=nil
if PokeBattle_Scene::USECOMMANDBOX
@display=IconSprite.new(0,Graphics.height-92,viewport)
@display.setBitmap("Graphics/Pictures/battleCommand")
end
@window=Window_CommandPokemonbetter.newWithSize([],
Graphics.width-240,Graphics.height-96,240,96,viewport)
@window.columns=2
@window.columnSpacing=4
@msgbox=Window_UnformattedTextPokemon.newWithSize(
"",-6,Graphics.height-85+2,220,96,viewport)
@msgbox.baseColor=PokeBattle_Scene::MESSAGEBASECOLOR
@msgbox.shadowColor=PokeBattle_Scene::MESSAGESHADOWCOLOR
@msgbox.windowskin=nil
@title=""
@buttons=nil
if PokeBattle_Scene::USECOMMANDBOX
@window.opacity=0
@buttons=CommandMenuButtons.new(self.index,self.mode)
@buttons.viewport=viewport
@window.x=Graphics.width
end
end
def index; @window.index; end
def index=(value); @window.index=value; end
def setTexts(value)
@msgbox.text=value[0]
commands=[]
[1,4,3,2].each{|i|
commands.push(value[i]) if value[i] && value[i]!=nil
}
@window.commands=commands
end
def visible; @window.visible; end
def visible=(value)
@window.visible=value
@msgbox.visible=value
@display.visible=value if @display
@buttons.visible=value if @buttons
end
def x; @window.x; end
def x=(value)
@window.x=value
@msgbox.x=value
@display.x=value if @display
@buttons.x=value if @buttons
end
def y; @window.y; end
def y=(value)
@window.y=value
@msgbox.y=value
@display.y=value if @display
@buttons.y=value if @buttons
end
def z; @window.z; end
def z=(value)
@window.z=value
@msgbox.z=value
@display.z=value if @display
@buttons.z=value if @buttons
end
def oy; @window.oy; end
def oy=(value)
@window.oy=value
@msgbox.oy=value
@display.oy=value if @display
@buttons.oy=value if @buttons
end
def color; @window.color; end
def color=(value)
@window.color=value
@msgbox.color=value
@display.color=value if @display
@buttons.color=value if @buttons
end
def ox; @window.ox; end
def ox=(value)
@window.ox=value
@msgbox.ox=value
@display.ox=value if @display
@buttons.ox=value if @buttons
end
def z; @window.z; end
def z=(value)
@window.z=value
@msgbox.z=value
@display.z=value if @display
@buttons.z=value+1 if @buttons
end
def disposed?
return @msgbox.disposed? || @window.disposed?
end
def dispose
return if disposed?
@msgbox.dispose
@window.dispose
@display.dispose if @display
@buttons.dispose if @buttons
end
def update
@msgbox.update
@window.update
@display.update if @display
@buttons.update(self.index,self.mode) if @buttons
end
def refresh
@msgbox.refresh
@window.refresh
@buttons.refresh(self.index,self.mode) if @buttons
end
end
class CommandMenuButtons < SpriteWindow_Base
def initialize(index=0,mode=0)
super(Graphics.width-260-16,Graphics.height-90-16,260+32,90+64)
self.z=99999
self.opacity=0
self.contents=Bitmap.new(self.width,self.height)
@mode=mode
@buttonbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleCommandButtons"))
refresh(index,mode)
end
def dispose
super
end
def update(index=0,mode=0)
refresh(index,mode)
end
def refresh(index,mode=0)
self.contents.clear
@mode=mode
cmdarray=[0,2,1,3]
case @mode
when 1
cmdarray=[0,1,2,4] # Use "Call"
when 2
cmdarray=[5,6,7,3] # Safari Zone battle
when 3
cmdarray=[0,1,8,3] # Bug Catching Contest
end
for i in 0...4
next if i==index
x=95
y=0+16*i
self.contents.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,cmdarray[i]*55,180,55))
end
for i in 0...4
next if i!=index
x=95
y=0+16*i
self.contents.blt(x,y,@buttonbitmap.bitmap,Rect.new(180,cmdarray[i]*55,180,55))
end
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
@window.index=value
refresh
end
end
def visible; @window.visible; end
def visible=(value)
@window.visible=value
@info.visible=value
@display.visible=value if @display
@buttons.visible=value if @buttons
end
def x; @window.x; end
def x=(value)
@window.x=value
@info.x=value
@display.x=value if @display
@buttons.x=value if @buttons
end
def y; @window.y; end
def y=(value)
@window.y=value
@info.y=value
@display.y=value if @display
@buttons.y=value if @buttons
end
def oy; @window.oy; end
def oy=(value)
@window.oy=value
@info.oy=value
@display.oy=value if @display
@buttons.oy=value if @buttons
end
def color; @window.color; end
def color=(value)
@window.color=value
@info.color=value
@display.color=value if @display
@buttons.color=value if @buttons
end
def ox; @window.ox; end
def ox=(value)
@window.ox=value
@info.ox=value
@display.ox=value if @display
@buttons.ox=value if @buttons
end
def z; @window.z; end
def z=(value)
@window.z=value
@info.z=value
@display.z=value if @display
@buttons.z=value+1 if @buttons
end
def disposed?
return @info.disposed? || @window.disposed?
end
def dispose
return if disposed?
@info.dispose
@display.dispose if @display
@buttons.dispose if @buttons
@window.dispose
end
def update
@info.update
@window.update
@display.update if @display
[email protected] ? @battler.moves : nil
@buttons.update(self.index,moves) if @buttons
end
def initialize(battler,viewport=nil)
@display=nil
if PokeBattle_Scene::USEFIGHTBOX
@display=IconSprite.new(0,Graphics.height-96,viewport)
@display.setBitmap("Graphics/Pictures/battleFight")
end
@window=Window_CommandPokemon.newWithSize([],
0,Graphics.height-96,320,96,viewport)
@window.columns=2
@window.columnSpacing=4
@info=Window_AdvancedTextPokemon.newWithSize(
"",320,Graphics.height-96,Graphics.width-320,96,viewport)
@ctag=shadowctag(PokeBattle_Scene::MENUBASECOLOR,
PokeBattle_Scene::MENUSHADOWCOLOR)
@buttons=nil
@battler=battler
@index=0
if PokeBattle_Scene::USEFIGHTBOX
@window.opacity=0
@info.opacity=0
@window.x=Graphics.width
@info.x=Graphics.width+Graphics.width-96
@buttons=FightMenuButtons.new(self.index,nil)
@buttons.viewport=viewport
end
refresh
end
def refresh
return if [email protected]
pbSetNarrowFont(@window.contents)
commands=[]
for i in 0...4
if @battler.moves[i].id!=0
commands.push(@battler.moves[i].name)
else
break
end
end
@window.commands=commands
[email protected][@index]
movetype=PBTypes.getName(selmove.type)
pbSetNarrowFont(@info.contents)
if selmove.totalpp==0
@info.text=_ISPRINTF("{1:s}PP: ---<br>TYPE/{2:s}",@ctag,movetype)
else
@info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
@ctag,selmove.pp,selmove.totalpp,movetype)
end
end
end
class FightMenuButtons < SpriteWindow_Base
def initialize(index=0,moves=nil)
super(-16,Graphics.height-90-16,Graphics.width+32,90+32)
self.z=99999
self.opacity=0
self.contents=Bitmap.new(self.width,self.height)
@buttonbitmap=AnimatedBitmap.new("Graphics/Pictures/battleFightButtons")
@typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
refresh(index,moves)
end
def dispose
super
end
def update(index=0,moves=nil)
refresh(index,moves)
end
def refresh(index,moves)
return if !moves
self.contents.clear
moveboxes=_INTL("Graphics/Pictures/battleFightButtons")
pbSetNarrowFont(self.contents)
for i in 0...4
next if i==index
next if moves[i].id==0
x=((i%2)==0) ? 4 : 192
y=((i/2)==0) ? 0 : 42
self.contents.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,moves[i].type*46,192,46))
movename=[[_INTL("{1}",moves[i].name),x+96,y+8,2,
PokeBattle_Scene::MENUBASECOLOR,PokeBattle_Scene::MENUSHADOWCOLOR]]
pbDrawTextPositions(self.contents,movename)
end
for i in 0...4
next if i!=index
next if moves[i].id==0
x=((i%2)==0) ? 4 : 192
y=((i/2)==0) ? 0 : 42
self.contents.blt(x,y,@buttonbitmap.bitmap,Rect.new(192,moves[i].type*46,192,46))
self.contents.blt(416,14,@typebitmap.bitmap,Rect.new(0,moves[i].type*28,64,28))
texts=[[_INTL("{1}",moves[i].name),x+96,y+8,2,
PokeBattle_Scene::MENUBASECOLOR,PokeBattle_Scene::MENUSHADOWCOLOR]]
if moves[i].totalpp>0
ppcolors=[PokeBattle_Scene::MENUBASECOLOR,PokeBattle_Scene::MENUSHADOWCOLOR,
PokeBattle_Scene::MENUBASECOLOR,PokeBattle_Scene::MENUSHADOWCOLOR,
Color.new(248,192,0),Color.new(144,104,0), # Yellow (1/2 or lower)
Color.new(248,136,32),Color.new(144,72,24), # Orange (1/4 or lower)
Color.new(248,72,72),Color.new(136,48,48)] # Red (zero)
ppfraction=(4.0*moves[i].pp/moves[i].totalpp).ceil
texts.push([_INTL("PP: {1}/{2}",moves[i].pp,moves[i].totalpp),
448,44,2,ppcolors[(4-ppfraction)*2],ppcolors[(4-ppfraction)*2+1]])
end
pbDrawTextPositions(self.contents,texts)
end
end
end
class PokemonBattlerSprite < RPG:
prite
attr_accessor :selected
def initialize(doublebattle,index,viewport=nil)
super(viewport)
@selected=0
@frame=0
@index=index
@updating=false
@doublebattle=doublebattle
@index=index
@spriteX=0
@spriteY=0
@spriteXExtra=0
@spriteYExtra=0
@spriteVisible=false
@_iconbitmap=nil
self.visible=false
end
def selected=(value)
if @selected==1 && value!=1 && @spriteYExtra>0
@spriteYExtra=0
[email protected]
end
@selected=value
end
def visible=(value)
@spriteVisible=value if [email protected]
super
end
def x
return @spriteX
end
def y
return @spriteY
end
def x=(value)
@spriteX=value
super([email protected])
end
def y=(value)
@spriteY=value
super([email protected])
end
def update
@frame+=1
@updating=true
@spriteYExtra=0
if ((@frame/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
@spriteYExtra=2
end
[email protected]
[email protected]
if ((@frame/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
[email protected]
elsif @selected==2 # When targeted or damaged
self.visible=(@frame%10<7)
else
[email protected]
end
if @_iconbitmap
@_iconbitmap.update
[email protected]_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)
[email protected]_iconbitmap ? @_iconbitmap.bitmap : nil
end
def setPokemonBitmapSpecies(pokemon,species,back=false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadPokemonBitmapSpecies(pokemon,species,back)
[email protected]_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/battlePlayerSafari")
@spriteX=248+(Graphics.width-480)
@spriteY=136+(Graphics.height-320) # Adjust for screen size
@appearing=false
@contents=BitmapWrapper.new(@databox.width,@databox.height)
[email protected]
self.visible=false
self.z=2
refresh
end
def appear
refresh
self.visible=true
self.opacity=255
[email protected]+240
[email protected]
@appearing=true
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
pbSetSystemFont(self.bitmap)
textpos=[]
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
textpos.push([_INTL("Safari Balls"),30,8,false,base,shadow])
textpos.push([_INTL("Left: {1}",@battle.ballcount),30,38,false,base,shadow])
pbDrawTextPositions(self.bitmap,textpos)
end
def update
super
if @appearing
self.x-=8
@appearing=false if self.x<[email protected]
[email protected]
return
end
[email protected]
[email protected]
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
@selected=0
@frame=0
@showhp=false
@showexp=false
@appearing=false
@animatingHP=false
@currenthp=0
@endhp=0
@expflash=0
if (@battler.index&1)==0 # if player's Pokémon
@spritebaseX=34
else
@spritebaseX=16
end
yoffset=(Graphics.height-320) # Adjust for screen size
if doublebattle
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBoxD")
@spriteX=224+Graphics.width-480
@spriteY=102+yoffset
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/battleFoeBoxD")
@spriteX=-4
@spriteY=2
when 2
@databox=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBoxD")
@spriteX=236+Graphics.width-480
@spriteY=162+yoffset
when 3
@databox=AnimatedBitmap.new("Graphics/Pictures/battleFoeBoxD")
@spriteX=-16
@spriteY=62
end
else
case @battler.index
when 0
@databox=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBoxS")
@spriteX=236+Graphics.width-480
@spriteY=128+yoffset
@showhp=true
@showexp=true
when 1
@databox=AnimatedBitmap.new("Graphics/Pictures/battleFoeBoxS")
@spriteX=-16
@spriteY=36
end
end
@statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleStatuses"))
@contents=BitmapWrapper.new(@databox.width,@databox.height)
[email protected]
self.visible=false
self.z=2
refreshExpLevel
refresh
end
def dispose
@statuses.dispose
@databox.dispose
@contents.dispose
super
end
def refreshExpLevel
if [email protected]
@explevel=0
else
[email protected]
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
[email protected]+320
else
[email protected]
end
[email protected]
@appearing=true
end
def refresh
self.bitmap.clear
return if [email protected]
hpGaugeSize=PokeBattle_Scene::HPGAUGESIZE
[email protected]==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
hpGaugeX=PokeBattle_Scene::HPGAUGEFOE_X if (@battler.index&1)==1
hpGaugeY=PokeBattle_Scene::HPGAUGE_Y
expGaugeX=PokeBattle_Scene::EXPGAUGE_X
expGaugeY=PokeBattle_Scene::EXPGAUGE_Y
self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY-20,hpgauge,0,hpcolors[hpzone*2])
self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY-1,hpgauge,36,hpcolors[hpzone*2+1])
if @showexp
# fill with EXP color
self.bitmap.fill_rect(@spritebaseX+expGaugeX,expGaugeY-6,self.exp,8,PokeBattle_Scene::EXPCOLORSHADOW)
self.bitmap.fill_rect(@spritebaseX+expGaugeX,expGaugeY-4,self.exp,0,PokeBattle_Scene::EXPCOLORBASE)
end
self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
base=PokeBattle_Scene::BOXTEXTBASECOLOR
shadow=PokeBattle_Scene::BOXTEXTSHADOWCOLOR
[email protected]
if @battler.name.split('').last=="♂" || @battler.name.split('').last=="♀"
[email protected][0..-2]
end
pbSetSystemFont(self.bitmap)
self.bitmap.font.size=21
textpos=[]
if (@battler.index&1)==0
textpos.push([pokename,@spritebaseX+36,35,false,base,shadow])
elsif (@battler.index&1)==1
textpos.push([pokename,@spritebaseX+93,35,false,base,shadow])
end
[email protected]
[email protected]+158 if (@battler.index&1)==0
genderY=6
genderY=6+9 if (@battler.index&1)==0
if @battler.gender==0 # Male
textpos.push([_INTL("♂"),genderX,genderY,false,Color.new(48,96,216),shadow])
elsif @battler.gender==1 # Female
textpos.push([_INTL("♀"),genderX,genderY,false,Color.new(248,88,40),shadow])
end
pbDrawTextPositions(self.bitmap,textpos)
pbSetSystemFont(self.bitmap)
self.bitmap.font.size=18
textpos=[]
if (@battler.index&1)==0
textpos.push([_INTL("Lv{1}",@battler.level),@spritebaseX+202,11,true,base,shadow])
elsif (@battler.index&1)==1
textpos.push([_INTL("Lv{1}",@battler.level),@spritebaseX+39,11,true,base,shadow])
end
hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
if @showhp
textpos.push([hpstring,@spritebaseX+188,48,true,base,shadow])
end
pbDrawTextPositions(self.bitmap,textpos)
if @battler.pokemon.isShiny?
shinyX=206
shinyX=-6 if (@battler.index&1)==0 # If player's Pokémon
imagepos=[["Graphics/Pictures/shiny.png",@spritebaseX+shinyX,36,0,0,-1,-1]]
pbDrawImagePositions(self.bitmap,imagepos)
end
if @battler.owned && (@battler.index&1)==1
imagepos=[["Graphics/Pictures/battleBoxOwned.png",@spritebaseX+185,36,0,0,-1,-1]]
pbDrawImagePositions(self.bitmap,imagepos)
end
if @battler.status>0
self.bitmap.blt(@spritebaseX+164,71,@statuses.bitmap,
Rect.new(0,(@battler.status-1)*16,44,16))
end
end
def update
super
@frame+=1
if @animatingHP
if @currenthp<@endhp
@currenthp+=1
elsif @currenthp>@endhp
@currenthp-=1
end
refresh
@animatingHP=false if @[email protected]
end
if @animatingEXP
if [email protected]
@[email protected]
elsif @currentexp<@endexp
@currentexp+=1
elsif @currentexp>@endexp
@currentexp-=1
end
refresh
if @[email protected]
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<[email protected]
else
self.x+=8
@appearing=false if self.x>[email protected]
end
[email protected]
return
end
[email protected]
if ((@frame/10).floor&1)==1 && @selected==1 # When choosing commands for this Pokémon
[email protected]+2
elsif ((@frame/5).floor&1)==1 && @selected==2 # When targeted or damaged
[email protected]+2
else
[email protected]
end
end
end
def showShadow?(species)
metrics=load_data("Data/metrics.dat")
return metrics[2][species]>0
end
# Shows the enemy trainer(s)'s Pokémon being thrown out. It appears at coords
# (@spritex,@spritey), and moves in y to @endspritey where it stays for the rest
# of the battle, i.e. the latter is the more important value.
# Doesn't show the ball itself being thrown.
class PokeballSendOutAnimation
SPRITESTEPS=10
STARTZOOM=0.125
def initialize(sprite,spritehash,pkmn,doublebattle)
@disposed=false
@ballused=pkmn.pokemon ? pkmn.pokemon.ballused : 0
@PokemonBattlerSprite=sprite
@PokemonBattlerSprite.visible=false
@PokemonBattlerSprite.tone=Tone.new(248,248,248,248)
@pokeballsprite=IconSprite.new(0,0,sprite.viewport)
@pokeballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d",@ballused))
if doublebattle
@spritex=pkmn.index==1 ? 400 : 304 # x coordinate of foe trainer's Pokémon
else
@spritex=352 # x coordinate of foe trainer's Pokémon
end
@spritex+=Graphics.width-480 # Adjust x for screen size
@spritey=128 # Start y coordinate of foe trainer's Pokémon
@spritey+=((Graphics.height-320)*3/4).floor # Adjust start y for screen size
@spritehash=spritehash
@pokeballsprite.x[email protected]@pokeballsprite.bitmap.width/2
@[email protected]@pokeballsprite.bitmap.height/2
@pkmn=pkmn
@endspritey=adjustBattleSpriteY(sprite,pkmn.species,pkmn.index) # end y
@[email protected] # from top
@shadowY-=16 if doublebattle && pkmn.index==3
@[email protected] # from left
@shadowVisible=showShadow?(pkmn.species)
@stepspritey=(@[email protected])
@zoomstep=(1.0-STARTZOOM)/SPRITESTEPS
@animdone=false
@frame=0
end
def disposed?
return @disposed
end
def animdone?
return @animdone
end
def dispose
return if disposed?
@pokeballsprite.dispose
@disposed=true
end
def update
return if disposed?
@pokeballsprite.update
@frame+=1
if @frame==2
pbSEPlay("recall")
end
if @frame==4
@PokemonBattlerSprite.visible=true
@PokemonBattlerSprite.zoom_x=STARTZOOM
@PokemonBattlerSprite.zoom_y=STARTZOOM
pbSpriteSetCenter(@PokemonBattlerSprite,@spritex,@spritey)
pbPlayCry(@pkmn.pokemon ? @pkmn.pokemon : @pkmn.species)
@pokeballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_open",@ballused))
end
if @frame==8
@pokeballsprite.visible=false
end
if @frame>8 && @frame<=16
color=Color.new(248,248,248,256-([email protected])*32)
@spritehash["enemybase"].color=color
@spritehash["playerbase"].color=color
@spritehash["battlebg"].color=color
for i in 0...4
@spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
end
end
if @frame>16 && @frame<=24
color=Color.new(248,248,248,([email protected])*32)
tone=([email protected])*32
@PokemonBattlerSprite.tone=Tone.new(tone,tone,tone,tone)
@spritehash["enemybase"].color=color
@spritehash["playerbase"].color=color
@spritehash["battlebg"].color=color
for i in 0...4
@spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
end
end
if @frame>5 && @PokemonBattlerSprite.zoom_x<1.0
@[email protected]
@[email protected]
@PokemonBattlerSprite.zoom_x=1.0 if @PokemonBattlerSprite.zoom_x > 1.0
@PokemonBattlerSprite.zoom_y=1.0 if @PokemonBattlerSprite.zoom_y > 1.0
[email protected](@stepspritey*@PokemonBattlerSprite.zoom_y)
pbSpriteSetCenter(@PokemonBattlerSprite,@spritex,currentY)
@PokemonBattlerSprite.y=currentY
end
if @PokemonBattlerSprite.tone.gray<=0 && @PokemonBattlerSprite.zoom_x>=1.0
@animdone=true
if @spritehash["shadow#{@pkmn.index}"]
@spritehash["shadow#{@pkmn.index}"][email protected]
@spritehash["shadow#{@pkmn.index}"][email protected]
@spritehash["shadow#{@pkmn.index}"][email protected]
end
end
end
end
# Shows the player's (or partner's) Pokémon being thrown out. It appears at
# (@spritex,@spritey), and moves in y to @endspritey where it stays for the rest
# of the battle, i.e. the latter is the more important value.
# Doesn't show the ball itself being thrown.
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
@PokemonBattlerSprite=sprite
@pkmn=pkmn
@PokemonBattlerSprite.visible=false
@PokemonBattlerSprite.tone=Tone.new(248,248,248,248)
@spritehash=spritehash
if doublebattle
@spritex=pkmn.index==0 ? 64 : 180 # x coordinate of player's Pokémon
else
@spritex=128 # x coordinate of player's Pokémon
end
@spritey=Graphics.height-64 # Start y coordinate of player's Pokémon
@endspritey=adjustBattleSpriteY(@PokemonBattlerSprite,pkmn.species,pkmn.index)
@animdone=false
@frame=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?
@frame+=1
if @frame==4
@PokemonBattlerSprite.visible=true
@PokemonBattlerSprite.zoom_x=STARTZOOM
@PokemonBattlerSprite.zoom_y=STARTZOOM
pbSEPlay("recall")
pbSpriteSetCenter(@PokemonBattlerSprite,@spritex,@spritey)
pbPlayCry(@pkmn.pokemon ? @pkmn.pokemon : @pkmn.species)
end
if @frame>8 && @frame<=16
color=Color.new(248,248,248,256-([email protected])*32)
@spritehash["enemybase"].color=color
@spritehash["playerbase"].color=color
@spritehash["battlebg"].color=color
for i in 0...4
@spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
end
end
if @frame>16 && @frame<=24
color=Color.new(248,248,248,([email protected])*32)
tone=([email protected])*32
@PokemonBattlerSprite.tone=Tone.new(tone,tone,tone,tone)
@spritehash["enemybase"].color=color
@spritehash["playerbase"].color=color
@spritehash["battlebg"].color=color
for i in 0...4
@spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
end
end
if @frame>5 && @PokemonBattlerSprite.zoom_x<1.0
@PokemonBattlerSprite.zoom_x+=0.1
@PokemonBattlerSprite.zoom_y+=0.1
@PokemonBattlerSprite.zoom_x=1.0 if @PokemonBattlerSprite.zoom_x > 1.0
@PokemonBattlerSprite.zoom_y=1.0 if @PokemonBattlerSprite.zoom_y > 1.0
pbSpriteSetCenter(@PokemonBattlerSprite,@spritex,0)
@[email protected]+(@[email protected])*@PokemonBattlerSprite.zoom_y
end
if @PokemonBattlerSprite.tone.gray<=0 && @PokemonBattlerSprite.zoom_x>=1.0
@animdone=true
end
end
end
# Shows the enemy trainer(s) and the enemy party lineup sliding off screen.
# Doesn't show the ball thrown or the Pokémon.
class TrainerFadeAnimation
def initialize(sprites)
@frame=0
@sprites=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
@frame+=1
@sprites["trainer"].x+=8
@sprites["trainer2"].x+=8 if @sprites["trainer2"]
@sprites["partybase1"].x+=8
@sprites["partybase1"].opacity-=12
for i in 0...6
@sprites["enemy#{i}"].opacity-=12
@sprites["enemy#{i}"].x+=8 if @frame>=i*4
end
@animdone=true if @sprites["trainer"].x>=Graphics.width &&
( [email protected]["trainer2"]||@sprites["trainer2"].x>=Graphics.width )
end
end
# Shows the player (and partner) and the player party lineup sliding off screen.
# Shows the player's/partner's throwing animation (if they have one). Doesn't
# show the ball thrown or the Pokémon.
class PlayerFadeAnimation
def initialize(sprites)
@frame=0
@sprites=sprites
@animdone=false
end
def animdone?
return @animdone
end
def update
return if @animdone
@frame+=1
@sprites["player"].x-=8
@sprites["playerB"].x-=8 if @sprites["playerB"]
@sprites["partybase2"].x-=8
@sprites["partybase2"].opacity-=12
for i in 0...6
if @sprites["player#{i}"]
@sprites["player#{i}"].opacity-=12
@sprites["player#{i}"].x-=8 if @frame>=i*4
end
end
[email protected]["player"]
[email protected]["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
@sprites["player"].src_rect.x=pawidth*1 if @frame>0
@sprites["player"].src_rect.x=pawidth*2 if @frame>8
@sprites["player"].src_rect.x=pawidth*3 if @frame>12
@sprites["player"].src_rect.x=pawidth*4 if @frame>16
@sprites["player"].src_rect.width=pawidth
else
pawidth=pa.bitmap.width
@sprites["player"].src_rect.x=0
@sprites["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
@sprites["playerB"].src_rect.x=pbwidth*1 if @frame>0
@sprites["playerB"].src_rect.x=pbwidth*2 if @frame>8
@sprites["playerB"].src_rect.x=pbwidth*3 if @frame>12
@sprites["playerB"].src_rect.x=pbwidth*4 if @frame>16
@sprites["playerB"].src_rect.width=pbwidth
else
pbwidth=pb.bitmap.width
@sprites["playerB"].src_rect.x=0
@sprites["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
# Shows the player's Poké Ball being thrown to capture a Pokémon.
def pokeballThrow(ball,shakes,targetBattler,scene,battler,burst=-1)
[email protected](ball)
[email protected]["shadow#{targetBattler}"].visible
@sprites["shadow#{targetBattler}"].visible=false
ball=sprintf("Graphics/Pictures/ball%02d",balltype)
ballopen=sprintf("Graphics/Pictures/ball%02d_open",balltype)
# sprites
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
[email protected]["pokemon#{targetBattler}"]
# pictures
pictureBall=PictureEx.new(0)
picturePoke=PictureEx.new(0)
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter(@sprites["pokemon#{targetBattler}"])
ballendy=128-4+((Graphics.height-320)*3/4).floor
# starting positions
pictureBall.moveVisible(1,true)
pictureBall.moveName(1,ball)
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(30,1,150,70,30+Graphics.width/2,10,center[0],center[1])
pictureBall.moveAngle(30,1,-1080)
pictureBall.moveAngle(0,pictureBall.totalDuration,0)
delay=pictureBall.totalDuration+4
picturePoke.moveTone(10,delay,Tone.new(0,-224,-224,0))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay+4,ballopen)
loop do
pictureBall.update
picturePoke.update
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
break if !pictureBall.running? && !picturePoke.running?
end
# Burst animation here
if burst>=0
scene.pbCommonAnimation("BallBurst#{burst}",battler,nil)
end
pictureBall.clearProcesses
picturePoke.clearProcesses
delay=0
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],center[1])
picturePoke.moveSE(delay+10,"Audio/SE/jumptoball")
picturePoke.moveVisible(delay+15,false)
pictureBall.moveName(picturePoke.totalDuration+2,ball)
delay=picturePoke.totalDuration+6
pictureBall.moveXY(15,delay,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(10,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])*2/3))
pictureBall.moveXY(10,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(6,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])*1/3))
pictureBall.moveXY(6,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(3,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])*1/6))
pictureBall.moveXY(3,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
picturePoke.moveXY(0,pictureBall.totalDuration,center[0],ballendy)
delay=pictureBall.totalDuration+18# if shakes==0
[shakes,3].min.times do
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(3,delay,center[0]-8,ballendy)
pictureBall.moveAngle(3,delay,20) # positive means counterclockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(6,delay,center[0]+8,ballendy)
pictureBall.moveAngle(6,delay,-20) # negative means clockwise
delay=pictureBall.totalDuration
pictureBall.moveXY(3,delay,center[0],ballendy)
pictureBall.moveAngle(3,delay,0)
delay=pictureBall.totalDuration+18
end
if shakes<4
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ballopen)
pictureBall.moveVisible(delay+10,false)
picturePoke.moveVisible(delay,true)
picturePoke.moveZoom(15,delay,100)
picturePoke.moveXY(15,delay,center[0],center[1])
picturePoke.moveTone(0,delay,Tone.new(248,248,248,248))
picturePoke.moveTone(24,delay,Tone.new(0,0,0,0))
delay=picturePoke.totalDuration
end
pictureBall.moveXY(0,delay,center[0],ballendy)
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
@sprites["shadow#{targetBattler}"].visible=oldvisible
end
spriteBall.dispose
end
####################################################
class PokeBattle_Scene
USECOMMANDBOX=true # If true, expects the file Graphics/Pictures/battleCommand.png
USEFIGHTBOX=true # If true, expects the file Graphics/Pictures/battleFight.png
MESSAGEBASECOLOR=Color.new(250,250,250)
MESSAGESHADOWCOLOR=Color.new(0,0,0)
MENUBASECOLOR=Color.new(80,80,88)
MENUSHADOWCOLOR=Color.new(160,160,168)
BOXTEXTBASECOLOR=Color.new(250,250,250)
BOXTEXTSHADOWCOLOR=Color.new(0,0,0)
EXPCOLORBASE=Color.new(72,144,248)
EXPCOLORSHADOW=Color.new(48,96,216)
# Green HP color
HPCOLORBASE1=Color.new(24,240,32)
HPCOLORSHADOW1=Color.new(0,144,0)
# Orange HP color
HPCOLORBASE2=Color.new(248,176,0)
HPCOLORSHADOW2=Color.new(176,104,8)
# Red HP color
HPCOLORBASE3=Color.new(248,88,40)
HPCOLORSHADOW3=Color.new(168,48,56)
# Position of HP gauge
HPGAUGE_X=54
HPGAUGEFOE_X=4
HPGAUGE_Y=33
# Position of EXP gauge
EXPGAUGE_X=25
EXPGAUGE_Y=75
# Size of gauges
EXPGAUGESIZE=138
HPGAUGESIZE=152
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]
@pkmnwindows=[nil,nil,nil,nil]
@sprites={}
@battlestart=true
@messagemode=false
@abortable=false
@aborted=false
end
def pbUpdate
partyAnimationUpdate
@sprites["battlebg"].update if @sprites["battlebg"].respond_to?("update")
end
def pbGraphicsUpdate
partyAnimationUpdate
@sprites["battlebg"].update if @sprites["battlebg"].respond_to?("update")
Graphics.update
end
def pbInputUpdate
Input.update
if Input.trigger?(Input::B) && @abortable && [email protected]
@aborted=true
@battle.pbAbort
end
end
def pbShowWindow(windowtype)
@sprites["messagebox"].visible = ( windowtype==MESSAGEBOX ||
windowtype==COMMANDBOX || windowtype==FIGHTBOX || windowtype==BLANK )
@sprites["messagewindow"].visible = (windowtype==MESSAGEBOX)
@sprites["commandwindow"].visible = (windowtype==COMMANDBOX)
@sprites["fightwindow"].visible = (windowtype==FIGHTBOX)
end
def pbSetMessageMode(mode)
@messagemode=mode
[email protected]["messagewindow"]
if mode # Within Pokémon command
msgwindow.baseColor=MENUBASECOLOR
msgwindow.shadowColor=MENUSHADOWCOLOR
msgwindow.opacity=255
msgwindow.x=16
msgwindow.width=Graphics.width
msgwindow.height=96
msgwindow.y=Graphics.height-msgwindow.height+2
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+2
end
end
def pbWaitMessage
if @briefmessage
pbShowWindow(MESSAGEBOX)
[email protected]["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)
[email protected]["messagewindow"]
cw.text=msg
i=0
loop do
pbGraphicsUpdate
pbInputUpdate
cw.update
if i==40
cw.text=""
cw.visible=false
return
end
if Input.trigger?(Input::C) || @abortable
if cw.pausing?
pbPlayDecisionSE() if [email protected]
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
[email protected]["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? && [email protected]
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)
[email protected]["messagewindow"]
dw.text=msg
cw = Window_CommandPokemon.new(commands)
cw.x=Graphics.width-cw.width
cw.y=Graphics.height-cw.height-dw.height
cw.index=0
[email protected]
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...4
if @sprites["battler#{i}"]
@sprites["battler#{i}"].update
end
if @sprites["pokemon#{i}"]
@sprites["pokemon#{i}"].update
end
end
end
def pbRefresh
for i in 0...4
if @sprites["battler#{i}"]
@sprites["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
@sprites[id]=sprite
return sprite
end
def pbAddPlane(id,filename,viewport)
sprite=AnimatedPlane.new(viewport)
if filename
sprite.setBitmap(filename)
end
@sprites[id]=sprite
return sprite
end
def pbDisposeSprites
pbDisposeSpriteHash(@sprites)
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=pbTrainerSpriteFile(@battle.opponent[index].trainertype)
else
trainerfile=pbTrainerSpriteFile(@battle.opponent.trainertype)
end
else
trainerfile="Graphics/Characters/trfront"
end
pbAddSprite("trainer",Graphics.width,16,trainerfile,@viewport)
if @sprites["trainer"].bitmap
@sprites["trainer"][email protected]["trainer"].bitmap.height-128
@sprites["trainer"][email protected]
end
20.times do
pbGraphicsUpdate
pbInputUpdate
@sprites["trainer"].x-=6
end
end
def pbHideOpponent
20.times do
pbGraphicsUpdate
pbInputUpdate
@sprites["trainer"].x+=6
end
end
def pbShowHelp(text)
@sprites["helpwindow"].resizeToFit(text,Graphics.width)
@sprites["helpwindow"].y=0
@sprites["helpwindow"].x=0
@sprites["helpwindow"].text=text
@sprites["helpwindow"].visible=true
end
def pbHideHelp
@sprites["helpwindow"].visible=false
end
def pbBackdrop
outdoor=false
if $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
outdoor=true
end
[email protected]
# Choose backdrop.
backdrop="Field"
if environ==PBEnvironment::Cave
backdrop="Cave"
elsif environ==PBEnvironment::MovingWater || environ==PBEnvironment:
tillWater
backdrop="Water"
elsif environ==PBEnvironment::Underwater
backdrop="Underwater"
elsif environ==PBEnvironment::Rock
backdrop="Mountain"
elsif !outdoor
backdrop="IndoorA"
end
if $game_map
back=pbGetMetadata($game_map.map_id,MetadataBattleBack)
if back && back!=""
backdrop=back
end
end
if $PokemonGlobal && $PokemonGlobal.nextBattleBack
backdrop=$PokemonGlobal.nextBattleBack
end
# Choose bases.
base=""
trialname=""
if environ==PBEnvironment::Grass || environ==PBEnvironment::TallGrass
trialname="Grass"
elsif environ==PBEnvironment:
and
trialname="Sand"
elsif $PokemonGlobal.surfing
trialname="Water"
end
if pbResolveBitmap(sprintf("Graphics/Battlebacks/playerbase"+backdrop+trialname))
base=trialname
end
# Choose time of day.
time=""
trialname=""
timenow=pbGetTimeNow
if PBDayNight.isNight?(timenow)
trialname="Night"
elsif PBDayNight.isEvening?(timenow)
trialname="Eve"
end
if pbResolveBitmap(sprintf("Graphics/Battlebacks/battlebg"+backdrop+trialname))
time=trialname
end
# Apply graphics.
battlebg="Graphics/Battlebacks/battlebg"+backdrop+time
enemybase="Graphics/Battlebacks/enemybase"+backdrop+base+time
playerbase="Graphics/Battlebacks/playerbase"+backdrop+base+time
pbAddPlane("battlebg",battlebg,@viewport)
pbAddSprite("enemybase",-256,[email protected],enemybase,@viewport) # ends at (224,64)
pbAddSprite("playerbase",Graphics.width-128,[email protected],playerbase,@viewport) # ends at (0,192)
@sprites["enemybase"].z=-1 # For compatibility with RGSS2
@sprites["playerbase"].z=-1 # For compatibility with RGSS2
@sprites["battlebg"].z=-1 # For compatibility with RGSS2
end
def inPartyAnimation?
return @enablePartyAnim && @partyAnimPhase<4
end
def partyAnimationUpdate
return if !inPartyAnimation?
if @partyAnimPhase==0
@sprites["partybase1"].x+=16
@sprites["partybase2"].x-=16
@partyAnimPhase=1 if @sprites["partybase1"][email protected]["partybase1"].bitmap.width>=248
return
end
if @partyAnimPhase==1
@enemyendpos=172
@playerendpos=296
@partyAnimPhase=2
@partyAnimI=0
end
if @partyAnimPhase==2
if @partyAnimI>=6
@partyAnimPhase=4
return
end
if @partyAnimI>[email protected] || [email protected][@partyAnimI]
pbAddSprite("enemy#{@partyAnimI}",-36,84,
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party2[@partyAnimI].hp<=0 || @battle.party2[@partyAnimI].egg?
pbAddSprite("enemy#{@partyAnimI}",-36,84,
"Graphics/Pictures/ballfainted",@viewport)
elsif @battle.party2[@partyAnimI].status>0
pbAddSprite("enemy#{@partyAnimI}",-36,84,
"Graphics/Pictures/ballstatus",@viewport)
else
pbAddSprite("enemy#{@partyAnimI}",-36,84,
"Graphics/Pictures/ballnormal",@viewport)
end
if @[email protected] || [email protected][@partyAnimI]
pbAddSprite("player#{@partyAnimI}",Graphics.width+4,[email protected],
"Graphics/Pictures/ballempty",@viewport)
elsif @battle.party1[@partyAnimI].hp<=0 || @battle.party1[@partyAnimI].egg?
pbAddSprite("player#{@partyAnimI}",Graphics.width+4,[email protected],
"Graphics/Pictures/ballfainted",@viewport)
elsif @battle.party1[@partyAnimI].status>0
pbAddSprite("player#{@partyAnimI}",Graphics.width+4,[email protected],
"Graphics/Pictures/ballstatus",@viewport)
else
pbAddSprite("player#{@partyAnimI}",Graphics.width+4,[email protected],
"Graphics/Pictures/ballnormal",@viewport)
end
@partyAnimPhase=3
end
if @partyAnimPhase==3
@sprites["enemy#{@partyAnimI}"].x+=16
@sprites["player#{@partyAnimI}"].x-=16
if @sprites["enemy#{@partyAnimI}"].x>[email protected]
@partyAnimPhase=2
@partyAnimI+=1
@enemyendpos-=32
@playerendpos+=32
end
end
end
def pbStartBattle(battle)
# Called whenever the battle begins
@battle=battle
@lastcmd=[0,0,0,0]
@lastmove=[0,0,0,0]
@sprites.clear
@sprites.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
@traineryoffset=(Graphics.height-320) # Adjust player's side for screen size
@foeyoffset=(@traineryoffset*3/4).floor # Adjust foe's side for screen size
pbBackdrop
pbAddSprite("partybase1",-448,114,"Graphics/Pictures/battleLineup",@viewport)
pbAddSprite("partybase2",Graphics.width+8,[email protected],"Graphics/Pictures/battleLineup",@viewport)
@sprites["partybase2"].mirror=true
@sprites["partybase1"].visible=false
@sprites["partybase2"].visible=false
if @battle.opponent
if @battle.opponent.is_a?(Array)
trainerfile=pbTrainerSpriteFile(@battle.opponent[0].trainertype)
pbAddSprite("trainer",-144,[email protected],trainerfile,@viewport)
trainerfile=pbTrainerSpriteFile(@battle.opponent[1].trainertype)
pbAddSprite("trainer2",-240,[email protected],trainerfile,@viewport)
else
trainerfile=pbTrainerSpriteFile(@battle.opponent.trainertype)
pbAddSprite("trainer",-192,[email protected],trainerfile,@viewport)
end
else
trainerfile="Graphics/Characters/trfront"
pbAddSprite("trainer",-192,[email protected],trainerfile,@viewport)
end
if @sprites["trainer"].bitmap
@sprites["trainer"].x-=(@sprites["trainer"].bitmap.width-128)/2
@sprites["trainer"][email protected]["trainer"].bitmap.height-128
end
if @sprites["trainer2"] && @sprites["trainer2"].bitmap
@sprites["trainer2"].x-=(@sprites["trainer2"].bitmap.width-128)/2
@sprites["trainer2"][email protected]["trainer2"].bitmap.height-128
end
@sprites["shadow0"]=IconSprite.new(0,0,@viewport)
pbAddSprite("shadow1",0,0,"Graphics/Pictures/battleShadow",@viewport)
@sprites["shadow1"].visible=false
@sprites["pokemon0"]=PokemonBattlerSprite.new(battle.doublebattle,0,@viewport)
@sprites["pokemon1"]=PokemonBattlerSprite.new(battle.doublebattle,1,@viewport)
if battle.doublebattle
pbAddSprite("shadow3",0,0,"Graphics/Pictures/battleShadow",@viewport)
@sprites["shadow3"].visible=false
@sprites["shadow2"]=IconSprite.new(0,0,@viewport)
@sprites["pokemon2"]=PokemonBattlerSprite.new(battle.doublebattle,2,@viewport)
@sprites["pokemon3"]=PokemonBattlerSprite.new(battle.doublebattle,3,@viewport)
end
@sprites["battler0"]=PokemonDataBox.new(battle.battlers[0],battle.doublebattle,@viewport)
@sprites["battler1"]=PokemonDataBox.new(battle.battlers[1],battle.doublebattle,@viewport)
if battle.doublebattle
@sprites["battler2"]=PokemonDataBox.new(battle.battlers[2],battle.doublebattle,@viewport)
@sprites["battler3"]=PokemonDataBox.new(battle.battlers[3],battle.doublebattle,@viewport)
end
if @battle.player.is_a?(Array)
trainerfile=pbTrainerSpriteBackFile(@battle.player[0].trainertype)
pbAddSprite("player",Graphics.width+64-48,[email protected],trainerfile,@viewport)
trainerfile=pbTrainerSpriteBackFile(@battle.player[1].trainertype)
pbAddSprite("playerB",Graphics.width+64+48,[email protected],trainerfile,@viewport)
if @sprites["player"].bitmap
if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height
@sprites["player"].src_rect.x=0
@sprites["player"][email protected]["player"].bitmap.width/5
end
@sprites["player"].x-=(@sprites["player"].src_rect.width-128)/2
end
if @sprites["playerB"].bitmap
if @sprites["playerB"].bitmap.width>@sprites["playerB"].bitmap.height
@sprites["playerB"].src_rect.x=0
@sprites["playerB"][email protected]["playerB"].bitmap.width/5
end
@sprites["playerB"].x-=(@sprites["playerB"].src_rect.width-128)/2
end
else
trainerfile=pbTrainerSpriteBackFile(@battle.player.trainertype)
pbAddSprite("player",Graphics.width+64,[email protected],trainerfile,@viewport)
if @sprites["player"].bitmap
if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height
@sprites["player"].src_rect.x=0
@sprites["player"][email protected]["player"].bitmap.width/5
end
@sprites["player"].x-=(@sprites["player"].src_rect.width-128)/2
end
end
pbAddSprite("messagebox",0,Graphics.height-96,"Graphics/Pictures/battleMessage2",@viewport)
@sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
@sprites["helpwindow"].visible=false
@sprites["messagewindow"]=Window_AdvancedTextPokemon.new("")
@sprites["commandwindow"]=CommandMenuDisplay.new(@viewport)
@sprites["fightwindow"]=FightMenuDisplay.new(nil,@viewport)
@sprites["messagewindow"].letterbyletter=true
@sprites["messagewindow"][email protected]
@sprites["messagebox"].z=-50
@sprites["messagewindow"].z=100
@sprites["commandwindow"].z=100
@sprites["fightwindow"].z=100
pbShowWindow(MESSAGEBOX)
pbSetMessageMode(false)
[email protected]["trainer"]
[email protected]["trainer2"]
if [email protected]
@sprites["trainer"].visible=false
if @battle.party2.length>=1
@sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
@sprites["pokemon1"].tone=Tone.new(-128,-128,-128,-128)
@sprites["pokemon1"].x=-192 # ends at 144*2
@sprites["shadow1"].x=-192+32
@sprites["shadow1"][email protected]
[email protected][0].species
@sprites["pokemon1"].visible=true
@sprites["shadow1"].visible=showShadow?(species)
pbPositionPokemonSprite(
@sprites["pokemon1"],@sprites["pokemon1"].x,@sprites["pokemon1"].y
)
@sprites["pokemon1"].y=adjustBattleSpriteY(
@sprites["pokemon1"],species,1)
[email protected]["pokemon1"]
end
if @battle.party2.length==2
@sprites["pokemon3"].setPokemonBitmap(@battle.party2[1],false)
@sprites["pokemon3"].tone=Tone.new(-128,-128,-128,-128)
@sprites["pokemon1"].x=-144
@sprites["shadow1"].x=-144+32
@sprites["pokemon3"].x=-240
@sprites["shadow3"].x=-240+32
@sprites["shadow3"][email protected]
[email protected][1].species
@sprites["pokemon3"].visible=true
@sprites["shadow3"].visible=showShadow?(species)
pbPositionPokemonSprite(
@sprites["pokemon3"],@sprites["pokemon3"].x,@sprites["pokemon3"].y
)
@sprites["pokemon3"].y=adjustBattleSpriteY(
@sprites["pokemon3"],species,3)
[email protected]["pokemon3"]
end
end
loop do
if @viewport.rect.y>0
@viewport.rect.y-=4
@viewport.rect.height+=8
end
for i in @sprites
i[1][email protected]
i[1][email protected]
end
appearspeed=8
@sprites["enemybase"].x+=appearspeed
@sprites["playerbase"].x-=appearspeed
@sprites["shadow1"].x+=appearspeed
@sprites["shadow3"].x+=appearspeed if @sprites["shadow3"]
trainersprite1.x+=appearspeed
trainersprite2.x+=appearspeed if trainersprite2
@sprites["player"].x-=appearspeed
@sprites["playerB"].x-=appearspeed if @sprites["playerB"]
pbGraphicsUpdate
pbInputUpdate
break if @sprites["enemybase"].x>=Graphics.width-256
end
# Play cry for wild Pokémon
if [email protected]
pbPlayCry(@battle.party2[0])
end
if @battle.opponent
@enablePartyAnim=true
@partyAnimPhase=0
@sprites["partybase1"].visible=true
@sprites["partybase2"].visible=true
else
@sprites["battler1"].appear
@sprites["battler3"].appear if @battle.party2.length==2
appearing=true
begin
pbGraphicsUpdate
pbInputUpdate
@sprites["battler1"].update
[email protected]["battler1"].appearing
@sprites["pokemon1"].tone.red+=8 if @sprites["pokemon1"].tone.red<0
@sprites["pokemon1"].tone.blue+=8 if @sprites["pokemon1"].tone.blue<0
@sprites["pokemon1"].tone.green+=8 if @sprites["pokemon1"].tone.green<0
@sprites["pokemon1"].tone.gray+=8 if @sprites["pokemon1"].tone.gray<0
if @battle.party2.length==2
@sprites["battler3"].update
@sprites["pokemon3"].tone.red+=8 if @sprites["pokemon3"].tone.red<0
@sprites["pokemon3"].tone.blue+=8 if @sprites["pokemon3"].tone.blue<0
@sprites["pokemon3"].tone.green+=8 if @sprites["pokemon3"].tone.green<0
@sprites["pokemon3"].tone.gray+=8 if @sprites["pokemon3"].tone.gray<0
appearing=(appearing||@sprites["battler3"].appearing)
end
end while appearing
# Show shiny animation for wild Pokémon
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
end
def pbEndBattle(result)
@abortable=false
pbShowWindow(BLANK)
# Fade out all sprites
pbBGMFade(1.0)
pbFadeOutAndHide(@sprites)
pbDisposeSprites
end
def pbRecall(battlerindex)
@briefmessage=false
origin=Graphics.height-64
if @battle.pbIsOpposing?(battlerindex)
@sprites["shadow#{battlerindex}"].visible=false
[email protected]
end
[email protected]["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.moveTone(10,1,Tone.new(0,-224,-224,0))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],origin)
picturePoke.moveVisible(picturePoke.totalDuration,false)
picturePoke.moveTone(0,picturePoke.totalDuration,Tone.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
def pbTrainerSendOut(battlerindex,pkmn)
@briefmessage=false
fadeanim=nil
while inPartyAnimation?; end
if @showingenemy
fadeanim=TrainerFadeAnimation.new(@sprites)
end
frame=0
@sprites["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,false)
sendout=PokeballSendOutAnimation.new(@sprites["pokemon#{battlerindex}"],
@sprites,@battle.battlers[battlerindex],@battle.doublebattle)
loop do
pbGraphicsUpdate
pbInputUpdate
fadeanim.update if fadeanim
frame+=1
if frame==1
@sprites["battler#{battlerindex}"].appear
end
if frame>=10
sendout.update
end
@sprites["battler#{battlerindex}"].update
break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
[email protected]["battler#{battlerindex}"].appearing
end
if @battle.battlers[battlerindex].pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
end
sendout.dispose
if @showingenemy
@showingenemy=false
pbDisposeSprite(@sprites,"trainer")
pbDisposeSprite(@sprites,"partybase1")
for i in 0...6
pbDisposeSprite(@sprites,"enemy#{i}")
end
end
pbRefresh
end
def pbSendOut(battlerindex,pkmn) # Player sending out Pokémon
while inPartyAnimation?; end
balltype=pkmn.ballused
ballbitmap=sprintf("Graphics/Pictures/ball%02d",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=[[0, 146], [10, 134], [21, 122], [30, 112],
[39, 104], [46, 99], [53, 95], [61, 93],
[68, 93], [75, 96], [82, 102], [89, 111],
[94, 121], [100, 134], [106, 150], [111, 166],
[116, 183], [120, 199], [124, 216], [127, 238]]
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
angle=0
multiplier=1.0
if @battle.doublebattle
multiplier=(battlerindex==0) ? 0.7 : 1.3
end
for coord in path
delay=pictureBall.totalDuration
pictureBall.moveAngle(0,delay,angle)
pictureBall.moveXY(1,delay,coord[0]*multiplier,coord[1])
angle+=40
angle%=360
end
pictureBall.adjustPosition(0,@traineryoffset)
@sprites["battler#{battlerindex}"].visible=false
@briefmessage=false
fadeanim=nil
if @showingplayer
fadeanim=PlayerFadeAnimation.new(@sprites)
end
frame=0
@sprites["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,true)
sendout=PokeballPlayerSendOutAnimation.new(@sprites["pokemon#{battlerindex}"],
@sprites,@battle.battlers[battlerindex],@battle.doublebattle)
loop do
fadeanim.update if fadeanim
frame+=1
if frame>1 && !pictureBall.running? && [email protected]["battler#{battlerindex}"].appearing
@sprites["battler#{battlerindex}"].appear
end
if frame>=3 && !pictureBall.running?
sendout.update
end
if (frame>=10 || !fadeanim) && pictureBall.running?
pictureBall.update
setPictureIconSprite(spriteBall,pictureBall)
end
@sprites["battler#{battlerindex}"].update
pbGraphicsUpdate
pbInputUpdate
break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
[email protected]["battler#{battlerindex}"].appearing
end
spriteBall.dispose
sendout.dispose
if @battle.battlers[battlerindex].pokemon.isShiny?
pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
end
if @showingplayer
@showingplayer=false
pbDisposeSprite(@sprites,"player")
pbDisposeSprite(@sprites,"partybase2")
for i in 0...6
pbDisposeSprite(@sprites,"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
@sprites["battler0"]=SafariDataBox.new(@battle,@viewport)
@sprites["battler0"].appear
loop do
@sprites["battler0"].update
pbGraphicsUpdate
pbInputUpdate
break if [email protected]["battler0"].appearing
end
pbRefresh
end
def pbCommandMenuEx(index,texts,mode=0) # Mode: 0 - regular battle
pbShowWindow(COMMANDBOX) # 1 - Shadow Pokémon battle
[email protected]["commandwindow"] # 2 - Safari Zone
cw2.setTexts(texts) # 3 - Bug Catching Contest
[email protected][index]
cw2.mode=mode
pbSelectBattler(index)
pbRefresh
loop do
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate(cw2)
if Input.trigger?(Input::C)
ret=cw2.index
pbPlayDecisionSE()
@lastcmd[index]=ret
return ret
elsif Input.trigger?(Input::B) && index==2 && @lastcmd[0]!=2
pbPlayDecisionSE()
return -1
end
nextindex=pbNextIndex(cw2.index)
if cw2.index!=nextindex
pbPlayCursorSE()
cw2.index=nextindex
end
end
end
def pbSafariCommandMenu(index)
pbCommandMenuEx(index,[
_INTL("What will\n{1} throw?",@battle.pbPlayer.name),
_INTL("Ball"),
_INTL("Bait"),
_INTL("Rock"),
_INTL("Run")
],2)
end
def pbCommandMenu(index)
# Use this method to display the list of commands.
# Return values:
# 0 - Fight
# 1 - Bag
# 2 - Pokémon
# 3 - Run
# 4 - Call
shadowTrainer=(hasConst?(PBTypes,
HADOW) && @battle.opponent)
ret=pbCommandMenuEx(index,[
_INTL("What will\n{1} do?",@battle.battlers[index].name),
_INTL("Fight"),
_INTL("Bag"),
_INTL("Pokémon"),
shadowTrainer ? _INTL("Call") : _INTL("Run")
],(shadowTrainer ? 1 : 0))
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
# Use this method to display the list of moves for a Pokémon
def pbFightMenu(index)
pbShowWindow(FIGHTBOX)
cw = @sprites["fightwindow"]
[email protected][index]
cw.battler=battler
[email protected][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=pbNextIndexNew(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
emptyspot=-1
pkmnid=-1
endscene=true
oldsprites=pbFadeOutAndHide(@sprites)
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 || usetype==3
pkmnlist=PokemonScreen_Scene.new
pkmnscreen=PokemonScreen.new(pkmnlist,@battle.party1)
itemscene.pbEndScene
pkmnscreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.doublebattle)
pkmnid=pkmnscreen.pbChoosePokemon
emptyspot=0 if @battle.doublebattle && @battle.battlers[0].hp<=0
emptyspot=2 if @battle.doublebattle && @battle.battlers[2].hp<=0
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 || usetype==4
if @battle.pbUseItemOnBattler(item,index,itemscene)
ret=item
break
end
end
end
end
pbConsumeItemInBattle($PokemonBag,ret)
itemscene.pbRefresh
itemscene.pbEndScene if endscene
for i in 0...4
if @sprites["battler#{i}"]
@sprites["battler#{i}"].refresh
end
end
pbFadeInAndShow(@sprites,oldsprites)
if emptyspot>=0 && @battle.battlers[emptyspot].hp>0
@battle.pbSendOut(emptyspot,$Trainer.party[pkmnid])
end
@battle.pbSwitch
return ret
end
def pbSelectBattler(index,selectmode=1)
[email protected] ? 4 : 2
for i in 0...numwindows
[email protected]["battler#{i}"]
sprite.selected=(i==index) ? selectmode : 0
[email protected]["pokemon#{i}"]
sprite.selected=(i==index) ? selectmode : 0
end
end
def pbFirstTarget(index)
for i in 0...4
if i!=index && @battle.battlers[i].hp>0 &&
@battle.battlers[index].pbIsOpposing?(i)
return i
end
end
return -1
end
def pbNextIndex(curindex)
if Input.trigger?(Input::DOWN)
return (curindex+3)%4
elsif Input.trigger?(Input::UP)
return (curindex+1)%4
end
return curindex
end
def pbNextIndexNew(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)
[email protected] ? 4 : 2
for i in 0...numwindows
if i==index
@sprites["battler#{i}"].selected=2
@sprites["pokemon#{i}"].selected=2
else
@sprites["battler#{i}"].selected=0
@sprites["pokemon#{i}"].selected=0
end
@sprites["battler#{i}"].update
@sprites["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)
[email protected](index)
inactives=[1,1,1,1,1,1]
partypos=[]
switchsprites={}
activecmd=0
ret=-1
pbShowWindow(BLANK)
pbSetMessageMode(true)
# Fade out and hide all sprites
visiblesprites=pbFadeOutAndHide(@sprites)
[email protected][0]
activecmd=0 if battler.index==index
inactives[battler.pokemonIndex]=0
partypos[0]=battler.pokemonIndex
if @battle.doublebattle && [email protected]
[email protected][2]
activecmd=1 if battler.index==index
inactives[battler.pokemonIndex]=0
partypos[1]=battler.pokemonIndex
end
# Add all non-active Pokémon
for i in 0...6
partypos[partypos.length]=i if inactives[i]==1
end
modparty=[]
for i in 0...6
modparty.push(party[partypos[i]])
end
scene=PokemonScreen_Scene.new
@switchscreen=PokemonScreen.new(scene,modparty)
@switchscreen.pbStartScene(_INTL("Choose a Pokémon."),
@battle.doublebattle && [email protected])
loop do
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
[email protected]
if cancancel && activecmd==-1
ret=-1
break
end
if activecmd>=0
commands=[]
cmdShift=-1
cmdSummary=-1
pkmnindex=partypos[activecmd]
commands[cmdShift=commands.length]=_INTL("Switch In") 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(@sprites,visiblesprites)
return ret
end
def pbDamageAnimation(pkmn,effectiveness)
[email protected]["pokemon#{pkmn.index}"]
[email protected]["shadow#{pkmn.index}"]
[email protected]["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,anim=false)
@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
if anim
if pkmn.hp>oldhp
pbCommonAnimation("HealthUp",pkmn,nil)
elsif pkmn.hp<oldhp
pbCommonAnimation("HealthDown",pkmn,nil)
end
end
[email protected]["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
@sprites["shadow#{pkmn.index}"].visible=false
[email protected]["pokemon#{pkmn.index}"]
pkmnsprite.visible=false
if @battle.pbIsOpposing?(pkmn.index)
ycoord=(@sprites["battler0"].visible && @battle.doublebattle) ? 118 : 130
tempvp=Viewport.new(0,0,Graphics.width,[email protected])
else
tempvp=Viewport.new(0,0,Graphics.width,[email protected])
end
[email protected]
tempsprite=SpriteWrapper.new(tempvp)
tempsprite.x=pkmnsprite.x
tempsprite.y=pkmnsprite.y
tempsprite.bitmap=pkmnsprite.bitmap
tempsprite.visible=true
pbSEPlay("faint")
20.times do
tempsprite.y+=8
pbGraphicsUpdate
pbInputUpdate
end
tempsprite.dispose
tempvp.dispose
8.times do
@sprites["battler#{pkmn.index}"].opacity-=32
pbGraphicsUpdate
pbInputUpdate
end
@sprites["battler#{pkmn.index}"].visible=false
pkmn.pbResetForm
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
@sprites["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
@sprites["battler#{battler.index}"].animateEXP(startexplevel,endexplevel)
while @sprites["battler#{battler.index}"].animatingEXP
pbGraphicsUpdate
pbInputUpdate
@sprites["battler#{battler.index}"].update
end
end
end
def pbShowPokedex(species)
pbFadeOutIn(99999){
scene=PokemonPokedexScene.new
screen=PokemonPokedex.new(scene)
screen.pbDexEntry(species)
}
end
def pbChangeSpecies(attacker,species)
[email protected]["pokemon#{attacker.index}"]
[email protected]["shadow#{attacker.index}"]
[email protected]?(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)
[email protected]["pokemon#{attacker.index}"]
[email protected]["shadow#{attacker.index}"]
[email protected]?(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 pbSaveShadows
shadows=[]
for i in 0...4
[email protected]["shadow#{i}"]
shadows[i]=s ? s.visible : false
s.visible=false if s
end
yield
for i in 0...4
[email protected]["shadow#{i}"]
s.visible=shadows[i] if s
end
end
def pbFindAnimation(moveid,userIndex)
begin
move2anim=load_data("Data/move2anim.dat")
noflip=false
if userIndex==0 || userIndex==2 # On player's side
anim=move2anim[0][moveid]
else # On opposing side
anim=move2anim[1][moveid]
noflip=true if anim
anim=move2anim[0][moveid] if !anim
end
return [anim,noflip] if anim
if hasConst?(PBMoves,:TACKLE)
anim=move2anim[0][getConst(PBMoves,:TACKLE)]
return [anim,false] 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[i] && animations[i].name=="Common:"+animname
pbAnimationCore(animations[i],attacker,opponent,side)
return
end
end
end
def pbAnimation(moveid,attacker,opponent,side=true)
animid=pbFindAnimation(moveid,attacker.index)
return if !animid
anim=animid[0]
animations=load_data("Data/PkmnAnimations.rxdata")
pbSaveShadows {
if animid[1] # On opposing side and using OppMove animation
pbAnimationCore(animations[anim],opponent,attacker,side)
else # On player's side, and/or using Move animation
pbAnimationCore(animations[anim],attacker,opponent,side)
end
}
if PBMoveData.new(moveid).function==0x69 && attacker && opponent # Transform
# Change form to transformed version
pbChangePokemon(attacker,opponent.pokemon)
end
end
def pbAnimationCore(animation,attacker,opponent,side=true)
return if !attacker || !animation
@briefmessage=false
user=(attacker) ? @sprites["pokemon#{attacker.index}"] : nil
target=(opponent) ? @sprites["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(128,224,384,98, # 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(128,224,384,98, # 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("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
pokemon.totalhp-oldtotalhp,
pokemon.attack-oldattack,
pokemon.defense-olddefense,
pokemon.spatk-oldspatk,
pokemon.spdef-oldspdef,
pokemon.speed-oldspeed))
pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
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
burst=-1
animations=load_data("Data/PkmnAnimations.rxdata")
for i in 0...2
t=(i==0) ? ball : 0
for j in 0...animations.length
if animations[j]
if animations[j].name=="Common:BallBurst#{t}"
burst=t if burst<0
break
end
end
end
break if burst>=0
end
pokeballThrow(ball,shakes,targetBattler,self,@battle.battlers[targetBattler],burst)
end
def pbThrowSuccess
if [email protected]
@briefmessage=false
pbMEPlay("Jingle - HMTM")
frames=(3.5*Graphics.frame_rate).to_i
frames.times do
pbGraphicsUpdate
pbInputUpdate
end
end
end
end
Friends
Showing Friends 1 to 17 of 17
-
~Angel~Seen June 4th, 2022 -
☆Rei☆Seen April 18th, 2021 -
Ace.Seen December 29th, 2015 -
C_r_e_a_m_p_u_f_fSeen May 19th, 2014 -
carmaniacSeen April 10th, 2023 -
DahDexySeen January 25th, 2013 -
Dradier234Seen June 2nd, 2014 -
HaxsaurusRexSeen March 7th, 2015 -
KytherSeen March 4th, 2021 -
mavy42Seen November 20th, 2015 -
PharetraSeen November 23rd, 2021 -
pokemonjsSeen July 24th, 2019 -
Radical RaptrSeen September 25th, 2022 -
Rayquaza.Seen January 24th, 2021 -
ShadowMirrorSeen April 13th, 2015 -
UnderMybrellaSeen February 7th, 2022 -
venom12Seen September 22nd, 2021
Recent Visitors
The last 30 visitor(s) to this page were:
- Aaron077
- AverageAlex
- deadman_6151_
- deadvaporeon
- Electric_Flare99
- felidaex
- HadCrs293
- Haowakeorden
- Haz'Zard
- Hazzarddb
- Judge Fudge
- Kotawo
- KushKush
- lautiizalazar
- Max Rebo
- Megan
- MessiDuvidoso
- Mr.BerGG
- Palamon
- Pepperton
- Pokedits
- Riondera
- seth_Angel
- stormbringer15
- TheBirdEmperor
- TKOA
- Venomous_Zero86
- Vortex137
- Wutsman
- भाग्य ज्योति
This page has had 11,124 visits


