class Game_Battler
attr_accessor :mhp # 移动的HP位置
attr_accessor :msp # 移动的SP位置
end
class Scene_Battle
alias etech_atb_setup atb_setup
def atb_setup
etech_atb_setup
for battler in $game_party.actors + $game_troop.enemies
battler.mhp = battler.maxhp
battler.msp = battler.maxsp
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 执行战斗事件中的情况下
if @result_window != nil
if @result_window.disposed?
#REM
else
if @result_window.visible
@result_window.refresh
end
end
end
if $game_system.battle_interpreter.running?
if @command.size > 0
@command_a = false
@command = []
command_delete
end
@status_window.at_refresh
# 刷新解释器
$game_system.battle_interpreter.update
# 强制行动的战斗者不存在的情况下
if $game_temp.forcing_battler == nil
# 执行战斗事件结束的情况下
unless $game_system.battle_interpreter.running?
# 继续战斗的情况下、再执行战斗事件的设置
@status_window.refresh
setup_battle_event
end
end
end
# 系统 (计时器)、刷新画面
$game_system.update
$game_screen.update
# 计时器为 0 的情况下
if $game_system.timer_working and $game_system.timer == 0
# 中断战斗
$game_temp.battle_abort = true
end
# 刷新窗口
@help_window.update
#------------------------------------------------------------------------------
#RTAB观光游第一站,去除“战斗/逃跑”选项部分
# @party_command_window.update
#------------------------------------------------------------------------------
@actor_command_window.update
@status_window.update
@message_window.update
# 刷新活动块
@spriteset.update
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除处理过渡中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下
if $game_temp.message_window_showing
return
end
# 游戏结束的情况下
if $game_temp.gameover
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 返回标题画面的情况下
if $game_temp.to_title
# 切换到标题画面
$scene = Scene_Title.new
return
end
# 中断战斗的情况下
if $game_temp.battle_abort
# 还原为战斗前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
return
end
# 帮助窗口显示中的场合
if @help_wait > 0
@help_wait -= 1
if @help_wait == 0
# 帮助窗口设为不可见
@help_window.visible = false
end
end
# 强制行动的角色存在、
# 并且战斗事件正在执行的情况下
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# 阶段分支
case @phase
when 0 # ATG更新阶段
if anime_wait_return
update_phase0
end
when 1 # 自由战斗阶段
update_phase1
return
when 2 # 同伴命令阶段
update_phase2
return
when 5 # 结束战斗阶段
update_phase5
return
end
if $scene != self
return
end
if @phase == 0
if @command.size != 0
if @command_a == false
start_phase3
end
update_phase3 # 角色命令阶段
end
# 等待中的场合
if @wait_count > 0
# 等待记数 -1
@wait_count -= 1
return
end
update_phase4 # 主阶段
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Slant Bar
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
#--------------------------------------------------------------------------
# ● HP ゲージの描画
#--------------------------------------------------------------------------
def dhp(actor = nil) # 画上的HP
if actor == nil
return 0
end
if actor.mhp == nil
actor.mhp = actor.hp
return actor.hp
end
if $game_temp.in_battle
#REM
else
actor.mhp = actor.hp
return actor.hp
end
if actor.mhp < actor.hp + $血条扣减速度 and actor.mhp > actor.hp - $血条扣减速度
actor.mhp = actor.hp
else
if actor.mhp < actor.hp
actor.mhp += $血条扣减速度
else
actor.mhp -= $血条扣减速度
end
end
return actor.mhp
end
def dsp(actor = nil) # 画上的SP
if actor == nil
return 0
end
if actor.msp == nil
actor.msp = actor.sp
return actor.sp
end
if $game_temp.in_battle
#REM
else
actor.msp = actor.sp
return actor.sp
end
if actor.msp < actor.sp + $气条扣减速度 and actor.msp > actor.sp - $气条扣减速度
actor.msp = actor.sp
else
if actor.msp < actor.sp
actor.msp += $气条扣减速度
else
actor.msp -= $气条扣减速度
end
end
return actor.msp
end
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● HP的刷新
#--------------------------------------------------------------------------
def hp_refresh(number = 0)
if number == 0
for window in @actor_window
window.hp_refresh
end
else
@actor_window[number - 1].hp_refresh
end
end
#--------------------------------------------------------------------------
# ● SP的刷新
#--------------------------------------------------------------------------
def sp_refresh(number = 0)
if number == 0
for window in @actor_window
window.sp_refresh
end
else
@actor_window[number - 1].sp_refresh
end
end
end
class Window_ActorStatus < Window_Base
def hp_refresh
@status_window[1].refresh($game_party.actors[@actor_num])
end
def sp_refresh
@status_window[2].refresh($game_party.actors[@actor_num])
end
end
class Scene_Battle
alias etech_update update
def update
@status_window.hp_refresh
@status_window.sp_refresh
etech_update
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ● 伤害计算
#--------------------------------------------------------------------------
alias etech_damage_effect damage_effect
def damage_effect(battler, item, skill)
etech_damage_effect(battler, item, skill)
$血条扣减速度 = (self.mhp.to_i - self.hp.to_i + self.damage[battler].to_i) / 150
if $血条扣减速度 == 0
$血条扣减速度 = 3
end
if $血条扣减速度 < 0
$血条扣减速度 *= -1
end
end
end