| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-2-10 |
| 在线时间 | 59 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 59 小时
- 注册时间
- 2013-12-22
- 回帖
- 56
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
这是脚本第三部分的,在(战斗x坐标的取得)2020行出现了typeerror
不知道怎么搞的
- #==============================================================================
- # ■ 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 !@battler.double_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
复制代码 |
|