class PokemonNewDataBox < SpriteWrapper
attr_reader :battler
attr_accessor :selected
attr_accessor :appearing
attr_reader :animatingHP
attr_reader :animatingEXP
def initialize(battler,doublebattle,viewport=nil,player=nil,scene=nil)
view = Viewport.new(viewport.rect.x,viewport.rect.y,viewport.rect.width,viewport.rect.height)
view.z = viewport.z + 1
viewport = view
super(viewport)
@scene=scene
@explevel=0
@player=player
@battler=battler
@doublebattle=doublebattle
@selected=0
@frame=0
@showhp=false
@showexp=false
@appearing=false
@animatingHP=false
@starthp=0
@currenthp=0
@endhp=0
@expflash=0
if (@battler.index&1)==0 # if player's Pokémon
@spritebaseX=34
@playerpoke=true
else
@spritebaseX=16
@playerpoke=false
end
if !doublebattle && @battler.index==0
@showhp=true
@showexp=true
end
@statuses=pbBitmap("#{checkEBFolderPath}/newStatuses")
@contents=BitmapWrapper.new(264,78)
self.bitmap=@contents
self.visible=false
self.z=50
refreshExpLevel
refresh
end
def dispose
@statuses.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_SceneConstants::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)
@starthp=oldhp
@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
end
def getBattler(battler)
return battler.effects[PBEffects::Illusion] if PBEffects.const_defined?(:Illusion) && battler.respond_to?('effects') && !battler.effects[PBEffects::Illusion].nil?
return battler
end
def refresh
self.bitmap.clear
return if !@battler.pokemon
if @playerpoke # Player Pokemon box
isOutsider=(@battler.pokemon.trainerID!=@player.id || (@battler.pokemon.language!=0 && @battler.pokemon.language!=@player.language))
y=0; y=1 if isOutsider;
self.bitmap.blt(22,0,pbBitmap("#{checkEBFolderPath}/bbtrans"),Rect.new(0,0,242,54))
y=0; y=32 if @doublebattle;
self.bitmap.blt(0,36,pbBitmap("#{checkEBFolderPath}/exparea"),Rect.new(0,y,262,32))
self.bitmap.blt(2,32,pbBitmap("#{checkEBFolderPath}/expbar"),Rect.new(0,y*34,self.exp,34)) if !@doublebattle
self.bitmap.blt(54,40,pbBitmap("#{checkEBFolderPath}/hparea"),Rect.new(0,0,180,16))
hpGaugeSize=PokeBattle_SceneConstants::HPGAUGESIZE
hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
hpgauge=2 if hpgauge==0 && self.hp > 0
hpzone=0
hpzone=1 if self.hp <=(@battler.totalhp/2).floor
hpzone=2 if self.hp <=(@battler.totalhp/3.5).floor
self.bitmap.blt(54,40,pbBitmap("#{checkEBFolderPath}/hpbars"),Rect.new(0,20*hpzone,6,20)) if self.hp > 0
self.bitmap.blt(60,40,pbBitmap("#{checkEBFolderPath}/hpbars"),Rect.new(6,20*hpzone,hpgauge,20))
self.bitmap.blt(60+hpgauge,40,pbBitmap("#{checkEBFolderPath}/hpbars"),Rect.new(174,20*hpzone,6,20)) if self.hp > 0
y=58; y-=26 if @doublebattle;
self.bitmap.blt(44,y,@statuses,Rect.new(0,17*(@battler.status-1),52,17)) if @battler.status > 0
self.bitmap.blt(22,34,pbBitmap("#{checkEBFolderPath}/mega_sym"),Rect.new(0,0,30,30)) if @battler.isMega?
if @battler.respond_to?(:isPrimal?) && @battler.isPrimal?
path=nil
path="Graphics/Pictures/battlePrimalAlphaBox.png" if @battler.species==PBSpecies::KYOGRE
path="Graphics/Pictures/battlePrimalOmegaBox.png" if @battler.species==PBSpecies::GROUDON
self.bitmap.blt(22,34,pbBitmap(path),Rect.new(0,0,30,30))
end
Alles anzeigen