#--------------------------------------------------------------------------
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
case self.index
when 0
return 400
when 1
return 510
when 2
return 510
when 3
return 580
else
return 640
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Y 坐标
#--------------------------------------------------------------------------
def screen_y
case self.index
when 0
return 210
when 1
return 130
when 2
return 350
when 3
return 210
else
return 1000
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
# 返回计算后的队伍 Z 坐标的排列顺序
if self.index != nil
return 4 - self.index
else
return 0
end
end
end
class Scene_Battle
#..........................................................................
#--------------------------------------------------------------------------
# ● 返回phase
#--------------------------------------------------------------------------
def phase
return @phase
end
#--------------------------------------------------------------------------
# ● 返回phase4_step
#--------------------------------------------------------------------------
def phase4_step
return @phase4_step
end
#--------------------------------------------------------------------------
# ● 返回phase4_step
#--------------------------------------------------------------------------
def actor_command_active?
return @actor_command_window.active
end
#..........................................................................
end
class Game_Battler
#..........................................................................
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def show_damage(value)
@show_damage_value = value
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def show_damage_value
return @show_damage_value
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def battler_ani
return @battler_ani
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def setup_battler_ani(battler_ani, once = 0)
@battler_ani = battler_ani
@once = once
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def setup_battler_hurt_ani(hurt)
@hurt = hurt
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def setup_battler_dead_ani(over)
@over = over
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def battler_dead_ani
return @over
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def battler_ani_once
return @once
end
#--------------------------------------------------------------------------
# ● 获取循环的动画 ID
#--------------------------------------------------------------------------
def battler_hurt_ani
return @hurt
end
#..........................................................................
end
class Sprite_Battler < RPG::Sprite
#..........................................................................
#--------------------------------------------------------------------------
# ● 胜利图
#--------------------------------------------------------------------------
def win
if @battler_name != nil and not @battler.hidden and not @battler.dead?
@battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
end
end
#..........................................................................
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 文件名和色相与当前情况有差异的情况下
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
@battler_hue = @battler.battler_hue
# 获取、设置位图
@battler_name = @battler.battler_name
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
#.......................................................................
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
#.......................................................................
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.is_a?(Game_Enemy)
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
end
# 动画 ID 与当前的情况有差异的情况下
#.........................................................................
if @battler.battler_ani != @battler_ani
@battler_ani = @battler.battler_ani
loop_animation($data_animations[@battler_ani.to_i])
end
#.........................................................................
# 应该被显示的角色的情况下
if @battler.is_a?(Game_Actor) and @battler_visible
# 不是主状态的时候稍稍降低点透明度
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
# 明灭
if @battler.blink
blink_on
else
blink_off
end
# 不可见的情况下
unless @battler_visible
# 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
if @battler.is_a?(Game_Enemy)
appear
else
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
end
@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
# korapusu
if @battler.damage == nil and @battler.dead?
#....................................................................
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
#collapse
else
$game_system.se_play($data_system.actor_collapse_se)
end
#....................................................................
@battler_visible = false
end
end
# 设置活动块的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.x -= self.bitmap.width/2 if @battler.is_a?(Game_Actor)
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = true
# 伤害美化字符串文件夹名(放在Pictures文件夹中的子文件夹)
STRING_DOCUMENTS = "String/"
# 是否使用伤害美化效果
USE_DAMAGE = true