Implemented GameData::Move

This commit is contained in:
Maruno17
2020-11-19 21:00:29 +00:00
parent 52ffae9e8a
commit 3cd8d59918
71 changed files with 1443 additions and 1584 deletions

View File

@@ -179,7 +179,7 @@ class CommandMenuDisplay < BattleMenuBase
def refreshButtons
return if !USE_GRAPHICS
for i in 0...4
for i in 0...@buttons.length
button = @buttons[i]
button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0
button.src_rect.y = MODES[@mode][i]*BUTTON_HEIGHT
@@ -218,7 +218,6 @@ class FightMenuDisplay < BattleMenuBase
Color.new(248,192,0),Color.new(144,104,0), # Yellow, 1/2 of total PP or less
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP
]
MAX_MOVES = 4 # Number of moves to display at once
def initialize(viewport,z)
super(viewport)
@@ -239,7 +238,7 @@ class FightMenuDisplay < BattleMenuBase
background.setBitmap("Graphics/Pictures/Battle/overlay_fight")
addSprite("background",background)
# Create move buttons
@buttons = Array.new(MAX_MOVES) do |i|
@buttons = Array.new(Pokemon::MAX_MOVES) do |i|
button = SpriteWrapper.new(viewport)
button.bitmap = @buttonBitmap.bitmap
button.x = self.x+4
@@ -337,20 +336,21 @@ class FightMenuDisplay < BattleMenuBase
if !USE_GRAPHICS
# Fill in command window
commands = []
moves.each { |m| commands.push((m && m.id>0) ? m.name : "-") }
for i in 0...[4, moves.length].max
commands.push((moves[i]) ? moves[i].name : "-")
end
@cmdWindow.commands = commands
return
end
# Draw move names onto overlay
@overlay.bitmap.clear
textPos = []
moves.each_with_index do |m,i|
button = @buttons[i]
@buttons.each_with_index do |button,i|
next if !@visibility["button_#{i}"]
x = button.x-self.x+button.src_rect.width/2
y = button.y-self.y+8
moveNameBase = TEXT_BASE_COLOR
if m.type>=0
if moves[i].type>=0
# NOTE: This takes a colour from a particular pixel in the button
# graphic and makes the move name's base colour that same colour.
# The pixel is at coordinates 10,34 in the button box. If you
@@ -358,7 +358,7 @@ class FightMenuDisplay < BattleMenuBase
# of code to ensure the font is an appropriate colour.
moveNameBase = button.bitmap.get_pixel(10,button.src_rect.y+34)
end
textPos.push([m.name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
textPos.push([moves[i].name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
end
pbDrawTextPositions(@overlay.bitmap,textPos)
end
@@ -368,7 +368,7 @@ class FightMenuDisplay < BattleMenuBase
if USE_GRAPHICS
# Choose appropriate button graphics and z positions
@buttons.each_with_index do |button,i|
if !moves[i] || moves[i].id==0
if !moves[i]
@visibility["button_#{i}"] = false
next
end
@@ -385,16 +385,16 @@ class FightMenuDisplay < BattleMenuBase
# Write PP and type of the selected move
if !USE_GRAPHICS
moveType = PBTypes.getName(move.type)
if move.totalpp<=0
if move.total_pp<=0
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}",moveType)
else
@msgBox.text = _ISPRINTF("PP: {1: 2d}/{2: 2d}<br>TYPE/{3:s}",
move.pp,move.totalpp,moveType)
move.pp,move.total_pp,moveType)
end
return
end
@infoOverlay.bitmap.clear
if !move || move.id==0
if !move
@visibility["typeIcon"] = false
return
end
@@ -402,10 +402,10 @@ class FightMenuDisplay < BattleMenuBase
# Type icon
@typeIcon.src_rect.y = move.type*TYPE_ICON_HEIGHT
# PP text
if move.totalpp>0
ppFraction = [(4.0*move.pp/move.totalpp).ceil,3].min
if move.total_pp>0
ppFraction = [(4.0*move.pp/move.total_pp).ceil,3].min
textPos = []
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.totalpp),
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.total_pp),
448,50,2,PP_COLORS[ppFraction*2],PP_COLORS[ppFraction*2+1]])
pbDrawTextPositions(@infoOverlay.bitmap,textPos)
end