赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2013-7-14 |
在线时间 | 2 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 170
- 在线时间
- 2 小时
- 注册时间
- 2013-7-7
- 帖子
- 1
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我现在这个脚本应该有让敌人显示行走图的功能,但是只有编号为1的敌角色能显示,从2号开始就都不能了,求解决办法……- #==============================================================================
- # ■ Sprite_Battler Ver2.6
- #------------------------------------------------------------------------------
- # 角色用于现实的战斗动作。
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- def initialize(viewport, battler = nil)
- super(viewport)
- [url=home.php?mod=space&uid=133701]@battler[/url] = battler
- @battler_visible = false
- @effect_type = 0 # 效果的种类
- @effect_duration = 0 # 效果的残留时间
- @move_x = 0 # 已变化的X坐标的累计
- @move_y = 0 # 已变化的Y坐标的累计
- @move_z = 0 # 已变化的Z坐标的累计
- @distanse_x = 0 # X坐标的移动距离
- @distanse_y = 0 # Y坐标的移动距离
- @moving_x = 0 #1单位所相当的X坐标移动距离
- @moving_y = 0 #1单位所相当的Y坐标移动距离
- @move_speed_x = 0 # X坐标的移动速度
- @move_speed_y = 0 # Y坐标的移动速度
- @move_speed_plus_x = 0 # X坐标在加减速时的补充移动速度
- @move_speed_plus_y = 0 # Y坐标在加减速时的补充移动速度
- @move_boost_x = 0 # X坐标加速度
- @move_boost_y = 0 # Y坐标加速度
- @jump_time = 0 # 跳跃时间
- @jump_time_plus = 0 # 跳跃时间补充
- @jump_up = 0 # 跳跃上升
- @jump_down = 0 # 跳跃下降
- @jump_size = 0 # 跳跃高度
- @float_time = 0 # 漂浮时间
- @float_up = 0 # 1单位所相当于的浮遊高度
- @jump_plus = 0 # 根据跳跃补充影位置
- @angle = 0 # 旋转角度
- @angling = 0 # 1单位所相当于的旋转角度
- @angle_time = 0 # 旋转时间
- @angle_reset = 0 # 是否初始化角度
- @zoom_x = 0 # 横向放大率
- @zoom_y = 0 # 纵向放大率
- @zooming_x = 0 # 1单位所相当于的横向放大率
- @zooming_y = 0 # 1单位所相当于的纵向放大率
- @zoom_time = 0 # 放大时间
- @zoom_reset = 0 # 是否初始化放大
- @target_battler = [] # 目标角色情报
- @now_targets = [] # 目标角色记忆
- @pattern = 0 # 横图片位置(更新位置)
- @pattern_back = false # 循环标志
- @wait = 0 # 到下个动作的等待时间
- @unloop_wait = 0 # 非循环系动画完毕时的等待时间
- @action = [] # 行动
- @anime_kind = 0 # 纵图片位置(动画种类位置)
- @anime_speed = 0 # 图片更新速度
- @frame = 0 # 被消费图片更新时间
- @anime_loop = 0 # 循环方式
- @anime_end = false # 角色的动画是否完毕
- @anime_freeze = false # 是否是固定动画
- @anime_freeze_kind = false # 固定图案位置
- @anime_moving = false # 是否在飞出动画中
- @base_width = N01::ANIME_PATTERN # 图片的横分割数
- @base_height = N01::ANIME_KIND # 图片的纵分割数
- @width = 0 # 横矩形
- @height = 0 # 纵矩形
- @picture_time = 0 # 图片显示时间
- @individual_targets = [] # 单独处理的保持目标
- @balloon_duration = 65 # 飞出动画时间
- @reverse = false # 动画的反向再生标志
- # 角色不存在的时候将中断处理
- return @battler_visible = false if @battler == nil
- # 角色是主人公时、或者敌方动画为NO时
- @anime_flug = true if @battler.actor?
- @anime_flug = true if [email protected]? && @battler.anime_on
- # 角色作成
- make_battler
- end
- #--------------------------------------------------------------------------
- # ● 角色作成
- #--------------------------------------------------------------------------
- def make_battler
- # 初期配置的取得
- @battler.base_position
- # 色相通过角色认别
- @battler_hue = @battler.battler_hue
- # 角色是主人公时、或者敌方动画为NO时
- if @anime_flug
- # 准备武器
- @weapon_R = Sprite_Weapon.new(viewport,@battler)
- # 取得我方人物名、敌人角色名
- @battler_name = @battler.character_name if @battler.actor?
- @battler_name = @battler.battler_name unless @battler.actor?
- # 敌方反转为NO的时候 画像被反转
- self.mirror = true if [email protected]? && @battler.action_mirror
- # 是不是利用行图片图来改变转送前的矩形尺寸的认识处
- self.bitmap = Cache.character(@battler_name) if N01::WALK_ANIME
- self.bitmap = Cache.character(@battler_name + "_1") unless N01::WALK_ANIME
- # 获取转送前的矩形
- @width = self.bitmap.width / @base_width
- @height = self.bitmap.height / @base_height
- # 矩形设定
- @sx = @pattern * @width
- @sy = @anime_kind * @height
- # 角色本体的描绘
- self.src_rect.set(@sx, @sy, @width, @height)
- # 不作动画的角色时
- else
- # bitmap的获取、设定
- @battler_name = @battler.battler_name
- self.bitmap = Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- end
- # 偷袭时画像反转
- self.mirror = false if self.mirror && $back_attack && N01::BACK_ATTACK
- self.mirror = true if $back_attack && !self.mirror && N01::BACK_ATTACK
- # 位置初期化
- @battler.reset_coordinate
- # 决定原点
- self.ox = @width / 2
- self.oy = @height * 2 / 3
- # 设定偷袭时的坐标
- update_move
- # 准备飞出动画的精灵
- @move_anime = Sprite_MoveAnime.new(viewport,battler)
- # 准备图片用精灵
- @picture = Sprite.new
- # 准备影子精灵
- make_shadow if N01::SHADOW
- # 作成伤害精灵
- @damage = Sprite_Damage.new(viewport,battler)
- end
- #--------------------------------------------------------------------------
- # ● 影作成
- #--------------------------------------------------------------------------
- def make_shadow
- @shadow.dispose if @shadow != nil
- @battler_hue = @battler.battler_hue
- @shadow = Sprite.new(viewport)
- @shadow.z = 200
- @shadow.visible = false
- # 准备角色的影子精灵
- @shadow.bitmap = Cache.character(@battler.shadow)
- @shadow_height = @shadow.bitmap.height
- # 影位置的稍微调整
- @shadow_plus_x = @battler.shadow_plus[0] - @width / 2
- @shadow_plus_y = @battler.shadow_plus[1]
- # 配合角色画像的大小使用影画像
- @shadow.zoom_x = @width * 1.0 / @shadow.bitmap.width
- # 更新
- update_shadow
- # fade中影子就像没有关联一样放置
- @skip_shadow = true
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- self.bitmap.dispose if self.bitmap != nil
- @weapon_R.dispose if @weapon_R != nil
- @move_anime.dispose if @move_anime != nil
- @picture.dispose if @picture != nil
- @shadow.dispose if @shadow != nil
- @damage.dispose if @damage != nil
- @balloon.dispose if @balloon != nil
- mirage_off
- super
- end
- #--------------------------------------------------------------------------
- # ● 伤害动作 action = [动画ID,反转标志,反方向许可]
- #--------------------------------------------------------------------------
- def damage_action(action)
- damage = @battler.hp_damage
- damage = @battler.mp_damage if @battler.mp_damage != 0
- # 如果HP和MP两个同时做出伤害
- if @battler.hp_damage != 0 && @battler.mp_damage != 0
- @battler.double_damage = true
- damage = @battler.hp_damage
- end
- # 吸收攻击使HP为0的处理
- if action[0] == "absorb"
- absorb = true
- action[0] = nil
- end
- # 只有在命中时动画才被执行
- unless @battler.evaded or @battler.missed or action[0] == nil
- @battler.animation_id = action[0]
- @battler.animation_mirror = action[1]
- end
- # 执行伤害动画
- start_action(@battler.damage_hit) if damage > 0 && action[2]
- # 攻击没有命中时执行回避动画
- if @battler.evaded or @battler.missed
- start_action(@battler.evasion) if action[2]
- Sound.play_evasion
- end
- @damage.damage_pop unless absorb or action[3] != nil
- end
- #--------------------------------------------------------------------------
- # ● 伤害数值POP
- #--------------------------------------------------------------------------
- def damage_pop(damage)
- @damage.damage_pop(damage)
- end
- #--------------------------------------------------------------------------
- # ● 战斗开始行动
- #--------------------------------------------------------------------------
- def first_action
- # 检查能否行动、只有在不能的情况下那个状态的动作开始
- action = @battler.first_action unless @battler.restriction == 4
- action = $data_states[@battler.state_id].base_action if @battler.states[0] != nil && @battler.restriction == 4
- start_action(action)
- @skip_shadow = false
- end
- #--------------------------------------------------------------------------
- # ● 动作开始
- #--------------------------------------------------------------------------
- def start_action(kind)
- # 初期化各种动作
- reset
- #记录现在取得的待机动作
- stand_by
- # 决定新的动作内容
- @action = N01::ACTION[kind].dup
- # 从行动配列的前头开始移动
- active = @action.shift
- # 自动完毕
- @action.push("完毕")
- # 确定现在的动作
- @active_action = N01::ANIME[active]
- # 等待设定
- @wait = active.to_i if @active_action == nil
- # 单独动作开始
- action
- end
- #--------------------------------------------------------------------------
- # ● 强制单独动作开始
- #--------------------------------------------------------------------------
- def start_one_action(kind,back)
- # 初期化各种动作
- reset
- # 记录现在取得的待机动作
- stand_by
- # 设置坐标初始化动作
- @action = [back]
- # 自动完毕
- @action.push("完毕")
- # 确定现在的动作
- @active_action = N01::ANIME[kind]
- # 单独动作开始
- action
- end
- #--------------------------------------------------------------------------
- # ● 到下一个动作
- #--------------------------------------------------------------------------
- def next_action
- # 等待中时取消
- return @wait -= 1 if @wait > 0
- # 或者全部图片动画没有被完成时取消
- return if @anime_end == false
- # 最后的图片显示等待
- return @unloop_wait -= 1 if @unloop_wait > 0
- # 从行动配列的前头开始移动
- active = @action.shift
- # 确定现在的动作
- @active_action = N01::ANIME[active]
- # 等待设定
- @wait = active.to_i if @active_action == nil
- # 单独动作开始
- action
- end
- #--------------------------------------------------------------------------
- # ● 待机动作
- #--------------------------------------------------------------------------
- def stand_by
- # 到通常待机
- @repeat_action = @battler.normal
- # HP为1/4时显示危急表情
- @repeat_action = @battler.pinch if @battler.hp <= @battler.maxhp / 4
- # 防御中
- @repeat_action = @battler.defence if @battler.guarding?
- # 如果什么状态都没有时完毕
- return if @battler.state_id == nil
- for state in @battler.states.reverse
- # 动作禁止的状态时跳过处理
- next if state.extension.include?("禁止状态动作")
- # 敌方被动作禁止状态时跳过处理
- next if @battler.is_a?(Game_Enemy) && state.extension.include?("敌方除外")
- # 状态的表情
- @repeat_action = state.base_action
- end
- end
- #--------------------------------------------------------------------------
- # ● 待机动作的插入
- #--------------------------------------------------------------------------
- def push_stand_by
- action = @battler.normal
- action = @battler.pinch if @battler.hp <= @battler.maxhp / 4
- action = @battler.defence if @battler.guarding?
- for state in @battler.states.reverse
- # 动作禁止的状态时跳过处理
- next if state.extension.include?("禁止状态动作")
- # 敌方被动作禁止状态时跳过处理
- next if @battler.is_a?(Game_Enemy) && state.extension.include?("敌方除外")
- # 状态的表情
- action = state.base_action
- end
- @repeat_action = action
- # 插入
- @action.delete("完毕")
- act = N01::ACTION[action].dup
- for i in 0...act.size
- @action.push(act[i])
- end
- @action.push("完毕")
- @anime_end = true
- end
- #--------------------------------------------------------------------------
- # ● 各种变化的初期化
- #--------------------------------------------------------------------------
- def reset
- self.zoom_x = self.zoom_y = 1
- self.oy = @height * 2 / 3
- @angle = self.angle = 0
- @anime_end = true
- @non_repeat = false
- @anime_freeze = false
- @unloop_wait = 0
- end
- #--------------------------------------------------------------------------
- # ● 跳跃的初期化
- #--------------------------------------------------------------------------
- def jump_reset
- @battler.jump = @jump_time = @jump_time_plus = @jump_up = @jump_down = 0
- @jump_size = @jump_plus = @float_time = @float_up = 0
- end
- #--------------------------------------------------------------------------
- # ● 受取目标情报
- #--------------------------------------------------------------------------
- def get_target(target)
- # 单独处理中是中止(全区域中自身被卷入时目标情报是不是正常的样子)
- return if @battler.individual
- @target_battler = target
- end
- #--------------------------------------------------------------------------
- # ● 动作情报在角色中收藏
- #--------------------------------------------------------------------------
- def send_action(action)
- @battler.play = 0
- @battler.play = action if @battler.active
- end
- #--------------------------------------------------------------------------
- # ● 角色追加
- #--------------------------------------------------------------------------
- def battler_join
- if @battler.exist? && !@battler_visible
- # 从战斗不能的復活时的处理被跳过
- if @battler.revival && @anime_flug
- return @battler.revival = false
- elsif @battler.revival && !@anime_flug
- @battler.revival = false
- self.visible = true
- return
- end
- @anime_flug = true if @battler.actor?
- @anime_flug = true if [email protected]? && @battler.anime_on
- make_battler
- @damage = Sprite_Damage.new(viewport,battler)
- @join = true
- first_action
- end
- end
- #--------------------------------------------------------------------------
- # ● 图片更新 ※再定义
- #--------------------------------------------------------------------------
- def update
- super
- # 角色不存在时跳过
- return self.bitmap = nil if @battler == nil
- # 追加角色
- battler_join
- # 到下一个动作
- next_action
- # 动画图像更新
- update_anime_pattern
- # 目标更新
- update_target
- # 强制动作更新
- update_force_action
- # 坐标更新
- update_move
- # 影更新
- update_shadow if @shadow != nil
- # 武器更新
- @weapon_R.update if @weapon_action
- # 漂浮更新
- update_float if @float_time > 0
- # 旋转更新
- update_angle if @angle_time > 0
- # 放大缩小更新
- update_zoom if @zoom_time > 0
- # 残像更新
- update_mirage if @mirage_flug
- # 图片更新
- update_picture if @picture_time > 0
- # 飞出动画更新
- update_move_anime if @anime_moving
- # 飞出动画更新(图片动画)
- update_balloon if @balloon_duration <= 64
- # 伤害精灵更新
- @damage.update if @damage != nil
- setup_new_effect
- update_effect
- update_battler_bitmap
- end
- #--------------------------------------------------------------------------
- # ● 动画图像更新
- #--------------------------------------------------------------------------
- def update_anime_pattern
- # 更新时间在到之前跳过
- return @frame -= 1 if @frame != 0
- # 只有在必要的时候更新武器动画
- @weapon_R.action if @weapon_action && @weapon_R != nil
- # 动画到最后是检查是否是循环
- if @pattern_back
- # 往返循环
- if @anime_loop == 0
- # 反向再生
- if @reverse
- @pattern += 1
- if @pattern == @base_width - 1
- @pattern_back = false
- @anime_end = true
- end
- # 通常再生
- else
- @pattern -= 1
- if @pattern == 0
- @pattern_back = false
- @anime_end = true
- end
- end
- # 单程或者是不循环时
- else
- @anime_end = true
- if @anime_loop == 1
- @pattern = 0 if !@reverse
- @pattern = @base_width - 1 if @reverse
- @pattern_back = false
- end
- end
- # 推进动画
- else
- if @reverse
- @pattern -= 1
- @pattern_back = true if @pattern == 0
- else
- @pattern += 1
- @pattern_back = true if @pattern == @base_width - 1
- end
- end
- # 初期化更新时间
- @frame = @anime_speed
- # 动画固定时,固定横矩形
- return if @anime_freeze
- # 设定转送处的矩形
- return unless @anime_flug
- @sx = @pattern * @width
- @sy = @anime_kind * @height
- self.src_rect.set(@sx, @sy, @width, @height)
- end
- #--------------------------------------------------------------------------
- # ● 目标更新 action = ["N01target_change",目标情报]
- #--------------------------------------------------------------------------
- def update_target
- # 目标确认
- return if @battler.force_target == 0
- # 单独处理中中止(全区域中自身被卷入时目标情报是不是)
- return if @battler.individual
- @target_battler = @battler.force_target[1]
- @battler.force_target = 0
- end
- #--------------------------------------------------------------------------
- # ● 強制动作更新 action = [识别,复原,实行动作]
- #--------------------------------------------------------------------------
- def update_force_action
- # 确认強制动作
- action = @battler.force_action
- return if action == 0
- @battler.force_action = 0
- # 主动中不能插入
- return if @battler.active
- # 击倒时就那样直接连接行动
- return collapse_action if action[0] == "N01collapse"
- # 单独时就那样直接连接
- return start_one_action(action[2],action[1]) if action[0] == "单独"
- # 通用作为动作对待
- start_action(action[2])
- # 有无坐标复原
- return if action[1] == ""
- # 完毕位置替换成重复动作
- @action.delete("完毕")
- @action.push(action[1])
- @action.push("完毕")
- end
- #--------------------------------------------------------------------------
- # ● 坐标更新
- #--------------------------------------------------------------------------
- def update_move
- # 补完加减速中距离的增减
- if @move_speed_plus_x > 0
- # 计算移动
- @move_x += @moving_x
- # 实行移动
- @battler.move_x = @move_x
- @move_speed_plus_x -= 1
- elsif @move_speed_x > 0
- # 加速时
- if @move_boost_x != 0
- @moving_x += @move_boost_x
- end
- # 计算移动
- @move_x += @moving_x
- # 实行移动
- @battler.move_x = @move_x
- @move_speed_x -= 1
- end
- # 补完加减速中距离的增减
- if @move_speed_plus_y > 0
- # 计算移动
- @move_y += @moving_y
- # 实行移动
- @battler.move_y = @move_y
- @move_speed_plus_y -= 1
- elsif @move_speed_y > 0
- # 加速时
- if @move_boost_y != 0
- @moving_y += @move_boost_y
- end
- # 计算移动
- @move_y += @moving_y
- # 实行移动
- @battler.move_y = @move_y
- @move_speed_y -= 1
- end
- # 跳跃上升
- if @jump_up != 0
- # 计算移动
- @jump_plus += @jump_up
- # 实行移动
- @battler.jump = @jump_plus
- @jump_up = @jump_up / 2
- @jump_time -= 1
- # 如果跳跃到了顶点时
- if @jump_time == 0 or @jump_up == @jump_sign
- @jump_down = @jump_up * 2 * @jump_sign * @jump_sign2
- @jump_time_plus += @jump_time * 2
- @jump_up = 0
- return
- end
- end
- # 跳跃下降
- if @jump_down != 0
- if @jump_time_plus != 0
- @jump_time_plus -= 1
- elsif @jump_down != @jump_size
- # 计算移动
- @jump_plus += @jump_down
- # 实行移动
- @battler.jump = @jump_plus
- @jump_down = @jump_down * 2
- if @jump_down == @jump_size
- if @jump_flug
- @jump_flug = false
- else
- # 计算移动
- @jump_plus += @jump_down
- # 实行移动
- @battler.jump = @jump_plus
- @jump_down = @jump_size = 0
- end
- end
- end
- end
- # 设定精灵的坐标
- self.x = @battler.position_x
- self.y = @battler.position_y
- self.z = @battler.position_z
- end
- #--------------------------------------------------------------------------
- # ● 影更新
- #--------------------------------------------------------------------------
- def update_shadow
- @shadow.opacity = self.opacity
- @shadow.x = self.x + @shadow_plus_x
- @shadow.y = self.y + @shadow_plus_y - @jump_plus
- end
- #--------------------------------------------------------------------------
- # ● 漂浮更新
- #--------------------------------------------------------------------------
- def update_float
- @float_time -= 1
- @jump_plus += @float_up
- @battler.jump = @jump_plus
- end
- #--------------------------------------------------------------------------
- # ● 旋转更新
- #--------------------------------------------------------------------------
- def update_angle
- # 实行旋转
- @angle += @angling
- self.angle = @angle
- @angle_time -= 1
- # 旋转时间结束时项目初始化
- return @angle = 0 if @angle_time == 0
- # 如果有复原标志时角度返回0
- self.angle = 0 if @angle_reset
- end
- #--------------------------------------------------------------------------
- # ● 扩大缩小更新
- #--------------------------------------------------------------------------
- def update_zoom
- # 实行扩大缩小
- @zoom_x += @zooming_x
- @zoom_y += @zooming_y
- self.zoom_x = @zoom_x
- self.zoom_y = @zoom_y
- @zoom_time -= 1
- # 扩大缩小时间结束时项目初始化
- return if @zoom_time != 0
- @zoom_x = @zoom_y = 0
- self.oy = @height * 2 / 3
- # 如果有复原标志时还原
- self.zoom_x = self.zoom_y = 1 if @zoom_reset
- end
- #--------------------------------------------------------------------------
- # ● 残像更新
- #--------------------------------------------------------------------------
- def update_mirage
- # 残像最大能显示3个、2格图片中更新
- mirage(@mirage0) if @mirage_count == 1
- mirage(@mirage1) if @mirage_count == 3
- mirage(@mirage2) if @mirage_count == 5
- @mirage_count += 1
- @mirage_count = 0 if @mirage_count == 6
- end
- #--------------------------------------------------------------------------
- # ● 图片更新
- #--------------------------------------------------------------------------
- def update_picture
- @picture_time -= 1
- @picture.x += @moving_pic_x
- @picture.y += @moving_pic_y
- end
- #--------------------------------------------------------------------------
- # ● 飞出动画 更新
- #--------------------------------------------------------------------------
- def update_move_anime
- @move_anime.update
- @anime_moving = false if @move_anime.finish?
- @move_anime.action_reset if @move_anime.finish?
- end
- #--------------------------------------------------------------------------
- # ● 崩坏效果的更新 ※再定义
- #--------------------------------------------------------------------------
- def update_collapse
- normal_collapse if @collapse_type == 2
- boss_collapse1 if @collapse_type == 3
- end
- #--------------------------------------------------------------------------
- # ● 飞出动画更新 (图片动画)
- #--------------------------------------------------------------------------
- def update_balloon
- @balloon_duration -= 1 if @balloon_duration > 0 && !@balloon_back
- @balloon_duration += 1 if @balloon_back
- if @balloon_duration == 64
- @balloon_back = false
- @balloon.visible = false
- elsif @balloon_duration == 0
- @balloon.visible = false if @balloon_loop == 0
- @balloon_back = true if @balloon_loop == 1
- end
- @balloon.x = self.x
- @balloon.y = self.y
- @balloon.z = 10
- @balloon.opacity = self.opacity
- sx = 7 * 32 if @balloon_duration < 12
- sx = (7 - (@balloon_duration - 12) / 8) * 32 unless @balloon_duration < 12
- @balloon.src_rect.set(sx, @balloon_id * 32, 32, 32)
- end
- #--------------------------------------------------------------------------
- # ● 转送处bitmap的更新 ※再定义
- #--------------------------------------------------------------------------
- def update_battler_bitmap
- return if @battler.actor?
- if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
- @battler_name = @battler.battler_name
- @battler_hue = @battler.battler_hue
- make_battler
- self.opacity = 0 if @battler.dead? or @battler.hidden
- end
- end
- #--------------------------------------------------------------------------
- # ● 实行动作
- #--------------------------------------------------------------------------
- def action
- return if @active_action == nil
- action = @active_action[0]
- # 反转时
- return mirroring if action == "反转"
- # 旋转时
- return angling if action == "angle"
- # 扩大缩小时
- return zooming if action == "zoom"
- # 残像ON时
- return mirage_on if action == "残像ON"
- # 残像OFF时
- return mirage_off if action == "残像OFF"
- # 图片表示时
- return picture if action == "pic"
- # 图片消去时
- return @picture.visible = false && @picture_time = 0 if action == "消去图片"
- # 图片文件变更时
- return graphics_change if action == "change"
- # 战斗动画表示时
- return battle_anime if action == "anime"
- # 飞出动画表示时 (图片动画)
- return balloon_anime if action == "balloon"
- # BGM/BGS/SE演奏时
- return sound if action == "sound"
- # 游戏开关操作时
- return $game_switches[@active_action[1]] = @active_action[2] if action == "switch"
- # 游戏变量操作时
- return variable if action == "variable"
- # 二刀限定时
- return two_swords if action == "二刀限定"
- # 非二刀限定时
- return non_two_swords if action == "非二刀限定"
- # 动作条件时
- return necessary if action == "nece"
- # 技能连发时
- return derivating if action == "der"
- # 单独处理开始时
- return individual_action if action == "个别处理开始"
- # 单独处理完毕时
- return individual_action_end if action == "个别处理完毕"
- # 待机不能移动时
- return non_repeat if action == "待机不能移动"
- # 变更初期位置时
- return @battler.change_base_position(self.x, self.y) if action == "变更初期位置"
- # 解除变更初期位置
- return @battler.base_position if action == "解除变更初期位置"
- # 变更目标时
- return change_target if action == "target"
- # 目标的击倒许可
- return send_action(action) if action == "击倒许可"
- # 解除主动
- return send_action(action) if action == "解除主动"
- # 赋予状态时
- return state_on if action == "sta+"
- # 解除状态时
- return state_off if action == "sta-"
- # 变更游戏整体的行进速度时
- return Graphics.frame_rate = @active_action[1] if action == "fps"
- # 漂浮时
- return floating if action == "float"
- # 脚本操作时
- return eval(@active_action[1]) if action == "script"
- # 强制动作时
- return force_action if @active_action.size == 4
- # 坐标初始化时
- return reseting if @active_action.size == 5
- # 移动时
- return moving if @active_action.size == 7
- # 角色动画时
- return battler_anime if @active_action.size == 9
- # 动画飛ばし时
- return moving_anime if @active_action.size == 11
- # 完毕时
- return anime_finish if action == "完毕"
- end
- #--------------------------------------------------------------------------
- # ● 实行反转
- #--------------------------------------------------------------------------
- def mirroring
- # 如果已经反转就还原
- if self.mirror
- self.mirror = false
- # 武器动画也反映
- @weapon_R.mirroring if @anime_flug
- else
- self.mirror = true
- # 武器动画也反映
- @weapon_R.mirroring if @anime_flug
- end
- end
- #--------------------------------------------------------------------------
- # ● 实行旋转
- #--------------------------------------------------------------------------
- def angling
- # 初期化跳跃
- jump_reset
- # 情报确认
- @angle_time = @active_action[1]
- start_angle = @active_action[2]
- end_angle = @active_action[3]
- @angle_reset = @active_action[4]
- # 袭击時时逆转
- start_angle *= -1 if $back_attack
- end_angle *= -1 if $back_attack
- # 敌方被逆转
- start_angle *= -1 if @battler.is_a?(Game_Enemy)
- end_angle *= -1 if @battler.is_a?(Game_Enemy)
- # 时间要是0以下时立即到最后角度
- if @angle_time <= 0
- self.angle = end_angle
- return @angle_time = 0
- end
- # 从旋转时间计算一格相当于的角度
- @angling = (end_angle - start_angle) / @angle_time
- # 不能整除的剩余到初期角度
- @angle = (end_angle - start_angle) % @angle_time + start_angle
- end
- #--------------------------------------------------------------------------
- # ● 实行放大缩小
- #--------------------------------------------------------------------------
- def zooming
- # 初期化跳跃
- jump_reset
- # 情报确认
- @zoom_time = @active_action[1]
- zoom_x = @active_action[2] - 1
- zoom_y = @active_action[3] - 1
- @zoom_reset = @active_action[4]
- @zoom_x = @zoom_y = 1
- # 时间是0以下时跳过
- return @zoom_time = 0 if @zoom_time <= 0
- # 从放大时间中计算一格相当于的放大率
- @zooming_x = zoom_x / @zoom_time
- @zooming_y = zoom_y / @zoom_time
- end
- #--------------------------------------------------------------------------
- # ● 残像开始
- #--------------------------------------------------------------------------
- def mirage_on
- # 战斗不能時不表现残像
- return if @battler.dead?
- @mirage0 = Sprite.new(self.viewport)
- @mirage1 = Sprite.new(self.viewport)
- @mirage2 = Sprite.new(self.viewport)
- @mirage_flug = true
- @mirage_count = 0
- end
- #--------------------------------------------------------------------------
- # ● 残像表示
- #--------------------------------------------------------------------------
- def mirage(body)
- body.bitmap = self.bitmap.dup
- body.x = self.x
- body.y = self.y
- body.ox = self.ox
- body.oy = self.oy
- body.z = self.z
- body.mirror = self.mirror
- body.angle = @angle
- body.opacity = 160
- body.zoom_x = self.zoom_x
- body.zoom_y = self.zoom_y
- body.src_rect.set(@sx, @sy, @width, @height) if @anime_flug
- body.src_rect.set(0, 0, @width, @height) unless @anime_flug
- end
- #--------------------------------------------------------------------------
- # ● 残像完毕
- #--------------------------------------------------------------------------
- def mirage_off
- @mirage_flug = false
- @mirage0.dispose if @mirage0 != nil
- @mirage1.dispose if @mirage1 != nil
- @mirage2.dispose if @mirage2 != nil
- end
- #--------------------------------------------------------------------------
- # ● 图片表示
- #--------------------------------------------------------------------------
- def picture
- # 确认移动开始位置
- pic_x = @active_action[1]
- pic_y = @active_action[2]
- # 确认移动完毕位置
- pic_end_x = @active_action[3]
- pic_end_y = @active_action[4]
- @picture_time = @active_action[5]
- # 用时间除、计算一个相当于的移动速度
- @moving_pic_x = (pic_end_x - pic_x)/ @picture_time
- @moving_pic_y = (pic_end_y - pic_y)/ @picture_time
- # 不能整除时到最初上加算
- plus_x = (pic_end_x - pic_x)% @picture_time
- plus_y = (pic_end_y - pic_y)% @picture_time
- # 图片表示
- @picture.bitmap = Cache.picture(@active_action[7])
- @picture.x = pic_x + plus_x
- @picture.y = pic_y + plus_y
- # Z坐标调整
- @picture.z = 1
- @picture.z = 1000 if @active_action[6]
- @picture.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 图像文件变更
- #--------------------------------------------------------------------------
- def graphics_change
- # 主人公限定
- return if @battler.is_a?(Game_Enemy)
- # 图像变更
- @battler_name = @active_action[2]
- # 是否使用歩行图像中改变转送处的矩形大小的辨别处
- self.bitmap = Cache.character(@battler_name) if N01::WALK_ANIME
- self.bitmap = Cache.character(@battler_name + "_1") unless N01::WALK_ANIME
- # 获取转送处的矩形
- @width = self.bitmap.width / @base_width
- @height = self.bitmap.height / @base_height
- # 如果想让战斗后的人物图也显示为变更后的化在这里修改
- @battler.graphic_change(@active_action[2]) unless @active_action[1]
- end
- #--------------------------------------------------------------------------
- # ● 显示战斗动画 [判別,ID,对象,反转,等待,二刀标志]
- #--------------------------------------------------------------------------
- def battle_anime
- # 取消敌人的二刀标志动画处理
- return if @active_action[5] && [email protected]?
- # 不是二刀的角色,取消二刀标志动画处理
- return if @active_action[5] && @battler.weapons[1] == nil
- # 如果二刀为右手(上面设置过)无武器只有左手(下面设置)持有时
- if @battler.actor?
- return if !@active_action[5] && @battler.weapons[0] == nil && @battler.weapons[1] != nil
- end
- anime_id = @active_action[1]
- # 偷袭时动画画像被反转
- if $back_attack
- mirror = true if @active_action[3] == false
- mirror = false if @active_action[3]
- end
- # 武器和技能动画时
- if anime_id < 0
- # 用行动的种类分歧动画处
- if @battler.action.skill? && anime_id != -2
- anime_id = @battler.action.skill.animation_id
- elsif @battler.action.item? && anime_id != -2
- anime_id = @battler.action.item.animation_id
- else
- # 没有武器时使用空手动画
- anime_id = N01::NO_WEAPON
- if @battler.actor?
- weapon_id = @battler.weapon_id
- anime_id = $data_weapons[weapon_id].animation_id if weapon_id != 0
- # 二刀动画时
- anime_id = @battler.atk_animation_id2 if @active_action[5]
- else
- weapon_id = @battler.weapon
- anime_id = $data_weapons[weapon_id].animation_id if weapon_id != 0
- end
- end
- # 等待設定
- @wait = $data_animations[anime_id].frame_max * 4 if $data_animations[anime_id] != nil && @active_action[4]
- waitflug = true
- # 显示伤害动画时、为了先计算出伤害計算而中断处理
- damage_action = [anime_id, mirror, true]
- return @battler.play = ["对象动画",damage_action] if @battler.active
- end
- # 实行动画
- if @active_action[2] == 0 && $data_animations[anime_id] != nil
- @battler.animation_id = anime_id
- @battler.animation_mirror = mirror
- elsif $data_animations[anime_id] != nil
- for target in @target_battler
- target.animation_id = anime_id
- target.animation_mirror = mirror
- end
- end
- # 等待设定
- @wait = $data_animations[anime_id].frame_max * 4 if $data_animations[anime_id] != nil && @active_action[4] && !waitflug
- end
- #--------------------------------------------------------------------------
- # ● 显示飞出动画 (图片动画)
- #--------------------------------------------------------------------------
- def balloon_anime
- return if self.opacity == 0
- if @balloon == nil
- @balloon = Sprite.new
- @balloon.bitmap = Cache.system("Balloon")
- @balloon.ox = @width / 16
- @balloon.oy = @balloon.height / 10 + @height / 3
- end
- @balloon_id = @active_action[1]
- @balloon_loop = @active_action[2]
- @balloon_duration = 64
- @balloon_back = false
- update_balloon
- @balloon.visible = true
- end
- #--------------------------------------------------------------------------
- # ● BGM/BGS/SE演奏
- #--------------------------------------------------------------------------
- def sound
- # 获取情报
- pitch = @active_action[2]
- vol = @active_action[3]
- name = @active_action[4]
- # 实行
- case @active_action[1]
- when "se"
- Audio.se_play("Audio/SE/" + name, vol, pitch)
- when "bgm"
- # 没有指定名字时、不改变现在的BGM
- if @active_action[4] == ""
- now_bgm = RPG::BGM.last
- name = now_bgm.name
- end
- Audio.bgm_play("Audio/BGM/" + name, vol, pitch)
- when "bgs"
- # 没有指定名字时、不改变现在的BGS
- if @active_action[4] == ""
- now_bgs = RPG::BGS.last
- name = now_bgs.name
- end
- Audio.bgs_play("Audio/BGS/" + name, vol, pitch)
- end
- end
- #--------------------------------------------------------------------------
- # ● 游戏变量操作
- #--------------------------------------------------------------------------
- def variable
- # 检查操作
- operand = @active_action[3]
- # 变数操作的分歧
- case @active_action[2]
- when 0 # 代入
- $game_variables[@active_action[1]] = operand
- when 1 # 加算
- $game_variables[@active_action[1]] += operand
- when 2 # 減算
- $game_variables[@active_action[1]] -= operand
- when 3 # 乗算
- $game_variables[@active_action[1]] *= operand
- when 4 # 除算
- $game_variables[@active_action[1]] /= operand
- when 5 # 剰余
- $game_variables[@active_action[1]] %= operand
- end
- end
- #--------------------------------------------------------------------------
- # ● 二刀限定
- #--------------------------------------------------------------------------
- def two_swords
- # 敌方不被处理
- return @action.shift unless @battler.actor?
- # 左手(下部显示)没有武器就会消除下面的动作
- return @action.shift if @battler.weapons[1] == nil
- # 从行动配类的前面移动
- active = @action.shift
- # 确定现在的动作
- @active_action = N01::ANIME[active]
- # 等待设定
- @wait = active.to_i if @active_action == nil
- # 单独动作开始
- action
- end
- #--------------------------------------------------------------------------
- # ● 非二刀限定
- #--------------------------------------------------------------------------
- def non_two_swords
- # 敌方不被处理
- return unless @battler.actor?
- # 左手(下部显示)没有武器就会消除下面的动作
- return @action.shift if @battler.weapons[1] != nil
- # 从行动配类的前面移动
- active = @action.shift
- # 确定现在的动作
- @active_action = N01::ANIME[active]
- # 等待设定
- @wait = active.to_i if @active_action == nil
- # 单独动作开始
- action
- end
- #--------------------------------------------------------------------------
- # ● 动作条件
- #--------------------------------------------------------------------------
- def necessary
- nece1 = @active_action[3]
- nece2 = @active_action[4]
- # 目标确认
- case @active_action[1]
- # 0自身 1目标 2敌全体 3我方全体
- when 0
- target = [$game_party.members[@battler.index]] if @battler.is_a?(Game_Actor)
- target = [$game_troop.members[@battler.index]] if @battler.is_a?(Game_Enemy)
- when 1
- target = @target_battler
- when 2
- target = $game_troop.members
- when 3
- target = $game_party.members
- end
- # 目标为空出时看作失败
- return start_action(@battler.recover_action) if target.size == 0
- # 内容确认
- case @active_action[2]
- # 指定了状态ID时
- when 0
- # 补充正号为「正在此状态」、负号为「不在此状态」的条件
- state_on = true if nece2 > 0
- # 获取条件人数
- state_member = nece2.abs
- # 0从队友数中获取
- if nece2 == 0
- state_member = $game_party.members.size if @battler.is_a?(Game_Actor)
- state_member = $game_troop.members.size if @battler.is_a?(Game_Enemy)
- end
- # 目标的状态确认后清点人数
- for member in target
- state_member -= 1 if member.state?(nece1)
- end
- # 条件全部满足后执行动作
- if state_member == 0 && state_on
- return
- elsif state_member == nece2.abs
- return if state_on == nil
- end
- # 指定了参数时
- when 1
- # 补充了正号为「数值以上」、负号为「数值以下」的条件
- num_over = true if nece2 > 0
- # 参照数值
- num = 0
- # 确认目标的参数
- for member in target
- # 参照参数来分歧
- case nece1
- when 0 # 现HP
- num += member.hp
- when 1 # 现MP
- num += member.mp
- when 2 # 攻击力
- num += member.atk
- when 3 # 防御力
- num += member.def
- when 4 # 精神力
- num += member.spi
- when 5 # 敏捷性
- num += member.agi
- end
- end
- # 平均
- num = num / target.size
- # 条件全部满足时执行动作
- if num > nece2.abs && num_over
- return
- elsif num < nece2.abs
- return if num_over == nil
- end
- # 指定了开关时
- when 2
- # 条件全部满足时执行动作
- if $game_switches[nece1]
- # 补充为true时「开关ON」、false时「开关OFF」的条件
- return if nece2
- # 开关为OFF时与ON时是相反的
- else
- return unless nece2
- end
- # 指定了变量时
- when 3
- # 补充为正号时「数值以上」、负号时「数値以下」的条件
- if nece2 > 0
- return if $game_variables[nece1] > nece2
- else
- return unless $game_variables[nece1] > nece2.abs
- end
- # 指定了习得技能时
- when 4
- # 获取技能条件人数
- skill_member = nece2.abs
- for member in target
- skill_member -= 1 if member.skill_learn?(nece1)
- # 条件确认
- return if skill_member == 0
- end
- end
- # 条件没有被满足时动作中断
- return @action = ["完毕"] if @non_repeat
- # 不让防御中看起来不自然,坐标不被还原
- action = @battler.recover_action
- action = @battler.defence if @battler.guarding?
- return start_action(action)
- end
- #--------------------------------------------------------------------------
- # ● 技能连发
- #--------------------------------------------------------------------------
- def derivating
- # 如果让没学的的技能不能连发时
- return if !@active_action[2] && [email protected]_id_learn?(@active_action[3])
- # 确率分歧
- return if rand(100) > @active_action[1]
- # 连发成功
- @battler.derivation = @active_action[3]
- # 之后的动作被中断
- @action = ["完毕"]
- end
- #--------------------------------------------------------------------------
- # ● 个别处理开始
- #--------------------------------------------------------------------------
- def individual_action
- # 反复标志ON
- @battler.individual = true
- # 保持反复动作
- @individual_act = @action.dup
- # 保持目标、一个一个的发出行动目标
- send_action(["个别处理"])
- @individual_targets = @target_battler.dup
- @target_battler = [@individual_targets.shift]
- end
- #--------------------------------------------------------------------------
- # ● 个别处理完毕
- #--------------------------------------------------------------------------
- def individual_action_end
- # 目标没有残留时行动完毕
- return @battler.individual = false if @individual_targets.size == 0
- @action = @individual_act.dup
- @target_battler = [@individual_targets.shift]
- end
- #--------------------------------------------------------------------------
- # ● 待机不能移动
- #--------------------------------------------------------------------------
- def non_repeat
- @repeat_action = []
- @non_repeat = true
- anime_finish
- end
- #--------------------------------------------------------------------------
- # ● 目标变更 action = [判別, 变更对象, 变更处]
- #--------------------------------------------------------------------------
- def change_target
- # 还原自身变更了的目标
- return @target_battler = @now_targets.dup if @active_action[2] == 3
- # 发送目标情报
- target = [@battler] if @active_action[2] == 0
- target = @target_battler.dup if @active_action[2] != 0
- # 自身的目标发送到对方时、记录现在的目标
- if @active_action[2] == 2
- @now_targets = @target_battler.dup
- @target_battler = []
- end
- # 发送目标指定目录时
- if @active_action[1] >= 1000
- members = $game_party.members if @battler.actor?
- members = $game_troop.members unless @battler.actor?
- index = @active_action[1] - 1000
- if index < members.size
- if members[index].exist? && @battler.index != index
- # 目标变更
- members[index].force_target = ["N01target_change", target]
- # 自身的目标发送到相手时
- @target_battler = [members[index]] if @active_action[2] == 2
- change = true
- else
- for member in members
- next if @battler.index == member.index
- next unless member.exist?
- member.force_target = ["N01target_change", target]
- @target_battler = [member] if @active_action[2] == 2
- break change = true
- end
- end
- end
- # 指定了发送目标的状态ID时
- elsif @active_action[1] > 0
- for member in $game_party.members + $game_troop.members
- if member.state?(@active_action[1])
- member.force_target = ["N01target_change", target]
- @target_battler.push(member) if @active_action[2] == 2
- change = true
- end
- end
- # 指定了发送目标学的的技能时
- elsif @active_action[1] < 0
- skill_id = @active_action[1].abs
- for actor in $game_party.members
- if actor.skill_learn?(skill_id)
- actor.force_target = ["N01target_change", target]
- @target_battler.push(target) if @active_action[2] == 2
- change = true
- end
- end
- # 发送目标是目标时
- else
- for member in @target_battler
- member.force_target = ["N01target_change", target]
- @target_battler.push(member) if @active_action[2] == 2
- change = true
- end
- end
- # 条件未满足时之后的动作被中断
- return if change
- return @action = ["完毕"] if @non_repeat
- return start_action(@battler.recover_action)
- end
- #--------------------------------------------------------------------------
- # ● 状态付与
- #--------------------------------------------------------------------------
- def state_on
- state_id = @active_action[2]
- # 分歧对象
- case @active_action[1]
- when 0
- @battler.add_state(state_id)
- when 1
- if @target_battler != nil
- for target in @target_battler
- target.add_state(state_id)
- end
- end
- when 2
- for target in $game_troop.members
- target.add_state(state_id)
- end
- when 3
- for target in $game_party.members
- target.add_state(state_id)
- end
- when 4
- for target in $game_party.members
- if target.index != @battler.index
- target.add_state(state_id)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 状态解除
- #--------------------------------------------------------------------------
- def state_off
- state_id = @active_action[2]
- # 分歧对象
- case @active_action[1]
- when 0
- @battler.remove_state(state_id)
- when 1
- if @target_battler != nil
- for target in @target_battler
- target.remove_state(state_id)
- end
- end
- when 2
- for target in $game_troop.members
- target.remove_state(state_id)
- end
- when 3
- for target in $game_party.members
- target.remove_state(state_id)
- end
- when 4
- for target in $game_party.members
- if target.index != @battler.index
- target.remove_state(state_id)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 实行漂浮
- #--------------------------------------------------------------------------
- def floating
- # 初期化跳跃
- jump_reset
- # 情报确认
- @jump_plus = @active_action[1]
- float_end = @active_action[2]
- @float_time = @active_action[3]
- # 计算一格相当的移动高度
- @float_up = (float_end - @jump_plus)/ @float_time
- # 漂浮结束前不执行下个动作
- @wait = @float_time
- # 反映漂浮动画的设定
- if @anime_flug
- move_anime = N01::ANIME[@active_action[4]]
- # 没有指定图片时跳过处理
- if move_anime != nil
- # 写下现在的动作
- @active_action = move_anime
- # 角色动画开始
- battler_anime
- # 漂浮完毕时即动画完毕
- @anime_end = true
- end
- end
- # 漂浮到初期高度
- @battler.jump = @jump_plus
- end
- #--------------------------------------------------------------------------
- # ● 强制动作
- #--------------------------------------------------------------------------
- def force_action
- # 动作是单独还是通用的判别
- kind = @active_action[0]
- # 确认有无复原
- rebirth = @active_action[2]
- # 获取强制动作的内容
- play = @active_action[3]
- # 归纳上面3个情报
- action = [kind,rebirth,play]
- # 目标指定目录时
- if @active_action[1] >= 1000
- members = $game_party.members if @battler.actor?
- members = $game_troop.members unless @battler.actor?
- index = @active_action[1] - 1000
- if index < members.size
- if members[index].exist? && @battler.index != index
- # 交付角色情报
- return members[index].force_action = action
- else
- for target in members
- next if @battler.index == target.index
- next unless target.exist?
- force = true
- break target.force_action = action
- end
- end
- end
- # 条件未满足时之后的动作全部中断
- return if force
- return @action = ["完毕"] if @non_repeat
- return start_action(@battler.recover_action)
- # 指定目标时
- elsif @active_action[1] == 0
- for target in @target_battler
- target.force_action = action if target != nil
- end
- # 指定状态ID时
- elsif @active_action[1] > 0
- for target in $game_party.members + $game_troop.members
- target.force_action = action if target.state?(@active_action[1])
- end
- # 指定习得技能时
- elsif @active_action[1] < 0
- # 敌方不被处理时
- return if @battler.is_a?(Game_Enemy)
- for actor in $game_party.members
- # 自身除外
- unless actor.id == @battler.id
- # 交付角色情报
- actor.force_action = action if actor.skill_id_learn?(@active_action[1].abs)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 实行坐标初始化
- #--------------------------------------------------------------------------
- def reseting
- # 初始化跳跃
- jump_reset
- # 还原旋转
- self.angle = 0
- # 情报确认
- @distanse_x = @move_x * -1
- @distanse_y = @move_y * -1
- @move_speed_x = @active_action[1]
- @move_speed_y = @move_speed_x
- @move_boost_x = @active_action[2]
- @move_boost_y = @move_boost_x
- @jump = @active_action[3]
- # 计算移动
- move_distance
- # 反映移动画面的设定
- if @anime_flug
- move_anime = N01::ANIME[@active_action[4]]
- # 没有指定图片时跳过处理
- if move_anime != nil
- # 写下现在的动作
- @active_action = move_anime
- # 角色动画开始
- battler_anime
- end
- # 移动完毕时即动画也完毕
- @anime_end = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 实行移动
- #--------------------------------------------------------------------------
- def moving
- # 初期化跳跃
- jump_reset
- # 方便调出X轴的移动
- xx = @active_action[1]
- # 袭击时X轴逆转
- xx *= -1 if $back_attack
- # 确认移动目标的目标
- case @active_action[0]
- when 0 # 自身
- @distanse_x = xx
- @distanse_y = @active_action[2]
- when 1 # 目标
- # 目标没有决定时、变换成自身
- if @target_battler == nil
- @distanse_x = xx
- @distanse_y = @active_action[2]
- else
- # 一个一个的确认目标对象
- target_x = 0
- target_y = 0
- time = 0
- for i in 0...@target_battler.size
- if @target_battler[i] != nil
- time += 1
- target_x += @target_battler[i].position_x
- target_y += @target_battler[i].position_y
- end
- end
- # 目标空出时、变换成自身
- if time == 0
- @distanse_x = xx
- @distanse_y = @active_action[2]
- else
- # 计算出复数目标的中心位置
- target_x = target_x / time
- target_y = target_y / time
- # 算出最终的移动距离
- @distanse_y = target_y - self.y + @active_action[2]
- # X坐标是角色和敌人的逆向计算
- if @battler.is_a?(Game_Actor)
- @distanse_x = target_x - self.x + xx
- else
- @distanse_x = self.x - target_x + xx
- end
- end
- end
- when 2 # 画面
- # X坐标是角色和敌人的逆向计算
- if @battler.is_a?(Game_Actor)
- @distanse_x = xx - self.x
- @distanse_x = Graphics.width + xx - self.x if $back_attack
- else
- @distanse_x = self.x - xx
- @distanse_x = self.x - (Graphics.width + xx) if $back_attack
- end
- @distanse_y = @active_action[2] - self.y
- when 3 # 初期位置
- # X坐标是角色和敌人的逆向计算
- if @battler.is_a?(Game_Actor)
- @distanse_x = xx + @battler.base_position_x - self.x
- else
- @distanse_x = xx + self.x - @battler.base_position_x
- end
- @distanse_y = @active_action[2] + @battler.base_position_y - @battler.position_y
- end
- @move_speed_x = @active_action[3]
- @move_speed_y = @active_action[3]
- @move_boost_x = @active_action[4]
- @move_boost_y = @active_action[4]
- @jump = @active_action[5]
- @jump_plus = 0
- # 计算移动
- move_distance
- # 反映移动动画的设定
- if @anime_flug
- move_anime = N01::ANIME[@active_action[6]]
- # 没有指定图片时跳过处理
- if move_anime != nil
- # 写下现在的动作
- @active_action = move_anime
- # 角色动画开始
- battler_anime
- end
- # 移动完毕时即动画也完毕
- @anime_end = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 计算移动
- #--------------------------------------------------------------------------
- def move_distance
- # 速度为0时、停留在那个地方
- if @move_speed_x == 0
- @moving_x = 0
- @moving_y = 0
- else
- # 计算一格相当的移动距离
- @moving_x = @distanse_x / @move_speed_x
- @moving_y = @distanse_y / @move_speed_y
- # 剩余的距离在这时移动消化
- over_x = @distanse_x % @move_speed_x
- over_y = @distanse_y % @move_speed_y
- @move_x += over_x
- @move_y += over_y
- @battler.move_x = @move_x
- @battler.move_y = @move_y
- @distanse_x -= over_x
- @distanse_y -= over_y
- end
- # 判定是否移动
- if @distanse_x == 0
- @move_speed_x = 0
- end
- if @distanse_y == 0
- @move_speed_y = 0
- end
- # 计算X坐标移动
- # 根据加减速修正移动格数
- boost_x = @moving_x
- move_x = 0
- # 加速时
- if @move_boost_x > 0 && @distanse_x != 0
- # 加减速的正负调整成左右移动
- if @distanse_x == 0
- @move_boost_x = 0
- elsif @distanse_x < 0
- @move_boost_x *= -1
- end
- # 事先计算距离的变化
- for i in 0...@move_speed_x
- boost_x += @move_boost_x
- move_x += boost_x
- # 记录超过距离
- over_distance = @distanse_x - move_x
- # 记录右移动时距离超越的时第几格
- if @distanse_x > 0 && over_distance < 0
- @move_speed_x = i
- break
- # 记录右移动时距离超越的时第几格
- elsif @distanse_x < 0 && over_distance > 0
- @move_speed_x = i
- break
- end
- end
- # 将超越距离还原到前一次
- before = over_distance + boost_x
- # 剩余的距离加算到等速移动的格数中
- @move_speed_plus_x = (before / @moving_x).abs
- # 即使这样剩余的距离也在这时移动消化
- @move_x += before % @moving_x
- @battler.move_x = @move_x
- # 减速时
- elsif @move_boost_x < 0 && @distanse_x != 0
- # 加减速的正负调整成左右移动
- if @distanse_x == 0
- @move_boost_x = 0
- elsif @distanse_x < 0
- @move_boost_x *= -1
- end
- # 事先计算距离的变化
- for i in 0...@move_speed_x
- boost_x += @move_boost_x
- move_x += boost_x
- # 记录不足的距离
- lost_distance = @distanse_x - move_x
- before = lost_distance
- # 记录右移动速度到0时是第几格
- if @distanse_x > 0 && boost_x < 0
- @move_speed_x = i - 1
- # 不足的距离还原到前一次
- before = lost_distance + boost_x
- break
- # 记录左移动速度到0时是第几格
- elsif @distanse_x < 0 && boost_x > 0
- @move_speed_x= i - 1
- # 不足的距离还原到前一次
- before = lost_distance + boost_x
- break
- end
- end
- # 不足的距离加算到等速移动的格数中
- plus = before / @moving_x
- @move_speed_plus_x = plus.abs
- # 即是如此剩余的距离也在这时移动消化
- @move_x += before % @moving_x
- @battler.move_x = @move_x
- end
- # 计算Y坐标移动
- # 根据加减速修正移动格数
- boost_y = @moving_y
- move_y = 0
- # 加速时
- if @move_boost_y > 0 && @distanse_y != 0
- # 加减速的正负调整成左右移动
- if @distanse_y == 0
- @move_boost_y = 0
- elsif @distanse_y < 0
- @move_boost_y *= -1
- end
- # 事先计算距离的变化
- for i in 0...@move_speed_y
- boost_y += @move_boost_y
- move_y += boost_y
- # 记录超越的距离
- over_distance = @distanse_y - move_y
- # 记录右移动时距离超越的时第几格
- if @distanse_y > 0 && over_distance < 0
- @move_speed_y = i
- break
- # 记录左移动时距离超越的时第几格
- elsif @distanse_y < 0 && over_distance > 0
- @move_speed_y = i
- break
- end
- end
- # 超越的距离还原到前一次
- before = over_distance + boost_y
- # 剩余的距离加算到等速移动的格数中
- @move_speed_plus_y = (before / @moving_y).abs
- # 即使这样剩余的距离也在这时移动消化
- @move_y += before % @moving_y
- @battler.move_y = @move_y
- # 減速时
- elsif @move_boost_y < 0 && @distanse_y != 0
- # 加减速的正负调整成左右移动
- if @distanse_y == 0
- @move_boost_y = 0
- elsif @distanse_y < 0
- @move_boost_y *= -1
- end
- # 事先计算距离的变化
- for i in 0...@move_speed_y
- boost_y += @move_boost_y
- move_y += boost_y
- # 记录不足的距离
- lost_distance = @distanse_y - move_y
- before = lost_distance
- # 记录右移动速度到0时是第几格
- if @distanse_y > 0 && boost_y < 0
- @move_speed_y = i
- # 不足的距离还原到前一次
- before = lost_distance + boost_y
- break
- # 记录左移动速度到0时是第几格
- elsif @distanse_y < 0 && boost_y > 0
- @move_speed_y = i
- # 不足的距离还原到前一次
- before = lost_distance + boost_y
- break
- end
- end
- # 不足的距离加算到等速移动的格数中
- plus = before / @moving_y
- @move_speed_plus_y = plus.abs
- # 即是如此剩余的距离也在这时移动消化
- @move_y += before % @moving_y
- @battler.move_y = @move_y
- end
- # 算出移动完毕的时间
- x = @move_speed_plus_x + @move_speed_x
- y = @move_speed_plus_y + @move_speed_y
- if x > y
- end_time = x
- else
- end_time = y
- end
- # 移动完毕前不进行下个动作
- @wait = end_time
- # 计算跳跃
- if @jump != 0
- # 没有移动只跳跃时
- if @wait == 0
- # 时间记入
- @wait = @active_action[3]
- end
- # 从移动完毕时间算出跳跃时间
- @jump_time = @wait / 2
- # 不能插入时的剩余时间
- @jump_time_plus = @wait % 2
- # 判别跳跃是正还是负
- @jump_sign = 0
- @jump_sign2 = 0
- if @jump < 0
- @jump_sign = -1
- @jump_sign2 = 1
- @jump = @jump * -1
- else
- @jump_sign = 1
- @jump_sign2 = -1
- end
- # 决定跳跃初始速度
- @jump_up = 2 ** @jump * @jump_sign
- # 略微调整条约时间的尾数
- if @jump_time == 0
- @jump_up = 0
- elsif @jump_time != 1
- @jump_size = @jump_up * @jump_sign * @jump_sign2
- else
- @jump_size = @jump_up * 2 * @jump_sign * @jump_sign2
- @jump_flug = true
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 角色动画开始
- #--------------------------------------------------------------------------
- def battler_anime
- # 反映动画设定
- @anime_kind = @active_action[1]
- @anime_speed = @active_action[2]
- @anime_loop = @active_action[3]
- # 如果有等待时间时加算
- @unloop_wait = @active_action[4]
- @anime_end = true
- @reverse = false
- # 只有有武器动作时进行更新
- if @weapon_R != nil && @active_action[8] != ""
- # 确认武器的设定
- weapon_kind = N01::ANIME[@active_action[8]]
- # 敌方和不使用二刀角色的取消二刀标志动画处理
- two_swords_flug = weapon_kind[11]
- return if two_swords_flug && [email protected]?
- return if two_swords_flug && @battler.weapons[1] == nil && @battler.actor?
- if @battler.actor? && @battler.weapons[0] == nil && !two_swords_flug
- @weapon_R.action_reset
- elsif @battler.actor? && @battler.weapons[1] == nil && two_swords_flug
- @weapon_R.action_reset
- elsif [email protected]? && @battler.weapon == 0
- @weapon_R.action_reset
- else
- # 初期化
- @weapon_R.action_reset
- # 动画图像是固定时的获取武器位置
- if @active_action[5] != -1
- @weapon_R.freeze(@active_action[5])
- end
- # 设定武器画像
- @weapon_R.weapon_graphics unless two_swords_flug
- @weapon_R.weapon_graphics(true) if two_swords_flug
- # 交付武器动作
- @weapon_R.weapon_action(@active_action[8],@anime_loop)
- @weapon_action = true
- # 更新最初的武器动作
- @weapon_R.action
- end
- elsif @weapon_R != nil
- @weapon_R.action_reset
- end
- @anime_end = false
- # 动画图片是固定时
- if @active_action[5] != -1 && @active_action[5] != -2
- # 标志ON
- @anime_freeze = true
- # 看作动画是通常的完毕了
- @anime_end = true
- # 单程逆转再生时
- elsif @active_action[5] == -2
- @anime_freeze = false
- # 标志ON
- @reverse = true
- # 更新最初的动画图像
- @pattern = @base_width - 1
- # 只有在有武器动画时更新
- if @weapon_action && @weapon_R != nil
- @weapon_R.action
- @weapon_R.update
- end
- # 更新通常动画时
- else
- @anime_freeze = false
- # 更新最初动画图像
- @pattern = 0
- # 只有在有武器动画时更新
- if @weapon_action && @weapon_R != nil
- @weapon_R.action
- @weapon_R.update
- end
- end
- @pattern_back = false
- @frame = @anime_speed
- # 设定Z坐标
- @battler.move_z = @active_action[6]
- # 是否有影
- if @shadow != nil
- @shadow.visible = true if @active_action[7]
- @shadow.visible = false unless @active_action[7]
- @shadow.visible = false if @skip_shadow
- end
- # 分期从编号读取文件名
- if @active_action[0] == 0
- file_name = @battler_name
- else
- file_name = @battler_name + "_" + @active_action[0].to_s
- end
- # 无动画角色时处理完毕
- return unless @anime_flug
- self.bitmap = Cache.character(file_name)
- # 设定转送前的矩形
- @sx = @pattern * @width
- @sy = @anime_kind * @height
- @sx = @active_action[5] * @width if @anime_freeze
- self.src_rect.set(@sx, @sy, @width, @height)
- end
- #--------------------------------------------------------------------------
- # ● 动画飞出
- #--------------------------------------------------------------------------
- def moving_anime
- # 如果前个飞出动画还有残留时初期化
- @move_anime.action_reset if @anime_moving
- @anime_moving = true
- # 袭击中动画、武器画像反转
- mirror = false
- mirror = true if $back_attack
- # 动画ID
- id = @active_action[1]
- # 对象
- target = @active_action[2]
- x = y = mem = 0
- # 对象为单体时
- if target == 0
- # 没有决定目标时、变换为自身
- if @target_battler == nil
- x = self.x
- y = self.y
- else
- # 目标空出时、变换为自身
- if @target_battler[0] == nil
- x = self.x
- y = self.y
- else
- # 决定最初进入的目标为对象
- x = @target_battler[0].position_x
- y = @target_battler[0].position_y
- end
- end
- # 对象在敌方中心时
- elsif target == 1
- # 自身是主人公时计算敌方的中心
- if @battler.is_a?(Game_Actor)
- for target in $game_troop.members
- x += target.position_x
- y += target.position_y
- mem += 1
- end
- x = x / mem
- y = y / mem
- # 自身是敌方时计算主人公的中心
- else
- for target in $game_party.members
- x += target.position_x
- y += target.position_y
- mem += 1
- end
- x = x / mem
- y = y / mem
- end
- # 对象在我方中心时
- elsif target == 2
- # 自身是主人公时计算主人公的中心
- if @battler.is_a?(Game_Actor)
- for target in $game_party.members
- x += target.position_x
- y += target.position_y
- mem += 1
- end
- x = x / mem
- y = y / mem
- # 自身是敌方时计算敌方的中心
- else
- for target in $game_troop.members
- x += target.position_x
- y += target.position_y
- mem += 1
- end
- x = x / mem
- y = y / mem
- end
- # 对象是自身时
- else
- x = self.x
- y = self.y
- end
- # 开始位置的略微调整
- plus_x = @active_action[6]
- plus_y = @active_action[7]
- # 敌方是X轴逆转
- plus_x *= -1 if @battler.is_a?(Game_Enemy)
- # 算出最終的移动距离
- distanse_x = x - self.x - plus_x
- distanse_y = y - self.y - plus_y
- # 飞出类型
- type = @active_action[3]
- # 速度
- speed = @active_action[4]
- # 轨道
- orbit = @active_action[5]
- # 如果自身在开始位置时
- if @active_action[8] == 0
- @move_anime.base_x = self.x + plus_x
- @move_anime.base_y = self.y + plus_y
- # 对象在开始位置时
- elsif @active_action[8] == 1
- @move_anime.base_x = x + plus_x
- @move_anime.base_y = y + plus_y
- # 把距离作为反面
- distanse_y = distanse_y * -1
- distanse_x = distanse_x * -1
- # 如果不能动
- else
- @move_anime.base_x = x
- @move_anime.base_y = y
- distanse_x = distanse_y = 0
- end
- # 无武器动作时不显示武器
- if @active_action[10] == ""
- weapon = ""
- # 无动画的敌方不显示武器
- elsif @anime_flug != true
- weapon = ""
- # 武器动作时
- else
- # 确认是否指定了飞出武器图片
- if @battler.is_a?(Game_Actor)
- battler = $game_party.members[@battler.index]
- weapon_id = battler.weapon_id
- else
- battler = $game_troop.members[@battler.index]
- weapon_id = battler.weapon
- end
- # 判别是使用技能画像还是使用武器画像
- weapon_act = N01::ANIME[@active_action[10]].dup if @active_action[10] != ""
- # 如果利用武器画像时并不是空手
- if weapon_id != 0 && weapon_act.size == 3
- weapon_file = $data_weapons[weapon_id].flying_graphic
- # 如果没有指定别的画像时获取既存的武器图片
- if weapon_file == ""
- weapon_name = $data_weapons[weapon_id].graphic
- icon_weapon = false
- # 然后没有指定时使用ICON图片
- if weapon_name == ""
- weapon_name = $data_weapons[weapon_id].icon_index
- icon_weapon = true
- end
- # 指定时获取那个图片名
- else
- icon_weapon = false
- weapon_name = weapon_file
- end
- # 武器动作情报を取得
- weapon = @active_action[10]
- # 指定了武器画像时不显示空手
- elsif weapon_act.size == 3
- weapon = ""
- # 使用技能画像
- elsif weapon_act != nil && @battler.action.skill != nil
- icon_weapon = false
- weapon_name = $data_skills[@battler.action.skill.id].flying_graphic
- weapon = @active_action[10]
- end
- end
- # 决定Z坐标
- @move_anime.z = 1
- @move_anime.z = 1000 if @active_action[9]
- # 已上的全部情报都已飞出动画送到精灵
- @move_anime.anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,weapon_name,icon_weapon)
- end
- #--------------------------------------------------------------------------
- # ● 动作完毕
- #--------------------------------------------------------------------------
- def anime_finish
- # 单独处理完毕省略时做反复
- return individual_action_end if @individual_targets.size != 0
- # 主动向角色归纳动作情报
- send_action(@active_action[0]) if @battler.active
- # 如果有残像时开放
- mirage_off if @mirage_flug
- # 重复待机动作
- start_action(@repeat_action) unless @non_repeat
- end
- #--------------------------------------------------------------------------
- # ● 击倒动作
- #--------------------------------------------------------------------------
- def collapse_action
- @non_repeat = true
- @effect_type = COLLAPSE
- @collapse_type = @battler.collapse_type unless @battler.actor?
- @battler_visible = false unless @battler.actor?
- @effect_duration = N01::COLLAPSE_WAIT + 48 if @collapse_type == 2
- @effect_duration = 401 if @collapse_type == 3
- end
- #--------------------------------------------------------------------------
- # ● 普通击倒
- #--------------------------------------------------------------------------
- def normal_collapse
- if @effect_duration == 47
- Sound.play_enemy_collapse
- self.blend_type = 1
- self.color.set(255, 128, 128, 128)
- end
- self.opacity = 256 - (48 - @effect_duration) * 6 if @effect_duration <= 47
- end
- #--------------------------------------------------------------------------
- # ● BOSS击倒
- #--------------------------------------------------------------------------
- def boss_collapse1
- if @effect_duration == 320
- Audio.se_play("Audio/SE/Absorb1", 100, 80)
- self.flash(Color.new(255, 255, 255), 60)
- viewport.flash(Color.new(255, 255, 255), 20)
- end
- if @effect_duration == 280
- Audio.se_play("Audio/SE/Absorb1", 100, 80)
- self.flash(Color.new(255, 255, 255), 60)
- viewport.flash(Color.new(255, 255, 255), 20)
- end
- if @effect_duration == 220
- Audio.se_play("Audio/SE/Earth4", 100, 80)
- reset
- self.blend_type = 1
- self.color.set(255, 128, 128, 128)
- self.wave_amp = 6
- end
- if @effect_duration < 220
- self.src_rect.set(0, @effect_duration / 2 - 110, @width, @height)
- self.x += 8 if @effect_duration % 4 == 0
- self.x -= 8 if @effect_duration % 4 == 2
- self.wave_amp += 1 if @effect_duration % 10 == 0
- self.opacity = @effect_duration
- return if @effect_duration < 50
- Audio.se_play("Audio/SE/Earth4", 100, 50) if @effect_duration % 50 == 0
- end
- end
- end
复制代码- #==============================================================================
- # ■ Scene_Battle Ver2.7
- #------------------------------------------------------------------------------
- # 战斗画面的处理的类。
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 完毕处理
- #--------------------------------------------------------------------------
- alias terminate_n01 terminate
- def terminate
- terminate_n01
- # 返还二刀流的替换处理
- for member in $game_party.members
- if member.two_swords_change
- member.change_equip_by_id(1, member.weapon_id)
- member.change_equip_by_id(0, 0)
- member.two_swords_change = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 战斗开始的处理
- #--------------------------------------------------------------------------
- alias process_battle_start_n01 process_battle_start
- def process_battle_start
- process_battle_start_n01
- # 如果二刀流让左(下部显示)手武器像右(上部表示)手武器那样没有持有时
- # 在这里强制替换他
- for member in $game_party.members
- if member.weapons[0] == nil and member.weapons[1] != nil
- member.change_equip_by_id(0, member.armor1_id)
- member.change_equip_by_id(1, 0)
- member.two_swords_change = true
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- alias update_n01 update
- def update
- reset_stand_by_action
- super
- update_n01
- end
- #--------------------------------------------------------------------------
- # ● 根据事件操作的HP变动再设置角色动画
- #--------------------------------------------------------------------------
- def reset_stand_by_action
- if $game_temp.status_window_refresh
- $game_temp.status_window_refresh = false
- for member in $game_party.members + $game_troop.members
- @spriteset.set_stand_by_action(member.actor?, member.index)
- # 确认自动复活
- resurrection(member) if member.hp == 0
- end
- @status_window.refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 战败的处理
- #--------------------------------------------------------------------------
- alias process_defeat_n01 process_defeat
- def process_defeat
- for member in $game_party.members
- @spriteset.set_stand_by_action(member.actor?, member.index)
- end
- process_defeat_n01
- end
- #--------------------------------------------------------------------------
- # ● 帮助窗口的显示
- #--------------------------------------------------------------------------
- def pop_help(obj)
- return if obj.extension.include?("不显示HELP")
- @help_window = Window_Help.new if @help_window == nil
- @help_window.set_text(obj.name, 1)
- @help_window.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 显示情报窗口的移动
- #--------------------------------------------------------------------------
- def move1_info_viewport
- @info_viewport.ox = 128
- loop do
- update_basic
- @info_viewport.ox -= 8
- @party_command_window.x -= 8
- @actor_command_window.x += 8
- break if @info_viewport.ox == 64
- end
- end
- #--------------------------------------------------------------------------
- # ● 显示情报窗口的移动
- #--------------------------------------------------------------------------
- def move2_info_viewport
- @info_viewport.ox = 64
- loop do
- update_basic
- @info_viewport.ox -= 8
- @party_command_window.x += 8
- @actor_command_window.x -= 8
- break if @info_viewport.ox == 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 到下个主人公的指令选择
- #--------------------------------------------------------------------------
- alias next_actor_n01 next_actor
- def next_actor
- # 只有能动的角色显示指令动作
- if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
- @spriteset.set_action(true, @actor_index,@active_battler.command_a)
- end
- # 最后的角色时、动作结束前等待
- @wait_count = 32 if @actor_index == $game_party.members.size-1
- next_actor_n01
- # 只有能动的角色现实指令动作
- if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
- @spriteset.set_action(true, @actor_index,@active_battler.command_b)
- end
- end
- #--------------------------------------------------------------------------
- # ● 到前一个角色的指令选择
- #--------------------------------------------------------------------------
- alias prior_actor_n01 prior_actor
- def prior_actor
- # 只有能动的角色显示指令动作
- if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
- @active_battler.action.clear
- @spriteset.set_action(true, @actor_index,@active_battler.command_a)
- end
- prior_actor_n01
- # 只有能动的角色显示指令动作
- if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
- @active_battler.action.clear
- @spriteset.set_action(true, @actor_index,@active_battler.command_b)
- end
- end
- #--------------------------------------------------------------------------
- # ● 目标选择的开始 ※再定义
- #--------------------------------------------------------------------------
- def start_target_enemy_selection
- start_target_selection
- end
- #--------------------------------------------------------------------------
- # ● 目标选择的开始 ※再定义
- #--------------------------------------------------------------------------
- def start_target_actor_selection
- start_target_selection(true)
- end
- #--------------------------------------------------------------------------
- # ● 目标选择的开始
- #--------------------------------------------------------------------------
- def start_target_selection(actor = false)
- members = $game_party.members if actor
- members = $game_troop.members unless actor
- # 光标精灵的作成
- @cursor = Sprite.new
- @cursor.bitmap = Cache.character("cursor")
- @cursor.src_rect.set(0, 0, 32, 32)
- @cursor_flame = 0
- @cursor.x = -200
- @cursor.y = -200
- @cursor.ox = @cursor.width
- @cursor.oy = @cursor.height
- # 作成显示目标名的帮助窗口
- @help_window.visible = false if @help_window != nil
- @help_window2 = Window_Help.new if @help_window2 == nil
- # 消除不要的窗口
- @actor_command_window.active = false
- @skill_window.visible = false if @skill_window != nil
- @item_window.visible = false if @item_window != nil
- # 存在的目标为最底号码的对象也想最初那样
- @index = 0
- @max_index = members.size - 1
- # 主人公为站都不能者也可以作为目标来与敌方区分
- unless actor
- members.size.times do
- break if members[@index].exist?
- @index += 1
- end
- end
- @help_window2.set_text(members[@index].name, 1)
- select_member(actor)
- end
- #--------------------------------------------------------------------------
- # ● 目标选择
- #--------------------------------------------------------------------------
- def select_member(actor = false)
- members = $game_party.members if actor
- members = $game_troop.members unless actor
- loop do
- update_basic
- @cursor_flame = 0 if @cursor_flame == 30
- @cursor.src_rect.set(0, 0, 32, 32) if @cursor_flame == 29
- @cursor.src_rect.set(0, 32, 32, 32) if @cursor_flame == 15
- point = @spriteset.set_cursor(actor, @index)
- @cursor.x = point[0]
- @cursor.y = point[1]
- @cursor_flame += 1
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_target_selection
- break
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @active_battler.action.target_index = @index
- end_target_selection
- end_skill_selection
- end_item_selection
- next_actor
- break
- end
- if Input.repeat?(Input::LEFT)
- if actor
- cursor_down(members, actor) if $back_attack
- cursor_up(members, actor) unless $back_attack
- else
- cursor_up(members, actor) if $back_attack
- cursor_down(members, actor) unless $back_attack
- end
- end
- if Input.repeat?(Input::RIGHT)
- if actor
- cursor_up(members, actor) if $back_attack
- cursor_down(members, actor) unless $back_attack
- else
- cursor_down(members, actor) if $back_attack
- cursor_up(members, actor) unless $back_attack
- end
- end
- cursor_up(members, actor) if Input.repeat?(Input::UP)
- cursor_down(members, actor) if Input.repeat?(Input::DOWN)
- end
- end
- #--------------------------------------------------------------------------
- # ● 向前移动光标
- #--------------------------------------------------------------------------
- def cursor_up(members, actor)
- Sound.play_cursor
- members.size.times do
- @index += members.size - 1
- @index %= members.size
- break if actor
- break if members[@index].exist?
- end
- @help_window2.set_text(members[@index].name, 1)
- end
- #--------------------------------------------------------------------------
- # ● 向后移动光标
- #--------------------------------------------------------------------------
- def cursor_down(members, actor)
- Sound.play_cursor
- members.size.times do
- @index += 1
- @index %= members.size
- break if actor
- break if members[@index].exist? && !actor
- end
- @help_window2.set_text(members[@index].name, 1)
- end
- #--------------------------------------------------------------------------
- # ● 目标选择的完毕
- #--------------------------------------------------------------------------
- def end_target_selection
- @actor_command_window.active = true if @actor_command_window.index == 0
- @skill_window.visible = true if @skill_window != nil
- @item_window.visible = true if @item_window != nil
- @cursor.dispose
- @cursor = nil
- if @help_window2 != nil
- @help_window2.dispose
- @help_window2 = nil
- end
- @help_window.visible = true if @help_window != nil
- end
- #--------------------------------------------------------------------------
- # ● 逃走的处理 ※再定义
- #--------------------------------------------------------------------------
- def process_escape
- @info_viewport.visible = false
- @message_window.visible = true
- text = sprintf(Vocab::EscapeStart, $game_party.name)
- $game_message.texts.push(text)
- if $game_troop.preemptive
- success = true
- else
- success = (rand(100) < @escape_ratio)
- end
- Sound.play_escape
- # 不能动的主人公除外逃走成功动作
- if success
- for actor in $game_party.members
- unless actor.restriction == 4
- @spriteset.set_action(true, actor.index,actor.run_success)
- end
- end
- wait_for_message
- battle_end(1)
- # 不能动主人公除外逃走失败动作
- else
- for actor in $game_party.members
- unless actor.restriction == 4
- @spriteset.set_action(true, actor.index,actor.run_ng)
- end
- end
- @escape_ratio += 10
- $game_message.texts.push('\.' + Vocab::EscapeFailure)
- wait_for_message
- $game_party.clear_actions
- start_main
- end
- end
- #--------------------------------------------------------------------------
- # ● 胜利的处理
- #--------------------------------------------------------------------------
- alias process_victory_n01 process_victory
- def process_victory
- @status_window.visible = true
- @message_window.visible = false
- # BOSS击倒为等待加长
- for enemy in $game_troop.members
- break boss_wait = true if enemy.collapse_type == 3
- end
- wait(440) if boss_wait
- wait(N01::WIN_WAIT) unless boss_wait
- # 不能动的主人公除外胜利动作
- for actor in $game_party.members
- unless actor.restriction == 4
- @spriteset.set_action(true, actor.index,actor.win)
- end
- end
- process_victory_n01
- end
- #--------------------------------------------------------------------------
- # ● 战斗处理的实行开始 ※再定义
- #--------------------------------------------------------------------------
- def start_main
- $game_troop.increase_turn
- @info_viewport.visible = true
- @info_viewport.ox = 0
- @party_command_window.active = false
- @actor_command_window.active = false
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @message_window.clear
- $game_troop.make_actions
- make_action_orders
- # 情报表示窗口的移动
- move1_info_viewport
- # 作成显示技能名的帮助窗口
- @help_window = Window_Help.new
- @help_window.visible = false
- process_battle_event
- end
- #--------------------------------------------------------------------------
- # ● 战斗事件的处理 ※再定义
- #--------------------------------------------------------------------------
- def process_battle_event
- loop do
- return if judge_win_loss
- return if $game_temp.next_scene != nil
- $game_troop.interpreter.update
- $game_troop.setup_battle_event
- @message_window.update
- if $game_message.visible
- @message_window.visible = true
- @status_window.visible = false
- end
- wait_for_message
- @message_window.visible = false
- @status_window.visible = true
- process_action if $game_troop.forcing_battler != nil
- return unless $game_troop.interpreter.running?
- update_basic
- end
- end
- #--------------------------------------------------------------------------
- # ● 作成行动顺序
- #--------------------------------------------------------------------------
- alias make_action_orders_n01 make_action_orders
- def make_action_orders
- make_action_orders_n01
- # 确认敌方的行动回数
- for enemy in $game_troop.members
- enemy.act_time = 0
- if enemy.action_time[0] != 1
- action_time = 0
- # 获得确认的回数
- for i in 1...enemy.action_time[0]
- action_time += 1 if rand(100) < enemy.action_time[1]
- end
- enemy.act_time = action_time
- action_time.times do
- enemy_order_time(enemy)
- action_time -= 1
- break if action_time == 0
- end
- enemy.adj_speed = nil
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 作成敌方的行动回数
- #--------------------------------------------------------------------------
- def enemy_order_time(enemy)
- enemy.make_action_speed2(enemy.action_time[2])
- select_time = 0
- for member in @action_battlers
- select_time += 1
- break @action_battlers.push(enemy) if member.action.speed < enemy.adj_speed
- break @action_battlers.push(enemy) if select_time == @action_battlers.size
- end
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行
- #--------------------------------------------------------------------------
- alias execute_action_n01 execute_action
- def execute_action
- # 技能、物品扩张时如果设定了行动前不清空
- if @active_battler.action.kind != 0
- obj = @active_battler.action.skill if @active_battler.action.kind == 1
- obj = @active_battler.action.item if @active_battler.action.kind == 2
- if obj.extension.include?("行动前不闪光")
- @active_battler.white_flash = false
- end
- end
- # 角色主动化
- @active_battler.active = true
- execute_action_n01
- # 有技能连发时、行动继续
- if @active_battler.derivation != 0
- @active_battler.action.kind = 1
- @active_battler.action.skill_id = @active_battler.derivation
- @action_battlers.unshift(@active_battler)
- end
- # 有复数行动的敌方时、决定下个行动
- if !@active_battler.actor? && @active_battler.act_time != 0
- @active_battler.make_action
- @active_battler.act_time -= 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 回合完毕 ※再定义
- #--------------------------------------------------------------------------
- def turn_end
- for member in $game_party.members + $game_troop.members
- member.clear_action_results
- next unless member.exist?
- member.slip_damage = false
- actor = member.actor?
- damage = 0
- # 确认是否有0回合解除的状态
- for state in member.states
- member.remove_state(state.id) if state.extension.include?("0回合解除")
- # 实行连续伤害 state = [ 对象, 定数, 比例, POP, 战斗不能许可]
- next unless state.extension.include?("连续伤害")
- for ext in state.slip_extension
- if ext[0] == "hp"
- base_damage = ext[1] + member.maxhp * ext[2] / 100
- damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
- slip_pop = ext[3]
- slip_dead = ext[4]
- slip_damage_flug = true
- member.slip_damage = true
- end
- end
- end
- # 默认的连续伤害
- if member.slip_damage? && member.exist? && !slip_damage_flug
- damage += member.apply_variance(member.maxhp / 10, 10)
- slip_dead = false
- slip_pop = true
- slip_damage_flug = true
- member.slip_damage = true
- end
- damage = member.hp - 1 if damage >= member.hp && slip_dead = false
- member.hp -= damage
- @spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
- member.perform_collapse if member.dead? && member.slip_damage
- member.clear_action_results
- end
- @status_window.refresh
- # HP和MP的定时改变
- wait(55) if slip_damage_flug
- slip_damage_flug = false
- for member in $game_party.members + $game_troop.members
- member.clear_action_results
- next unless member.exist?
- actor = member.actor?
- mp_damage = 0
- for state in member.states
- next unless state.extension.include?("连续伤害")
- for ext in state.slip_extension
- if ext[0] == "mp"
- base_damage = ext[1] + member.maxmp * ext[2] / 100
- mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
- slip_pop = ext[2]
- slip_damage_flug = true
- end
- end
- member.mp_damage = mp_damage
- member.mp -= mp_damage
- @spriteset.set_damage_pop(actor, member.index, mp_damage) if slip_pop
- end
- member.clear_action_results
- end
- @status_window.refresh
- # 伤害和回復的定时改变
- wait(55) if slip_damage_flug
- # 是否有自动回复
- for member in $game_party.members
- if member.auto_hp_recover and member.exist?
- plus_hp = member.maxhp / 20
- member.hp += plus_hp
- @spriteset.set_damage_pop(true, member.index, plus_hp * -1)
- plus_hp_flug = true
- end
- member.clear_action_results
- end
- @status_window.refresh
- wait(55) if plus_hp_flug
- @help_window.dispose if @help_window != nil
- @help_window = nil
- move2_info_viewport
- $game_troop.turn_ending = true
- $game_troop.preemptive = false
- $game_troop.surprise = false
- process_battle_event
- $game_troop.turn_ending = false
- start_party_command_selection
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 攻击 ※再定义
- #--------------------------------------------------------------------------
- def execute_action_attack
- if @active_battler.actor?
- if @active_battler.weapon_id == 0
- action = @active_battler.non_weapon
- # 行动中不会死的队员全员为不死身化
- immortaling
- else
- action = $data_weapons[@active_battler.weapon_id].base_action
- # 用赋予战斗不能的武器来分歧不死身设定
- if $data_weapons[@active_battler.weapon_id].state_set.include?(1)
- for member in $game_party.members + $game_troop.members
- next if member.immortal
- next if member.dead?
- member.dying = true
- end
- else
- immortaling
- end
- end
- else
- if @active_battler.weapon == 0
- action = @active_battler.base_action
- immortaling
- else
- action = $data_weapons[@active_battler.weapon].base_action
- if $data_weapons[@active_battler.weapon].state_set.include?(1)
- for member in $game_party.members + $game_troop.members
- next if member.immortal
- next if member.dead?
- member.dying = true
- end
- else
- immortaling
- end
- end
- end
- target_decision
- @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
- playing_action
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 防御 ※再定义
- #--------------------------------------------------------------------------
- def execute_action_guard
- @help_window.set_text("防御", 1)
- @help_window.visible = true
- # 解除角色的主动化
- @active_battler.active = false
- wait(45)
- @help_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 逃走
- #--------------------------------------------------------------------------
- def execute_action_escape
- @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
- @help_window.set_text("逃走", 1)
- @help_window.visible = true
- # 解除角色的主动化
- @active_battler.active = false
- @active_battler.escape
- Sound.play_escape
- wait(45)
- @help_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 待机 ※再定义
- #--------------------------------------------------------------------------
- def execute_action_wait
- # 解除角色的主动化
- @active_battler.active = false
- wait(45)
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 技能 ※再定义
- #--------------------------------------------------------------------------
- def execute_action_skill
- skill = @active_battler.action.skill
- # 用赋予战斗不能的技能来分歧不死身设定
- if skill.plus_state_set.include?(1)
- for member in $game_party.members + $game_troop.members
- next if member.immortal
- next if member.dead?
- member.dying = true
- end
- else
- # 行动中不会死的队员全员为不死身化
- immortaling
- end
- # 判别技能使用可能
- return unless @active_battler.skill_can_use?(skill)
- # 决定目标
- target_decision(skill)
- # 动作开始
- @spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action)
- # 帮助窗口中显示技能名
- pop_help(skill)
- # 动作中
- playing_action
- # 技能成本消费
- @active_battler.consum_skill_cost(skill)
- # 还原状态窗口
- @status_window.refresh
- # 取得公共事件
- $game_temp.common_event_id = skill.common_event_id
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行 : 物品 ※再定义
- #--------------------------------------------------------------------------
- def execute_action_item
- item = @active_battler.action.item
- # 用赋予战斗不能的物品来分歧不死身设定
- if item.plus_state_set.include?(1)
- for member in $game_party.members + $game_troop.members
- next if member.immortal
- next if member.dead?
- member.dying = true
- end
- else
- # 行动中不会死的队员全员为不死身化
- immortaling
- end
- $game_party.consume_item(item)
- target_decision(item)
- @spriteset.set_action(@active_battler.actor?, @active_battler.index, item.base_action)
- pop_help(item)
- playing_action
- $game_temp.common_event_id = item.common_event_id
- end
- #--------------------------------------------------------------------------
- # ● 决定目标
- #--------------------------------------------------------------------------
- def target_decision(obj = nil)
- @targets = @active_battler.action.make_targets
- # 目标不存在时、动作中断
- if @targets.size == 0
- action = @active_battler.recover_action
- @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
- end
- if obj != nil
- # 如果默认了设定复数回合攻击时变换成单体目标
- if obj.for_two? or obj.for_three? or obj.dual?
- @targets = [@targets[0]]
- end
- # 随机目标时、选择的一体保持在随机范围
- if obj.extension.include?("随机目标")
- randum_targets = @targets.dup
- @targets = [randum_targets[rand(randum_targets.size)]]
- end
- end
- # 目标情报发送到角色精灵
- @spriteset.set_target(@active_battler.actor?, @active_battler.index, @targets)
- end
- #--------------------------------------------------------------------------
- # ● 实行动作中
- #--------------------------------------------------------------------------
- def playing_action
- loop do
- update_basic
- # 查看被归纳在主动角色的动作情报
- action = @active_battler.play
- next if action == 0
- @active_battler.play = 0
- if action[0] == "个别处理"
- individual
- elsif action == "击倒许可"
- unimmortaling
- elsif action == "解除主动"
- break action_end
- elsif action == "完毕"
- break action_end
- elsif action[0] == "对象动画"
- damage_action(action[1])
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 个别处理
- #--------------------------------------------------------------------------
- def individual
- # 保持目标情报
- @individual_target = @targets
- @stand_by_target = @targets.dup
- end
- #--------------------------------------------------------------------------
- # ● 击倒禁止
- #--------------------------------------------------------------------------
- def immortaling
- # 赋予全员不死身
- for member in $game_party.members + $game_troop.members
- # 如果不能战斗时跳过处理
- next if member.dead?
- # 有事件等设定不死身创立解除无效的标志
- member.non_dead = true if member.immortal
- member.immortal = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 击倒许可
- #--------------------------------------------------------------------------
- def unimmortaling
- # 个别处理中无击败许可
- return if @active_battler.individual
- # 解除全员的不死身化(用事件设定的不死身除外)
- for member in $game_party.members + $game_troop.members
- if member.dying
- member.dying = false
- if member.dead? or member.hp == 0
- member.add_state(1)
- member.perform_collapse
- end
- end
- next if member.non_dead
- next if member.dead?
- member.immortal = false
- member.add_state(1) if member.hp == 0
- member.perform_collapse
- end
- # 在这个时候反映待机动作
- @targets = @stand_by_target if @stand_by_target != nil
- return if @targets == nil or @targets.size == 0
- for target in @targets
- @spriteset.set_stand_by_action(target.actor?, target.index)
- # 确认自动复活
- next unless target.hp == 0
- resurrection(target)
- end
- end
- #--------------------------------------------------------------------------
- # ● 自动复活
- #--------------------------------------------------------------------------
- def resurrection(target)
- for state in target.states
- for ext in state.extension
- name = ext.split('')
- next unless name[0] == "自"
- wait(50)
- name = name.join
- name.slice!("自动复活/")
- target.hp = target.maxhp * name.to_i / 100
- target.remove_state(1)
- target.remove_state(state.id)
- target.animation_id = N01::RESURRECTION
- target.animation_mirror = true if $back_attack
- @status_window.refresh
- wait($data_animations[N01::RESURRECTION].frame_max * 4)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 魔法反射・无效
- #--------------------------------------------------------------------------
- def magic_reflection(target, obj)
- return if obj.physical_attack
- for state in target.states
- for ext in state.extension
- name = ext.split('')
- next unless name[0] == "魔"
- if name[2] == "反"
- name = name.join
- name.slice!("魔法反射/")
- target.animation_id = name.to_i
- target.animation_mirror = true if $back_attack
- @reflection = true
- else
- name = name.join
- name.slice!("魔法无效/")
- target.animation_id = name.to_i
- target.animation_mirror = true if $back_attack
- @invalid = true
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 物理反射・无效
- #--------------------------------------------------------------------------
- def physics_reflection(target, obj)
- return if obj != nil && !obj.physical_attack
- for state in target.states
- for ext in state.extension
- name = ext.split('')
- next unless name[0] == "物"
- if name[2] == "反"
- name = name.join
- name.slice!("物理反射/")
- target.animation_id = name.to_i
- target.animation_mirror = true if $back_attack
- @reflection = true
- else
- name = name.join
- name.slice!("物理无效/")
- target.animation_id = name.to_i
- target.animation_mirror = true if $back_attack
- @invalid = true
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 技能成本吸收
- #--------------------------------------------------------------------------
- def absorb_cost(target, obj)
- for state in target.states
- if state.extension.include?("成本吸收")
- cost = @active_battler.calc_mp_cost(obj)
- # 区分为SP消费和HP消费
- return target.hp += cost if obj.extension.include?("HP消耗")
- return target.mp += cost
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 吸收处理
- #--------------------------------------------------------------------------
- def absorb_attack(obj, target, index, actor)
- absorb = target.hp_damage
- absorb = target.mp_damage if target.mp_damage != 0
- # 目标是复数同时吸收处理
- @wide_attack = true if obj.scope == 2 or obj.scope == 4 or obj.scope == 6 or obj.extension.include?("全区域")
- if @wide_attack && @absorb == nil && @targets.size != 1
- # 返还吸收的部分
- @active_battler.hp -= @active_battler.hp_damage
- @active_battler.mp -= @active_battler.mp_damage
- # 之后加算吸收返还的数值
- @absorb = absorb
- @absorb_target_size = @targets.size - 2
- elsif @absorb != nil && @absorb_target_size > 0
- @active_battler.hp -= @active_battler.hp_damage
- @active_battler.mp -= @active_battler.mp_damage
- @absorb += absorb
- @absorb_target_size -= 1
- # 处理复数目标的最重吸收
- elsif @absorb != nil
- # 返还吸收的部分
- @active_battler.hp -= @active_battler.hp_damage
- @active_battler.mp -= @active_battler.mp_damage
- @absorb += absorb
- # 在这里反映全部吸收部分
- @active_battler.hp_damage = -@absorb
- @active_battler.mp_damage = -@absorb if target.mp_damage != 0
- @active_battler.hp -= @active_battler.hp_damage
- @active_battler.mp -= @active_battler.mp_damage
- # 吸收量是0时吸收者方面的处理
- absorb_action = ["absorb", nil, false] if @absorb == 0
- absorb_action = [nil, nil, false] if @absorb != 0
- @spriteset.set_damage_action(actor, index, absorb_action)
- @active_battler.perform_collapse
- @absorb = nil
- @absorb_target_size = nil
- # 单体吸收的处理
- else
- if N01::ABSORB_DAMAGE
- # 返还吸收的部分
- @active_battler.hp += @active_battler.hp_damage
- @active_battler.mp += @active_battler.mp_damage
- # 反映吸收
- @active_battler.hp_damage = -absorb
- @active_battler.mp_damage = -absorb if target.mp_damage != 0
- @active_battler.hp -= @active_battler.hp_damage
- @active_battler.mp -= @active_battler.mp_damage
- end
- # 吸收量是0时吸收者方面的处理
- absorb_action = ["absorb", nil, false] if absorb == 0
- absorb_action = [nil, nil, false] if absorb != 0
- @spriteset.set_damage_action(actor, index, absorb_action)
- # 逆向吸收时HP为0时
- @absorb_dead = true if @active_battler.hp == 0 && !@active_battler.non_dead
- end
- # 吸收量是0时对象者方面的处理
- return 0 if absorb == 0
- end
- #--------------------------------------------------------------------------
- # ● 动作完毕
- #--------------------------------------------------------------------------
- def action_end
- # 初期化
- @individual_target = nil
- @help_window.visible = false if @help_window != nil && @help_window.visible
- @active_battler.active = false
- @active_battler.clear_action_results
- # 慎重起见解除不死身化
- unimmortaling
- # 被反射时
- if @active_battler.reflex != nil
- if @active_battler.action.skill?
- obj = @active_battler.action.skill
- @active_battler.perfect_skill_effect(@active_battler, obj)
- elsif @active_battler.action.item?
- obj = @active_battler.action.item
- @active_battler.item_effect(@active_battler, obj)
- else
- @active_battler.perfect_attack_effect(@active_battler)
- end
- pop_damage(@active_battler, obj, @active_battler.reflex)
- @active_battler.perform_collapse
- @active_battler.reflex = nil
- wait(N01::COLLAPSE_WAIT)
- end
- #因逆向吸收战斗不能时
- if @absorb_dead
- @active_battler.perform_collapse
- @absorb_dead = false
- wait(N01::COLLAPSE_WAIT)
- end
- # 缩短到下次行动前的等待
- wait(N01::ACTION_WAIT)
- end
- #--------------------------------------------------------------------------
- # ● 伤害处理
- #--------------------------------------------------------------------------
- def damage_action(action)
- # 单独处理时目标一个一个发出
- @targets = [@individual_target.shift] if @active_battler.individual
- # 技能时
- if @active_battler.action.skill?
- obj = @active_battler.action.skill
- for target in @targets
- return if target == nil
- return if target.dead? && !obj.for_dead_friend?
- # HP为0时战斗不能復活以外不MISS
- target.revival = true if obj.for_dead_friend?
- if target.hp == 0 && !obj.for_dead_friend?
- target.perfect_skill_effect(@active_battler, obj)
- # 确认必中
- elsif obj.extension.include?("必中")
- target.perfect_skill_effect(@active_battler, obj)
- else
- # 确认反射
- magic_reflection(target, obj) unless obj.extension.include?("无视反射")
- physics_reflection(target, obj) unless obj.extension.include?("无视反射")
- # 计算伤害
- target.skill_effect(@active_battler, obj) unless @reflection or @invalid
- end
- pop_damage(target, obj, action) unless @reflection or @invalid
- # 确认成本吸收
- absorb_cost(target, obj)
- # 获取反射动作
- @active_battler.reflex = action if @reflection
- @reflection = false
- @invalid = false
- end
- # 物品时
- elsif @active_battler.action.item?
- obj = @active_battler.action.item
- for target in @targets
- return if target == nil
- return if target.dead? && !obj.for_dead_friend?
- target.revival = true if obj.for_dead_friend?
- if target.hp == 0 && !obj.for_dead_friend?
- target.perfect_item_effect(@active_battler, obj)
- elsif obj.extension.include?("必中")
- target.perfect_item_effect(@active_battler, obj)
- else
- magic_reflection(target, obj) unless obj.extension.include?("无视反射")
- physics_reflection(target, obj) unless obj.extension.include?("无视反射")
- target.item_effect(@active_battler, obj) unless @reflection or @invalid
- end
- pop_damage(target, obj, action) unless @reflection or @invalid
- @active_battler.reflex = action if @reflection
- @reflection = false
- @invalid = false
- end
- # 通常攻击时
- else
- for target in @targets
- return if target == nil or target.dead?
- physics_reflection(target, nil)
- target.perfect_attack_effect(@active_battler) if target.hp <= 0
- target.attack_effect(@active_battler) unless target.hp <= 0 or @reflection or @invalid
- pop_damage(target, nil, action) unless @reflection or @invalid
- # 获取反射动作
- @active_battler.reflex = action if @reflection
- @reflection = false
- @invalid = false
- end
- end
- # 还原状态窗口
- @status_window.refresh
- # 考虑连续性懂得随机目标、立刻选择下个目标
- return if obj == nil
- target_decision(obj) if obj.extension.include?("随机目标")
- end
- #--------------------------------------------------------------------------
- # ● 伤害表示 action = [动画ID,反转标志,动作许可]
- #--------------------------------------------------------------------------
- def pop_damage(target, obj, action)
- index = @active_battler.index
- actor = @active_battler.actor?
- if obj != nil
- # 技能或者物品是吸收属性时
- absorb = absorb_attack(obj, target, index, actor) if obj.absorb_damage
- action.push(true) if absorb == 0
- # 扩张设定为伤害动作禁止时
- action[2] = false if obj.extension.include?("禁止伤害动作")
- end
- # 还原对象
- @spriteset.set_damage_action(target.actor?, target.index, action)
- end
- end
- #==============================================================================
- # ■ Game_BattleAction
- #------------------------------------------------------------------------------
- # 战斗行动处理的类。
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # ● 判定行动是否有效 ※再定义
- #--------------------------------------------------------------------------
- def valid?
- return false if nothing? # 什么都不作
- return true if @forcing # 强制行动中
- return false unless battler.movable? # 行动不能
- if skill? # 技能
- if battler.derivation != 0
- battler.derivation = 0
- return true
- end
- return false unless battler.skill_can_use?(skill)
- elsif item? # 物品
- return false unless friends_unit.item_can_use?(item)
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 作成目标的排列 ※再定义
- #--------------------------------------------------------------------------
- def make_targets
- if attack?
- return make_attack_targets
- elsif skill?
- targets = make_obj_targets(skill)
- targets = make_obj_targets2(skill, targets) if skill.extension != ["无"]
- return targets
- elsif item?
- targets = make_obj_targets(item)
- targets = make_obj_targets2(item, targets) if item.extension != ["无"]
- return targets
- end
- end
- #--------------------------------------------------------------------------
- # ● 作成技能或是物品的目标的扩张
- #--------------------------------------------------------------------------
- def make_obj_targets2(obj, targets)
- if obj.extension.include?("全区域")
- targets = []
- targets += opponents_unit.existing_members
- targets += friends_unit.existing_members
- end
- if obj.extension.include?("自身以外")
- targets.delete($game_party.members[battler.index]) if battler.actor?
- targets.delete($game_troop.members[battler.index]) unless battler.actor?
- end
- return targets.compact
- end
- end
- #==============================================================================
- # ■ Sprite_Base
- #------------------------------------------------------------------------------
- # 追加了动画的表示处理的精灵的类。
- #==============================================================================
- class Sprite_Base < Sprite
- #--------------------------------------------------------------------------
- # ● 动画的更新 动画追随精灵
- #--------------------------------------------------------------------------
- alias update_animation_n01 update_animation
- def update_animation
- @animation_ox = x - ox + width / 2
- @animation_oy = y - oy + height / 2
- update_animation_n01
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 整理战斗画面的精灵的类。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● 敌方精灵的作成
- #--------------------------------------------------------------------------
- def create_enemies
- @enemy_sprites = []
- for i in 0...$game_troop.members.size
- enemy = $game_troop.members[i]
- @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
- # 战斗开始启动动作
- @enemy_sprites[i].opacity = 0 if $game_troop.members[i].hidden
- @enemy_sprites[i].first_action if $game_troop.members[i] != nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 主人公精灵的作成
- #--------------------------------------------------------------------------
- def create_actors
- @actor_sprites = []
- # 准备成员最大数精灵
- member = N01::MAX_MEMBER
- for i in 0...member
- actor = $game_party.members[i]
- @actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
- # 战斗开始启动动作
- @actor_sprites[i].first_action if $game_party.members[i] != nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 战斗层精灵的作成
- #--------------------------------------------------------------------------
- def create_battlefloor
- @battlefloor_sprite = Sprite.new(@viewport1)
- @battlefloor_sprite.bitmap = Cache.system("BattleFloor")
- @battlefloor_sprite.x = N01::FLOOR[0]
- @battlefloor_sprite.y = N01::FLOOR[1]
- @battlefloor_sprite.z = N01::FLOOR[2]
- @battlefloor_sprite.opacity = 128
- # 偷袭时時、反转层面和背景
- back_attack
- if $back_attack
- @battlefloor_sprite.mirror = true
- @battleback_sprite.mirror = true
- $game_troop.surprise = true
- else
- $game_troop.surprise = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 背部攻击
- #--------------------------------------------------------------------------
- def back_attack
- # 強制背部攻击时标志ON
- for i in 0...N01::BACK_ATTACK_SWITCH.size
- return $back_attack = true if $game_switches[N01::BACK_ATTACK_SWITCH[i]]
- end
- # 如果没发生偷袭时将中断处理
- return $back_attack = false unless $game_troop.surprise && N01::BACK_ATTACK
- # 确认根据装备等背部攻击的无效化
- for actor in $game_party.members
- return $back_attack = false if N01::NON_BACK_ATTACK_WEAPONS.include?(actor.weapon_id)
- return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR1.include?(actor.armor1_id)
- return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR2.include?(actor.armor2_id)
- return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR3.include?(actor.armor3_id)
- return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR4.include?(actor.armor4_id)
- for i in 0...N01::NON_BACK_ATTACK_SKILLS.size
- return $back_attack = false if actor.skill_id_learn?(N01::NON_BACK_ATTACK_SKILLS[i])
- end
- end
- # 发生背部攻击
- $back_attack = true
- end
- #--------------------------------------------------------------------------
- # ● 主人公精灵的更新 ※再定义
- #--------------------------------------------------------------------------
- def update_actors
- for i in 0...$game_party.members.size
- if @actor_sprites[i].battler.id != $game_party.members[i].id
- @actor_sprites[i].battler = $game_party.members[i]
- @actor_sprites[i].make_battler
- @actor_sprites[i].first_action
- end
- end
- for sprite in @actor_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 伤害动作组合
- #--------------------------------------------------------------------------
- def set_damage_action(actor, index, action)
- @actor_sprites[index].damage_action(action) if actor
- @enemy_sprites[index].damage_action(action) unless actor
- end
- #--------------------------------------------------------------------------
- # ● 伤害POP组合
- #--------------------------------------------------------------------------
- def set_damage_pop(actor, index, damage)
- @actor_sprites[index].damage_pop(damage) if actor
- @enemy_sprites[index].damage_pop(damage) unless actor
- end
- #--------------------------------------------------------------------------
- # ● 目标组合
- #--------------------------------------------------------------------------
- def set_target(actor, index, target)
- @actor_sprites[index].get_target(target) if actor
- @enemy_sprites[index].get_target(target) unless actor
- end
- #--------------------------------------------------------------------------
- # ● 动作组合
- #--------------------------------------------------------------------------
- def set_action(actor, index, kind)
- @actor_sprites[index].start_action(kind) if actor
- @enemy_sprites[index].start_action(kind) unless actor
- end
- #--------------------------------------------------------------------------
- # ● 待机动作组合
- #--------------------------------------------------------------------------
- def set_stand_by_action(actor, index)
- @actor_sprites[index].push_stand_by if actor
- @enemy_sprites[index].push_stand_by unless actor
- end
- #--------------------------------------------------------------------------
- # ● 光标移动的组合
- #--------------------------------------------------------------------------
- def set_cursor(actor, index)
- return [@actor_sprites[index].x, @actor_sprites[index].y] if actor
- return [@enemy_sprites[index].x, @enemy_sprites[index].y] unless actor
- end
- end
- #==============================================================================
- # ■ Sprite_MoveAnime
- #------------------------------------------------------------------------------
- # 动画飞出用的精灵。
- #==============================================================================
- class Sprite_MoveAnime < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :battler
- attr_accessor :base_x # 自身的基本X坐标
- attr_accessor :base_y # 自身的基本Y坐标
- #--------------------------------------------------------------------------
- # ● 客观初期化
- #--------------------------------------------------------------------------
- def initialize(viewport,battler = nil)
- super(viewport)
- @battler = battler
- self.visible = false
- @base_x = 0
- @base_y = 0
- @move_x = 0 # 移动后的X坐标
- @move_y = 0 # 移动后Y坐标
- @moving_x = 0 # 1单位相当移动的X坐标
- @moving_y = 0 # 1单位相当移动的Y坐标
- @orbit = 0 # 圆轨道
- @orbit_plus = 0 # 加算的圆轨道
- @orbit_time = 0 # 圆轨道计算时间
- @through = false # 是否贯通
- @finish = false # 移动完毕的标志
- @time = 0 # 一动时间
- @angle = 0 # 武器的角度
- @angling = 0 # 1单位相当移动的武器的角度
- end
- #--------------------------------------------------------------------------
- # ● 获取动作
- #--------------------------------------------------------------------------
- def anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,icon_index,icon_weapon)
- # 算出1单位相当的移动距离
- @time = speed
- @moving_x = distanse_x / speed
- @moving_y = distanse_y / speed
- # 是否贯通
- @through = true if type == 1
- # 获取圆轨道
- @orbit_plus = orbit
- @orbit_time = @time
- # 有无武器图片
- if weapon != ""
- action = N01::ANIME[weapon].dup
- @angle = action[0]
- end_angle = action[1]
- time = action[2]
- # 调出1单位相当的旋转角度
- @angling = (end_angle - @angle)/ time
- # 取得开始角度
- self.angle = @angle
- # 显示武器图片
- self.mirror = mirror
- if icon_weapon
- self.bitmap = Cache.system("Iconset")
- self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- self.ox = 12
- self.oy = 12
- else
- self.bitmap = Cache.character(icon_index)
- self.ox = self.bitmap.width / 2
- self.oy = self.bitmap.height / 2
- end
- self.visible = true
- # 显示在角色面前
- self.z = 1000
- end
- # 最初不动只显示一次
- self.x = @base_x + @move_x
- self.y = @base_y + @move_y + @orbit
- if id != 0
- animation = $data_animations[id]
- start_animation(animation, mirror)
- end
- end
- #--------------------------------------------------------------------------
- # ● 变化了的移动组合
- #--------------------------------------------------------------------------
- def action_reset
- @moving_x = @moving_y = @move_x = @move_y = @base_x = @base_y = @orbit = 0
- @orbit_time = @angling = @angle = 0
- @through = self.visible = @finish = false
- dispose_animation
- end
- #--------------------------------------------------------------------------
- # ● 贯通完毕
- #--------------------------------------------------------------------------
- def finish?
- return @finish
- end
- #--------------------------------------------------------------------------
- # ● 单位更新
- #--------------------------------------------------------------------------
- def update
- super
- # 时间消耗
- @time -= 1
- # 时间内指定的移动
- if @time >= 0
- @move_x += @moving_x
- @move_y += @moving_y
- # 计算圆轨道
- if @time < @orbit_time / 2
- @orbit_plus = @orbit_plus * 5 / 4
- elsif @time == @orbit_time / 2
- @orbit_plus *= -1
- else
- @orbit_plus = @orbit_plus * 2 / 3
- end
- @orbit += @orbit_plus
- end
- # 就算时间完毕如果是贯穿的话也会继续直进
- @time = 100 if @time < 0 && @through
- @finish = true if @time < 0 && !@through
- # 更新精灵的坐标
- self.x = @base_x + @move_x
- self.y = @base_y + @move_y + @orbit
- # 贯穿时、从画面消失的完毕标志ON
- if self.x < -200 or self.x > 840 or self.y < -200 or self.y > 680
- @finish = true
- end
- # 更新武器图片
- if self.visible
- @angle += @angling
- self.angle = @angle
- end
- end
- end
- #==============================================================================
- # ■ Sprite_Weapon
- #------------------------------------------------------------------------------
- # 显示武器用的精灵。
- #==============================================================================
- class Sprite_Weapon < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :battler
- #--------------------------------------------------------------------------
- # ● 客观初始化
- #--------------------------------------------------------------------------
- def initialize(viewport,battler = nil)
- super(viewport)
- @battler = battler
- @action = [] # 武器的动作情报
- @move_x = 0 # 移动后的X坐标
- @move_y = 0 # 移动后的Y坐标
- @move_z = 0 # 移动后的Z坐标
- @plus_x = 0 # 略微调整X坐标
- @plus_y = 0 # 略微调整Y坐标
- @angle = 0 # 武器的旋转角度
- @zoom_x = 1 # 武器的横向放大率
- @zoom_y = 1 # 武器的纵向放大率
- @moving_x = 0 # 1单位相当移动的X坐标
- @moving_y = 0 # 1单位相当移动的Y坐标
- @angling = 0 # 1单位相当的旋转角度
- @zooming_x = 1 # 1单位相当的横向放大率
- @zooming_y = 1 # 1单位相当的纵向放大率
- @freeze = -1 # 固定动画用的武器位置
- @mirroring = false # 角色是否为反转
- @time = N01::ANIME_PATTERN + 1 # 更新回数
- # 获取武器
- weapon_graphics
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- self.bitmap.dispose if self.bitmap != nil
- super
- end
- #--------------------------------------------------------------------------
- # ● 获取武器
- #--------------------------------------------------------------------------
- def weapon_graphics(left = false)
- if @battler.actor?
- weapon = @battler.weapons[0] unless left
- weapon = @battler.weapons[1] if left
- else
- weapon = $data_weapons[@battler.weapon]
- # 确认敌方的反转标志
- @mirroring = true if @battler.action_mirror
- end
- # 如果没有武器时处理被取消
- return if weapon == nil
- # 如果用ICON时
- if weapon.graphic == ""
- icon_index = weapon.icon_index
- self.bitmap = Cache.system("Iconset")
- self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- @weapon_width = @weapon_height = 24
- # 如果有指定ID时、获取不是ICON的图片
- else
- self.bitmap = Cache.character(weapon.graphic)
- @weapon_width = self.bitmap.width
- @weapon_height = self.bitmap.height
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取动画固定时的武器位置
- #--------------------------------------------------------------------------
- def freeze(action)
- @freeze = action
- end
- #--------------------------------------------------------------------------
- # ● 获取武器动作 freeze
- #--------------------------------------------------------------------------
- def weapon_action(action,loop)
- # 没有名称时不显示
- if action == ""
- self.visible = false
- # 空手时不显示
- elsif @weapon_id == 0
- self.visible = false
- # 受取武器的动作情报
- else
- @action = N01::ANIME[action]
- act0 = @action[0]
- act1 = @action[1]
- act2 = @action[2]
- act3 = @action[3]
- act4 = @action[4]
- act5 = @action[5]
- act6 = @action[6]
- act7 = @action[7]
- act8 = @action[8]
- act9 = @action[9]
- act10 = @action[10]
- # 角色为反转时、X轴的动作也逆转
- if @mirroring
- act0 *= -1
- act3 *= -1
- act4 *= -1
- act9 *= -1
- end
- # 背部攻击时逆转
- if $back_attack && N01::BACK_ATTACK
- act0 *= -1
- act3 *= -1
- act4 *= -1
- act9 *= -1
- end
- # 确认角色的动画图片数
- time = N01::ANIME_PATTERN
- # 确认Z坐标
- if act2
- self.z = @battler.position_z + 1
- else
- self.z = @battler.position_z - 1
- end
- # 在这里实行反转、如果已经反转就还原
- if act6
- if self.mirror
- self.mirror = false
- else
- self.mirror = true
- end
- end
- # 反映角色的反转
- if @mirroring
- if self.mirror
- self.mirror = false
- else
- self.mirror = true
- end
- end
- # 背后攻击时逆转
- if $back_attack && N01::BACK_ATTACK
- if self.mirror
- self.mirror = false
- else
- self.mirror = true
- end
- end
- # 计算以动画图片数相除的变化
- @moving_x = act0 / time
- @moving_y = act1 / time
- # 代入最初的角度
- @angle = act3
- self.angle = @angle
- # 计算更新角度
- @angling = (act4 - act3)/ time
- # 角度没有被插入时、在这里加算剩余旋转的部分
- @angle += (act4 - act3) % time
- # 放大缩小
- @zooming_x = (1 - act7) / time
- @zooming_y = (1 - act8) / time
- # 如果是反转时、逆转反转前的原点
- if self.mirror
- case act5
- when 1 # 左上→到右上
- act5 = 2
- when 2 # 右上→到左上
- act5 = 1
- when 3 # 左下→到右下
- act5 = 4
- when 4 # 右下→到左下
- act5 = 3
- end
- end
- # 设定旋转前的原点
- case act5
- when 0 # 中心
- self.ox = @weapon_width / 2
- self.oy = @weapon_height / 2
- when 1 # 左上
- self.ox = 0
- self.oy = 0
- when 2 # 右上
- self.ox = @weapon_width
- self.oy = 0
- when 3 # 左下
- self.ox = 0
- self.oy = @weapon_height
- when 4 # 右下
- self.ox = @weapon_width
- self.oy = @weapon_height
- end
- # 略微调整坐标
- @plus_x = act9
- @plus_y = act10
- # 往返循环时标志ON
- @loop = true if loop == 0
- # 第一次时0开始、在这时作-1回的动作
- @angle -= @angling
- @zoom_x -= @zooming_x
- @zoom_y -= @zooming_y
- # 更新精灵的坐标
- @move_x -= @moving_x
- @move_y -= @moving_y
- @move_z = 1000 if act2
- # 固定动画时、在这时消化动作
- if @freeze != -1
- for i in 0..@freeze + 1
- @angle += @angling
- @zoom_x += @zooming_x
- @zoom_y += @zooming_y
- # 更新精灵的坐标
- @move_x += @moving_x
- @move_y += @moving_y
- end
- @angling = 0
- @zooming_x = 0
- @zooming_y = 0
- @moving_x = 0
- @moving_y = 0
- end
- # 可视
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 变化后的动作全部组合
- #--------------------------------------------------------------------------
- def action_reset
- @moving_x = @moving_y = @move_x = @move_y = @plus_x = @plus_y = 0
- @angling = @zooming_x = @zooming_y = @angle = self.angle = @move_z = 0
- @zoom_x = @zoom_y = self.zoom_x = self.zoom_y = 1
- self.mirror = self.visible = @loop = false
- @freeze = -1
- @action = []
- @time = N01::ANIME_PATTERN + 1
- end
- #--------------------------------------------------------------------------
- # ● 作出往返循环
- #--------------------------------------------------------------------------
- def action_loop
- # 让动作相反
- @angling *= -1
- @zooming_x *= -1
- @zooming_y *= -1
- @moving_x *= -1
- @moving_y *= -1
- end
- #--------------------------------------------------------------------------
- # ● 主人公是反转时、自身也反转
- #--------------------------------------------------------------------------
- def mirroring
- return @mirroring = false if @mirroring
- @mirroring = true
- end
- #--------------------------------------------------------------------------
- # ● 只有在主人公动画被更新时武器动作的変化也更新
- #--------------------------------------------------------------------------
- def action
- return if @time <= 0
- @time -= 1
- # 旋转、更新放大缩小
- @angle += @angling
- @zoom_x += @zooming_x
- @zoom_y += @zooming_y
- # 更新精灵的坐标
- @move_x += @moving_x
- @move_y += @moving_y
- # 往返循环时动作反转
- if @loop && @time == 0
- @time = N01::ANIME_PATTERN + 1
- action_loop
- end
- end
- #--------------------------------------------------------------------------
- # ● 单位更新
- #--------------------------------------------------------------------------
- def update
- super
- # 旋转、更新放大缩小
- self.angle = @angle
- self.zoom_x = @zoom_x
- self.zoom_y = @zoom_y
- # 更新精灵的坐标
- self.x = @battler.position_x + @move_x + @plus_x
- self.y = @battler.position_y + @move_y + @plus_y
- self.z = @battler.position_z + @move_z - 1
- end
- end
- #==============================================================================
- # ■ Game_Battler (分割定义 1)
- #------------------------------------------------------------------------------
- # 处理角色的类。
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :hp_damage # 行动結果: HP 伤害
- attr_accessor :mp_damage # 行动結果: MP 伤害
- attr_accessor :move_x # X方向的移动修正
- attr_accessor :move_y # Y方向的移动修正
- attr_accessor :move_z # Z方向的移动修正
- attr_accessor :jump # 修正跳跃
- attr_accessor :active # 是否主动
- attr_accessor :non_dead # 不死身标志
- attr_accessor :dying # 即死标志
- attr_accessor :slip_damage # 连续伤害标志
- attr_accessor :derivation # 技能连发ID
- attr_accessor :individual # 技能连发ID
- attr_accessor :play # 动作情报
- attr_accessor :force_action # 强制动作情报
- attr_accessor :force_target # 目标变更情报
- attr_accessor :revival # 复活
- attr_accessor :double_damage # HPMP两方同时伤害
- attr_accessor :reflex # 技能反射情报
- attr_accessor :absorb # 技能成本吸收
- attr_reader :base_position_x # 初期配置X坐标
- attr_reader :base_position_y # 初期配置Y坐标
- attr_accessor :force_damage # 事件的伤害
- #--------------------------------------------------------------------------
- # ● 客观初期化
- #--------------------------------------------------------------------------
- alias initialize_n01 initialize
- def initialize
- initialize_n01
- @move_x = @move_y = @move_z = @plus_y = @jump = @derivation = @play = 0
- @force_action = @force_target = @base_position_x = @base_position_y = 0
- @absorb = @act_time = @force_damage = 0
- @active = @non_dead = @individual = @slip_damage = @revival = false
- @double_damage = @dying = false
- end
- #--------------------------------------------------------------------------
- # ● 返还最新的状态ID
- #--------------------------------------------------------------------------
- def state_id
- return @states[@states.size - 1]
- end
- #--------------------------------------------------------------------------
- # ● 判定技能的使用可能 ※再定义
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return false unless skill.is_a?(RPG::Skill)
- return false unless movable?
- return false if silent? and skill.spi_f > 0
- if skill.extension.include?("HP消耗")
- return false if calc_mp_cost(skill) > hp
- else
- return false if calc_mp_cost(skill) > mp
- end
- if $game_temp.in_battle
- return skill.battle_ok?
- else
- return skill.menu_ok?
- end
- end
- #--------------------------------------------------------------------------
- # ● 技能的消费 MP 计算 ※再定义
- #--------------------------------------------------------------------------
- def calc_mp_cost(skill)
- if half_mp_cost && !skill.extension.include?("MP消耗减半无效")
- cost = skill.mp_cost / 2
- else
- cost = skill.mp_cost
- end
- if skill.extension.include?("%成本MAX")
- return self.maxhp * cost / 100 if skill.extension.include?("HP消耗")
- return self.maxmp * cost / 100
- elsif skill.extension.include?("%成本NOW")
- return self.hp * cost / 100 if skill.extension.include?("HP消耗")
- return self.mp * cost / 100
- end
- return cost
- end
- #--------------------------------------------------------------------------
- # ● 技能成本消费
- #--------------------------------------------------------------------------
- def consum_skill_cost(skill)
- return false unless skill_can_use?(skill)
- cost = calc_mp_cost(skill)
- return self.hp -= cost if skill.extension.include?("HP消耗")
- return self.mp -= cost
- end
- #--------------------------------------------------------------------------
- # ● 根据通常攻击计算伤害 修正二刀流
- #--------------------------------------------------------------------------
- alias make_attack_damage_value_n01 make_attack_damage_value
- def make_attack_damage_value(attacker)
- make_attack_damage_value_n01(attacker)
- # 只有在装备了两把武器时修正有效
- return unless attacker.actor?
- return if attacker.weapons[0] == nil
- return if attacker.weapons[1] == nil
- @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[0] / 100
- end
- #--------------------------------------------------------------------------
- # ● 根据技能或者物品来计算伤害 修正二刀流
- #--------------------------------------------------------------------------
- alias make_obj_damage_value_n01 make_obj_damage_value
- def make_obj_damage_value(user, obj)
- make_obj_damage_value_n01(user, obj)
- # 只有在装备了两把武器时修正有效
- return unless user.actor?
- return if user.weapons[0] == nil
- return if user.weapons[1] == nil
- if obj.damage_to_mp
- @mp_damage = @mp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害MP
- else
- @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害HP
- end
- end
- #--------------------------------------------------------------------------
- # ● 使用通常攻击的効果 全部战斗不能,不能绝对回避的处理
- #--------------------------------------------------------------------------
- def perfect_attack_effect(attacker)
- clear_action_results
- make_attack_damage_value(attacker) # 计算伤害
- execute_damage(attacker) # 反映伤害
- apply_state_changes(attacker) # 状态变化
- end
- #--------------------------------------------------------------------------
- # ● 使用技能的效果 全部战斗不能,不能绝对回避的处理
- #--------------------------------------------------------------------------
- def perfect_skill_effect(user, skill)
- clear_action_results
- make_obj_damage_value(user, skill) # 伤害計算
- make_obj_absorb_effect(user, skill) # 吸収効果計算
- execute_damage(user) # 伤害反映
- apply_state_changes(skill) # ステート変化
- end
- #--------------------------------------------------------------------------
- # ● 使用物品的効果 全部战斗不能,不能绝对回避的处理
- #--------------------------------------------------------------------------
- def perfect_item_effect(user, item)
- clear_action_results
- hp_recovery = calc_hp_recovery(user, item) # 计算HP的回复量
- mp_recovery = calc_mp_recovery(user, item) # 计算MP的回复量
- make_obj_damage_value(user, item) # 计算伤害
- @hp_damage -= hp_recovery # 扣除HP的回复量
- @mp_damage -= mp_recovery # 扣除MP的回复量
- make_obj_absorb_effect(user, item) # 计算吸收效果
- execute_damage(user) # 反映伤害
- item_growth_effect(user, item) # 使用成长效果
- if item.physical_attack and @hp_damage == 0 # 物理ノー伤害判定
- return
- end
- apply_state_changes(item) # 状态变化
- end
- #--------------------------------------------------------------------------
- # ● 伤害的反映
- #--------------------------------------------------------------------------
- alias execute_damage_n01 execute_damage
- def execute_damage(user)
- execute_damage_n01(user)
- # 吸収时这里的处理相冲
- if @absorbed
- user.hp_damage = -@hp_damage
- user.mp_damage = -@mp_damage
- end
- end
- #--------------------------------------------------------------------------
- # ● 使用技能的効果
- #--------------------------------------------------------------------------
- alias skill_effect_n01 skill_effect
- def skill_effect(user, obj)
- # 保持变化前的HPMP
- nowhp = self.hp
- nowmp = self.mp
- # 为了计算现在HPMP的威力获取变化前的使用者的HPMP
- if obj.extension.include?("HP消耗")
- user_hp = user.hp + user.calc_mp_cost(obj)
- user_mp = user.mp
- else
- user_hp = user.hp
- user_mp = user.mp + user.calc_mp_cost(obj)
- end
- # 确认扩张设定
- check_extension(obj)
- # 计算伤害
- skill_effect_n01(user, obj)
- # 有伤害系的扩张时这里的处理会相冲
- if @extension
- self.hp = nowhp
- self.mp = nowmp
- end
- # 攻击未名中时中断处理
- return if self.evaded or self.missed
- # 变换伤害属性
- damage = @hp_damage unless obj.damage_to_mp
- damage = @mp_damage if obj.damage_to_mp
- # 比例伤害
- if @ratio_maxdamage != nil
- damage = self.maxhp * @ratio_maxdamage / 100 unless obj.damage_to_mp
- damage = self.maxmp * @ratio_maxdamage / 100 if obj.damage_to_mp
- end
- if @ratio_nowdamage != nil
- damage = self.hp * @ratio_nowdamage / 100 unless obj.damage_to_mp
- damage = self.mp * @ratio_nowdamage / 100 if obj.damage_to_mp
- end
- # 成本威力
- if @cost_damage
- cost = user.calc_mp_cost(obj)
- if obj.extension.include?("HP消耗")
- damage = damage * cost / user.maxhp
- else
- damage = damage * cost / user.maxmp
- end
- end
- # 现在HP威力
- damage = damage * user_hp / user.maxhp if @nowhp_damage
- # 现在MP威力
- damage = damage * user_mp / user.maxmp if @nowmp_damage
- # 放弃伤害属性的变换
- @hp_damage = damage unless obj.damage_to_mp
- @mp_damage = damage if obj.damage_to_mp
- # 反应扩张
- if @extension
- self.hp -= @hp_damage
- self.mp -= @mp_damage
- end
- # 初期化
- @extension = false
- @cost_damage = false
- @nowhp_damage = false
- @nowmp_damage = false
- @ratio_maxdamage = nil
- @ratio_nowdamage = nil
- end
- #--------------------------------------------------------------------------
- # ● 确认扩张设定
- #--------------------------------------------------------------------------
- def check_extension(skill)
- for ext in skill.extension
- # 成本威力
- if ext == "成本威力"
- @extension = true
- next @cost_damage = true
- # 现在HP威力
- elsif ext == "现HP威力"
- @extension = true
- next @nowhp_damage = true
- # 现在MP威力
- elsif ext == "现MP威力"
- @extension = true
- next @nowmp_damage = true
- else
- # 比例伤害
- name = ext.split('')
- if name[5] == "M"
- name = name.join
- name.slice!("%伤害MAX/")
- @extension = true
- next @ratio_maxdamage = name.to_i
- elsif name[5] == "N"
- name = name.join
- name.slice!("%伤害NOW/")
- @extension = true
- next @ratio_nowdamage = name.to_i
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 初期配置的変更
- #--------------------------------------------------------------------------
- def change_base_position(x, y)
- @base_position_x = x
- @base_position_y = y
- end
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- def reset_coordinate
- @move_x = @move_y = @move_z = @jump = @derivation = 0
- @active = @non_dead = @individual = false
- end
- #--------------------------------------------------------------------------
- # ● 使用连续伤害的効果
- #--------------------------------------------------------------------------
- def slip_damage_effect
- if slip_damage? and @hp > 0
- @hp_damage = apply_variance(maxhp / 10, 10)
- @hp_damage = @hp - 1 if @hp_damage >= @hp
- self.hp -= @hp_damage
- end
- end
- #--------------------------------------------------------------------------
- # ● 事件的伤害POP
- #--------------------------------------------------------------------------
- def damage_num(num = nil)
- return if dead? or !$game_temp.in_battle or num == 0
- @force_damage = num
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理主人公的类。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :two_swords_change # 强制替换二刀流的标志
- #--------------------------------------------------------------------------
- # ● 根据ID判定技能是否习得
- #--------------------------------------------------------------------------
- def skill_id_learn?(skill_id)
- return @skills.include?(skill_id)
- end
- #--------------------------------------------------------------------------
- # ● 判定技能的使用可能 ※再定义
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return super
- end
- #--------------------------------------------------------------------------
- # ● 图片的变更
- #--------------------------------------------------------------------------
- def graphic_change(character_name)
- @character_name = character_name
- end
- #--------------------------------------------------------------------------
- # ● 击倒的实行 ※再定义
- #--------------------------------------------------------------------------
- def perform_collapse
- Sound.play_actor_collapse if $game_temp.in_battle and dead?
- end
- #--------------------------------------------------------------------------
- # ● 初期配置的取得
- #--------------------------------------------------------------------------
- def base_position
- base = N01::ACTOR_POSITION[self.index]
- @base_position_x = base[0]
- @base_position_y = base[1]
- # バックアタック時はX軸を逆に
- @base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 X 坐标的取得
- #--------------------------------------------------------------------------
- def position_x
- return 0 if self.index == nil
- return @base_position_x + @move_x
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 Y 坐标的取得
- #--------------------------------------------------------------------------
- def position_y
- return 0 if self.index == nil
- return @base_position_y + @move_y + @jump
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 Z 坐标的取得
- #--------------------------------------------------------------------------
- def position_z
- return 0 if self.index == nil
- return self.index + @base_position_y + @move_y + @move_z - @jump + 200
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #------------------------------------------------------------------------------
- # 处理敌方的类。
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :adj_speed # 复数会合行动的速度修正
- attr_accessor :act_time # 行动数回
- #--------------------------------------------------------------------------
- # ● 动作速度的決定 复数回合行动用
- #--------------------------------------------------------------------------
- def make_action_speed2(adj)
- @adj_speed = self.action.speed if @adj_speed == nil
- @adj_speed = @adj_speed * adj / 100
- end
- #--------------------------------------------------------------------------
- # ● 击倒的实行 ※再定义
- #--------------------------------------------------------------------------
- def perform_collapse
- @force_action = ["N01collapse"] if $game_temp.in_battle and dead?
- end
- #--------------------------------------------------------------------------
- # ● 获取初期配置
- #--------------------------------------------------------------------------
- def base_position
- return if self.index == nil
- # 确认角色画像的大小修正Y坐标
- bitmap = Bitmap.new("Graphics/Battlers/" + @battler_name) if !self.anime_on
- bitmap = Bitmap.new("Graphics/Characters/" + @battler_name) if self.anime_on && N01::WALK_ANIME
- bitmap = Bitmap.new("Graphics/Characters/" + @battler_name + "_1") if self.anime_on && !N01::WALK_ANIME
- height = bitmap.height
- @base_position_x = self.screen_x + self.position_plus[0]
- @base_position_y = self.screen_y + self.position_plus[1] - height / 3
- bitmap.dispose
- # 背后攻击时X轴逆转
- if $back_attack && N01::BACK_ATTACK
- @base_position_x = Graphics.width - self.screen_x - self.position_plus[0]
- end
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 X 坐标的取得
- #--------------------------------------------------------------------------
- def position_x
- return @base_position_x - @move_x
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 Y 坐标的取得
- #--------------------------------------------------------------------------
- def position_y
- return @base_position_y + @move_y + @jump
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面 Z 坐标的取得
- #--------------------------------------------------------------------------
- def position_z
- return position_y + @move_z - @jump + 200
- end
- end
- #==============================================================================
- # ■ Sprite_Damage
- #------------------------------------------------------------------------------
- # 伤害表示的精灵。
- #==============================================================================
- class Sprite_Damage < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :battler
- #--------------------------------------------------------------------------
- # ● 客观初期化
- #--------------------------------------------------------------------------
- def initialize(viewport,battler = nil)
- super(viewport)
- @battler = battler
- @damage = 0
- @duration = 0
- @x = 0
- @y = 0
- @z_plus = 0
- @minus = false
- @num1 = Sprite.new(viewport)
- @num2 = Sprite.new(viewport)
- @num3 = Sprite.new(viewport)
- @num4 = Sprite.new(viewport)
- @num5 = Sprite.new(viewport)
- @num1.visible = false
- @num2.visible = false
- @num3.visible = false
- @num4.visible = false
- @num5.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- force_damage
- move_damage(@num5, @pop_time) if @num5.visible
- move_damage(@num4, @pop_time - 2) if @num4.visible
- move_damage(@num3, @pop_time - 4) if @num3.visible
- move_damage(@num2, @pop_time - 6) if @num2.visible
- move_damage(@num1, @pop_time - 8) if @num1.visible
- move_window if @window != nil
- @duration -= 1 if @duration > 0
- end
- #--------------------------------------------------------------------------
- # ● 事件的伤害POP
- #--------------------------------------------------------------------------
- def force_damage
- if @battler.force_damage != 0
- damage_pop(@battler.force_damage)
- @battler.hp -= @battler.force_damage
- @force_damage = true
- @battler.force_damage = 0
- $game_temp.status_window_refresh = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 数値的移动
- #--------------------------------------------------------------------------
- def move_damage(num, min)
- case @duration
- when min-1..min
- num.y -= 4
- when min-3..min-2
- num.y -= 3
- when min-6..min-4
- num.y -= 2
- when min-14..min-7
- num.y += 2
- when min-17..min-15
- num.y -= 2
- when min-23..min-18
- num.y += 1
- when min-27..min-24
- num.y -= 1
- when min-30..min-28
- num.y += 1
- when min-33..min-31
- num.y -= 1
- when min-36..min-34
- num.y += 1
- end
- next_damage if @battler.double_damage && @duration == min-34
- num.opacity = 256 - (12 - @duration) * 32
- num.visible = false if @duration == 0
- if @force_damage && @duration == 0
- @force_damage = false
- @battler.perform_collapse
- end
- end
- #--------------------------------------------------------------------------
- # ● 文字窗口的移动
- #--------------------------------------------------------------------------
- def move_window
- @window.x -= 6 if @window_time > 0 && @window.x > 0
- @window_time -= 1
- if @duration == 0
- @window.dispose
- @window = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● HPMP两方同时伤害
- #--------------------------------------------------------------------------
- def next_damage
- @battler.hp_damage = 0
- @battler.double_damage = false
- damage_pop
- end
- #--------------------------------------------------------------------------
- # ● 准备伤害POP
- #--------------------------------------------------------------------------
- def damage_pop(num = nil)
- reset
- damage = battler.hp_damage
- # 抽出状态的变化
- states = battler.added_states
- text = ""
- # MP伤害用文本(HPMP两方同时伤害除外)
- if [email protected]_damage && @battler.mp_damage != 0
- text = N01::POP_MP_DAM if battler.mp_damage > 0
- text = N01::POP_MP_REC if battler.mp_damage < 0
- damage = battler.mp_damage
- end
- # 连续伤害不显示MP伤害以外的文字
- if num == nil
- text = N01::POP_MISS if battler.missed && states == []
- text = N01::POP_DAMAGE0 if damage == 0 && states == [] && !battler.revival
- text = N01::POP_EVA if battler.evaded
- text = N01::POP_CRI if battler.critical
- for state in states
- # 无POP设定的状态不显示
- unless state.extension.include?("无POP")
- text += " " if text != ""
- text += state.name
- end
- end
- else
- damage = num
- end
- # 区分伤害和回复
- @minus = false
- @minus = true if damage < 0
- damage = damage.abs
- # 略微调整POP位置
- adjust = -16
- adjust = 16 if $back_attack
- adjust = 0 if damage == 0
- @x = battler.position_x + adjust
- @y = battler.position_y
- window(text) if text != ""
- @pop_time = N01::NUM_DURATION
- # 没有伤害时没有数字的POP
- return @duration = @pop_time if damage == 0
- @num_time = -1
- damage_file(@num1, damage % 10, @pop_time - 7) if damage >= 0
- damage_file(@num2, (damage % 100)/10, @pop_time - 5) if damage >= 10
- damage_file(@num3, (damage % 1000)/100, @pop_time - 3) if damage >= 100
- damage_file(@num4, (damage % 10000)/1000, @pop_time - 1) if damage >= 1000
- damage_file(@num5, (damage % 100000)/10000, @pop_time + 1) if damage >= 10000
- end
- #--------------------------------------------------------------------------
- # ● 准备情报窗口
- #--------------------------------------------------------------------------
- def window(text)
- @window = Window_Damage.new(@x - 64, @y - 22)
- @window.pop_text(text)
- @window_time = 5
- end
- #--------------------------------------------------------------------------
- # ● 准备数字画像
- #--------------------------------------------------------------------------
- def damage_file(num, cw, dur)
- num.visible = true
- # 判別文件
- file = N01::DAMAGE_GRAPHICS
- file = N01::RECOVER_GRAPHICS if @minus
- # 数字
- num.bitmap = Cache.system(file)
- @num_time += 1
- sx = num.bitmap.width / 10
- num.src_rect.set(cw * sx, 0, sx, num.height)
- num.x = @x - (num.width + N01::NUM_INTERBAL) * @num_time
- num.y = @y
- num.z = 2000 - @num_time
- @duration = dur
- @window.x = num.x - @window.width + 64 if @window != nil && N01::NON_DAMAGE_WINDOW
- @window.x = num.x - @window.width + 26 if @window != nil && !N01::NON_DAMAGE_WINDOW
- @window.x = 0 if @window != nil && @window.x < 0
- end
- #--------------------------------------------------------------------------
- # ● 伤害组合
- #--------------------------------------------------------------------------
- def reset
- @num5.visible = @num4.visible = @num3.visible = @num2.visible = @num1.visible = false
- @window.dispose if @window != nil
- @window = nil
- end
- #--------------------------------------------------------------------------
- # ● 开放
- #--------------------------------------------------------------------------
- def dispose
- super
- @num1.dispose
- @num2.dispose
- @num3.dispose
- @num4.dispose
- @num5.dispose
- @window.dispose if @window != nil
- end
- end
- #==============================================================================
- # ■ Window_Damage
- #------------------------------------------------------------------------------
- # 危机等表示的窗口。
- #==============================================================================
- class Window_Damage < Window_Base
- #--------------------------------------------------------------------------
- # ● 客观初期化
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 160, 46)
- self.opacity = 0 if N01::NON_DAMAGE_WINDOW
- end
- #--------------------------------------------------------------------------
- # ● 窗口内容的作成
- #--------------------------------------------------------------------------
- def create_contents
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● 状态设定
- #--------------------------------------------------------------------------
- def pop_text(text, align = 1)
- self.contents.clear
- self.width = self.contents.text_size(text).width + 36
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.color = normal_color
- self.contents.font.size = 16
- self.contents.draw_text(0,-8, width - 32, 32, text, align)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中处理所有窗口的超级类。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 状态的描画 ※再定义(反映设定不显示状态ICON)
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 96)
- count = 0
- for state in actor.states
- break if state.extension.include?("不显示ICON")
- draw_icon(state.icon_index, x + 24 * count, y)
- count += 1
- break if (24 * count > width - 24)
- end
- end
- end
- #==============================================================================
- # ■ Game_Temp
- #------------------------------------------------------------------------------
- # 不包含存储数据、处理一时数据的类。
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 公开变数
- #--------------------------------------------------------------------------
- attr_accessor :status_window_refresh # 状态窗口的还原标志
- #--------------------------------------------------------------------------
- # ● 客观初期化
- #--------------------------------------------------------------------------
- alias initialize_n01 initialize
- def initialize
- initialize_n01
- @status_window_refresh = false
- end
- end
- #==============================================================================
- # ■ Game_Interpreter
- #------------------------------------------------------------------------------
- # 实行时间指令的解释。
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● HP 的增减
- #--------------------------------------------------------------------------
- def command_311
- if $game_temp.in_battle
- value = operate_value(@params[1], @params[2], @params[3])
- iterate_actor_id(@params[0]) do |actor|
- next if actor.dead?
- if @params[4] == false and actor.hp + value <= 0
- actor.damage_num(actor.hp - 1) # 如果不允许战斗不能时变为1
- else
- actor.damage_num(-value)
- end
- end
- return true
- else
- value = operate_value(@params[1], @params[2], @params[3])
- iterate_actor_id(@params[0]) do |actor|
- next if actor.dead?
- if @params[4] == false and actor.hp + value <= 0
- actor.hp = 1 # 如果不允许战斗不能时变为1
- else
- actor.hp += value
- end
- actor.perform_collapse
- end
- if $game_party.all_dead?
- $game_temp.next_scene = "gameover"
- end
- return true
- end
- end
- #--------------------------------------------------------------------------
- # ● 敌角色的 HP 增减
- #--------------------------------------------------------------------------
- def command_331
- value = operate_value(@params[1], @params[2], @params[3])
- iterate_enemy_index(@params[0]) do |enemy|
- if enemy.hp > 0
- if @params[4] == false and enemy.hp + value <= 0
- enemy.damage_num(enemy.hp - 1) # 如果不允许战斗不能时变为1
- else
- enemy.damage_num(-value)
- end
- end
- end
- return true
- end
- end
复制代码 |
|