mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Combined overwriting code from the new animation editor files
This commit is contained in:
@@ -32,34 +32,34 @@ class Battle::Scene
|
||||
# Create message box graphic
|
||||
messageBox = pbAddSprite("messageBox", 0, Graphics.height - 96,
|
||||
"Graphics/UI/Battle/overlay_message", @viewport)
|
||||
messageBox.z = 195
|
||||
messageBox.z = 10195
|
||||
# Create message window (displays the message)
|
||||
msgWindow = Window_AdvancedTextPokemon.newWithSize(
|
||||
"", 16, Graphics.height - 96 + 2, Graphics.width - 32, 96, @viewport
|
||||
)
|
||||
msgWindow.z = 200
|
||||
msgWindow.z = 10200
|
||||
msgWindow.opacity = 0
|
||||
msgWindow.baseColor = MESSAGE_BASE_COLOR
|
||||
msgWindow.shadowColor = MESSAGE_SHADOW_COLOR
|
||||
msgWindow.letterbyletter = true
|
||||
@sprites["messageWindow"] = msgWindow
|
||||
# Create command window
|
||||
@sprites["commandWindow"] = CommandMenu.new(@viewport, 200)
|
||||
@sprites["commandWindow"] = CommandMenu.new(@viewport, 10200)
|
||||
# Create fight window
|
||||
@sprites["fightWindow"] = FightMenu.new(@viewport, 200)
|
||||
@sprites["fightWindow"] = FightMenu.new(@viewport, 10200)
|
||||
# Create targeting window
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport, 200, @battle.sideSizes)
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport, 10200, @battle.sideSizes)
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
# The party lineup graphics (bar and balls) for both sides
|
||||
2.times do |side|
|
||||
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
|
||||
"Graphics/UI/Battle/overlay_lineup", @viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.z = 10120
|
||||
partyBar.mirror = true if side == 0 # Player's lineup bar only
|
||||
partyBar.visible = false
|
||||
NUM_BALLS.times do |i|
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
|
||||
ball.z = 121
|
||||
ball.z = 10121
|
||||
ball.visible = false
|
||||
end
|
||||
# Ability splash bars
|
||||
@@ -136,22 +136,22 @@ class Battle::Scene
|
||||
messageBG = "Graphics/Battlebacks/" + messageFilename + "_message"
|
||||
# Apply graphics
|
||||
bg = pbAddSprite("battle_bg", 0, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.z = -200
|
||||
bg = pbAddSprite("battle_bg2", -Graphics.width, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.z = -200
|
||||
bg.mirror = true
|
||||
2.times do |side|
|
||||
baseX, baseY = Battle::Scene.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}", baseX, baseY,
|
||||
(side == 0) ? playerBase : enemyBase, @viewport)
|
||||
base.z = 1
|
||||
base.z = -199
|
||||
if base.bitmap
|
||||
base.ox = base.bitmap.width / 2
|
||||
base.oy = (side == 0) ? base.bitmap.height : base.bitmap.height / 2
|
||||
end
|
||||
end
|
||||
cmdBarBG = pbAddSprite("cmdBar_bg", 0, Graphics.height - 96, messageBG, @viewport)
|
||||
cmdBarBG.z = 180
|
||||
cmdBarBG.z = 10180
|
||||
end
|
||||
|
||||
def pbCreateTrainerBackSprite(idxTrainer, trainerType, numTrainers = 1)
|
||||
@@ -164,7 +164,7 @@ class Battle::Scene
|
||||
trainer = pbAddSprite("player_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 80 + idxTrainer
|
||||
trainer.z = 1500 + (idxTrainer * 100)
|
||||
if trainer.bitmap.width > trainer.bitmap.height * 2
|
||||
trainer.src_rect.x = 0
|
||||
trainer.src_rect.width = trainer.bitmap.width / 5
|
||||
@@ -179,7 +179,7 @@ class Battle::Scene
|
||||
trainer = pbAddSprite("trainer_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 7 + idxTrainer
|
||||
trainer.z = 500 - (idxTrainer * 100)
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
@@ -2,6 +2,28 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Scene
|
||||
ANIMATION_DEFAULTS = [:TACKLE, :DEFENSECURL] # With target, without target
|
||||
ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY = {
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :BODYSLAM, nil, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :BULKUP, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
:POISON => [:POISONSTING, :SLUDGE, :ACIDARMOR, nil, :ACID, :POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB, :MUDSLAP, :MUDSPORT, :EARTHQUAKE, :EARTHPOWER, :SANDATTACK],
|
||||
:ROCK => [:ROCKTHROW, :POWERGEM, :ROCKPOLISH, :ROCKSLIDE, nil, :SANDSTORM],
|
||||
:BUG => [:TWINEEDLE, :BUGBUZZ, :QUIVERDANCE, nil, :STRUGGLEBUG, :STRINGSHOT],
|
||||
:GHOST => [:ASTONISH, :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, :RAZORLEAF, :COTTONGUARD, nil, nil, :SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH, :THUNDERSHOCK, :CHARGE, nil, :DISCHARGE, :THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT, :CONFUSION, :CALMMIND, nil, :SYNCHRONOISE, :MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH, :ICEBEAM, :MIST, :AVALANCHE, :POWDERSNOW, :HAIL],
|
||||
:DRAGON => [:DRAGONCLAW, :DRAGONRAGE, :DRAGONDANCE, nil, :TWISTER, nil],
|
||||
:DARK => [:KNOCKOFF, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :DAZZLINGGLEAM, :SWEETKISS]
|
||||
}
|
||||
|
||||
# Animates the battle intro.
|
||||
def pbBattleIntroAnimation
|
||||
# Make everything appear
|
||||
@@ -377,7 +399,7 @@ class Battle::Scene
|
||||
throwAnim.dispose
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Hides all battler shadows before yielding to a move animation, and then
|
||||
# restores the shadows afterwards.
|
||||
@@ -399,119 +421,241 @@ class Battle::Scene
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Loads a move/common animation.
|
||||
# Loads a move animation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# 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)
|
||||
real_move_id = GameData::Move.try_get(moveID)&.id || moveID
|
||||
noFlip = false
|
||||
if (idxUser & 1) == 0 # On player's side
|
||||
anim = move2anim[0][real_move_id]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][real_move_id]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][real_move_id] if !anim
|
||||
# Returns an array of GameData::Animation if a new animation(s) is found.
|
||||
# Return [animation index, shouldn't be flipped] if an old animation is found.
|
||||
def find_move_animation(move_id, version, user_index)
|
||||
# Get animation
|
||||
anims = find_move_animation_for_move(move_id, version, user_index)
|
||||
return anims if anims
|
||||
# Get information to decide which default animation to try
|
||||
move_data = GameData::Move.get(move_id)
|
||||
target_data = GameData::Target.get(move_data.target)
|
||||
move_type = move_data.type
|
||||
default_idx = move_data.category
|
||||
default_idx += 3 if target_data.num_targets > 1 ||
|
||||
(target_data.num_targets > 0 && move_data.status?)
|
||||
# Check for a default animation
|
||||
wanted_move = ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY[move_type][default_idx]
|
||||
anims = find_move_animation_for_move(wanted_move, 0, user_index)
|
||||
return anims if anims
|
||||
if default_idx >= 3
|
||||
wanted_move = ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY[move_type][default_idx - 3]
|
||||
anims = find_move_animation_for_move(wanted_move, 0, user_index)
|
||||
return anims if anims
|
||||
return nil if ANIMATION_DEFAULTS.include?(wanted_move) # No need to check for these animations twice
|
||||
end
|
||||
return [anim + hitNum, noFlip] if anim
|
||||
# Use Tackle or Defense Curl's animation
|
||||
if target_data.num_targets == 0 && target.data.id != :None
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[1], 0, user_index)
|
||||
end
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[0], 0, user_index)
|
||||
end
|
||||
|
||||
# Find an animation(s) for the given move_id.
|
||||
def find_move_animation_for_move(move_id, version, user_index)
|
||||
# Find new animation
|
||||
anims = try_get_better_move_animation(move_id, version, user_index)
|
||||
return anims if anims
|
||||
if version > 0
|
||||
anims = try_get_better_move_animation(move_id, 0, user_index)
|
||||
return anims if anims
|
||||
end
|
||||
# Find old animation
|
||||
anim = pbFindMoveAnimDetails(move_id, user_index, version)
|
||||
return anim
|
||||
end
|
||||
|
||||
# Finds a new animation for the given move_id and version. Prefers opposing
|
||||
# animations if the user is opposing. Can return multiple animations.
|
||||
def try_get_better_move_animation(move_id, version, user_index)
|
||||
ret = []
|
||||
backup_ret = []
|
||||
GameData::Animation.each do |anim|
|
||||
next if !anim.move_animation? || anim.ignore
|
||||
next if anim.move != move_id.to_s
|
||||
next if anim.version != version
|
||||
if !user_index
|
||||
ret.push(anim)
|
||||
next
|
||||
end
|
||||
if user_index.even? # User is on player's side
|
||||
ret.push(anim) if !anim.opposing_animation?
|
||||
else # User is on opposing side
|
||||
(anim.opposing_animation?) ? ret.push(anim) : backup_ret.push(anim)
|
||||
end
|
||||
end
|
||||
return ret if !ret.empty?
|
||||
return backup_ret if !backup_ret.empty?
|
||||
return nil
|
||||
end
|
||||
|
||||
# Returns the animation ID to use for a given move. If the move has no
|
||||
# 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)
|
||||
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)
|
||||
return anim if anim
|
||||
# Actual animation not found, get the default animation for the move's type
|
||||
moveData = GameData::Move.get(moveID)
|
||||
target_data = GameData::Target.get(moveData.target)
|
||||
moveType = moveData.type
|
||||
moveKind = moveData.category
|
||||
moveKind += 3 if target_data.num_targets > 1 || target_data.affects_foe_side
|
||||
moveKind += 3 if moveData.status? && target_data.num_targets > 0
|
||||
# [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]
|
||||
}
|
||||
if typeDefaultAnim[moveType]
|
||||
anims = typeDefaultAnim[moveType]
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(moveID, idxUser, hitNum = 0)
|
||||
real_move_id = GameData::Move.try_get(moveID)&.id || moveID
|
||||
anims = pbLoadBattleAnimations
|
||||
return nil if !anims
|
||||
anim_id = -1
|
||||
foe_anim_id = -1
|
||||
no_flip = false
|
||||
anims.length.times do |i|
|
||||
next if !anims[i]
|
||||
if anims[i].name[/^OppMove\:\s*(.*)$/]
|
||||
if GameData::Move.exists?($~[1])
|
||||
moveid = GameData::Move.get($~[1]).id
|
||||
foe_anim_id = i if moveid == real_move_id
|
||||
end
|
||||
if !anim && moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
if !anim && GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
elsif anims[i].name[/^Move\:\s*(.*)$/]
|
||||
if GameData::Move.exists?($~[1])
|
||||
moveid = GameData::Move.get($~[1]).id
|
||||
anim_id = i if moveid == real_move_id
|
||||
end
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
if GameData::Move.exists?(:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim, :TACKLE, idxUser)
|
||||
end
|
||||
rescue
|
||||
end
|
||||
if (idxUser & 1) == 0 # On player's side
|
||||
anim = anim_id
|
||||
else # On opposing side
|
||||
anim = foe_anim_id
|
||||
no_flip = true if anim >= 0
|
||||
anim = anim_id if anim < 0
|
||||
end
|
||||
return [anim + hitNum, no_flip] if anim >= 0
|
||||
return nil
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Loads a common animation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def try_get_better_common_animation(anim_name, user_index)
|
||||
# Find a new format common animation to play
|
||||
ret = []
|
||||
backup_ret = []
|
||||
GameData::Animation.each do |anim|
|
||||
next if !anim.common_animation? || anim.ignore
|
||||
next if anim.move != anim_name
|
||||
if !user_index
|
||||
ret.push(anim)
|
||||
next
|
||||
end
|
||||
if user_index.even? # User is on player's side
|
||||
ret.push(anim) if !anim.opposing_animation?
|
||||
else # User is on opposing side
|
||||
(anim.opposing_animation?) ? ret.push(anim) : backup_ret.push(anim)
|
||||
end
|
||||
end
|
||||
return ret if !ret.empty?
|
||||
return backup_ret if !backup_ret.empty?
|
||||
# Find an old format common animation to play
|
||||
target = target[0] if target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return nil if !animations
|
||||
animations.each do |anim|
|
||||
next if !anim || anim.name != "Common:" + anim_name
|
||||
ret = anim
|
||||
break
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Plays a move/common animation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Plays a move animation.
|
||||
def pbAnimation(moveID, user, targets, hitNum = 0)
|
||||
animID = pbFindMoveAnimation(moveID, user.index, hitNum)
|
||||
return if !animID
|
||||
anim = animID[0]
|
||||
target = (targets.is_a?(Array)) ? targets[0] : targets
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
pbSaveShadows do
|
||||
if animID[1] # On opposing side and using OppMove animation
|
||||
pbAnimationCore(animations[anim], target, user, true)
|
||||
else # On player's side, and/or using Move animation
|
||||
pbAnimationCore(animations[anim], user, target)
|
||||
def pbAnimation(move_id, user, targets, version = 0)
|
||||
anims = find_move_animation(move_id, version, user&.index)
|
||||
return if !anims || anims.empty?
|
||||
if anims[0].is_a?(GameData::Animation) # New format animation
|
||||
pbSaveShadows do
|
||||
# NOTE: anims.sample is a random valid animation.
|
||||
play_better_animation(anims.sample, user, targets)
|
||||
end
|
||||
else # Old format animation
|
||||
anim = anims[0]
|
||||
target = (targets.is_a?(Array)) ? targets[0] : targets
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
pbSaveShadows do
|
||||
if anims[1] # On opposing side and using OppMove animation
|
||||
pbAnimationCore(animations[anim], target, user, true)
|
||||
else # On player's side, and/or using Move animation
|
||||
pbAnimationCore(animations[anim], user, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName, user = nil, target = nil)
|
||||
return if nil_or_empty?(animName)
|
||||
target = target[0] if target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
animations.each do |a|
|
||||
next if !a || a.name != "Common:" + animName
|
||||
pbAnimationCore(a, user, target || user)
|
||||
def pbCommonAnimation(anim_name, user = nil, target = nil)
|
||||
return if nil_or_empty?(anim_name)
|
||||
# Find an animation to play (new format or old format)
|
||||
anims = try_get_better_common_animation(anim_name, user.index)
|
||||
return if !anims
|
||||
# Play a new format animation
|
||||
if anims.is_a?(Array)
|
||||
# NOTE: anims.sample is a random valid animation.
|
||||
play_better_animation(anims.sample, user, target)
|
||||
return
|
||||
end
|
||||
# Play an old format animation
|
||||
target = target[0] if target.is_a?(Array)
|
||||
pbAnimationCore(anims, user, target || user)
|
||||
end
|
||||
|
||||
# Ball burst common animations should have a focus of "Target" and a priority
|
||||
# of "Front".
|
||||
# TODO: This is unused. It also doesn't support the new animation format.
|
||||
def pbBallBurstCommonAnimation(_picture_ex, anim_name, battler, target_x, target_y)
|
||||
return if nil_or_empty?(anim_name)
|
||||
animations = pbLoadBattleAnimations
|
||||
anim = animations&.get_from_name("Common:" + anim_name)
|
||||
return if !anim
|
||||
animPlayer = PBAnimationPlayerX.new(anim, battler, nil, self)
|
||||
animPlayer.discard_user_and_target_sprites # Don't involve user/target in animation
|
||||
animPlayer.set_target_origin(target_x, target_y)
|
||||
animPlayer.start
|
||||
@animations.push(animPlayer)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def play_better_animation(anim_data, user, targets)
|
||||
return if !anim_data
|
||||
@briefMessage = false
|
||||
# Memorize old battler coordinates, to be reset after the animation
|
||||
old_battler_coords = []
|
||||
if user
|
||||
sprite = @sprites["pokemon_#{user.index}"]
|
||||
old_battler_coords[user.index] = [sprite.x, sprite.y]
|
||||
end
|
||||
if targets
|
||||
targets.each do |target|
|
||||
sprite = @sprites["pokemon_#{target.index}"]
|
||||
old_battler_coords[target.index] = [sprite.x, sprite.y]
|
||||
end
|
||||
end
|
||||
# Create animation player
|
||||
anim_player = AnimationPlayer.new(anim_data, user, targets, self)
|
||||
anim_player.set_up
|
||||
# Play animation
|
||||
anim_player.start
|
||||
loop do
|
||||
pbUpdate
|
||||
anim_player.update
|
||||
break if anim_player.can_continue_battle?
|
||||
end
|
||||
anim_player.dispose
|
||||
# Restore old battler coordinates
|
||||
old_battler_coords.each_with_index do |values, i|
|
||||
next if !values
|
||||
sprite = @sprites["pokemon_#{i}"]
|
||||
sprite.x = values[0]
|
||||
sprite.y = values[1]
|
||||
end
|
||||
end
|
||||
|
||||
def pbAnimationCore(animation, user, target, oppMove = false)
|
||||
@@ -558,18 +702,4 @@ class Battle::Scene
|
||||
targetSprite.pbSetOrigin
|
||||
end
|
||||
end
|
||||
|
||||
# Ball burst common animations should have a focus of "Target" and a priority
|
||||
# of "Front".
|
||||
def pbBallBurstCommonAnimation(_picture_ex, anim_name, battler, target_x, target_y)
|
||||
return if nil_or_empty?(anim_name)
|
||||
animations = pbLoadBattleAnimations
|
||||
anim = animations&.get_from_name("Common:" + anim_name)
|
||||
return if !anim
|
||||
animPlayer = PBAnimationPlayerX.new(anim, battler, nil, self)
|
||||
animPlayer.discard_user_and_target_sprites # Don't involve user/target in animation
|
||||
animPlayer.set_target_origin(target_x, target_y)
|
||||
animPlayer.start
|
||||
@animations.push(animPlayer)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,7 +98,7 @@ class Battle::Scene::PokemonDataBox < Sprite
|
||||
@contents = Bitmap.new(@databoxBitmap.width, @databoxBitmap.height)
|
||||
self.bitmap = @contents
|
||||
self.visible = false
|
||||
self.z = 150 + ((@battler.index / 2) * 5)
|
||||
self.z = 10150 + ((@battler.index / 2) * 5)
|
||||
pbSetSystemFont(self.bitmap)
|
||||
end
|
||||
|
||||
@@ -438,7 +438,7 @@ class Battle::Scene::AbilitySplashBar < Sprite
|
||||
# Position the bar
|
||||
self.x = (side == 0) ? -Graphics.width / 2 : Graphics.width
|
||||
self.y = (side == 0) ? 180 : 80
|
||||
self.z = 120
|
||||
self.z = 10120
|
||||
self.visible = false
|
||||
end
|
||||
|
||||
@@ -578,9 +578,9 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
return if !@_iconBitmap
|
||||
pbSetOrigin
|
||||
if @index.even?
|
||||
self.z = 50 + (5 * @index / 2)
|
||||
self.z = 1100 + (100 * @index / 2)
|
||||
else
|
||||
self.z = 50 - (5 * (@index + 1) / 2)
|
||||
self.z = 1000 - (100 * (@index + 1) / 2)
|
||||
end
|
||||
# Set original position
|
||||
p = Battle::Scene.pbBattlerPosition(@index, @sideSize)
|
||||
@@ -672,7 +672,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
def pbSetPosition
|
||||
return if !@_iconBitmap
|
||||
pbSetOrigin
|
||||
self.z = 3
|
||||
self.z = -198
|
||||
# Set original position
|
||||
p = Battle::Scene.pbBattlerPosition(@index, @sideSize)
|
||||
self.x = p[0]
|
||||
|
||||
@@ -367,7 +367,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
glare1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[11]}", PictureOrigin::CENTER)
|
||||
glare2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[8]}", PictureOrigin::CENTER)
|
||||
[glare1, glare2].each_with_index do |particle, num|
|
||||
particle.setZ(0, 105 + num)
|
||||
particle.setZ(0, 5105 + num)
|
||||
particle.setZoom(0, 0)
|
||||
particle.setTone(0, variances[12 - (3 * num)])
|
||||
particle.setVisible(0, false)
|
||||
@@ -405,7 +405,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
ray = addNewSprite(ballX + (ray_min_radius * Math.cos(radian)),
|
||||
ballY - (ray_min_radius * Math.sin(radian)),
|
||||
"Graphics/Battle animations/ballBurst_ray", PictureOrigin::BOTTOM)
|
||||
ray.setZ(0, 100)
|
||||
ray.setZ(0, 5100)
|
||||
ray.setZoomXY(0, 200, start_zoom)
|
||||
ray.setTone(0, variances[0]) if poke_ball != :CHERISHBALL
|
||||
ray.setOpacity(0, 0)
|
||||
@@ -432,7 +432,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
particle1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[5]}", PictureOrigin::CENTER)
|
||||
particle2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[2]}", PictureOrigin::CENTER)
|
||||
[particle1, particle2].each_with_index do |particle, num|
|
||||
particle.setZ(0, 110 + num)
|
||||
particle.setZ(0, 5110 + num)
|
||||
particle.setZoom(0, (80 - (num * 20)) / (["ring2"].include?(variances[5 - (3 * num)]) ? 2 : 1))
|
||||
particle.setTone(0, variances[6 - (3 * num)])
|
||||
particle.setVisible(0, false)
|
||||
@@ -580,7 +580,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
glare2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[3]}", PictureOrigin::CENTER)
|
||||
glare3 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[0]}", PictureOrigin::CENTER)
|
||||
[glare1, glare2, glare3].each_with_index do |particle, num|
|
||||
particle.setZ(0, 100 + num)
|
||||
particle.setZ(0, 5100 + num)
|
||||
particle.setZoom(0, 0)
|
||||
particle.setTone(0, variances[7 - (3 * num)])
|
||||
particle.setVisible(0, false)
|
||||
@@ -618,7 +618,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
num_particles.times do |i|
|
||||
# Set up particle that keeps moving out
|
||||
particle1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
|
||||
particle1.setZ(0, 105)
|
||||
particle1.setZ(0, 5105)
|
||||
particle1.setZoom(0, 150)
|
||||
particle1.setOpacity(0, 160)
|
||||
particle1.setVisible(0, false)
|
||||
@@ -626,7 +626,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
particle2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[12]}", PictureOrigin::CENTER)
|
||||
particle3 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[9]}", PictureOrigin::CENTER)
|
||||
[particle2, particle3].each_with_index do |particle, num|
|
||||
particle.setZ(0, 110 + num)
|
||||
particle.setZ(0, 5110 + num)
|
||||
particle.setZoom(0, (poke_ball == :NESTBALL) ? 50 : 0)
|
||||
particle.setTone(0, variances[13 - (3 * num)])
|
||||
particle.setVisible(0, false)
|
||||
@@ -690,7 +690,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
# Web sprite (for Net Ball)
|
||||
if poke_ball == :NETBALL
|
||||
web = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_web", PictureOrigin::CENTER)
|
||||
web.setZ(0, 123)
|
||||
web.setZ(0, 5123)
|
||||
web.setZoom(0, 120)
|
||||
web.setOpacity(0, 0)
|
||||
web.setTone(0, Tone.new(-32, -32, -128))
|
||||
@@ -710,7 +710,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
end
|
||||
# Ring particle
|
||||
ring = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_ring1", PictureOrigin::CENTER)
|
||||
ring.setZ(0, 110)
|
||||
ring.setZ(0, 5110)
|
||||
ring.setZoom(0, 0)
|
||||
ring.setTone(0, variances[15])
|
||||
ring.setVisible(0, false)
|
||||
@@ -735,7 +735,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
3.times do |i| # Left, middle, right
|
||||
# Set up particle
|
||||
star = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_star", PictureOrigin::CENTER)
|
||||
star.setZ(0, 110)
|
||||
star.setZ(0, 5110)
|
||||
star.setZoom(0, [50, 50, 33][i])
|
||||
start_angle = [0, 345, 15][i]
|
||||
star.setAngle(0, start_angle)
|
||||
@@ -775,7 +775,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
num_particles.times do |i|
|
||||
# Set up particle
|
||||
particle = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
|
||||
particle.setZ(0, 110)
|
||||
particle.setZ(0, 5110)
|
||||
particle.setZoom(0, 150)
|
||||
particle.setOpacity(0, 0)
|
||||
particle.setVisible(0, false)
|
||||
@@ -807,11 +807,11 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
end
|
||||
# Ring particles
|
||||
ring1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_ring1", PictureOrigin::CENTER)
|
||||
ring1.setZ(0, 110)
|
||||
ring1.setZ(0, 5110)
|
||||
ring1.setZoom(0, 0)
|
||||
ring1.setVisible(0, false)
|
||||
ring2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_ring2", PictureOrigin::CENTER)
|
||||
ring2.setZ(0, 110)
|
||||
ring2.setZ(0, 5110)
|
||||
ring2.setVisible(0, false)
|
||||
# Ring particle animations
|
||||
ring1.setVisible(delay + burst_duration - 2, true)
|
||||
|
||||
@@ -38,12 +38,12 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
||||
end
|
||||
# Fading blackness over whole screen
|
||||
blackScreen = addNewSprite(0, 0, "Graphics/Battle animations/black_screen")
|
||||
blackScreen.setZ(0, 999)
|
||||
blackScreen.setZ(0, 99999)
|
||||
blackScreen.moveOpacity(0, 8, 0)
|
||||
# Fading blackness over command bar
|
||||
blackBar = addNewSprite(@sprites["cmdBar_bg"].x, @sprites["cmdBar_bg"].y,
|
||||
"Graphics/Battle animations/black_bar")
|
||||
blackBar.setZ(0, 998)
|
||||
blackBar.setZ(0, 99998)
|
||||
blackBar.moveOpacity(appearTime * 3 / 4, appearTime / 4, 0)
|
||||
end
|
||||
|
||||
@@ -419,7 +419,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
|
||||
ballMidY = battlerStartY - 144
|
||||
# Set up Poké Ball sprite
|
||||
ball = addBallSprite(ballStartX, ballStartY, poke_ball)
|
||||
ball.setZ(0, 25)
|
||||
ball.setZ(0, 1025)
|
||||
ball.setVisible(0, false)
|
||||
# Poké Ball tracking the player's hand animation (if trainer is visible)
|
||||
if @showingTrainer && traSprite && traSprite.x > 0
|
||||
@@ -835,7 +835,7 @@ class Battle::Scene::Animation::PokeballThrowDeflect < Battle::Scene::Animation
|
||||
ballEndY = 112
|
||||
# Set up Poké Ball sprite
|
||||
ball = addBallSprite(ballStartX, ballStartY, @poke_ball)
|
||||
ball.setZ(0, 90)
|
||||
ball.setZ(0, 5090)
|
||||
# Poké Ball arc animation
|
||||
ball.setSE(0, "Battle throw")
|
||||
createBallTrajectory(ball, 0, 16,
|
||||
|
||||
Reference in New Issue
Block a user