Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WILD_POKEMON_NAMES = %w|
- Karen
- Regina
- Gretchen
- |
- class Array
- def sample
- self[rand(self.length)]
- end
- end
- class PokeBattle_Battler
- attr_accessor :wild_name
- end
- class PokemonDataBox
- def get_battler_name
- unless @battler.wild_name
- @battler.wild_name = WILD_POKEMON_NAMES.sample
- end
- if (@battler.index & 1) == 1
- @battler.wild_name
- else
- @battler.name
- end
- 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))
- base = Color.new(72,72,72)
- shadow = Color.new(184,184,184)
- pbSetSystemFont(self.bitmap)
- textpos = []
- imagepos = []
- # Draw Pokémon's name
- textpos.push([get_battler_name,@spritebaseX+8,6,false,base,shadow])
- # Draw Pokémon's gender symbol
- genderX = self.bitmap.text_size(@battler.name).width
- genderX += @spritebaseX+14
- case @battler.displayGender
- when 0 # Male
- textpos.push([_INTL("♂"),genderX,6,false,Color.new(48,96,216),shadow])
- when 1 # Female
- textpos.push([_INTL("♀"),genderX,6,false,Color.new(248,88,40),shadow])
- end
- pbDrawTextPositions(self.bitmap,textpos)
- # Draw Pokémon's level
- pbSetSmallFont(self.bitmap)
- imagepos.push(["Graphics/Pictures/Battle/overlay_lv",
- @spritebaseX+180-self.bitmap.text_size(@battler.level.to_s).width,16,0,0,-1,-1])
- textpos = [
- [@battler.level.to_s,@spritebaseX+202,8,true,base,shadow]
- ]
- # Draw Pokémon's HP numbers
- if @showhp
- hpstring = _ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
- textpos.push([hpstring,@spritebaseX+188,48,true,base,shadow])
- end
- pbDrawTextPositions(self.bitmap,textpos)
- # Draw shiny icon
- if @battler.isShiny?
- shinyX = ((@battler.index&1)==0) ? -6 : 206 # Player's/foe's
- imagepos.push(["Graphics/Pictures/shiny",@spritebaseX+shinyX,36,0,0,-1,-1])
- end
- # Draw Mega Evolution/Primal Reversion icon
- if @battler.isMega?
- imagepos.push(["Graphics/Pictures/Battle/icon_mega",@spritebaseX+8,34,0,0,-1,-1])
- elsif @battler.isPrimal?
- if isConst?(@battler.pokemon.species,PBSpecies,:KYOGRE)
- imagepos.push(["Graphics/Pictures/Battle/icon_primal_Kyogre",@spritebaseX+140,4,0,0,-1,-1])
- elsif isConst?(@battler.pokemon.species,PBSpecies,:GROUDON)
- imagepos.push(["Graphics/Pictures/Battle/icon_primal_Groudon",@spritebaseX+140,4,0,0,-1,-1])
- end
- end
- # Draw owned icon (foe Pokémon only)
- if @battler.owned && (@battler.index&1)==1
- imagepos.push(["Graphics/Pictures/Battle/icon_own",@spritebaseX+8,36,0,0,-1,-1])
- end
- # Draw status icon
- if @battler.status>0
- iconheight = 16
- self.bitmap.blt(@spritebaseX+24,36,@statuses.bitmap,
- Rect.new(0,(@battler.status-1)*iconheight,@statuses.bitmap.width,iconheight))
- end
- # Draw HP bar
- hpgauge = (@battler.totalhp==0) ? 0 : self.hp*@hpbar.bitmap.width/@battler.totalhp
- hpgauge = 2 if hpgauge<2 && self.hp>0
- hpzone = 0
- hpzone = 1 if self.hp<=(@battler.totalhp/2).floor
- hpzone = 2 if self.hp<=(@battler.totalhp/4).floor
- if @animatingHP && self.hp>0 # fill with black (shows what the HP used to be)
- self.bitmap.fill_rect(@spritebaseX+102,40,
- @starthp*@hpbar.bitmap.width/@battler.totalhp,@hpbar.bitmap.height/3,Color.new(0,0,0))
- end
- self.bitmap.blt(@spritebaseX+102,40,@hpbar.bitmap,
- Rect.new(0,hpzone*@hpbar.bitmap.height/3,hpgauge,@hpbar.bitmap.height/3))
- # Draw Exp bar
- if @showexp
- self.bitmap.blt(@spritebaseX+6,76,@expbar.bitmap,
- Rect.new(0,0,self.exp,@expbar.bitmap.height))
- end
- pbDrawImagePositions(self.bitmap,imagepos)
- end
- end
Add Comment
Please, Sign In to add comment