| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 3 |
| 经验 | |
| 最后登录 | 2024-2-3 |
| 在线时间 | 398 小时 |
- 梦石
- 0
- 星屑
- 293
- 在线时间
- 398 小时
- 注册时间
- 2011-5-20
- 回帖
- 94
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
在不删脚本的情况下有办法解决丢帧问题吗?
三个脚本分别是后知后觉的横版战斗,atelier-rgss的战斗窗口和AT条
范例没有,未完成的游戏工程倒是有但是非常大,http://pan.baidu.com/s/12DOuE
[pre lang="ruby" line="1"]#==============================================================================
# ■ 此脚本来自 www.66rpg.com
#------------------------------------------------------------------------------
# 名称:横版战斗模板
# 作者:后知后觉(hzhj.tnt@163.com)
# 版本:v1.7 2012-02-09
# 使用协议:在保留此脚本相关信息的情况下
# 可任意使用、修改及修改后发布.
# 如是修改后发布.请在作者标注那里加上 某某某改 等信息
# 感谢你来这里谈谈你对这个工程的看法或报告BUG.
# http://rpg.blue/thread-216673-1-1.html
# 使用说明:
# 请来发布帖查看:
# http://rpg.blue/thread-216673-1-1.html
#==============================================================================
module Hzhj
module HorizontalBattleSystem
# 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
MaxBattleMembers = 4
ActorsBattlePosition = {}
# 设置角色战斗图形的坐标
# 等号左边的[]号里面的1 2 3 4 表示角色在队伍里的位置
# 等号右边的[]号里面的两个数字分别表示 X坐标 Y坐标
# 每次进入战斗的时候都会以这里设置的信息作为初始化位置.
# 如果你把上面的 MaxBattleMembers 改大了.比如改成了 5.
# 那么你需要在下面新增一行代码设置队伍中第5位置的坐标.
# 就像这样 ActorsBattlePosition[5] = [X坐标, Y坐标]
ActorsBattlePosition[1] = [410, 180]
ActorsBattlePosition[2] = [450, 220]
ActorsBattlePosition[3] = [490, 260]
ActorsBattlePosition[4] = [530, 300]
# 设置伤害值图形的色相 取值范围 0~360
DamageBitmapHue = 0
# 伤害值分段显示的标志SE文件名
DamageSectionDisplaySEName = "DamageSection"
# 动画 Z 坐标值默认变化量
DefaultAniAddZ = 768
# 状态动画 Z 坐标值默认变化量
DefaultLoopAniAddZ = 20
# 战斗中角色的面向
ActorDirection = 4
# 真位移的帧数
RealMoveDuration = 20
# 真位移移动前会计算目标点.会获取攻防双方战斗图大小来进行计算.
# 下面2个是对战斗图 width height 进行修正.
# 为正则扩大 为负则缩小.单位 像素.
# 一般来说不必修改.只有像梦幻群侠传那种战斗图四边有很多透明区域时才修正.
RealMoveBmpAddW = 0
RealMoveBmpAddH = 0
# 使用技能、物品的过程默认使用RMVA模式
# 在该模式下.本脚本提供的很多功能受限无法使用.
DefaultUseRmvaMode = false
# 默认显示敌人的HP条、MP条、TP条
DefaultDisplayEnemyBar = false
# 一张战斗图中有几个样式(帧、格)
DynamicPatternMax = 1
# 一张战斗图中的一个样式持续多少帧
OnePatternDuration = 15
# 角色使用战斗死亡图形
UseActorDeadGraphic = true
# 敌人使用战斗死亡图形
UseEnemyDeadGraphic = false
# 使用挨打图形
UseBeatenGraphic = true
# 挨打图形维持帧数
BeatenGraphicDuration = 15
# 是否使用角色防御图 只有同时使用了挨打图.此项才有效.
UseActorGuardGraphic = false
# 是否使用敌人防御图 只有同时使用了挨打图.此项才有效.
UseEnemyGuardGraphic = false
# 角色是否使用挨打SE
UseActorWBSE = false
# 敌人是否使用挨打SE
UseEnemyWBSE = false
# 角色是否使用防御SE
UseActorGDSE = false
# 敌人是否使用防御SE
UseEnemyGDSE = false
end
end
class RPG::Actor < RPG::BaseItem
def battler_name
return @battler_name unless @battler_name.nil?
if /@btname\[(.+?)\]/ =~ @note
return (@battler_name = $1.clone)
else
return (@battler_name = "#{@name}_#{@nickname}")
end
end
def battler_hue
return @battler_hue unless @battler_hue.nil?
if /@bthue\[([0-9]+?)\]/ =~ @note
return (@battler_hue = $1.to_i.abs)
else
return (@battler_hue = 0)
end
end
attr_writer :battler_name
attr_writer :battler_hue
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 属性(新增定义)
#--------------------------------------------------------------------------
attr_writer :battler_name # 战斗图形文件名
attr_writer :battler_hue # 战斗图形色相
#--------------------------------------------------------------------------
# ● 设置(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_setup_for_add_actor_battle_graphic setup
def setup(actor_id)
hzhj_old_setup_for_add_actor_battle_graphic(actor_id)
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
end
#--------------------------------------------------------------------------
# ● 是否使用活动块(重定义)
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 X 坐标(新增定义)
#--------------------------------------------------------------------------
def screen_x
return ActorsBattlePosition[index + 1][0]
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 Y 坐标(新增定义)
#--------------------------------------------------------------------------
def screen_y
return ActorsBattlePosition[index + 1][1]
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 Z 坐标(新增定义)
#--------------------------------------------------------------------------
def screen_z
return real_screen_y + 100
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 属性(新增定义)
#--------------------------------------------------------------------------
attr_writer :battler_name # 战斗图形文件名
attr_writer :battler_hue # 战斗图形色相
#--------------------------------------------------------------------------
# ● 取得战斗画面 Z 坐标(重定义)
#--------------------------------------------------------------------------
def screen_z
return real_screen_y + 100
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
include Hzhj::HorizontalBattleSystem
#--------------------------------------------------------------------------
# ● 取得参战角色的最大数(重定义)
#--------------------------------------------------------------------------
def max_battle_members
return MaxBattleMembers
end
end
class RPG::Animation
def wait_subject_duration
return @wait_subject_duration unless @wait_subject_duration.nil?
if /@w\[(\-??\d+?)\]/ =~ @name
@wait_subject_duration = $1.to_i
else
@wait_subject_duration = 0
end
return @wait_subject_duration
end
attr_writer :wait_subject_duration
end
class RPG::UsableItem < RPG::BaseItem
include Hzhj::HorizontalBattleSystem
def animation1_id
return @animation1_id unless @animation1_id.nil?
if /@a1id\[(\d+?)\]/i =~ @note
return (@animation1_id = $1.to_i)
else
return (@animation1_id = 0)
end
end
def wljn
return @wljn unless @wljn.nil?
if /@wljn/i =~ @note
return (@wljn = true)
else
return (@wljn = false)
end
end
def rmva_mode
return @rmva_mode unless @rmva_mode.nil?
if /@rmva/i =~ @note
return (@rmva_mode = !DefaultUseRmvaMode)
else
return (@rmva_mode = DefaultUseRmvaMode)
end
end
attr_writer :animation1_id
attr_writer :wljn
attr_writer :rmva_mode
end
class RPG::Weapon < RPG::EquipItem
def animation1_id
return @animation1_id unless @animation1_id.nil?
if /@a1id\[(\d+?)\]/ =~ @note
return (@animation1_id = $1.to_i)
else
return (@animation1_id = 0)
end
end
attr_writer :animation1_id
end
class RPG::Enemy < RPG::BaseItem
def animation1_id
return @animation1_id unless @animation1_id.nil?
if /@a1id\[(\d+?)\]/ =~ @note
return (@animation1_id = $1.to_i)
else
return (@animation1_id = 0)
end
end
def animation2_id
return @animation2_id unless @animation2_id.nil?
if /@a2id\[(\d+?)\]/ =~ @note
return (@animation2_id = $1.to_i)
else
return (@animation2_id = 0)
end
end
def animation3_id
return @animation3_id unless @animation3_id.nil?
if /@a3id\[(\d+?)\]/ =~ @note
return (@animation3_id = $1.to_i)
else
return (@animation3_id = 0)
end
end
attr_writer :animation1_id
attr_writer :animation2_id
attr_writer :animation3_id
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 取得普通攻击的行动方动画 ID (新增定义)
#--------------------------------------------------------------------------
def animation1_id
if dual_wield?
return weapons[0].animation1_id if weapons[0]
return weapons[1] ? weapons[1].animation1_id : 0
else
return weapons[0] ? weapons[0].animation1_id : 0
end
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 取得普通攻击的行动方动画 ID (新增定义)
#--------------------------------------------------------------------------
def animation1_id
return enemy.animation1_id
end
#--------------------------------------------------------------------------
# ● 取得普通攻击的动画 ID (新增定义)
#--------------------------------------------------------------------------
def atk_animation_id1
return enemy.animation2_id
end
#--------------------------------------------------------------------------
# ● 取得普通攻击的动画 ID (二刀流:武器2)(新增定义)
#--------------------------------------------------------------------------
def atk_animation_id2
return enemy.animation3_id
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
include Hzhj::HorizontalBattleSystem
#--------------------------------------------------------------------------
# ● 使用技能/物品(重定义)
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.use_item(item)
refresh_status
targets = @subject.current_action.make_targets.compact
show_animation(targets, item.animation_id)
end
#--------------------------------------------------------------------------
# ● 显示动画(重定义)
#--------------------------------------------------------------------------
def show_animation(targets, animation_id)
item = @subject.current_action.item
if item.rmva_mode
show_rmva_animation(targets, animation_id, item)
else
show_hzhj_animation(targets, animation_id, item)
end
end
#--------------------------------------------------------------------------
# ● RMVA模式显示动画(新增定义)
#--------------------------------------------------------------------------
def show_rmva_animation(targets, animation_id, item)
@subject.damage_section_displayed = false
@subject.not_damage_section = true
targets.each do |target|
target.damage_section_displayed = false
target.not_damage_section = true
end
if animation_id < 0
show_attack_animation(targets)
else
show_rmva_usable_animation(targets, animation_id, item)
end
end
#--------------------------------------------------------------------------
# ● HZHJ模式显示动画(新增定义)
#--------------------------------------------------------------------------
def show_hzhj_animation(targets, animation_id, item)
if animation_id < 0
show_hzhj_attack_animation(targets, item)
else
if item.wljn
show_wljn_skill_animation(targets, animation_id, item)
else
show_magic_skill_animation(targets, animation_id, item)
end
end
end
#--------------------------------------------------------------------------
# ● HZHJ模式显示攻击动画(重定义)
#--------------------------------------------------------------------------
def show_hzhj_attack_animation(targets, item)
ary = []
need_move = false
animation1 = $data_animations[@subject.animation1_id]
need_move = animation1.need_move if animation1
come_back = true
targets.each_with_index do |target, i|
ary[0] = target
item.repeats.times do
next if target.dead? && item.damage.type == 1
next if @subject.dead?
next if !@subject.current_action
if need_move && come_back
come_back = false
@subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
wait_for_move
end
damage_target = hzhj_apply_item_effects(target, item)
show_subject_animation(@subject.animation1_id)
show_normal_animation(ary, @subject.atk_animation_id1, false)
show_normal_animation(ary, @subject.atk_animation_id2, true)
@log_window.wait
wait_for_animation
hzhj_invoke_item(target, item, damage_target)
end
if need_move
if target != targets[i+1] or target.dead?
come_back = true
@subject.come_back_self_position(RealMoveDuration)
wait_for_move
else
come_back = false
end
end
end
end
#--------------------------------------------------------------------------
# ● HZHJ模式显示物理技能类动画(新增定义)
#--------------------------------------------------------------------------
def show_wljn_skill_animation(targets, animation_id, item)
ary = []
need_move = false
animation1 = $data_animations[item.animation1_id]
need_move = animation1.need_move if animation1
come_back = true
targets.each_with_index do |target, i|
ary[0] = target
item.repeats.times do
next if target.dead? && item.damage.type == 1
next if @subject.dead?
next if !@subject.current_action
if need_move && come_back
come_back = false
@subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
wait_for_move
end
damage_target = hzhj_apply_item_effects(target, item)
show_subject_animation(item.animation1_id)
show_normal_animation(ary, animation_id, false)
@log_window.wait
wait_for_animation
hzhj_invoke_item(target, item, damage_target)
end
if need_move
if target != targets[i+1] or target.dead?
come_back = true
@subject.come_back_self_position(RealMoveDuration)
wait_for_move
else
come_back = false
end
end
end
end
#--------------------------------------------------------------------------
# ● HZHJ模式显示魔法技能类动画(新增定义)
#--------------------------------------------------------------------------
def show_magic_skill_animation(targets, animation_id, item)
ary = []
damage_targets = {}
item.repeats.times do
next if @subject.dead?
next if !@subject.current_action
ary.clear
damage_targets.clear
targets.each do |target|
next if target.dead? && item.damage.type == 1
ary << target
damage_targets[target] = hzhj_apply_item_effects(target, item)
end
next if ary.empty?
show_subject_animation(item.animation1_id)
show_normal_animation(ary, animation_id)
@log_window.wait
wait_for_animation
ary.each do |target|
hzhj_invoke_item(target, item, damage_targets[target])
end
if [9, 10].include?(item.scope)
ary.each do |target|
if target.alive?
target.come_back_self_position(RealMoveDuration)
end
end
wait_for_move
end
end
end
#--------------------------------------------------------------------------
# ● RMVA模式显示攻击动画(重定义)
#--------------------------------------------------------------------------
def show_attack_animation(targets)
item = @subject.current_action.item
show_subject_animation(@subject.animation1_id)
show_normal_animation(targets, @subject.atk_animation_id1, false)
show_normal_animation(targets, @subject.atk_animation_id2, true)
@log_window.wait
wait_for_animation
targets.each {|target| item.repeats.times { invoke_item(target, item) } }
end
#--------------------------------------------------------------------------
# ● RMVA模式显示技能、物品动画 (新增定义)
#--------------------------------------------------------------------------
def show_rmva_usable_animation(targets, animation_id, item)
show_subject_animation(item.animation1_id)
show_normal_animation(targets, animation_id)
@log_window.wait
wait_for_animation
targets.each {|target| item.repeats.times { invoke_item(target, item) } }
if [9, 10].include?(item.scope)
targets.each do |target|
if target.alive?
target.come_back_self_position(RealMoveDuration)
end
end
wait_for_move
end
end
#--------------------------------------------------------------------------
# ● 显示行动方动画(新增定义)
#--------------------------------------------------------------------------
def show_subject_animation(animation_id, subject = @subject, mirror = false)
animation = $data_animations[animation_id]
if animation
subject.animation_id = animation_id
subject.animation_mirror = mirror
if animation.wait_subject_duration < 0
wait_for_animation
elsif animation.wait_subject_duration > 0
animation.wait_subject_duration.times{update_for_wait}
end
end
end
end
class RPG::Animation
include Hzhj::HorizontalBattleSystem
def ani_z_correction
return @ani_z_correction unless @ani_z_correction.nil?
if /@az\[(\-??\d+?)\]/ =~ @name
return (@ani_z_correction = $1.to_i)
else
return (@ani_z_correction = DefaultAniAddZ)
end
end
def loop_z_correction
return @loop_z_correction unless @loop_z_correction.nil?
if /@lz\[(\-??\d+?)\]/ =~ @name
return (@loop_z_correction = $1.to_i)
else
return (@loop_z_correction = DefaultLoopAniAddZ)
end
end
attr_writer :ani_z_correction
attr_writer :loop_z_correction
end
class RPG::State < RPG::BaseItem
def animation_id
return @animation_id unless @animation_id.nil?
if /@aid\[(\d+?)\]/ =~ @note
return (@animation_id = $1.to_i)
else
return (@animation_id = 0)
end
end
attr_writer :animation_id
end
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 实例变量(新增定义)
#--------------------------------------------------------------------------
attr_reader :hzhj_add_state_id
attr_reader :hzhj_remove_state_id
attr_accessor :need_update_state_animation
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_state_ani_game_battler_base initialize
def initialize
@hzhj_add_state_id = []
@hzhj_remove_state_id = []
@need_update_state_animation = false
@states = []
@state_turns = {}
@state_steps = {}
hzhj_old_init_for_state_ani_game_battler_base
end
#--------------------------------------------------------------------------
# ● 清除状态信息(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_clear_states_for_state_ani_game_battler_base clear_states
def clear_states
old_states = @states.clone
hzhj_old_clear_states_for_state_ani_game_battler_base
bingji = old_states | @states
return if bingji.empty?
set_add_state_id(bingji & @states)
set_remove_state_id(bingji & old_states)
end
#--------------------------------------------------------------------------
# ● 消除状态(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_erase_state_for_state_ani_game_battler_base erase_state
def erase_state(state_id)
old_states = @states.clone
hzhj_old_erase_state_for_state_ani_game_battler_base(state_id)
bingji = old_states | @states
return if bingji.empty?
set_add_state_id(bingji & @states)
set_remove_state_id(bingji & old_states)
end
#--------------------------------------------------------------------------
# ● 设置增加的状态(新增定义)
#--------------------------------------------------------------------------
def set_add_state_id(zjdzt)
for i in zjdzt
if $data_states.animation_id > 0
if not @hzhj_add_state_id.include?(i)
@hzhj_add_state_id.push(i)
end
end
end
end
#--------------------------------------------------------------------------
# ● 设置解除的状态(新增定义)
#--------------------------------------------------------------------------
def set_remove_state_id(jsdzt)
for i in jsdzt
if $data_states.animation_id > 0
if not @hzhj_remove_state_id.include?(i)
ani_id = $data_states.animation_id
not_end_loop_animation = false
for state in self.states
if state.animation_id == ani_id
not_end_loop_animation = true
break
end
end
unless not_end_loop_animation
@hzhj_remove_state_id.push(i)
end
end
end
end
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● 附加新的状态(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_add_new_state_for_state_ani_game_battler add_new_state
def add_new_state(state_id)
old_states = @states.clone
hzhj_old_add_new_state_for_state_ani_game_battler(state_id)
bingji = old_states | @states
return if bingji.empty?
set_add_state_id(bingji & @states)
set_remove_state_id(bingji & old_states)
end
end
#==============================================================================
# ■ Sprite_Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_state_ani_spr_base initialize
def initialize(*args)
hzhj_old_init_for_state_ani_spr_base(*args)
@hzhj_loop_animations = []
@hzhj_loop_durations = {}
@hzhj_loop_sprites = {}
@hzhj_loop_bitmap1s = {}
@hzhj_loop_bitmap2s = {}
@hzhj_loop_ani_oxs = {}
@hzhj_loop_ani_oys = {}
@flash_nil_duration = 0
end
#--------------------------------------------------------------------------
# ● 释放(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_dispose_for_state_ani_spr_base dispose
def dispose
dispose_loop_animation
hzhj_old_dispose_for_state_ani_spr_base
end
#--------------------------------------------------------------------------
# ● 设定动画的活动块(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_ani_set_spr_for_state_ani_spr_base animation_set_sprites
def animation_set_sprites(*args)
hzhj_old_ani_set_spr_for_state_ani_spr_base(*args)
@ani_sprites.each{|sprite|sprite.z += @animation.ani_z_correction}
end
#--------------------------------------------------------------------------
# ● 判断是否有循环动画(新增定义)
#--------------------------------------------------------------------------
def loop_animation?
return (not @hzhj_loop_animations.empty?)
end
#--------------------------------------------------------------------------
# ● 开始播放循环动画(新增定义)
#--------------------------------------------------------------------------
def start_loop_animation(animation)
return if @hzhj_loop_animations.include?(animation)
if animation.nil?
dispose_loop_animation
return
end
set_animation_rate
@hzhj_loop_animations.push(animation)
init_loop_animation_duration(animation)
load_loop_animation_bitmap(animation)
make_loop_animation_sprites(animation)
set_loop_animation_origin(animation)
end
#--------------------------------------------------------------------------
# ● 初始化循环动画播放位置(新增定义)
#--------------------------------------------------------------------------
def init_loop_animation_duration(animation)
@hzhj_loop_durations[animation] = animation.frame_max * @ani_rate + 1
end
#--------------------------------------------------------------------------
# ● 读取循环动画图像(新增定义)
#--------------------------------------------------------------------------
def load_loop_animation_bitmap(animation)
animation1_name = animation.animation1_name
animation1_hue = animation.animation1_hue
animation2_name = animation.animation2_name
animation2_hue = animation.animation2_hue
bitmap1 = Cache.animation(animation1_name, animation1_hue)
bitmap2 = Cache.animation(animation2_name, animation2_hue)
if @@_reference_count.include?(bitmap1)
@@_reference_count[bitmap1] += 1
else
@@_reference_count[bitmap1] = 1
end
if @@_reference_count.include?(bitmap2)
@@_reference_count[bitmap2] += 1
else
@@_reference_count[bitmap2] = 1
end
@hzhj_loop_bitmap1s[animation] = bitmap1
@hzhj_loop_bitmap2s[animation] = bitmap2
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● 生成循环动画活动块(新增定义)
#--------------------------------------------------------------------------
def make_loop_animation_sprites(animation)
sprites = []
if @use_sprite
16.times do
sprite = ::Sprite.new(viewport)
sprite.visible = false
sprites.push(sprite)
end
end
@hzhj_loop_sprites[animation] = sprites
end
#--------------------------------------------------------------------------
# ● 设定循环动画的原点(新增定义)
#--------------------------------------------------------------------------
def set_loop_animation_origin(animation)
if animation.position == 3
if viewport == nil
ani_ox = Graphics.width / 2
ani_oy = Graphics.height / 2
else
ani_ox = viewport.rect.width / 2
ani_oy = viewport.rect.height / 2
end
else
ani_ox = x - ox + width / 2
ani_oy = y - oy + height / 2
if animation.position == 0
ani_oy -= height / 2
elsif animation.position == 2
ani_oy += height / 2
end
end
@hzhj_loop_ani_oxs[animation] = ani_ox
@hzhj_loop_ani_oys[animation] = ani_oy
end
#--------------------------------------------------------------------------
# ● 释放所有循环动画(新增定义)
#--------------------------------------------------------------------------
def dispose_loop_animation
return unless loop_animation?
for animation in @hzhj_loop_animations.clone
end_loop_animation(animation)
end
@hzhj_loop_durations.clear
@hzhj_loop_sprites.clear
@hzhj_loop_bitmap1s.clear
@hzhj_loop_bitmap2s.clear
@hzhj_loop_ani_oxs.clear
@hzhj_loop_ani_oys.clear
@hzhj_loop_animations.clear
end
#--------------------------------------------------------------------------
# ● 结束某个循环动画(新增定义)
#--------------------------------------------------------------------------
def end_loop_animation(animation)
return if not @hzhj_loop_animations.include?(animation)
bitmap1 = @hzhj_loop_bitmap1s[animation]
@@_reference_count[bitmap1] -= 1
if @@_reference_count[bitmap1] == 0
@@_reference_count.delete(bitmap1)
bitmap1.dispose
end
bitmap2 = @hzhj_loop_bitmap2s[animation]
@@_reference_count[bitmap2] -= 1
if @@_reference_count[bitmap2] == 0
@@_reference_count.delete(bitmap2)
bitmap2.dispose
end
sprites = @hzhj_loop_sprites[animation]
for sprite in sprites
sprite.dispose
end
@hzhj_loop_durations.delete(animation)
@hzhj_loop_sprites.delete(animation)
@hzhj_loop_bitmap1s.delete(animation)
@hzhj_loop_bitmap2s.delete(animation)
@hzhj_loop_ani_oxs.delete(animation)
@hzhj_loop_ani_oys.delete(animation)
@hzhj_loop_animations.delete(animation)
end
#--------------------------------------------------------------------------
# ● 刷新(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_for_state_ani_spr_base update
def update
hzhj_old_update_for_state_ani_spr_base
update_loop_animation
end
#--------------------------------------------------------------------------
# ● 刷新循环动画(新增定义)
#--------------------------------------------------------------------------
def update_loop_animation
@flash_nil_duration -= 1 if @flash_nil_duration > 0
return unless loop_animation?
for animation in @hzhj_loop_animations
@hzhj_loop_durations[animation] -= 1
duration = @hzhj_loop_durations[animation]
if duration % @ani_rate == 0
if duration > 0
set_loop_animation_origin(animation)
frame_index = animation.frame_max
frame_index -= (duration + @ani_rate - 1) / @ani_rate
args = []
args[0] = @hzhj_loop_sprites[animation]
args[1] = @hzhj_loop_bitmap1s[animation]
args[2] = @hzhj_loop_bitmap2s[animation]
args[3] = @hzhj_loop_ani_oxs[animation]
args[4] = @hzhj_loop_ani_oys[animation]
args[5] = animation.loop_z_correction
args[6] = ((not flash_nil? or animation.to_screen?) and visible)
loop_animation_set_sprites(animation.frames[frame_index], args)
animation.timings.each do |timing|
loop_animation_process_timing(timing) if timing.frame == frame_index
end
else
init_loop_animation_duration(animation)
redo
end
end
end
end
#--------------------------------------------------------------------------
# ● 设定循环动画的活动块(新增定义)
#--------------------------------------------------------------------------
def loop_animation_set_sprites(frame, args)
sprites = args[0]
bitmap1 = args[1]
bitmap2 = args[2]
ani_ox = args[3]
ani_oy = args[4]
loop_z_correction = args[5]
state_visible = args[6]
cell_data = frame.cell_data
sprites.each_with_index do |sprite, i|
next unless sprite
pattern = cell_data[i, 0]
if !pattern || pattern < 0
sprite.visible = false
next
end
sprite.bitmap = pattern < 100 ? bitmap1 : bitmap2
sprite.visible = state_visible
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
sprite.x = ani_ox + cell_data[i, 1]
sprite.y = ani_oy + cell_data[i, 2]
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
if loop_z_correction > 9999
sprite.z = loop_z_correction % 10000 + i
elsif loop_z_correction < -9999
sprite.z = loop_z_correction % -10000 + i
else
sprite.z = self.z + loop_z_correction + i
end
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
#--------------------------------------------------------------------------
# ● 循环动画SE 和闪烁时机的处理(新增定义)
#--------------------------------------------------------------------------
def loop_animation_process_timing(timing)
timing.se.play
case timing.flash_scope
when 1
self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
when 2
if viewport
viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
end
when 3
self.flash(nil, timing.flash_duration * @ani_rate)
end
end
#--------------------------------------------------------------------------
# ● 设置闪烁(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_flash_for_state_ani_spr_base flash
def flash(*args)
if args[0].nil?
@flash_nil_duration = args[1]
else
@flash_nil_duration = 0
end
hzhj_old_flash_for_state_ani_spr_base(*args)
end
#--------------------------------------------------------------------------
# ● 判断是否正处于【隐藏目标】(新增定义)
#--------------------------------------------------------------------------
def flash_nil?
return (@flash_nil_duration > 0)
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_state_ani_spr_battler initialize
def initialize(*args)
hzhj_old_init_for_state_ani_spr_battler(*args)
init_battler_add_state_id
end
#--------------------------------------------------------------------------
# ● 初始化战斗者要播放状态动画的状态(新增定义)
#--------------------------------------------------------------------------
def init_battler_add_state_id
if @battler.nil?
dispose_loop_animation
else
@battler.hzhj_add_state_id.clear
@battler.hzhj_remove_state_id.clear
@battler.need_update_state_animation = true
for state in @battler.states
next if state.nil?
next if $data_animations[state.animation_id].nil?
@battler.hzhj_add_state_id.push(state.id)
end
end
end
#--------------------------------------------------------------------------
# ● 设置战斗者(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_battlerdy_for_state_ani_spr_battler battler=
def battler=(value)
old_battler = @battler
hzhj_old_battlerdy_for_state_ani_spr_battler(value)
if old_battler != @battler
init_battler_add_state_id
end
end
#--------------------------------------------------------------------------
# ● 刷新(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_for_state_ani_spr_battler update
def update
hzhj_old_update_for_state_ani_spr_battler
if @battler
if @battler.need_update_state_animation
@battler.need_update_state_animation = false
if not @battler.hzhj_add_state_id.empty?
for i in @battler.hzhj_add_state_id
if @battler.state?(i)
ani_id = $data_states.animation_id
animation = $data_animations[ani_id]
start_loop_animation(animation) if not animation.nil?
end
end
@battler.hzhj_add_state_id.clear
end
if not @battler.hzhj_remove_state_id.empty?
for i in @battler.hzhj_remove_state_id
if not @battler.state?(i)
ani_id = $data_states.animation_id
animation = $data_animations[ani_id]
end_loop_animation(animation) if not animation.nil?
end
end
@battler.hzhj_remove_state_id.clear
end
end
end
end
end
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● 显示状态附加/解除(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_status_for_state_ani_wnd_btlog display_changed_states
def display_changed_states(target)
target.need_update_state_animation = true
hzhj_old_display_status_for_state_ani_wnd_btlog(target)
end
end
#==============================================================================
# ■ Sprite_Damage (新增类)
#==============================================================================
class Sprite_Damage < Sprite
include Hzhj::HorizontalBattleSystem
#--------------------------------------------------------------------------
# ● 获取/生成伤害值源图
#--------------------------------------------------------------------------
@@obmp = nil
def self.obmp
if @@obmp.nil? or @@obmp.disposed?
@@obmp = Bitmap.new(180, 256)
@@obmp.font.bold = true
@@obmp.font.shadow = false
@@obmp.font.outline = true
@@obmp.font.out_color = Color.new(255, 255, 255, 255)
@@obmp.font.size = 32
colors = []
colors.push(Color.new(255, 0, 0, 255))
colors.push(Color.new(255, 128, 128, 255))
colors.push(Color.new( 0, 0, 255, 255))
colors.push(Color.new(128, 128, 255, 255))
colors.push(Color.new( 0, 255, 0, 255))
colors.push(Color.new(128, 255, 128, 255))
colors.each_with_index do |color, hi|
@@obmp.font.color = color
for wi in 0..9
@@obmp.draw_text(wi * 18, hi * 32, 18, 32, "#{wi}", 1)
end
end
@@obmp.font.size = 20
@@obmp.font.italic = true
@@obmp.font.out_color = Color.new(0, 0, 0, 255)
@@obmp.font.color = Color.new(255, 255, 255, 255)
@@obmp.draw_text( 0, 192, 90, 32, "Critical", 1)
@@obmp.draw_text(90, 192, 90, 32, "Miss", 1)
@@obmp.draw_text( 0, 224, 90, 32, "Evasion", 1)
@@obmp.hue_change(DamageBitmapHue)
end
return @@obmp
end
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(viewport, args)
super(viewport)
@type = args[0]
@value = args[1]
@critical = args[2]
self.x = args[4]
self.y = args[5]
self.z = args[6] + Graphics.height * 5
make_move(args[3])
refresh
end
#--------------------------------------------------------------------------
# ● 生成移动数据
#--------------------------------------------------------------------------
def make_move(battler_obj_class)
@move = []
case battler_obj_class
when :actor
make_move_actor
when :enemy
make_move_enemy
else
make_move_default
end
end
#--------------------------------------------------------------------------
# ● 生成移动数据 默认
#--------------------------------------------------------------------------
def make_move_default
45.times do |n|
if n % 3 == 0
ady = n < 21 ? -6 : -1
opa = n < 21 ? 255 : 255-(n-21)*6
@move.push([0, ady, opa])
else
@move.push([0, 0, -1])
end
end
end
#--------------------------------------------------------------------------
# ● 生成移动数据 角色
#--------------------------------------------------------------------------
def make_move_actor
make_move_default
end
#--------------------------------------------------------------------------
# ● 生成移动数据 敌人
#--------------------------------------------------------------------------
def make_move_enemy
make_move_default
end
#--------------------------------------------------------------------------
# ● 描绘
#--------------------------------------------------------------------------
def refresh
if not self.bitmap.nil?
self.bitmap.dispose
self.bitmap = nil
end
begin
@obmp = Cache.animation("damage", DamageBitmapHue)
rescue Errno::ENOENT
@obmp = Sprite_Damage.obmp
end
@numw = @obmp.width / 10
@numh = @obmp.height / 8
@strw = @obmp.width / 2
case @value
when Numeric
blt_obmp_numeric
when Symbol
blt_obmp_text
end
end
#--------------------------------------------------------------------------
# ● 通过源图描绘数字
#--------------------------------------------------------------------------
def blt_obmp_numeric
nums = @value.to_i.abs.to_s.split("")
nbmpw = nums.size * @numw
bmph = @numh
cbmpw = 0
crect = nil
dy = 0
if @critical
cbmpw = @strw
bmph *= 2
crect = Rect.new(0, @numh * 6, @strw, @numh)
dy = @numh
end
self.bitmap = Bitmap.new([nbmpw, cbmpw, 32].max, [bmph, 32].max)
self.ox = bitmap.width / 2
self.oy = bmph /2
bitmap.blt((bitmap.width - cbmpw) / 2, 0, @obmp, crect) if crect
dx = (bitmap.width - nbmpw) / 2
ry = 0
case @type
when :hp
ry = @value >= 0 ? 0 : @numh
when :mp
ry = @value >= 0 ? @numh * 2 : @numh * 3
when :tp
ry = @value >= 0 ? @numh * 4 : @numh * 5
else
return
end
rect = Rect.new(0, ry, @numw, @numh)
nums.each_with_index do |str, i|
rect.x = str.to_i * @numw
bitmap.blt(dx, dy, @obmp, rect)
dx += @numw
end
end
#--------------------------------------------------------------------------
# ● 通过源图描绘文字
#--------------------------------------------------------------------------
def blt_obmp_text
self.bitmap = Bitmap.new([@strw, 32].max, [@numh, 32].max)
self.ox = @strw / 2
self.oy = @numh / 2
rx = ry = 0
case @type
when :miss
rx = @strw
ry = @numh * 6
when :eva
ry = @numh * 7
else
return
end
rect = Rect.new(rx, ry, @strw, @numh)
bitmap.blt(0, 0, @obmp, rect)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
bitmap.dispose if bitmap
super
end
#--------------------------------------------------------------------------
# ● 移动中判定
#--------------------------------------------------------------------------
def moving?
return (not @move.empty?)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
super
if moving?
ary = @move.shift
self.x += ary[0]
self.y += ary[1]
self.opacity = ary[2] if ary[2] >= 0
end
end
end
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 实例变量(新增定义)
#--------------------------------------------------------------------------
attr_accessor :hzhj_damage
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_display_damage_game_battler_base initialize
def initialize
@hzhj_damage = []
hzhj_old_init_for_display_damage_game_battler_base
end
end
#==============================================================================
# ■ Sprite_Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_display_damage_spr_base initialize
def initialize(*args)
hzhj_old_init_for_display_damage_spr_base(*args)
@hzhj_damage_sprites = []
end
#--------------------------------------------------------------------------
# ● 释放(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_dispose_for_display_damage_spr_base dispose
def dispose
hzhj_old_dispose_for_display_damage_spr_base
dispose_damage
end
#--------------------------------------------------------------------------
# ● 判断是否有伤害在显示(新增定义)
#--------------------------------------------------------------------------
def damage?
return (not @hzhj_damage_sprites.empty?)
end
#--------------------------------------------------------------------------
# ● 开始显示伤害(新增定义)
#--------------------------------------------------------------------------
def start_damage(args)
args[4] = x - ox + width / 2
args[5] = y - oy + height / 2
args[6] = z
@hzhj_damage_sprites.push(Sprite_Damage.new(viewport, args))
end
#--------------------------------------------------------------------------
# ● 释放所有伤害显示(新增定义)
#--------------------------------------------------------------------------
def dispose_damage
return unless damage?
@hzhj_damage_sprites.each{|sprite|sprite.dispose}
@hzhj_damage_sprites.clear
end
#--------------------------------------------------------------------------
# ● 刷新(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_for_display_damage_spr_base update
def update
hzhj_old_update_for_display_damage_spr_base
update_damage
end
#--------------------------------------------------------------------------
# ● 刷新显示伤害(新增定义)
#--------------------------------------------------------------------------
def update_damage
return unless damage?
@hzhj_damage_sprites.each_with_index do |sprite, i|
if sprite.moving?
sprite.update
else
sprite.dispose
@hzhj_damage_sprites = nil
end
end
@hzhj_damage_sprites.delete(nil)
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 刷新(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_for_display_damage_spr_battler update
def update
hzhj_old_update_for_display_damage_spr_battler
if @battler
if not @battler.hzhj_damage.empty?
unless @battler.damage_section_displayed
args = @battler.hzhj_damage.clone
args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
start_damage(args)
end
@battler.hzhj_damage.clear
end
end
end
end
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● 显示 MISS (追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_miss_for_display_damage_wnd_btlog display_miss
def display_miss(target, item)
target.hzhj_damage = [:miss, :miss, false]
hzhj_old_display_miss_for_display_damage_wnd_btlog(target, item)
end
#--------------------------------------------------------------------------
# ● 显示回避 (追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_evasion_for_display_damage_wnd_btlog display_evasion
def display_evasion(target, item)
target.hzhj_damage = [:eva, :evasion, false]
hzhj_old_display_evasion_for_display_damage_wnd_btlog(target, item)
end
#--------------------------------------------------------------------------
# ● 显示 HP 伤害 (追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_hp_damage_for_display_damage_wnd_btlog display_hp_damage
def display_hp_damage(target, item)
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
value = target.result.hp_damage
critical = target.result.critical
target.hzhj_damage = [:hp, value, critical]
hzhj_old_display_hp_damage_for_display_damage_wnd_btlog(target, item)
end
#--------------------------------------------------------------------------
# ● 显示 MP 伤害 (追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_mp_damage_for_display_damage_wnd_btlog display_mp_damage
def display_mp_damage(target, item)
return if target.dead? || target.result.mp_damage == 0
value = target.result.mp_damage
critical = target.result.critical
target.hzhj_damage = [:mp, value, critical]
hzhj_old_display_mp_damage_for_display_damage_wnd_btlog(target, item)
end
#--------------------------------------------------------------------------
# ● 显示 TP 伤害 (追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_display_tp_damage_for_display_damage_wnd_btlog display_tp_damage
def display_tp_damage(target, item)
return if target.dead? || target.result.tp_damage == 0
value = target.result.tp_damage
critical = target.result.critical
target.hzhj_damage = [:tp, value, critical]
hzhj_old_display_tp_damage_for_display_damage_wnd_btlog(target, item)
end
end
class RPG::Animation
def need_move
return @need_move unless @need_move.nil?
if /@[Rr][Mm]/ =~ @name
return (@need_move = true)
else
return (@need_move = false)
end
end
def move_se
return @move_se unless @move_se.nil?
@move_se = RPG::SE.new
if /@[Ss][Ee]\[(.+?)\]/ =~ @name
@move_se.name = $1.clone
end
return @move_se
end
attr_writer :need_move
attr_writer :move_se
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
include Hzhj::HorizontalBattleSystem
#--------------------------------------------------------------------------
# ● 属性
#--------------------------------------------------------------------------
attr_accessor :add_x # X 坐标变化量
attr_accessor :add_y # Y 坐标变化量
attr_accessor :move_speed_x # 战斗图 X 移动速度
attr_accessor :move_speed_y # 战斗图 Y 移动速度
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_real_move_game_battler initialize
def initialize
@add_x = 0
@add_y = 0
@move_speed_x = 0
@move_speed_y = 0
hzhj_old_init_for_real_move_game_battler
end
#--------------------------------------------------------------------------
# ● 真实 X 坐标(新增定义)
#--------------------------------------------------------------------------
def real_screen_x
return screen_x + add_x
end
#--------------------------------------------------------------------------
# ● 真实 Y 坐标(新增定义)
#--------------------------------------------------------------------------
def real_screen_y
return screen_y + add_y
end
#--------------------------------------------------------------------------
# ● 返回自己的战斗位置(新增定义)
#--------------------------------------------------------------------------
def come_back_self_position(duration)
return if dead?
tx = screen_x
ty = screen_y
addx = tx - real_screen_x
addy = ty - real_screen_y
return if addx == 0 && addy == 0
@add_x = 0
@add_y = 0
@move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
@move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
end
#--------------------------------------------------------------------------
# ● 设置移动信息(新增定义)
#--------------------------------------------------------------------------
def setup_move_info(target_battler, duration, move_se)
return if dead?
tbmp = Cache.battler(target_battler.battler_name, target_battler.battler_hue)
sbmp = Cache.battler(@battler_name, @battler_hue)
tbw = tbmp.width / DynamicPatternMax + RealMoveBmpAddW
sbw = sbmp.width / DynamicPatternMax + RealMoveBmpAddW
tbh = tbmp.height + RealMoveBmpAddH
sbh = sbmp.height + RealMoveBmpAddH
d = actor? ? ActorDirection : 10 - ActorDirection
tx = target_battler.real_screen_x
ty = target_battler.real_screen_y
case d
when 1
tx = tx + tbw / 2 + sbw / 2
ty = ty - sbh / 2
when 2
ty = ty - sbh / 2
when 3
tx = tx - tbw / 2 - sbw / 2
ty = ty - sbh / 2
when 4
tx = tx + tbw / 2 + sbw / 2
when 6
tx = tx - tbw / 2 - sbw / 2
when 7
tx = tx + tbw / 2 + sbw / 2
ty = ty + sbh / 2
when 8
ty = ty + sbh / 2
when 9
tx = tx - tbw / 2 - sbw / 2
ty = ty + sbh / 2
end
addx = tx - real_screen_x
addy = ty - real_screen_y
return if addx == 0 && addy == 0
@add_x = tx - screen_x if addx != 0
@add_y = ty - screen_y if addy != 0
@move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
@move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
move_se.play
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_real_move_spr_battler initialize
def initialize(viewport, battler = nil)
hzhj_old_init_for_real_move_spr_battler(viewport, battler)
init_position(@battler) if @battler
end
#--------------------------------------------------------------------------
# ● 设置战斗者(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_set_battler_for_real_move_spr_battler battler=
def battler=(value)
if @battler != value && value
init_position(value)
end
hzhj_old_set_battler_for_real_move_spr_battler(value)
end
#--------------------------------------------------------------------------
# ● 初始化位置(新增定义)
#--------------------------------------------------------------------------
def init_position(battler)
battler.add_x = 0
battler.add_y = 0
self.x = battler.real_screen_x
self.y = battler.real_screen_y
self.z = battler.screen_z
end
#--------------------------------------------------------------------------
# ● 移动中判定(新增定义)
#--------------------------------------------------------------------------
def moving?
return false unless @battler
(x != @battler.real_screen_x or y != @battler.real_screen_y) && @battler
end
#--------------------------------------------------------------------------
# ● 位置的更新(重定义)
#--------------------------------------------------------------------------
def update_position
if !@battler.dead?
if x < @battler.real_screen_x
self.x = [x + @battler.move_speed_x, @battler.real_screen_x].min
elsif x > @battler.real_screen_x
self.x = [x - @battler.move_speed_x, @battler.real_screen_x].max
end
if y < @battler.real_screen_y
self.y = [y + @battler.move_speed_y, @battler.real_screen_y].min
elsif y > @battler.real_screen_y
self.y = [y - @battler.move_speed_y, @battler.real_screen_y].max
end
self.z = y + 100
end
end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 判定是否移动中(新增定义)
#--------------------------------------------------------------------------
def moving?
battler_sprites.any? {|sprite| sprite.moving? }
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 等待战斗图移动的结束(新增定义)
#--------------------------------------------------------------------------
def wait_for_move
update_for_wait
update_for_wait while @spriteset.moving?
end
end
class RPG::Troop
include Hzhj::HorizontalBattleSystem
def display_enemy_bar
return @display_enemy_bar unless @display_enemy_bar.nil?
if /@ebar/i =~ @name
return (@display_enemy_bar = !DefaultDisplayEnemyBar)
else
return (@display_enemy_bar = DefaultDisplayEnemyBar)
end
end
attr_writer :display_enemy_bar
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
attr_accessor :display_enemy_bar # 是否显示敌人HP条、MP条、TP条
#--------------------------------------------------------------------------
# ● 设置
#--------------------------------------------------------------------------
alias hzhj_old_setup_for_display_enemy_bar_game_troop setup
def setup(troop_id)
hzhj_old_setup_for_display_enemy_bar_game_troop(troop_id)
@display_enemy_bar = troop.display_enemy_bar
end
end
#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy < Window_Selectable
#--------------------------------------------------------------------------
# ● 取得列数
#--------------------------------------------------------------------------
def col_max
if $game_troop.display_enemy_bar
return 1
else
return 2
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
create_contents
super
end
#--------------------------------------------------------------------------
# ● 描画项目
#--------------------------------------------------------------------------
def draw_item(index)
if $game_troop.display_enemy_bar
enemy = $game_troop.alive_members[index]
draw_basic_area(basic_area_rect(index), enemy)
draw_gauge_area(gauge_area_rect(index), enemy)
else
change_color(normal_color)
name = $game_troop.alive_members[index].name
draw_text(item_rect_for_text(index), name)
end
end
#--------------------------------------------------------------------------
# ● 取得基本区域的矩形
#--------------------------------------------------------------------------
def basic_area_rect(index)
rect = item_rect_for_text(index)
rect.width -= gauge_area_width + 10
rect
end
#--------------------------------------------------------------------------
# ● 取得值槽区域的矩形
#--------------------------------------------------------------------------
def gauge_area_rect(index)
rect = item_rect_for_text(index)
rect.x += rect.width - gauge_area_width
rect.width = gauge_area_width
rect
end
#--------------------------------------------------------------------------
# ● 取得值槽区域的宽度
#--------------------------------------------------------------------------
def gauge_area_width
return 220
end
#--------------------------------------------------------------------------
# ● 描画基本区域
#--------------------------------------------------------------------------
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x + 0, rect.y, 100)
draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
end
#--------------------------------------------------------------------------
# ● 描画值槽区域
#--------------------------------------------------------------------------
def draw_gauge_area(rect, actor)
if $data_system.opt_display_tp
draw_gauge_area_with_tp(rect, actor)
else
draw_gauge_area_without_tp(rect, actor)
end
end
#--------------------------------------------------------------------------
# ● 描画值槽区域(包括 TP 值)
#--------------------------------------------------------------------------
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 72)
draw_actor_mp(actor, rect.x + 82, rect.y, 64)
draw_actor_tp(actor, rect.x + 156, rect.y, 64)
end
#--------------------------------------------------------------------------
# ● 描画值槽区域(不包括 TP 值)
#--------------------------------------------------------------------------
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 134)
draw_actor_mp(actor, rect.x + 144, rect.y, 76)
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
include Hzhj::HorizontalBattleSystem
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_dynamic_spr_battler initialize
def initialize(viewport, battler = nil)
hzhj_old_init_for_dynamic_spr_battler(viewport, battler)
@dynamic_duration = 0
@dynamic_duration_max = DynamicPatternMax * OnePatternDuration
end
#--------------------------------------------------------------------------
# ● 源位图(Source Bitmap)的更新(重定义)
#--------------------------------------------------------------------------
def update_bitmap
new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
if bitmap != new_bitmap
self.bitmap = new_bitmap
init_visibility
@dynamic_duration = 0
@sx = 0
@sw = bitmap.width / DynamicPatternMax
@sh = bitmap.height
self.ox = @sw / 2
self.oy = @sh
src_rect.set(@sx, 0, @sw, @sh)
end
end
#--------------------------------------------------------------------------
# ● 原点的更新(重定义)
#--------------------------------------------------------------------------
def update_origin
if bitmap
@dynamic_duration += 1
@dynamic_duration %= @dynamic_duration_max
@sx = @dynamic_duration / OnePatternDuration * @sw
src_rect.set(@sx, 0, @sw, @sh)
end
end
#--------------------------------------------------------------------------
# ● 返回普通设定(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_revert_to_normal_for_dynamic_spr_battler revert_to_normal
def revert_to_normal
hzhj_old_revert_to_normal_for_dynamic_spr_battler
self.ox = @sw / 2 if bitmap
end
#--------------------------------------------------------------------------
# ● BOSS 战败(崩坏)效果的更新(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_boss_col_for_dynamic_spr_battler update_boss_collapse
def update_boss_collapse
hzhj_old_update_boss_col_for_dynamic_spr_battler
self.ox = @sw / 2 + @effect_duration % 2 * 4 - 2
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
def set_normal_battler_name
@battler_name = @battler_name.split(/★/)[0]
end
def set_beaten_battler_name
if guard?
if (UseActorGuardGraphic && actor?) or
(UseEnemyGuardGraphic && enemy?)
set_guard_battler_name
return
end
end
@battler_name = @battler_name.split(/★/)[0] + "★1"
if UseActorWBSE && actor?
Audio.se_play("Audio/SE/AWBSE_#{id}", 100, 100)
elsif UseEnemyWBSE && enemy?
Audio.se_play("Audio/SE/EWBSE_#{enemy_id}", 100, 100)
end
end
def set_dead_battler_name
@battler_name = @battler_name.split(/★/)[0] + "★2"
end
def set_guard_battler_name
@battler_name = @battler_name.split(/★/)[0] + "★3"
if UseActorGDSE && actor?
Audio.se_play("Audio/SE/AGDSE_#{id}", 100, 100)
elsif UseEnemyGDSE && enemy?
Audio.se_play("Audio/SE/EGDSE_#{enemy_id}", 100, 100)
end
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 初始化(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_init_for_dead_spr_battler initialize
def initialize(viewport, battler = nil)
hzhj_old_init_for_dead_spr_battler(viewport, battler)
@dead_graphic_used = false
if @battler
@battler.set_normal_battler_name
if @battler.dead?
if (UseActorDeadGraphic && @battler.actor?) or
(UseEnemyDeadGraphic && @battler.enemy?)
@battler.set_dead_battler_name
@dead_graphic_used = true
end
end
end
@beaten_duration = -1
end
#--------------------------------------------------------------------------
# ● 设置战斗者(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_set_battler_for_dead_spr_battler battler=
def battler=(value)
if @battler != value
@dead_graphic_used = false
if value
value.set_normal_battler_name
if value.dead?
if (UseActorDeadGraphic && value.actor?) or
(UseEnemyDeadGraphic && value.enemy?)
value.set_dead_battler_name
@dead_graphic_used = true
end
end
end
@beaten_duration = -1
end
hzhj_old_set_battler_for_dead_spr_battler(value)
end
#--------------------------------------------------------------------------
# ● 源位图(Source Bitmap)的更新(重定义)
#--------------------------------------------------------------------------
alias hzhj_old_update_bitmap_for_was_beaten_spr_battler update_bitmap
def update_bitmap
if @beaten_duration > 0
@beaten_duration -= 1
elsif @beaten_duration == 0
@beaten_duration = -1
set_bitmap(:normal)
end
hzhj_old_update_bitmap_for_was_beaten_spr_battler
end
#--------------------------------------------------------------------------
# ● 初始化可视状态(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_visibility_for_dead_spr_battler init_visibility
def init_visibility
hzhj_old_visibility_for_dead_spr_battler
if @battler.dead?
if (UseActorDeadGraphic && @battler.actor?) or
(UseEnemyDeadGraphic && @battler.enemy?)
self.opacity = 255
end
end
end
#--------------------------------------------------------------------------
# ● 效果开始(追加定义)
#--------------------------------------------------------------------------
alias hzhj_old_start_effect_for_dead_spr_battler start_effect
def start_effect(effect_type)
if effect_type == :appear
if @dead_graphic_used
set_bitmap(:normal)
@effect_type = nil
@effect_duration = 0
@dead_graphic_used = false
@battler_visible = true
return
end
elsif effect_type == :collapse or
effect_type == :boss_collapse or
effect_type == :instant_collapse
if @beaten_duration >= 0
@beaten_duration = -1
set_bitmap(:normal)
end
if (UseActorDeadGraphic && @battler.actor?) or
(UseEnemyDeadGraphic && @battler.enemy?)
set_bitmap(:dead)
@effect_type = nil
@effect_duration = 0
@dead_graphic_used = true
@battler_visible = false
return
end
end
hzhj_old_start_effect_for_dead_spr_battler(effect_type)
end
#--------------------------------------------------------------------------
# ● 设置新的位图(新增定义)
#--------------------------------------------------------------------------
def set_bitmap(sym)
case sym
when :normal
@battler.set_normal_battler_name
when :was_beaten
@battler.set_beaten_battler_name
when :dead
@battler.set_dead_battler_name
else
return
end
new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
if bitmap != new_bitmap
self.bitmap = new_bitmap
@dynamic_duration = 0
@sx = 0
@sw = bitmap.width / DynamicPatternMax
@sh = bitmap.height
self.ox = @sw / 2
self.oy = @sh
src_rect.set(@sx, 0, @sw, @sh)
end
update_origin
update_position
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 发动技能/物品(新增定义)
#--------------------------------------------------------------------------
def hzhj_invoke_item(target, item, damage_target)
refresh_status
@log_window.display_action_results(damage_target, item)
@subject.damage_section_displayed = false
@subject.last_target_index = target.index
return if target.dead?
if rand < target.item_cnt(@subject, item)
hzhj_invoke_counter_attack(target, item)
elsif rand < target.item_mrf(@subject, item)
hzhj_invoke_magic_reflection(target, item)
end
end
#--------------------------------------------------------------------------
# ● 发动物理反击(新增定义)
#--------------------------------------------------------------------------
def hzhj_invoke_counter_attack(target, item)
@log_window.display_counter(target, item)
attack_skill = $data_skills[target.attack_skill_id]
@subject.item_apply(target, attack_skill)
need_move = false
animation1 = $data_animations[target.animation1_id]
need_move = animation1.need_move if animation1
ary = [@subject]
if need_move
target.setup_move_info(@subject, RealMoveDuration, animation1.move_se)
wait_for_move
end
@subject.damage_section_displayed = false
@subject.not_damage_section = false
show_subject_animation(target.animation1_id, target)
show_normal_animation(ary, target.atk_animation_id1, false)
show_normal_animation(ary, target.atk_animation_id2, true)
@log_window.wait
wait_for_animation
if need_move && target.alive?
target.come_back_self_position(RealMoveDuration)
wait_for_move
end
refresh_status
@log_window.display_action_results(@subject, attack_skill)
end
#--------------------------------------------------------------------------
# ● 发动魔法反射(新增定义)
#--------------------------------------------------------------------------
def hzhj_invoke_magic_reflection(target, item)
@subject.damage_section_displayed = false
@subject.not_damage_section = false
@log_window.display_reflection(target, item)
@subject.item_apply(@subject, item)
refresh_status
@log_window.display_action_results(@subject, item)
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
attr_accessor :damage_section_displayed
attr_accessor :not_damage_section
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 执行伤害效果
#--------------------------------------------------------------------------
alias hzhj_old_per_damage_for_damage_section_game_actor perform_damage_effect
def perform_damage_effect
unless damage_section_displayed
hzhj_old_per_damage_for_damage_section_game_actor
end
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 执行伤害效果
#--------------------------------------------------------------------------
alias hzhj_old_per_damage_for_damage_section_game_enemy perform_damage_effect
def perform_damage_effect
unless damage_section_displayed
hzhj_old_per_damage_for_damage_section_game_enemy
end
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● SE 和闪烁时机的处理
#--------------------------------------------------------------------------
def animation_process_timing(timing)
if timing.se.name == DamageSectionDisplaySEName
hp_value = @battler.result.hp_damage
mp_value = @battler.result.mp_damage
tp_value = @battler.result.tp_damage
value = args = nil
was_beaten = false
if hp_value != 0 && !@battler.not_damage_section
was_beaten = true if hp_value > 0
value = hp_value * timing.flash_color.red.to_i / 100
critical = @battler.result.critical
args = [:hp, value, critical]
elsif mp_value != 0 && !@battler.not_damage_section
was_beaten = true if mp_value > 0
value = mp_value * timing.flash_color.red.to_i / 100
critical = @battler.result.critical
args = [:mp, value, critical]
elsif tp_value != 0 && !@battler.not_damage_section
was_beaten = true if tp_value > 0
value = tp_value * timing.flash_color.red.to_i / 100
critical = @battler.result.critical
args = [:tp, value, critical]
end
if value && args
args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
@battler.damage_section_displayed = true
start_damage(args)
if UseBeatenGraphic && was_beaten
set_bitmap(:was_beaten)
@beaten_duration = BeatenGraphicDuration
end
end
return
end
super(timing)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 应用技能/物品效果(新增定义)
#--------------------------------------------------------------------------
def hzhj_apply_item_effects(target, item)
target.damage_section_displayed = false
target.not_damage_section = false
target = apply_substitute(target, item)
target.damage_section_displayed = false
target.not_damage_section = false
target.item_apply(@subject, item)
return target
end
end
#==============================================================================
# ■ 此脚本来自 www.66rpg.com
#==============================================================================[/pre]
[pre lang="ruby" line="1"]#==============================================================================
# +++ MOG - Advanced Battle Hud (v2.6) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de hud avançado de batalha.
#==============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 2.6 - Melhor codificação
# v 2.5 - Melhoria na performance
# - Correção de bugs.
#==============================================================================
#
# Battle_AT_Layout.png
# Battle_AT_Meter.png
#
#==============================================================================
# ■ - FACE ANIMADAS DOS PERSONAGENS - (Opcional)
#==============================================================================
# 1 - Grave as imagens das faces dos personagens na pasta.
#
# GRAPHICS/BATTLERS/
#
# 2 - Nomeie a imagem com o mesmo nome do personagem. (EG - Hertor.png)
# 3 - A largura da imagem deverá ser dividido por 5. (A escolha do tamanho
# da face é livre desde que a lagura dividido pela altura seja igual a 5 )
#
#==============================================================================
#==============================================================================
# ■ BATTLE HUD SETTING
#==============================================================================
module MOG_BATTLE_HUD
# Ativar Battlers dos personagens em faces, deixe desativado em caso de haver
# outros scripts que usam battlers dos personagens em seu projeto.
BATTLER_FACE_ENABLE = true
#Definição geral da posição da HUD.
HUD_POSITION = [5,315]
#Definição da posição da face
FACE_POSITION = [60,30]
#Definição da posição do numero de HP.
HP_NUMBER_POSITION = [85,28]
#Definição da posição do medidor de HP.
HP_METER_POSITION = [27,37]
#Definição da posição do numero de MP.
MP_NUMBER_POSITION = [101,46]
#Definição da posição do medidor de MP.
MP_METER_POSITION = [43,55]
#Definição da posição do numero de TP.
TP_NUMBER_POSITION = [85,64]
#Definição da posição do medidor de TP.
TP_METER_POSITION = [27,73]
#Definição da posição das condições
STATES_POSITION = [5,1]
#Definição da posição do comando de batalha.
COMMAND_POSITION = [0,-145]
#Definição da posição do espaço da HUD entre os membros do grupo.
MEMBERS_SPACE = [136,0]
#Definição da prioridade da HUD.
BATTLE_HUD_Z = 0
#Definição da velocidade de animação dos medidores.
METER_FLOW_SPEED = 2
#Ativa o layout mais limpo nas janelas de item e skill.
ITEM_SKILL_WINDOWS_CLEAN_STYLE = true
#Definição da opacidade das janelas.
ITEM_SKILL_WINDOW_OPACITY = 0
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :cache_battle_hud
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
pre_cache_battle_hud
end
#--------------------------------------------------------------------------
# ● Pre Cache Battle Hud
#--------------------------------------------------------------------------
def pre_cache_battle_hud
@cache_battle_hud = []
@cache_battle_hud.push(Cache.system("Battle_Hud_Number"))
@cache_battle_hud.push(Cache.system("Battle_Hud_Meter"))
@cache_battle_hud.push(Cache.system("IconSet"))
@cache_battle_hud.push(Cache.system("Battle_Hud_Layout"))
end
end
#==============================================================================
# ■ Battle_Hud
#==============================================================================
class Battle_Hud
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
@y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
@flow_speed = 0
pre_cache
create_layout
create_hp_number
create_hp_meter
create_mp_number
create_mp_meter
create_tp_number
create_tp_meter
create_states
end
#--------------------------------------------------------------------------
# ● Pre Cache
#--------------------------------------------------------------------------
def pre_cache
$game_temp.pre_cache_battle_hud
@number = $game_temp.cache_battle_hud[0]
@number_cw = @number.width / 10
@number_ch = @number.height / 4
@meter = $game_temp.cache_battle_hud[1]
@meter_cw = @meter.width / 3
@meter_ch = @meter.height / 3
@icon = $game_temp.cache_battle_hud[2]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.cache_battle_hud[3]
@layout.z = BATTLE_HUD_Z
@layout.x = @x
@layout.y = @y
end
#--------------------------------------------------------------------------
# ● Create HP Number
#--------------------------------------------------------------------------
def create_hp_number
@hp = @actor.hp
@hp_old = @actor.hp
@hp_ref = @hp_old
@hp_refresh = false
@hp_number = Sprite.new
@hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@hp_number.z = BATTLE_HUD_Z + 2
@hp_number.x = @x + HP_NUMBER_POSITION[0]
@hp_number.y = @y + HP_NUMBER_POSITION[1]
refresh_hp_number
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@hp_meter.z = BATTLE_HUD_Z + 1
@hp_meter.x = @x + HP_METER_POSITION[0]
@hp_meter.y = @y + HP_METER_POSITION[1]
@hp_flow = rand(@meter_cw * 2)
@hp_width_old = @meter_cw * @actor.hp / @actor.mhp
hp_flow_update
end
#--------------------------------------------------------------------------
# ● Hp Flow Update
#--------------------------------------------------------------------------
def hp_flow_update
@hp_meter.bitmap.clear
hp_width = @meter_cw * @actor.hp / @actor.mhp
hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
@hp_flow += METER_FLOW_SPEED
@hp_flow = 0 if @hp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Execute Damage Flow
#--------------------------------------------------------------------------
def execute_damage_flow(hp_width)
n = (@hp_width_old - hp_width).abs * 3 / 100
damage_flow = [[n, 2].min,0.5].max
@hp_width_old -= damage_flow
@hp_width_old = hp_width if @hp_width_old < hp_width
src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, src_rect_old)
end
#--------------------------------------------------------------------------
# ● Update HP Number
#--------------------------------------------------------------------------
def update_hp_number
@hp_refresh = true
n = 2 * (@actor.hp - @hp_old).abs / 100
hp_ref = [[n, 100].min,1].max
if @hp_old < @actor.hp
@hp += hp_ref
if @hp >= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
elsif @hp_old > @actor.hp
@hp -= hp_ref
if @hp <= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh HP Number
#--------------------------------------------------------------------------
def refresh_hp_number
@flow_speed = METER_FLOW_SPEED
@hp_number.bitmap.clear
number_value = @hp.abs.to_s.split(//)
hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
@hp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@hp_refresh = false if @hp == @actor.hp
end
#--------------------------------------------------------------------------
# ● Create MP Number
#--------------------------------------------------------------------------
def create_mp_number
@mp = @actor.mp
@mp_old = @actor.mp
@mp_ref = @mp_old
@mp_refresh = false
@mp_number = Sprite.new
@mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@mp_number.z = BATTLE_HUD_Z + 2
@mp_number.x = @x + MP_NUMBER_POSITION[0]
@mp_number.y = @y + MP_NUMBER_POSITION[1]
refresh_mp_number
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@mp_meter.z = BATTLE_HUD_Z + 1
@mp_meter.x = @x + MP_METER_POSITION[0]
@mp_meter.y = @y + MP_METER_POSITION[1]
@mp_flow = rand(@meter_cw * 2)
@mp_width_old = @meter_cw * @actor.mp / @actor.mmp rescue 0
mp_flow_update
end
#--------------------------------------------------------------------------
# ● Mp Flow Update
#--------------------------------------------------------------------------
def mp_flow_update
return if @actor.mmp == 0
@mp_meter.bitmap.clear
mp_width = @meter_cw * @actor.mp / @actor.mmp rescue 0
src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
@mp_meter.bitmap.blt(0,0, @meter, src_rect)
@mp_flow += METER_FLOW_SPEED
@mp_flow = 0 if @mp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Update MP Number
#--------------------------------------------------------------------------
def update_mp_number
@mp_refresh = true
n = 2 * (@actor.mp - @mp_old).abs / 100
mp_ref = [[n, 100].min,1].max
if @mp_old < @actor.mp
@mp += mp_ref
if @mp >= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
elsif @mp_old > @actor.mp
@mp -= mp_ref
if @mp <= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh MP Number
#--------------------------------------------------------------------------
def refresh_mp_number
@flow_speed = METER_FLOW_SPEED
@mp_number.bitmap.clear
number_value = @mp.abs.to_s.split(//)
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
@mp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@mp_refresh = false if @mp == @actor.mp
end
#--------------------------------------------------------------------------
# ● Create TP Number
#--------------------------------------------------------------------------
def create_tp_number
@tp = @actor.tp
@tp_old = @actor.tp
@tp_ref = @tp_old
@tp_refresh = false
@tp_number = Sprite.new
@tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@tp_number.z = BATTLE_HUD_Z + 2
@tp_number.x = @x + TP_NUMBER_POSITION[0]
@tp_number.y = @y + TP_NUMBER_POSITION[1]
refresh_tp_number
end
#--------------------------------------------------------------------------
# ● Create TP Meter
#--------------------------------------------------------------------------
def create_tp_meter
@tp_meter = Sprite.new
@tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@tp_meter.z = BATTLE_HUD_Z + 1
@tp_meter.x = @x + TP_METER_POSITION[0]
@tp_meter.y = @y + TP_METER_POSITION[1]
@tp_flow = rand(@meter_cw * 2)
@tp_width_old = @meter_cw * @actor.tp / @actor.max_tp rescue 0
tp_flow_update
end
#--------------------------------------------------------------------------
# ● TP Flow Update
#--------------------------------------------------------------------------
def tp_flow_update
return if @actor.max_tp == 0
@tp_meter.bitmap.clear
tp_width = @meter_cw * @actor.tp / @actor.max_tp rescue 0
src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
@tp_meter.bitmap.blt(0,0, @meter, src_rect)
@tp_flow += METER_FLOW_SPEED
@tp_flow = 0 if @tp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Update TP Number
#--------------------------------------------------------------------------
def update_tp_number
@tp_refresh = true
n = 2 * (@actor.tp - @tp_old).abs / 100
tp_ref = [[n, 100].min,1].max
if @tp_old < @actor.tp
@tp += tp_ref
if @tp >= @actor.tp
@tp_old = @actor.tp
@tp = @actor.tp
@tp_ref = 0
end
elsif @tp_old > @actor.tp
@tp -= tp_ref
if @tp <= @actor.tp
@tp_old = @actor.tp
@tp = @actor.tp
@tp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh TP Number
#--------------------------------------------------------------------------
def refresh_tp_number
@flow_speed = METER_FLOW_SPEED
@tp_number.bitmap.clear
number_value = @tp.truncate.to_s.split(//)
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
@tp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@tp_refresh = false if @tp == @actor.tp
end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
refresh_states
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@status.x = @x + STATES_POSITION[0]
@status.y = @y + STATES_POSITION[1]
@status_flow = -24
@states_speed = 50
@status.z = BATTLE_HUD_Z + 2
@old_states = @actor.states
flow_states
end
#--------------------------------------------------------------------------
# ● Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor.states.size == 0 and !@status.visible
@states_speed = 0
@status.bitmap.clear
src_rect = Rect.new(@status_flow,0, 24,24)
@status.bitmap.blt(0,0, @actor_status, src_rect)
@status.visible = @actor.states.size == 0 ? false : true
@status_flow += 1
@status_flow = -24 if @status_flow >= @states_size - 24
end
#--------------------------------------------------------------------------
# ● Refresh States
#--------------------------------------------------------------------------
def refresh_states
@old_states = @actor.states
@actor_status.dispose if @actor_status != nil
@states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(48 * index , 0, @icon, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
return if @layout == nil
@layout.dispose
@hp_number.bitmap.dispose
@hp_number.dispose
@hp_meter.bitmap.dispose
@hp_meter.dispose
@mp_number.bitmap.dispose
@mp_number.dispose
@mp_meter.bitmap.dispose
@mp_meter.dispose
@tp_number.bitmap.dispose
@tp_number.dispose
@tp_meter.bitmap.dispose
@tp_meter.dispose
@status.bitmap.dispose
@status.dispose
@actor_status.dispose if @actor_status != nil
@layout = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
return if @meter == nil
update_hp_number if @hp_old != @actor.hp
refresh_hp_number if @hp_refresh
update_mp_number if @mp_old != @actor.mp
refresh_mp_number if @mp_refresh
update_tp_number if @tp_old != @actor.tp
refresh_tp_number if @tp_refresh
refresh_states if @old_states != @actor.states
@flow_speed += 1
if @flow_speed >= METER_FLOW_SPEED
@flow_speed = 0
hp_flow_update
tp_flow_update
mp_flow_update
end
flow_states
end
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :battler_hud
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_adv_battle_hud_initialize initialize
def initialize
@battler_hud = false
mog_adv_battle_hud_initialize
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
create_battle_hud
end
#--------------------------------------------------------------------------
# ● Create Battle Hud
#--------------------------------------------------------------------------
def create_battle_hud
@battle_hud = []
for i in $game_party.battle_members
@battle_hud.push(Battle_Hud.new(i))
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_hud_dispose dispose
def dispose
mog_battle_hud_dispose
dispose_battle_hud
end
#--------------------------------------------------------------------------
# ● Dispose Battle Hud
#--------------------------------------------------------------------------
def dispose_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.dispose }
@battle_hud = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update update
def update
mog_battle_hud_update
update_battle_hud
end
#--------------------------------------------------------------------------
# ● Update Battle Hud
#--------------------------------------------------------------------------
def update_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.update }
end
end
#==============================================================================
# ■ Game_Actor #测试
#==============================================================================
class Game_Actor < Game_Battler
include MOG_BATTLE_HUD
attr_accessor :hud_x
attr_accessor :hud_y
#--------------------------------------------------------------------------
# ● HUD X
#--------------------------------------------------------------------------
def hud_x
return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
end
#--------------------------------------------------------------------------
# ● HUD Y
#--------------------------------------------------------------------------
def hud_y
return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Create Party Command Window
#--------------------------------------------------------------------------
alias mog_battle_hud_create_party_command_window create_party_command_window
def create_party_command_window
mog_battle_hud_create_party_command_window
set_party_window_position
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
def set_party_window_position
@party_command_window.viewport = nil
return if $mog_rgss3_at_system != nil
a_index = []
for actor in $game_party.alive_members
a_index = [actor.hud_x, actor.hud_y]
break
end
return if a_index.empty?
@party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
@party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
alias mog_battle_hud_start_party_command_selection start_party_command_selection
def start_party_command_selection
set_party_window_position
mog_battle_hud_start_party_command_selection
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update_basic update_basic
def update_basic
mog_battle_hud_update_basic
update_command_window_visible
end
#--------------------------------------------------------------------------
# ● Update Command Window Visible
#--------------------------------------------------------------------------
def update_command_window_visible
@status_window.visible = @status_window.active ? true : false
@actor_command_window.visible = @actor_command_window.active ? true : false
@skill_window.visible = @skill_window.active ? true : false
@item_window.visible = @item_window.active ? true : false
end
#~ #--------------------------------------------------------------------------
#~ # ● Start Actor Command Selection #测试
#~ #--------------------------------------------------------------------------
alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
def start_actor_command_selection
mog_battle_hud_start_actor_command_selection
@actor_command_window.viewport = nil
@actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
@actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
@party_command_window.x = @actor_command_window.x
@party_command_window.y = @actor_command_window.y
end
end
#~ #==============================================================================
#~ # ■ Game_Actor
#~ #==============================================================================
#~ class Game_Actor < Game_Battler
#~ include MOG_BATTLE_HUD
#~
#~ attr_accessor :battler_face
#~ attr_accessor :battler_face_name
#~ attr_accessor :screen_x
#~ attr_accessor :screen_y
#~ attr_accessor :screen_z
#~
#~ #--------------------------------------------------------------------------
#~ # ● Initialize
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_hud_initialize setup
#~ def setup(actor_id)
#~ mog_battle_hud_initialize(actor_id)
#~ battler_sprite_setup
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Battler Sprite Setup
#~ #--------------------------------------------------------------------------
#~ def battler_sprite_setup
#~ @battler_face = [0,0,0]
#~ @battler_face_name = @name + "_Face"
#~ end
#~ if BATTLER_FACE_ENABLE
#~ #--------------------------------------------------------------------------
#~ # ● Use Sprite?
#~ #--------------------------------------------------------------------------
#~ def use_sprite?
#~ return true
#~ end
#~ end
#~
#~ end
#~ #==============================================================================
#~ # ■ Sprite_Battler
#~ #==============================================================================
#~ class Sprite_Battler < Sprite_Base
#~ include MOG_BATTLE_HUD
#~
#~ #--------------------------------------------------------------------------
#~ # ● Dispose
#~ #--------------------------------------------------------------------------
#~ alias mog_battler_face_dispose dispose
#~ def dispose
#~ mog_battler_face_dispose
#~ dispose_battler_face
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update
#~ #--------------------------------------------------------------------------
#~ alias mog_battler_face_update update
#~ def update
#~ refresh_face_battler
#~ mog_battler_face_update
#~ update_battler_face
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Refresh Face Battler
#~ #--------------------------------------------------------------------------
#~ def refresh_face_battler
#~ return if @face_sprite != nil
#~ return if @battler == nil
#~ return if @battler.is_a?(Game_Enemy)
#~ setup_battler_screen if @battler.screen_x == nil or $game_system.battler_hud
#~ @face_sprite = Battler_Face_Sprite.new(self.viewport, @battler)
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Setup Battler Screen
#~ #--------------------------------------------------------------------------
#~ def setup_battler_screen
#~ $game_system.battler_hud = true
#~ @battler.screen_x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
#~ @battler.screen_y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
#~ @battler.screen_z = 103 if @battler.screen_z == nil
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Dispose Battler Face
#~ #--------------------------------------------------------------------------
#~ def dispose_battler_face
#~ return if @face_sprite == nil
#~ @face_sprite.dispose
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Battler Face
#~ #--------------------------------------------------------------------------
#~ def update_battler_face
#~ return if @face_sprite == nil
#~ @face_sprite.update_actor_battler
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Posiion
#~ #--------------------------------------------------------------------------
#~ alias mog_battler_face_update_position update_position
#~ def update_position
#~ mog_battler_face_update_position
#~ update_face_z
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Face Z
#~ #--------------------------------------------------------------------------
#~ def update_face_z
#~ return if @face_sprite == nil
#~ @face_sprite.update_face_z(self.z)
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● Update Collapse
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_hud_update_collapse update_collapse
#~ def update_collapse
#~ if face_can_cancel_method?
#~ self.opacity = 255
#~ self.visible = true
#~ return
#~ end
#~ mog_battle_hud_update_collapse
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Instant Collapse
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_hud_update_instant_collapse update_instant_collapse
#~ def update_instant_collapse
#~ if face_can_cancel_method?
#~ self.opacity = 255
#~ self.visible = true
#~ return
#~ end
#~ mog_battle_hud_update_instant_collapse
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Init Visibility
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_face_init_visibility init_visibility
#~ def init_visibility
#~ if face_can_cancel_method?
#~ self.opacity = 255
#~ self.visible = true
#~ return
#~ end
#~ mog_battle_face_init_visibility
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Face Can Cancel Method
#~ #--------------------------------------------------------------------------
#~ def face_can_cancel_method?
#~ return false if !BATTLER_FACE_ENABLE
#~ return false if @battler.is_a?(Game_Enemy)
#~ return false if !$game_system.battler_hud
#~ return true
#~ end
#~
#~ end
#~ #==============================================================================
#~ # ■ Battler Face Sprite
#~ #==============================================================================
#~ class Battler_Face_Sprite < Sprite
#~ include MOG_BATTLE_HUD
#~
#~ #--------------------------------------------------------------------------
#~ # ● Initialize
#~ #--------------------------------------------------------------------------
#~ def initialize(viewport = nil,battler)
#~ super(viewport)
#~ @battler = battler
#~ @f_im = Cache.battler(@battler.battler_face_name, 0)
#~ @f_cw = @f_im.width / 5
#~ @f_ch = @f_im.height
#~ self.bitmap = Bitmap.new(@f_cw,@f_ch)
#~ x = -(@f_cw / 2) + FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
#~ y = -@f_ch + FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
#~ @org_pos = [x,y]
#~ @battler.battler_face = [0,0,0]
#~ @battler_visible = true
#~ @low_hp = @battler.mhp * 30 / 100
#~ @old_face_index = 0
#~ self.z = @battler.screen_z
#~ make_face(true)
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Dispose
#~ #--------------------------------------------------------------------------
#~ def dispose
#~ super
#~ dispose_battler_face_sprite
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● Dispose Battler Face Sprite
#~ #--------------------------------------------------------------------------
#~ def dispose_battler_face_sprite
#~ self.bitmap.dispose
#~ @f_im.dispose
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update
#~ #--------------------------------------------------------------------------
#~ def update_face_sprite(battler)
#~ @battler = battler
#~ update_face_reset_time
#~ update_face_effect
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Face Base Setting
#~ #--------------------------------------------------------------------------
#~ def face_base_setting
#~ self.x = @org_pos[0]
#~ self.y = @org_pos[1]
#~ self.zoom_x = 1
#~ self.zoom_y = 1
#~ self.mirror = false
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Check Base Face
#~ #--------------------------------------------------------------------------
#~ def check_base_face(reset)
#~ face_base_setting
#~ return if @battler.battler_face[2] > 0
#~ @battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2
#~ @battler.battler_face[0] = 3 if @battler.hp < @low_hp
#~ @battler.battler_face[0] = 4 if @battler.hp == 0
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Make Face
#~ #--------------------------------------------------------------------------
#~ def make_face(reset = false)
#~ self.bitmap.clear
#~ check_base_face(reset)
#~ src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
#~ self.bitmap.blt(0,0, @f_im, src_rect_back)
#~ @old_face_index = @battler.battler_face[0]
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● Update Actor Battler
#~ #--------------------------------------------------------------------------
#~ def update_actor_battler
#~ return if self.bitmap == nil
#~ update_face_effect
#~ update_face_reset_time
#~ make_face if @old_face_index != @battler.battler_face[0]
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Face Z
#~ #--------------------------------------------------------------------------
#~ def update_face_z(value)
#~ self.z = value + 2
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Update Face Reset Time
#~ #--------------------------------------------------------------------------
#~ def update_face_reset_time
#~ return if @battler.battler_face[2] == 0
#~ @battler.battler_face[2] -= 1
#~ if @battler.battler_face[2] == 0 or
#~ (@battler.hp < @low_hp and @battler.battler_face[0] == 0)
#~ make_face(true)
#~ end
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● Update Face Effect
#~ #--------------------------------------------------------------------------
#~ def update_face_effect
#~ return if @battler.battler_face[2] == 0
#~ case @battler.battler_face[1]
#~ when 0
#~ face_damage
#~ when 1..2
#~ face_heal
#~ when 3
#~ face_action
#~ end
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Face Damage
#~ #--------------------------------------------------------------------------
#~ def face_damage
#~ self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Face Heal
#~ #--------------------------------------------------------------------------
#~ def face_heal
#~ case @battler.battler_face[2]
#~ when 20..40
#~ self.zoom_x += 0.01
#~ self.zoom_y = self.zoom_x
#~ when 0..20
#~ self.zoom_x -= 0.01
#~ self.zoom_y = self.zoom_x
#~ end
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Face Action
#~ #--------------------------------------------------------------------------
#~ def face_action
#~ case @battler.battler_face[2]
#~ when 25..50
#~ self.zoom_x += 0.01
#~ self.zoom_y = self.zoom_x
#~ self.mirror = true
#~ when 0..25
#~ self.zoom_x -= 0.01
#~ self.zoom_y = self.zoom_x
#~ self.mirror = false
#~ end
#~ self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
#~ self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
#~ end
#~
#~ end
#~
#~ #==============================================================================
#~ # ■ Battle Manager
#~ #==============================================================================
#~ class << BattleManager
#~
#~ #--------------------------------------------------------------------------
#~ # ● Battle End
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_hud_battle_process_victory process_victory
#~ def process_victory
#~ execute_face_effect
#~ mog_battle_hud_battle_process_victory
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Prepare
#~ #--------------------------------------------------------------------------
#~ def execute_face_effect
#~ for i in $game_party.members
#~ i.battler_face = [1,2,40] if i.hp > 0
#~ end
#~ end
#~
#~ end
#~ #==============================================================================
#~ # ■ Game Action
#~ #==============================================================================
#~ class Scene_Battle < Scene_Base
#~
#~ #--------------------------------------------------------------------------
#~ # ● Show Animations
#~ #--------------------------------------------------------------------------
#~ alias mog_battle_hud_show_animation show_animation
#~ def show_animation(targets, animation_id)
#~ make_face_action_battle
#~ mog_battle_hud_show_animation(targets, animation_id)
#~ end
#~
#~ #--------------------------------------------------------------------------
#~ # ● Make Face Action
#~ #--------------------------------------------------------------------------
#~ def make_face_action_battle
#~ return if !@subject.is_a?(Game_Actor)
#~ @subject.battler_face = [2,3,50]
#~ end
#~
#~ end
#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● Item Apply
#--------------------------------------------------------------------------
alias mog_battle_hud_item_apply item_apply
def item_apply(user, item)
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_item_apply(user, item)
#~ check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#~ #--------------------------------------------------------------------------
#~ # ● Check Face Effect
#~ #--------------------------------------------------------------------------
#~ def check_face_effect(old_hp,old_mp)
#~ if self.hp > old_hp or self.mp > old_mp
#~ self.battler_face = [1,1,40]
#~ elsif self.hp < old_hp
#~ self.battler_face = [3,0,40]
#~ end
#~ end
#--------------------------------------------------------------------------
# ● Added New State
#--------------------------------------------------------------------------
alias mog_battle_hud_add_new_state add_new_state
def add_new_state(state_id)
mog_battle_hud_add_new_state(state_id)
if self.is_a?(Game_Actor)
self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
end
end
#--------------------------------------------------------------------------
# ● Regenerate HP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_hp regenerate_hp
def regenerate_hp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_hp
#~ check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Regenerate MP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_mp regenerate_mp
def regenerate_mp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_mp
#~ check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Can Check Face Effect
#--------------------------------------------------------------------------
def can_check_face_effect?(old_hp,old_mp)
return false if self.is_a?(Game_Enemy)
return true if old_hp != self.hp
return true if old_mp != self.mp
return false
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Invoke Counter Attack
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
def invoke_counter_attack(target, item)
mog_battle_hud_invoke_counter_attack(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
#--------------------------------------------------------------------------
# ● Invoke Magic Reflection
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
def invoke_magic_reflection(target, item)
mog_battle_hud_invoke_magic_reflection(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● select_enemy_selection
#--------------------------------------------------------------------------
alias mog_battle_cursor_select_enemy_selection select_enemy_selection
def select_enemy_selection
mog_battle_cursor_select_enemy_selection
if $mog_rgss3_battle_cursor != nil
@enemy_window.visible = false
@info_viewport.rect.width = 0
end
end
#--------------------------------------------------------------------------
# ● select_enemy_selection
#--------------------------------------------------------------------------
alias mog_battle_cursor_select_actor_selection select_actor_selection
def select_actor_selection
mog_battle_cursor_select_actor_selection
if $mog_rgss3_battle_cursor != nil
@actor_window.visible = false
@info_viewport.rect.width = 0
end
end
end
$mog_rgss3_battle_hud = true[/pre]
[pre lang="ruby" line="1"]#==============================================================================
# +++ MOG - AT System (v0.7 Beta) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de batalha de turnos em tempo real.
#==============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 0.7 - Melhoria na performance.
#==============================================================================
#==============================================================================
# ● AT SYSTEM
#==============================================================================
# A velocidade de AT é baseaddo na agilidade do Battler.
# Em caso de batalhas preventivas (Preemptive) os aliados começarão com AT em
# 80% e os inimigos começarão com AT em 0 (Zero)
# Em batalhas surpresas (Surprise) é o inverso das batalhas preventivas.
# Em batalhas normais todos os battlers começarão com AT em 40%.
#==============================================================================
# ● CAST TIME
#==============================================================================
# Para definir uma habilidade ou item com a função de Cast Time basta definir
# o valor da velocidade (Speed) diferente de 0 (Zero).
#
# NOTA - Não é possível ativar 2 ou mais habilidades com a função Cast Time no
# mesmo turno. (Caso você esteja usando características de Multi Action em
# seu projeto.)
#==============================================================================
module MOG_AT_SYSTEM
#Som quando o sistema AT estiver no maximo
SE_ACTIVE = "Decision2"
#Definição do valor de AT para ativar a ação.(Gauge Meter).
AT_GAUGE_METER = 5000
# Definição do tipo de duração (Contagem/formula) de um turno.
# Essa definição influência na ativação dos eventos de batalha.
# (BATTLE EVENTS)
#
# 0 - Duração de um turno é um valor fixo.
# 1 - Duração de um turno é multiplicado pela quantidade de batllers.
# 2 - Duração de um turno é baseado na média de agilidade dos battlers.
#
TURN_DURATION_TYPE = 1
# Definição de valor usado para calcular a duração de um turno.
TURN_DURATION = 60
# Definição da animação quando o battler usa habilidades de carregamento.
CAST_ANIMATION = 49
# Ativar a janela de LOG, deixe desativado se desejar uma batalha mais
# dinâmica.
WAIT_LOG_WINDOW = true
# Ativar a mensagem inicial com os nomes dos inimigos.
MESSAGE_ENEMY_APPEAR = false
# Definição da posição da janela de mensagem.
# 0 - Superior
# 1 - Centro
# 2 - Inferior
MESSAGE_POSITION = 0
# Tipo de posicionamento da Hud.
# 0 - Posição fixa.
# 1 - Posição baseado no valor X e Y do battler.
AT_HUD_POSITION_TYPE = 0
#Posição geral (Inicial) da Hud.
AT_HUD_POSITION = [25,400]
#Posição do medidor de AT
AT_METER_POSITION = [29,1]
#Definição da posição do espaço da HUD entre os membros do grupo.
#
#MEMBERS_SPACE = [Horizontal ,Vertical]
#
MEMBERS_SPACE = [136,0]
#Velocidade de animação do medidor de at, defina 0 se não quiser a animação.
AT_METER_FLOW_SPEED = 3
#Prioridade da Hud.
BATTLE_HUD_Z = 0
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :at_max
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_at_system_initialize initialize
def initialize
@at_max = [[MOG_AT_SYSTEM::AT_GAUGE_METER, 999999].min, 100].max
mog_at_system_initialize
end
end
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● Battle Start
#--------------------------------------------------------------------------
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
if MOG_AT_SYSTEM::MESSAGE_ENEMY_APPEAR
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● Input Start
#--------------------------------------------------------------------------
def self.input_start_at(battler)
if @phase != :input
@phase = :input
battler.make_actions
clear_actor
end
return !@surprise && battler.inputable?
end
#--------------------------------------------------------------------------
# ● Turn Start
#--------------------------------------------------------------------------
def self.turn_start
@phase = :turn
clear_actor
make_action_orders
end
#--------------------------------------------------------------------------
# ● Preemtive Attack
#--------------------------------------------------------------------------
def self.preemptive_attack
@preemptive
end
#--------------------------------------------------------------------------
# ● Suprise Attack
#--------------------------------------------------------------------------
def self.surprise_attack
@surprise
end
end
#==============================================================================
# ■ Game Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● Prepare
#--------------------------------------------------------------------------
alias mog_at_system_prepare prepare
def prepare
mog_at_system_prepare
set_cast_action
end
#--------------------------------------------------------------------------
# ● Set Cast Action
#--------------------------------------------------------------------------
def set_cast_action
return if forcing
if @item.object != nil and @item.object.speed != 0 and @subject.at_cast.empty?
@subject.at_cast = [@item.object,@item.object.speed.abs,@target_index]
@item.object = nil
@subject.animation_id = MOG_AT_SYSTEM::CAST_ANIMATION
@subject.at = 0
BattleManager.turn_end if @subject.auto_battle?
elsif !@subject.at_cast.empty?
if @subject.at_cast[1] == 0
@item.object = @subject.at_cast[0]
@target_index = @subject.at_cast[2]
@subject.at_cast.clear
else
@item.object = nil
end
end
end
end
#==============================================================================
# ■ Game Battler Base
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● Inputable?
#--------------------------------------------------------------------------
def inputable?
normal? && !auto_battle? && self.at == $game_system.at_max
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
attr_accessor :at
attr_accessor :at_cast
attr_accessor :at_turn_duration
attr_accessor :at_action
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_at_system_initialize initialize
def initialize
mog_at_system_initialize
@at = 0
@at_cast = []
@at_cast_selectable = true
@at_turn_duration = 0
@at_action = nil
end
#--------------------------------------------------------------------------
# ● At
#--------------------------------------------------------------------------
def at
n = at_active? ? $game_system.at_max : 0
return [[@at, n].min, 0].max
end
#--------------------------------------------------------------------------
# ● At Active
#--------------------------------------------------------------------------
def at_active?
return false if restriction >= 4
return false if self.hp == 0
return true
end
#--------------------------------------------------------------------------
# ● Added New State
#--------------------------------------------------------------------------
alias mog_at_system_add_new_state add_new_state
def add_new_state(state_id)
mog_at_system_add_new_state(state_id)
if restriction >= 4
self.at_cast.clear
self.at = 0
end
end
#--------------------------------------------------------------------------
# ● can AT?
#--------------------------------------------------------------------------
def can_upd_at?
return false if restriction >= 4
return false if self.hp == 0
return false if !self.at_cast.empty?
return false if self.at_action != nil
return true
end
end
#==============================================================================
# ■ Game Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● Tranform
#--------------------------------------------------------------------------
alias mog_at_system_transform transform
def transform(enemy_id)
mog_at_system_transform(enemy_id)
self.at = 0
self.at_cast.clear
end
end
if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW
#==============================================================================
# ■ BattleManager
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
end
#--------------------------------------------------------------------------
# ● Message Speed
#--------------------------------------------------------------------------
def message_speed
return 5
end
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
include MOG_AT_SYSTEM
#--------------------------------------------------------------------------
# ● AT Wait
#--------------------------------------------------------------------------
alias mog_at_system_start start
def start
reset_at_parameter
mog_at_system_start
end
#--------------------------------------------------------------------------
# ● Battle Start
#--------------------------------------------------------------------------
def battle_start
BattleManager.battle_start
process_event
set_turn_duration
end
#--------------------------------------------------------------------------
# ● Reset AT Parameter
#--------------------------------------------------------------------------
def reset_at_parameter
return if @at_phase != nil
@at_phase = 0
n_at = $game_system.at_max * 40 / 100
p_at = $game_system.at_max * 90 / 100
s_at = 0
all_battle_members.each do |battler|
if BattleManager.preemptive_attack
battler.at = p_at if battler.is_a?(Game_Actor)
battler.at = s_at if battler.is_a?(Game_Enemy)
elsif BattleManager.surprise_attack
battler.at = p_at if battler.is_a?(Game_Enemy)
battler.at = s_at if battler.is_a?(Game_Actor)
else
battler.at = n_at
end
if battler.at >= $game_system.at_max
battler.at = $game_system.at_max - 1
end
battler.at = 0 if battler.at < 0
battler.at_cast.clear
end
end
#--------------------------------------------------------------------------
# ● Set Turn Duration
#--------------------------------------------------------------------------
def set_turn_duration
max_battlers = all_battle_members.size > 0 ? all_battle_members.size : 1
case TURN_DURATION_TYPE
when 1
n = TURN_DURATION * max_battlers
when 2
turn_sp = 0
all_battle_members.each do |battler|
turn_sp += battler.agi
end
n = TURN_DURATION + (turn_sp / max_battlers)
else
n = TURN_DURATION
end
turn_time_max = [[n, 9999].min, 120].max
@turn_duration = [0, turn_time_max]
if @status_window != nil
@status_window.open
end
end
#--------------------------------------------------------------------------
# ● Turn End
#--------------------------------------------------------------------------
def turn_end
@at_phase = 0
all_battle_members.each do |battler|
if battler.at >= $game_system.at_max
battler.at = 0
refresh_status
@log_window.display_auto_affected_status(battler)
@log_window.wait_and_clear
end
end
BattleManager.turn_end
end
#--------------------------------------------------------------------------
# ● Update Turn Duration
#--------------------------------------------------------------------------
def update_turn_duration
return if @turn_duration == nil or @turn_duration[0] == nil
@turn_duration[0] += 1
if @turn_duration[0] >= @turn_duration[1]
@turn_duration[0] = 0
$game_troop.increase_turn
process_event
check_states_effect_turn
end
end
#--------------------------------------------------------------------------
# ● Check States Effect Turn
#--------------------------------------------------------------------------
def check_states_effect_turn
all_battle_members.each do |battler|
battler.on_turn_end if battler.restriction >= 4
end
end
#--------------------------------------------------------------------------
# ● Update AT System
#--------------------------------------------------------------------------
def update_at_system
reset_at_parameter if @at_phase == nil
set_turn_duration if @turn_duration == nil
return if !can_update_at?
update_turn_duration
all_battle_members.each do |battler|
update_battler_turn_duration(battler)
if !battler.at_cast.empty?
battler.at_cast[1] -= 1
if battler.at_cast[1] <= 0
execute_at_cast(battler)
break
end
else
battler.at += battler.agi
end
if battler.at >= $game_system.at_max
battler.on_turn_end
update_at_actor(battler)
update_at_enemy(battler)
battler.current_action.prepare if battler.current_action
if battler.at_cast.empty?
@at_phase = 1
turn_start if battler.is_a?(Game_Enemy)
end
break
end
end
end
#--------------------------------------------------------------------------
# ● Update Battler Turn Duration
#--------------------------------------------------------------------------
def update_battler_turn_duration(battler)
if battler.restriction >= 4
battler.at_turn_duration += 1
if battler.at_turn_duration >= $game_system.at_max
battler.on_turn_end
battler.at_turn_duration = 0
end
else
battler.at_turn_duration = 0
end
end
#--------------------------------------------------------------------------
# ● Execute AT CAST
#--------------------------------------------------------------------------
def execute_at_cast(battler)
@subject = battler
battler.make_actions
turn_start
end
#--------------------------------------------------------------------------
# ● Update AT Actor
#--------------------------------------------------------------------------
def update_at_actor(battler)
return if !battler.is_a?(Game_Actor)
Audio.se_play("Audio/SE/" + SE_ACTIVE,100,100)
start_party_command_selection_at(battler)
end
#--------------------------------------------------------------------------
# ● Update AT Enemy
#--------------------------------------------------------------------------
def update_at_enemy(battler)
return if !battler.is_a?(Game_Enemy)
battler.make_actions
end
#--------------------------------------------------------------------------
# ● Can Update AT
#--------------------------------------------------------------------------
def can_update_at?
return false if $game_troop.interpreter.running?
return false if BattleManager.action_forced?
return false if @at_phase != 0
return false if $game_message.visible
return false if BattleManager.in_turn?
return true
end
#--------------------------------------------------------------------------
# ● Star Party Command Selection at
#--------------------------------------------------------------------------
def start_party_command_selection_at(battler)
unless scene_changing?
refresh_status
@status_window.unselect
@status_window.open
if BattleManager.input_start_at(battler)
@actor_command_window.close
next_command
else
turn_start
end
end
end
#--------------------------------------------------------------------------
# ● Update Basic
#--------------------------------------------------------------------------
alias mog_at_system_update_basic update_basic
def update_basic
mog_at_system_update_basic
update_at_system
update_party_command
$game_message.position = MESSAGE_POSITION
end
#--------------------------------------------------------------------------
# ● Update Party Command
#--------------------------------------------------------------------------
def update_party_command
return if !@party_command_window.active
return if !@actor_command_window.visible
return if $game_message.visible
if Input.trigger?(:B)
next_command
Sound.play_cancel
@party_command_window.active = false
end
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :cache_at_meter
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_at_meter_initialize initialize
def initialize
mog_at_meter_initialize
cache_atmeter
end
#--------------------------------------------------------------------------
# ● Cache ATmeter
#--------------------------------------------------------------------------
def cache_atmeter
@cache_at_meter = []
@cache_at_meter.push(Cache.system("Battle_AT_Meter"))
@cache_at_meter.push(Cache.system("Battle_AT_Layout"))
end
end
#==============================================================================
# ■ AT Meter
#==============================================================================
class AT_Meter
include MOG_AT_SYSTEM
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@flow_speed = 0
if AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite?
@x = AT_HUD_POSITION[0] + @actor.screen_x rescue 0
@y = AT_HUD_POSITION[1] + @actor.screnn_y rescue 0
else
@x = AT_HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
@y = AT_HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
end
pre_cache
create_layout
create_at_meter
end
#--------------------------------------------------------------------------
# ● Pre Cache
#--------------------------------------------------------------------------
def pre_cache
@meter = $game_temp.cache_at_meter[0]
@meter_cw = @meter.width / 3
@meter_ch = @meter.height / 3
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = $game_temp.cache_at_meter[1]
@layout.z = BATTLE_HUD_Z
@layout.x = @x
@layout.y = @y
end
#--------------------------------------------------------------------------
# ● Create AT Meter
#--------------------------------------------------------------------------
def create_at_meter
@at_meter = Sprite.new
@at_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@at_meter.z = BATTLE_HUD_Z + 50
@at_meter.x = @x + AT_METER_POSITION[0]
@at_meter.y = @y + AT_METER_POSITION[1]
@at_flow = rand(@meter_cw * 2)
at_flow_update
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
return if @layout == nil
@layout.dispose
@layout = nil
@at_meter.bitmap.dispose
@at_meter.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
return if @layout == nil
at_position
@flow_speed += 1
if @flow_speed >= AT_METER_FLOW_SPEED
@flow_speed = 0
at_flow_update
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def at_position
return unless AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite?
@x = AT_HUD_POSITION[0] + @actor.screen_x rescue 0
@y = AT_HUD_POSITION[1] + @actor.screnn_y rescue 0
@layout.x = @x
@layout.y = @y
@at_meter.x = @x + AT_METER_POSITION[0]
@at_meter.y = @y + AT_METER_POSITION[1]
end
#--------------------------------------------------------------------------
# ● AT Flow Update
#--------------------------------------------------------------------------
def at_flow_update
@at_meter.bitmap.clear
if !@actor.at_cast.empty?
max_cast = @actor.at_cast[0].speed.abs != 0 ? @actor.at_cast[0].speed.abs : 1
at_width = @meter_cw * @actor.at_cast[1] / max_cast
ch = @meter_ch * 2
else
at_width = @meter_cw * @actor.at / $game_system.at_max
ch = @actor.at < $game_system.at_max ? 0 : @meter_ch
end
src_rect = Rect.new(@at_flow, ch,at_width, @meter_ch)
@at_meter.bitmap.blt(0,0, @meter, src_rect)
@at_flow += AT_METER_FLOW_SPEED
@at_flow = 0 if @at_flow >= @meter_cw * 2
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_at_system_initialize initialize
def initialize
mog_at_system_initialize
create_at_meter
end
#--------------------------------------------------------------------------
# ● Create AT Meter
#--------------------------------------------------------------------------
def create_at_meter
@at_meter = []
for i in $game_party.battle_members
@at_meter.push(AT_Meter.new(i))
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_at_system_dispose dispose
def dispose
mog_at_system_dispose
dispose_at_meter
end
#--------------------------------------------------------------------------
# ● Dispose AT Meter
#--------------------------------------------------------------------------
def dispose_at_meter
return if @at_meter == nil
@at_meter.each {|sprite| sprite.dispose }
@at_meter = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_at_system_update update
def update
mog_at_system_update
update_at_meter
end
#--------------------------------------------------------------------------
# ● Update AT Meter
#--------------------------------------------------------------------------
def update_at_meter
return if @at_meter == nil
@at_meter.each {|sprite| sprite.update }
end
end
$mog_rgss3_at_system = true[/pre] |
|