mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 06:34:59 +00:00
Implemented GameData::Move
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -70,7 +70,7 @@ class PokeBattle_Scene
|
||||
cw = @sprites["fightWindow"]
|
||||
cw.battler = battler
|
||||
moveIndex = 0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id>0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id
|
||||
moveIndex = @lastMove[idxBattler]
|
||||
end
|
||||
cw.shiftMode = (@battle.pbCanShift?(idxBattler)) ? 1 : 0
|
||||
@@ -98,13 +98,13 @@ class PokeBattle_Scene
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index&1)==1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id>0
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id
|
||||
cw.index += 1 if (cw.index&1)==0
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index&2)==2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id>0
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id
|
||||
cw.index += 2 if (cw.index&2)==0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -383,13 +383,14 @@ class PokeBattle_Scene
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum=0)
|
||||
id_number = GameData::Move.get(moveID).id_number
|
||||
noFlip = false
|
||||
if (idxUser&1)==0 # On player's side
|
||||
anim = move2anim[0][moveID]
|
||||
anim = move2anim[0][id_number]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][moveID]
|
||||
anim = move2anim[1][id_number]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][moveID] if !anim
|
||||
anim = move2anim[0][id_number] if !anim
|
||||
end
|
||||
return [anim+hitNum,noFlip] if anim
|
||||
return nil
|
||||
@@ -399,62 +400,62 @@ class PokeBattle_Scene
|
||||
# animations, tries to use a default move animation depending on the move's
|
||||
# type. If that default move animation doesn't exist, trues to use Tackle's
|
||||
# move animation. Returns nil if it can't find any of these animations to use.
|
||||
def pbFindMoveAnimation(moveID,idxUser,hitNum)
|
||||
def pbFindMoveAnimation(moveID, idxUser, hitNum)
|
||||
begin
|
||||
move2anim = pbLoadMoveToAnim
|
||||
# Find actual animation requested (an opponent using the animation first
|
||||
# looks for an OppMove version then a Move version)
|
||||
anim = pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum)
|
||||
anim = pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum)
|
||||
return anim if anim
|
||||
# Actual animation not found, get the default animation for the move's type
|
||||
moveData = pbGetMoveData(moveID)
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
moveKind = moveData[MoveData::CATEGORY]
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData[MoveData::TARGET]) ||
|
||||
PBTargets.targetsFoeSide?(moveData[MoveData::TARGET])
|
||||
moveKind += 3 if moveKind==2 && moveData[MoveData::TARGET]!=PBTargets::User &&
|
||||
moveData[MoveData::TARGET]!=PBTargets::UserSide
|
||||
moveData = GameData::Move.get(moveID)
|
||||
moveType = moveData.type
|
||||
moveKind = moveData.category
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData.target) ||
|
||||
PBTargets.targetsFoeSide?(moveData.target)
|
||||
moveKind += 3 if moveKind == 2 && moveData.target != PBTargets::User &&
|
||||
moveData.target != PBTargets::UserSide
|
||||
# [one target physical, one target special, user status,
|
||||
# multiple targets physical, multiple targets special, non-user status]
|
||||
typeDefaultAnim = {
|
||||
:NORMAL => [:TACKLE,:SONICBOOM,:DEFENSECURL,:EXPLOSION,:SWIFT,:TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH,:AURASPHERE,:DETECT,nil,nil,nil],
|
||||
:FLYING => [:WINGATTACK,:GUST,:ROOST,nil,:AIRCUTTER,:FEATHERDANCE],
|
||||
:POISON => [:POISONSTING,:SLUDGE,:ACIDARMOR,nil,:ACID,:POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB,:MUDSLAP,nil,:EARTHQUAKE,:EARTHPOWER,:MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW,:POWERGEM,:ROCKPOLISH,:ROCKSLIDE,nil,:SANDSTORM],
|
||||
:BUG => [:TWINEEDLE,:BUGBUZZ,:QUIVERDANCE,nil,:STRUGGLEBUG,:STRINGSHOT],
|
||||
:GHOST => [:LICK,:SHADOWBALL,:GRUDGE,nil,nil,:CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD,:MIRRORSHOT,:IRONDEFENSE,nil,nil,:METALSOUND],
|
||||
:FIRE => [:FIREPUNCH,:EMBER,:SUNNYDAY,nil,:INCINERATE,:WILLOWISP],
|
||||
:WATER => [:CRABHAMMER,:WATERGUN,:AQUARING,nil,:SURF,:WATERSPORT],
|
||||
:GRASS => [:VINEWHIP,:MEGADRAIN,:COTTONGUARD,:RAZORLEAF,nil,:SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH,:THUNDERSHOCK,:CHARGE,nil,:DISCHARGE,:THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT,:CONFUSION,:CALMMIND,nil,:SYNCHRONOISE,:MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH,:ICEBEAM,:MIST,nil,:POWDERSNOW,:HAIL],
|
||||
:DRAGON => [:DRAGONCLAW,:DRAGONRAGE,:DRAGONDANCE,nil,:TWISTER,nil],
|
||||
:DARK => [:PURSUIT,:DARKPULSE,:HONECLAWS,nil,:SNARL,:EMBARGO],
|
||||
:FAIRY => [:TACKLE,:FAIRYWIND,:MOONLIGHT,nil,:SWIFT,:SWEETKISS]
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :EXPLOSION, :SWIFT, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :DETECT, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
:POISON => [:POISONSTING, :SLUDGE, :ACIDARMOR, nil, :ACID, :POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB, :MUDSLAP, nil, :EARTHQUAKE, :EARTHPOWER, :MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW, :POWERGEM, :ROCKPOLISH, :ROCKSLIDE, nil, :SANDSTORM],
|
||||
:BUG => [:TWINEEDLE, :BUGBUZZ, :QUIVERDANCE, nil, :STRUGGLEBUG, :STRINGSHOT],
|
||||
:GHOST => [:LICK, :SHADOWBALL, :GRUDGE, nil, nil, :CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD, :MIRRORSHOT, :IRONDEFENSE, nil, nil, :METALSOUND],
|
||||
:FIRE => [:FIREPUNCH, :EMBER, :SUNNYDAY, nil, :INCINERATE, :WILLOWISP],
|
||||
:WATER => [:CRABHAMMER, :WATERGUN, :AQUARING, nil, :SURF, :WATERSPORT],
|
||||
:GRASS => [:VINEWHIP, :MEGADRAIN, :COTTONGUARD, :RAZORLEAF, nil, :SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH, :THUNDERSHOCK, :CHARGE, nil, :DISCHARGE, :THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT, :CONFUSION, :CALMMIND, nil, :SYNCHRONOISE, :MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH, :ICEBEAM, :MIST, nil, :POWDERSNOW, :HAIL],
|
||||
:DRAGON => [:DRAGONCLAW, :DRAGONRAGE, :DRAGONDANCE, nil, :TWISTER, nil],
|
||||
:DARK => [:PURSUIT, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :SWIFT, :SWEETKISS]
|
||||
}
|
||||
typeDefaultAnim.each do |type, anims|
|
||||
next if !isConst?(moveType,PBTypes,type)
|
||||
if anims[moveKind] && hasConst?(PBMoves,anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind]),idxUser)
|
||||
next if !isConst?(moveType, PBTypes, type)
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if moveKind>=3 && anims[moveKind-3] && hasConst?(PBMoves,anims[moveKind-3])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind-3]),idxUser)
|
||||
if moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if anims[2] && hasConst?(PBMoves,anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[2]),idxUser)
|
||||
if GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
end
|
||||
break
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
if hasConst?(PBMoves,:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim,getConst(PBMoves,:TACKLE),idxUser)
|
||||
if GameData::Move.exists?(:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim, :TACKLE, idxUser)
|
||||
end
|
||||
rescue
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user