=begin
待机(面向左) :00 01 02 03 共 4 张。
待机(面向右) :10 11 12 13 共 4 张。
移动(面向左) :20 21 22 23 共 4 张。
移动(面向右) :30 31 32 33 共 4 张。
攻击(面向左) :40 41 42 43 共 4 张。
攻击(面向右) :50 51 52 53 共 4 张.
防御(面向左) :80 共 1 张.
防御(面向右) :90 共 1 张.
挨打(面向左) :100 共 1 张.
挨打(面向右) :110 共 1 张.
死亡(面向左) :140 141 共 2 张.
死亡(面向右) :150 151 共 2 张.
=end
#==============================================================================
###############################################################################
#==============================================================================
# ★全图片单帧播放实现战斗动态效果★
#=============================================================================
# by -> 芯☆淡如水
#==============================================================================
###############################################################################
#==============================================================================
module RPG
module Cache
def self.battler(name, filename, hue)
self.load_bitmap("Graphics/Battlers/"+name+"/", filename, hue)
end
end
class Sprite < ::Sprite
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
@_tip_duration = 0
end
#-----------------------------------------------------------
alias add_dispose_xdrs dispose
def dispose
dispose_tip
dispose_damage
dispose_animation
dispose_loop_animation
super
end
#-----------------------------------------------------------
def tip(txt, type)
dispose_tip
bitmap = Bitmap.new(240, 52)
bitmap.font.name = (["黑体","宋体","Arial Black"])
bitmap.font.size = 32
bitmap.font.bold = true
if type == 1
bitmap.font.color.set(255, 0, 255)
bitmap.draw_text(+1, 6+1, 220, 50, txt, 1)
bitmap.font.color.set(0, 255, 120)
bitmap.draw_text(0, 6, 220, 50, txt, 1)
else
bitmap.font.color.set(0, 255, 120)
bitmap.draw_text(+1, 6+1, 220, 50, txt, 1)
bitmap.font.color.set(255, 0, 255)
bitmap.draw_text(0, 6, 220, 50, txt, 1)
end
@_tip_sprite = ::Sprite.new(self.viewport)
@_tip_sprite.bitmap = bitmap
@_tip_sprite.opacity = 0
@_tip_sprite.ox = 120
@_tip_sprite.oy = 20
@_tip_sprite.x = self.x
@_tip_sprite.y = self.y - self.oy / 2
@_tip_sprite.z = 3000
@_tip_duration = 60
end
#-----------------------------------------------------------
def dispose_tip
if @_tip_sprite != nil
@_tip_sprite.bitmap.dispose
@_tip_sprite.dispose
@_tip_sprite = nil
@_tip_duration = 0
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#--------------------------------------------------------
if @_tip_duration > 0
@_tip_duration -= 1
case @_tip_duration
when 58..59
@_tip_sprite.opacity += 20
@_tip_sprite.y -= 4
when 56..57
@_tip_sprite.opacity += 40
@_tip_sprite.y -= 4
when 54..55
@_tip_sprite.opacity += 40
@_tip_sprite.y -= 3
when 51..53
@_tip_sprite.opacity += 30
@_tip_sprite.y -= 3
when 40..50
@_tip_sprite.y -= 2
end
@_tip_sprite.opacity = 256 - (12 - @_tip_duration) * 32
if @_tip_duration == 0
dispose_tip
end
end
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
end
end
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
attr_accessor :show_refresh
#--------------------------------------------------------------------------
alias add_initialize_xdrs initialize
def initialize
add_initialize_xdrs
@show_refresh = false
end
end
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
attr_reader :viewport1 # 敌人方的显示端口
attr_reader :viewport2 # 角色方的显示端口
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# 生成战斗背景活动块
@battleback_sprite = Sprite.new(@viewport1)
# 生成敌人活动块
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# 生成敌人活动块
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport1))
@actor_sprites.push(Sprite_Battler.new(@viewport1))
@actor_sprites.push(Sprite_Battler.new(@viewport1))
@actor_sprites.push(Sprite_Battler.new(@viewport1))
# 生成天候
@weather = RPG::Weather.new(@viewport1)
# 生成图片活动块
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
#--------------------------------------------------------------------------
def update
# 刷新角色的活动块 (对应角色的替换)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# 战斗背景的文件名与现在情况有差异的情况下
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 480)
end
# 刷新战斗者的活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# 刷新天气图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# 刷新图片活动块
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器活动块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport4.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport2.update
@viewport4.update
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合)
#--------------------------------------------------------------------------
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
when 7
update_phase4_step7
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 2 : 开始行动)
#--------------------------------------------------------------------------
def update_phase4_step2
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
if @active_battler.restriction == 2 or @active_battler.restriction == 3
# 设置行动为攻击
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# 限制为 [不能行动] 的情况下
if @active_battler.restriction == 4
# 清除行动强制对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
@active_battler.targets = []
@set_action = false
# 行动种类分支
case @active_battler.current_action.kind
when 0 # 基本
make_basic_action_result
when 1 # 特技
make_skill_action_result
when 2 # 物品
make_item_action_result
end
# 移至步骤 3
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
# 设置攻击 ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# 设置对像方的战斗者序列
@active_battler.targets = [target]
# 应用通常攻击效果
for target in @active_battler.targets
target.attack_effect(@active_battler)
end
return
end
# 防御的情况下
if @active_battler.current_action.basic == 1
# 帮助窗口显示"防御"
@help_window.set_text($data_system.words.guard, 1)
@phase4_step = 1
return
end
# 逃跑的情况下
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# 帮助窗口显示"逃跑"
@help_window.set_text("逃跑", 1)
# 逃跑
@active_battler.escape
return
end
# 什么也不做的情况下
if @active_battler.current_action.basic == 3
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
def set_target_battlers(scope)
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@active_battler.targets.push($game_party.smooth_target_actor(index))
when 2 # 敌全体
for actor in $game_party.actors
if actor.exist?
@active_battler.targets.push(actor)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@active_battler.targets.push($game_troop.smooth_target_enemy(index))
when 4 # 我方全体
for enemy in $game_troop.enemies
if enemy.exist?
@active_battler.targets.push(enemy)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@active_battler.targets.push(enemy)
end
when 6 # 我方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@active_battler.targets.push(enemy)
end
end
when 7 # 使用者
@active_battler.targets.push(@active_battler)
end
else
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@active_battler.targets.push($game_troop.smooth_target_enemy(index))
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
@active_battler.targets.push(enemy)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@active_battler.targets.push($game_party.smooth_target_actor(index))
when 4 # 我方全体
for actor in $game_party.actors
if actor.exist?
@active_battler.targets.push(actor)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@active_battler.targets.push(actor)
end
when 6 # 我方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@active_battler.targets.push(actor)
end
end
when 7 # 使用者
@active_battler.targets.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
# 消耗 SP
@active_battler.sp -= @skill.sp_cost
# 刷新状态窗口
@active_battler.tip_type = @skill.power > 0 ? 0 : 1
@active_battler.tip_message = @skill.name
# 设置动画 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 设置公共事件 ID
@common_event_id = @skill.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill.scope)
# 应用特技效果
for target in @active_battler.targets
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# ● 生成物品行动结果
#--------------------------------------------------------------------------
def make_item_action_result
# 获取物品
@item = $data_items[@active_battler.current_action.item_id]
# 因为物品耗尽而无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 移至步骤 1
@phase4_step = 1
return
end
# 消耗品的情况下
if @item.consumable
# 使用的物品减 1
$game_party.lose_item(@item.id, 1)
end
@active_battler.tip_type = [1,2].include?(@item.scope) ? 0 : 1
@active_battler.tip_message = @item.name
# 设置动画 ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# 设置公共事件 ID
@common_event_id = @item.common_event_id
# 确定对像
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# 设置对像侧战斗者
set_target_battlers(@item.scope)
# 应用物品效果
for target in @active_battler.targets
target.item_effect(@item)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 3 : 行动方动画)
#--------------------------------------------------------------------------
def update_phase4_step3
unless @set_action
if @active_battler.current_action.kind == 0
@active_battler.moveto_pop = true if @active_battler.current_action.basic == 0
else
@active_battler.tip_pop = true
@active_battler.animation_id = @animation1_id if @animation1_id != 0
end
@set_action = true
end
if @active_battler.current_action.kind == 0
@phase4_step = 4 if @active_battler.atk_pop
elsif @active_battler.current_action.kind == 1
if @animation2_id != 0
for target in @active_battler.targets
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
end
@phase4_step = 6
else
@phase4_step = 5
end
end
#--------------------------------------------------------------------------
def update_phase4_step4
@active_battler.show_refresh = true
@phase4_step = 5
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 5 : 对像方动画)
#--------------------------------------------------------------------------
def update_phase4_step5
if @animation2_id != 0
for target in @active_battler.targets
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
end
@phase4_step = 6
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 6 : 显示伤害)
#--------------------------------------------------------------------------
def update_phase4_step6
# 隐藏帮助窗口
@help_window.visible = false
# 刷新状态窗口
for target in @active_battler.targets
if target.damage != nil and target.damage.is_a?(Numeric)
target.show_refresh = true if target.damage != 0
if target.damage > 0
if target.current_action.kind == 0 and
target.current_action.basic == 1
target.guard_pop = true
else
target.ad_pop = true
end
end
end
end
for target in @active_battler.targets
if target.damage != nil
target.damage_pop = true
if target.damage.is_a?(Numeric) and target.dead?
target.dead_pop = true
end
end
end
@status_window.refresh
# 移至步骤 6
@phase4_step = 7
end
#--------------------------------------------------------------------------
def update_phase4_step7
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 公共事件 ID 有效的情况下
if @common_event_id > 0
# 设置事件
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# 移至步骤 1
@phase4_step = 1
end
end
#-----------------------------------------------------------------------------
class Game_Battler
#---------------------------------------------------------------------------
attr_accessor :dead_one
attr_accessor :sp_damage_pop
attr_accessor :sp_damage
attr_accessor :moveto_pop
attr_accessor :moveback_pop
attr_accessor :atk_pop
attr_accessor :int_pop
attr_accessor :dead_pop
attr_accessor :guard_pop
attr_accessor :ad_pop
attr_accessor :atk2_pop
attr_accessor :targets
attr_accessor :show_refresh
attr_accessor :tip_pop
attr_accessor :tip_type
attr_accessor :tip_message
attr_accessor :get_pop
attr_accessor :an2_pop
#--------------------------------------------------------------------------
def initialize
@battler_name = ""
@battler_hue = 0
@hp = 0
@sp = 0
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
@hidden = false
@immortal = false
@damage_pop = false
@damage = nil
@critical = false
@animation_id = 0
@animation_hit = false
@white_flash = false
@blink = false
@current_action = Game_BattleAction.new
@sp_damage = nil
@dead_one = false
@show_refresh = true
@targets = []
@tip_pop = false
@get_pop = false
@tip_type = 0
@tip_message = ""
off_pop
end
#---------------------------------------------------------------------------
def off_pop
@atk_pop = false
@int_pop = false
@dead_pop = false
@guard_pop = false
@ad_pop = false
@moveto_pop = false
@moveback_pop = false
@atk2_pop = false
end
#---------------------------------------------------------------------------
def moving?
return true if @atk_pop or @atk2_pop or @moveto_pop or @moveback_pop
return false
end
#---------------------------------------------------------------------------
end
#===============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
if @battler != nil
@set = @battler.is_a?(Game_Enemy) ? 1 : 0
else
@set = 0
end
@battler_name = "00"
@battler_visible = false
@wait_time = @move_time = @atk_time = 0
@int_time = @ad_time = @dead_time = @win_time = 0
@show = Sprite.new(viewport)
@show.bitmap = Bitmap.new(96, 32)
@height = 0
return if @battler.nil?
@show.bitmap.font.color.set(0, 0, 0)
@show.bitmap.fill_rect(0, 0, 62, 6, Color.new(0, 0, 0))
@show.bitmap.fill_rect(0, 7, 62, 6, Color.new(0, 0, 0))
w = 60 * @battler.hp / @battler.maxhp
for i in 1..w
@show.bitmap.fill_rect(i, 1, 1, 4, Color.new(255, 0, 255-i*4))
end
w = 60 * @battler.sp / @battler.maxsp
for i in 1..w
@show.bitmap.fill_rect(i, 8, 1, 4, Color.new(0, 255-i*4, 255))
end
@show.x = self.x-30
@show.y = self.y - @height - 20
@show.z = 490
@show.visible = @battler_visible
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def dispose
@battler.show_refresh = true if battler != nil
@show.dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
def tuch_range(target)
bp = RPG::Cache.battler(@battler.name, "00", 0)
r1 = bp.width / 2
bp = RPG::Cache.battler(target.name, "01", 0)
r2 = bp.width / 2
return r1 + r2
end
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
@wait_time += 1
@wait_time = 0 if @wait_time >= 39
@battler
name = (0+@set).to_s + (@wait_time / 10).to_s
#----------------------------------------------------------------------
if @battler.moveto_pop
@move_time += 1
@move_time = 0 if @move_time >= 19
lx = @battler.targets.size == 1 ? @battler.targets[0].screen_x : 320
name = self.x > lx ? "2" : "3"
name += (@move_time / 5).to_s
if @battler.targets.size == 1
target = @battler.targets[0]
if @battler == target
@battler.current_action.kind == 0 ? @battler.atk_pop = true : @battler.atk2_pop = true
@battler.moveto_pop = false
@move_time = 0
return
end
tx = target.screen_x
tx += @battler.screen_x > target.screen_x ? (tuch_range(target)) : -(tuch_range(target))
ty = target.screen_y
else
tx = 320
ty = 280
end
if self.x == tx and self.y == ty
@battler.current_action.kind == 0 ? @battler.atk_pop = true : @battler.atk2_pop = true
@battler.moveto_pop = false
@move_time = 0
return
end
rx = (self.x - tx).abs
ry = (self.y - ty).abs
lx = [Integer(20.0*rx / (rx+ry)), rx].min
ly = [Integer(20.0*ry / (rx+ry)), ry].min
self.x += self.x > tx ? -lx : (self.x < tx ? lx : 0)
self.y += self.y > ty ? -ly : (self.y < ty ? ly : 0)
end
#---------------------------------------------------------------------
if @battler.atk_pop
n_time = [@atk_time, 39].min
if @battler.targets.size == 1
nx = self.x > @battler.targets[0].screen_x ? "4" : "5"
name = nx + (n_time / 10).to_s
else
name = (4+@set).to_s + (n_time / 10).to_s
end
@atk_time += 1
if @atk_time >= 39
@atk_time = 0
@battler.atk_pop = false
@battler.moveback_pop = true
end
end
#---------------------------------------------------------------------
if @battler.atk2_pop
n_time = [@atk_time, 39].min
if @battler.targets.size == 1
nx = self.x > @battler.targets[0].screen_x ? "6" : "7"
name = nx + (n_time / 10).to_s
else
name = (4+@set).to_s + (n_time / 10).to_s
end
@atk_time += 1
if @atk_time >= 49
@atk_time = 0
@battler.atk2_pop = false
@battler.moveback_pop = true
end
end
#----------------------------------------------------------------------
if @battler.moveback_pop
@move_time += 1
@move_time = 0 if @move_time >= 19
name = self.x > @battler.screen_x ? "2" : "3"
name += (@move_time / 5).to_s
tx = @battler.screen_x
ty = @battler.screen_y
if self.x == tx and self.y == ty
@battler.moveback_pop = false
@move_time = 0
return
end
rx = (self.x - tx).abs
ry = (self.y - ty).abs
lx = [Integer(20.0*rx / (rx+ry)), rx].min
ly = [Integer(20.0*ry / (rx+ry)), ry].min
self.x += self.x > tx ? -lx : (self.x < tx ? lx : 0)
self.y += self.y > ty ? -ly : (self.y < ty ? ly : 0)
end
#----------------------------------------------------------------------
if @battler.int_pop
if @battler.targets.size == 1 and @battler != @battler.targets[0]
nx = self.x > @battler.targets[0].screen_x ? "12" : "13"
name = nx + (@int_time / 10).to_s
else
name = (12+@set).to_s + (@int_time / 10).to_s
end
@int_time += 1
if @int_time >= 39
@int_time = 0
@battler.int_pop = false
end
end
#----------------------------------------------------------------------
if @battler.ad_pop
name = (10+@set).to_s + (@ad_time / 40).to_s
@ad_time += 1
if @ad_time >= 39
@ad_time = 0
@battler.ad_pop = false
end
end
#-----------------------------------------------------------------------
if @battler.guard_pop and not @battler.dead?
name = (8+@set).to_s + (@ad_time / 40).to_s
@ad_time += 1
if @ad_time >= 39
@ad_time = 0
@battler.guard_pop = false
end
end
#----------------------------------------------------------------------
if @battler.dead_pop
name = (14+@set).to_s + (@dead_time / 20).to_s
@dead_time += 1
if @dead_time >= 39
@dead_time = 0
@battler.dead_one = true
@battler.dead_pop = false
end
end
#-----------------------------------------------------------------------
if @battler.dead? and @battler.dead_one
name = (14+@set).to_s + "1"
end
if @battler_name != name
hue = @battler.battler_hue
# 获取、设置位图
@battler_name = name
self.bitmap = RPG::Cache.battler(@battler.name, name, hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
self.opacity = 0 if @battler.hidden
end
#-----------------------------------------------------------------------
if @battler != nil and @battler.show_refresh
@show.bitmap.clear
@show.bitmap.font.color.set(0, 0, 0)
@show.bitmap.fill_rect(0, 0, 62, 6, Color.new(0, 0, 0))
@show.bitmap.fill_rect(0, 7, 62, 6, Color.new(0, 0, 0))
w = 60 * @battler.hp / @battler.maxhp
for i in 1..w
@show.bitmap.fill_rect(i, 1, 1, 4, Color.new(255, 0, (255-i*4)))
end
w = 60 * @battler.sp / @battler.maxsp
for i in 1..w
@show.bitmap.fill_rect(i, 8, 1, 4, Color.new(0, (255-i*4), 255))
end
@battler.show_refresh = false
end
@show.x = self.x-30
@show.y = self.y - @height - 20
@show.z = 490
if @battler_visible
@show.visible = @battler.dead_one ? false : true
else
@show.visible = @battler_visible
end
#-----------------------------------------------------------------------
# 动画 ID 与当前的情况有差异的情况下
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 明灭
if @battler.blink
blink_on
else
blink_off
end
# 不可见的情况下
unless @battler_visible
# 出现
unless @battler.hidden
appear
@battler_visible = true
end
end
# 可见的情况下
if @battler_visible
# 逃跑
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白色闪烁
if @battler.white_flash
whiten
@battler.white_flash = false
end
# 动画
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
if @battler.tip_pop and @battler.tip_message != ""
tip(@battler.tip_message, @battler.tip_type)
@battler.tip_message = ""
@battler.tip_pop = false
end
if @battler.sp_damage_pop
sp_damage(@battler.sp_damage)
@battler.sp_damage = nil
@battler.sp_damage_pop = false
end
end
unless @battler.moving?
# 设置活动块的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = self.y
end
self.z = self.y
end
end
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
def remove_state(state_id, force = false)
# 无法附加本状态的情况下
if state?(state_id)
# 被强制附加的状态、并不是强制解除的情况下
if @states_turn[state_id] == -1 and not force
# 过程结束
return
end
# 现在的 HP 为 0 当作选项 [当作 HP 0 的状态]有效的场合
if @hp == 0 and $data_states[state_id].zero_hp
# 判断是否有另外的 [当作 HP 0 的状态]状态
zero_hp = false
for i in @states
if i != state_id and $data_states[i].zero_hp
zero_hp = true
end
end
# 如果可以解除战斗不能、将 HP 更改为 1
if zero_hp == false
@hp = 1
self.dead_one = false
end
end
# 将状态 ID 从 @states 队列和 @states_turn hash 中删除
@states.delete(state_id)
@states_turn.delete(state_id)
end
# 检查 HP 及 SP 的最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● # 调 X 坐标。
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
case self.index
when 0
return 480
when 1
return 500
when 2
return 520
when 3
return 540
end
else
return 0
end
end
#--------------------------------------------------------------------------
# ● # 调 Y 坐标。
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
case self.index
when 0
return 200
when 1
return 240
when 2
return 280
when 3
return 320
end
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
if self.index != nil
return screen_y
else
return 0
end
end
end
###############################################################################
#==============================================================================