查看: 1877|回复: 2

[已经解决] 又是关于状态的问题。。。

[复制链接]
梦石
0
星屑
1328
在线时间
354 小时
注册时间
2009-9-14
回帖
211
发表于 2018-4-25 14:46:14 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 CR~ 于 2018-4-25 14:47 编辑

这几天天天被状态困扰,,,好不容易快弄完了,,今天测试的时候,又发现了一个问题。。。

因为我用了CP战斗,就有出现了一个毛病,就是角色如果有个状态,在积攒CP条的时候,这个状态还存在,然后CP条积满,轮到角色行动时,技能释放前,自然解除状态,状态刷新。。。
就导致了虽然积攒CP条时状态还在,但是技能没有状态的加成。。。
就如图这样。。。技能并没有状态的加成。。。
123.gif

然后我就把自然解除状态,状态刷新这两句放在了最后的步骤6。。。
然后发现,,,如果角色被上了个睡眠之类的BUFF
因为不能主动行动,,,然后永远都不能刷新自己的状态了。。

Scene_Battle 4
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始主回合
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :active_battler
  11.   attr_reader   :target_battlers
  12.   attr_reader   :help_window
  13.   def start_phase4
  14.     # 转移到回合 4
  15.     @phase = 4
  16.     # 回合数计数
  17.     $game_temp.battle_turn += 1
  18.     # 搜索全页的战斗事件
  19.     for index in 0...$data_troops[@troop_id].pages.size
  20.       # 获取事件页
  21.       page = $data_troops[@troop_id].pages[index]
  22.       # 本页的范围是 [回合] 的情况下
  23.       if page.span == 1
  24.         # 设置已经执行标志
  25.         $game_temp.battle_event_flags[index] = false
  26.       end
  27.     end
  28.     # 设置角色为非选择状态
  29.     @actor_index = -1
  30.     @active_battler = nil
  31.     # 有效化同伴指令窗口
  32.     @party_command_window.active = false
  33.     @party_command_window.visible = false
  34.     # 无效化角色指令窗口
  35.     @actor_command_window.active = false
  36.     @actor_command_window.visible = false
  37.     # 设置主回合标志
  38.     $game_temp.battle_main_phase = true
  39.     # 生成敌人行动
  40.     for enemy in $game_troop.enemies
  41.       enemy.make_action
  42.     end
  43.     # 生成行动顺序
  44.     make_action_orders
  45.     # 移动到步骤 1
  46.     @phase4_step = 1
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 生成行动循序
  50.   #--------------------------------------------------------------------------
  51.   def make_action_orders
  52.     # 初始化序列 @action_battlers
  53.     @action_battlers = []
  54.     # 添加敌人到 @action_battlers 序列
  55.     for enemy in $game_troop.enemies
  56.       @action_battlers.push(enemy)
  57.     end
  58.     # 添加角色到 @action_battlers 序列
  59.     for actor in $game_party.actors
  60.       @action_battlers.push(actor)
  61.     end
  62.     # 确定全体的行动速度
  63.     for battler in @action_battlers
  64.       battler.make_action_speed
  65.     end
  66.     # 按照行动速度从大到小排列
  67.     @action_battlers.sort! {|a,b|
  68.       b.current_action.speed - a.current_action.speed }
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 刷新画面 (主回合)
  72.   #--------------------------------------------------------------------------
  73.   def update_phase4
  74.     case @phase4_step
  75.     when 1
  76.       update_phase4_step1
  77.     when 2
  78.       update_phase4_step2
  79.     when 3
  80.       update_phase4_step3
  81.     when 4
  82.       update_phase4_step4
  83.     when 5
  84.       update_phase4_step5
  85.     when 6
  86.       update_phase4_step6
  87.     end
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  91.   #--------------------------------------------------------------------------
  92.   def update_phase4_step1
  93.     # 隐藏帮助窗口
  94.     @help_window.visible = false
  95.     # 判定胜败
  96.     if judge
  97.       # 胜利或者失败的情况下 : 过程结束
  98.       return
  99.     end
  100.     # 强制行动的战斗者不存在的情况下
  101.     if $game_temp.forcing_battler == nil
  102.       # 设置战斗事件
  103.       setup_battle_event
  104.       # 执行战斗事件中的情况下
  105.       if $game_system.battle_interpreter.running?
  106.         return
  107.       end
  108.     end
  109.     # 强制行动的战斗者存在的情况下
  110.     if $game_temp.forcing_battler != nil
  111.       # 在头部添加后移动
  112.       @action_battlers.delete($game_temp.forcing_battler)
  113.       @action_battlers.unshift($game_temp.forcing_battler)
  114.     end
  115.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  116.     if @action_battlers.size == 0
  117.       # 开始同伴命令回合
  118.       start_phase2
  119.       return
  120.     end
  121.     # 初始化动画 ID 和公共事件 ID
  122.     @animation1_id = 0
  123.     @animation2_id = 0
  124.     @common_event_id = 0
  125.     # 未行动的战斗者移动到序列的头部
  126.     @active_battler = @action_battlers.shift
  127.     # 如果已经在战斗之外的情况下
  128.     if @active_battler.index == nil
  129.       return
  130.     end
  131.     # 连续伤害
  132.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  133.       @active_battler.slip_damage_effect
  134.       @active_battler.damage_pop = true
  135.     end
  136.         # 自然解除状态
  137.     @active_battler.remove_states_auto
  138.     # 刷新状态窗口
  139.     @status_window.refresh
  140.     # 移至步骤 2
  141.     @phase4_step = 2
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  145.   #--------------------------------------------------------------------------
  146.   def update_phase4_step2
  147.     # 如果不是强制行动
  148.     unless @active_battler.current_action.forcing
  149.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  150.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  151.         # 设置行动为攻击
  152.         @active_battler.current_action.kind = 0
  153.         @active_battler.current_action.basic = 0
  154.       end
  155.       # 限制为 [不能行动] 的情况下
  156.       if @active_battler.restriction == 4
  157.         # 清除行动强制对像的战斗者
  158.         $game_temp.forcing_battler = nil
  159.         # 移至步骤 1
  160.         @phase4_step = 1
  161.         return
  162.       end
  163.     end
  164.     # 清除对像战斗者
  165.     @target_battlers = []
  166.     # 行动种类分支
  167.     case @active_battler.current_action.kind
  168.     when 0  # 基本
  169.       make_basic_action_result
  170.     when 1  # 特技
  171.       make_skill_action_result
  172.     when 2  # 物品
  173.       make_item_action_result
  174.     end
  175.     # 移至步骤 3
  176.     if @phase4_step == 2
  177.       @phase4_step = 3
  178.     end
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 生成基本行动结果
  182.   #--------------------------------------------------------------------------
  183.   def make_basic_action_result
  184.     # 攻击的情况下
  185.     if @active_battler.current_action.basic == 0
  186.       # 设置攻击 ID
  187.       @animation1_id = @active_battler.animation1_id
  188.       @animation2_id = @active_battler.animation2_id
  189.       # 行动方的战斗者是敌人的情况下
  190.       if @active_battler.is_a?(Game_Enemy)
  191.         if @active_battler.restriction == 3
  192.           target = $game_troop.random_target_enemy
  193.         elsif @active_battler.restriction == 2
  194.           target = $game_party.random_target_actor
  195.         else
  196.           index = @active_battler.current_action.target_index
  197.           target = $game_party.smooth_target_actor(index)
  198.         end
  199.       end
  200.       # 行动方的战斗者是角色的情况下
  201.       if @active_battler.is_a?(Game_Actor)
  202.         if @active_battler.restriction == 3
  203.           target = $game_party.random_target_actor
  204.         elsif @active_battler.restriction == 2
  205.           target = $game_troop.random_target_enemy
  206.         else
  207.           index = @active_battler.current_action.target_index
  208.           target = $game_troop.smooth_target_enemy(index)
  209.         end
  210.       end
  211.       # 设置对像方的战斗者序列
  212.       @target_battlers = [target]
  213.       # 应用通常攻击效果
  214.       for target in @target_battlers
  215.         target.attack_effect(@active_battler)
  216.       end
  217.       return
  218.     end
  219.     # 防御的情况下
  220.     if @active_battler.current_action.basic == 1
  221.       # 帮助窗口显示"防御"
  222.       @help_window.set_text($data_system.words.guard, 1)
  223.       return
  224.     end
  225.     # 逃跑的情况下
  226.     if @active_battler.is_a?(Game_Enemy) and
  227.        @active_battler.current_action.basic == 2
  228.       #  帮助窗口显示"逃跑"
  229.       @help_window.set_text("逃跑", 1)
  230.       # 逃跑
  231.       @active_battler.escape
  232.       return
  233.     end
  234.     # 什么也不做的情况下
  235.     if @active_battler.current_action.basic == 3
  236.       # 清除强制行动对像的战斗者
  237.       $game_temp.forcing_battler = nil
  238.       # 移至步骤 1
  239.       @phase4_step = 1
  240.       return
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 设置物品或特技对像方的战斗者
  245.   #     scope : 特技或者是物品的范围
  246.   #--------------------------------------------------------------------------
  247.   def set_target_battlers(scope)
  248.     # 行动方的战斗者是敌人的情况下
  249.     if @active_battler.is_a?(Game_Enemy)
  250.       # 效果范围分支
  251.       case scope
  252.       when 1  # 敌单体
  253.         index = @active_battler.current_action.target_index
  254.         @target_battlers.push($game_party.smooth_target_actor(index))
  255.       when 2  # 敌全体
  256.         for actor in $game_party.actors
  257.           if actor.exist?
  258.             @target_battlers.push(actor)
  259.           end
  260.         end
  261.       when 3  # 我方单体
  262.         index = @active_battler.current_action.target_index
  263.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  264.       when 4  # 我方全体
  265.         for enemy in $game_troop.enemies
  266.           if enemy.exist?
  267.             @target_battlers.push(enemy)
  268.           end
  269.         end
  270.       when 5  # 我方单体 (HP 0)
  271.         index = @active_battler.current_action.target_index
  272.         enemy = $game_troop.enemies[index]
  273.         if enemy != nil and enemy.hp0?
  274.           @target_battlers.push(enemy)
  275.         end
  276.       when 6  # 我方全体 (HP 0)
  277.         for enemy in $game_troop.enemies
  278.           if enemy != nil and enemy.hp0?
  279.             @target_battlers.push(enemy)
  280.           end
  281.         end
  282.       when 7  # 使用者
  283.         @target_battlers.push(@active_battler)
  284.       end
  285.     end
  286.     # 行动方的战斗者是角色的情况下
  287.     if @active_battler.is_a?(Game_Actor)
  288.       # 效果范围分支
  289.       case scope
  290.       when 1  # 敌单体
  291.         index = @active_battler.current_action.target_index
  292.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  293.       when 2  # 敌全体
  294.         for enemy in $game_troop.enemies
  295.           if enemy.exist?
  296.             @target_battlers.push(enemy)
  297.           end
  298.         end
  299.       when 3  # 我方单体
  300.         index = @active_battler.current_action.target_index
  301.         @target_battlers.push($game_party.smooth_target_actor(index))
  302.       when 4  # 我方全体
  303.         for actor in $game_party.actors
  304.           if actor.exist?
  305.             @target_battlers.push(actor)
  306.           end
  307.         end
  308.       when 5  # 我方单体 (HP 0)
  309.         index = @active_battler.current_action.target_index
  310.         actor = $game_party.actors[index]
  311.         if actor != nil and actor.hp0?
  312.           @target_battlers.push(actor)
  313.         end
  314.       when 6  # 我方全体 (HP 0)
  315.         for actor in $game_party.actors
  316.           if actor != nil and actor.hp0?
  317.             @target_battlers.push(actor)
  318.           end
  319.         end
  320.       when 7  # 使用者
  321.         @target_battlers.push(@active_battler)
  322.       end
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 生成特技行动结果
  327.   #--------------------------------------------------------------------------
  328.   def make_skill_action_result
  329.     # 获取特技
  330.     @skill = $data_skills[@active_battler.current_action.skill_id]
  331.     # 如果不是强制行动
  332.     unless @active_battler.current_action.forcing
  333.       # 因为 SP 耗尽而无法使用的情况下
  334.       unless @active_battler.skill_can_use?(@skill.id)
  335.         # 清除强制行动对像的战斗者
  336.         $game_temp.forcing_battler = nil
  337.         # 移至步骤 1
  338.         @phase4_step = 1
  339.         return
  340.       end
  341.     end
  342.     # 消耗 SP
  343.     @active_battler.sp -= @skill.sp_cost
  344.     # 刷新状态窗口
  345.     @status_window.refresh
  346.     # 在帮助窗口显示特技名
  347.     @help_window.set_text(@skill.name, 1)
  348.         #####################################################################
  349.     if @skill.id == 118
  350.       common_event = $data_common_events[71]
  351.       $game_system.battle_interpreter.setup(common_event.list, 0)
  352.     end
  353.     if @skill.id == 127
  354.       common_event = $data_common_events[72]
  355.       $game_system.battle_interpreter.setup(common_event.list, 0)
  356.     end
  357.     if @skill.id == 129
  358.       common_event = $data_common_events[74]
  359.       $game_system.battle_interpreter.setup(common_event.list, 0)
  360.     end
  361.     if @skill.id == 130
  362.       common_event = $data_common_events[73]
  363.       $game_system.battle_interpreter.setup(common_event.list, 0)
  364.     end
  365.     if @skill.id == 131
  366.       common_event = $data_common_events[75]
  367.       $game_system.battle_interpreter.setup(common_event.list, 0)
  368.     end
  369.     if @skill.id == 132
  370.       common_event = $data_common_events[76]
  371.       $game_system.battle_interpreter.setup(common_event.list, 0)
  372.     end
  373.     if @skill.id == 135
  374.       common_event = $data_common_events[77]
  375.       $game_system.battle_interpreter.setup(common_event.list, 0)
  376.     end
  377.     if @skill.id == 152
  378.       common_event = $data_common_events[78]
  379.       $game_system.battle_interpreter.setup(common_event.list, 0)
  380.     end
  381.     if @skill.id == 154
  382.       common_event = $data_common_events[79]
  383.       $game_system.battle_interpreter.setup(common_event.list, 0)
  384.     end
  385.     if @skill.id == 401
  386.       common_event = $data_common_events[45]
  387.       $game_system.battle_interpreter.setup(common_event.list, 0)
  388.     end
  389.     if @skill.id == 168
  390.       common_event = $data_common_events[80]
  391.       $game_system.battle_interpreter.setup(common_event.list, 0)
  392.     end
  393.     if @skill.id == 169
  394.       common_event = $data_common_events[81]
  395.       $game_system.battle_interpreter.setup(common_event.list, 0)
  396.     end
  397.     if @skill.id == 171
  398.       common_event = $data_common_events[82]
  399.       $game_system.battle_interpreter.setup(common_event.list, 0)
  400.     end
  401.     if @skill.id == 172
  402.       common_event = $data_common_events[83]
  403.       $game_system.battle_interpreter.setup(common_event.list, 0)
  404.     end
  405.     if @skill.id == 176
  406.       common_event = $data_common_events[84]
  407.       $game_system.battle_interpreter.setup(common_event.list, 0)
  408.     end
  409.         if @skill.id == 189
  410.       common_event = $data_common_events[85]
  411.       $game_system.battle_interpreter.setup(common_event.list, 0)
  412.     end
  413.         if @skill.id == 190
  414.       common_event = $data_common_events[86]
  415.       $game_system.battle_interpreter.setup(common_event.list, 0)
  416.     end
  417.             if @skill.id == 192
  418.       common_event = $data_common_events[87]
  419.       $game_system.battle_interpreter.setup(common_event.list, 0)
  420.     end
  421.                 if @skill.id == 194
  422.       common_event = $data_common_events[88]
  423.       $game_system.battle_interpreter.setup(common_event.list, 0)
  424.     end
  425.     if @skill.id == 330
  426.       common_event = $data_common_events[89]
  427.       $game_system.battle_interpreter.setup(common_event.list, 0)
  428.     end
  429.         if @skill.id == 332
  430.       common_event = $data_common_events[90]
  431.       $game_system.battle_interpreter.setup(common_event.list, 0)
  432.     end
  433.             if @skill.id == 333
  434.       common_event = $data_common_events[91]
  435.       $game_system.battle_interpreter.setup(common_event.list, 0)
  436.     end
  437.                 if @skill.id == 334
  438.       common_event = $data_common_events[89]
  439.       $game_system.battle_interpreter.setup(common_event.list, 0)
  440.     end
  441.                     if @skill.id == 210
  442.       common_event = $data_common_events[92]
  443.       $game_system.battle_interpreter.setup(common_event.list, 0)
  444.     end
  445.                         if @skill.id == 211
  446.       common_event = $data_common_events[92]
  447.       $game_system.battle_interpreter.setup(common_event.list, 0)
  448.     end
  449.                             if @skill.id == 212
  450.       common_event = $data_common_events[92]
  451.       $game_system.battle_interpreter.setup(common_event.list, 0)
  452.     end
  453.                                 if @skill.id == 851
  454.       common_event = $data_common_events[93]
  455.       $game_system.battle_interpreter.setup(common_event.list, 0)
  456.     end
  457.                                     if @skill.id == 852
  458.       common_event = $data_common_events[93]
  459.       $game_system.battle_interpreter.setup(common_event.list, 0)
  460.     end
  461.                                     if @skill.id == 853
  462.       common_event = $data_common_events[93]
  463.       $game_system.battle_interpreter.setup(common_event.list, 0)
  464.     end
  465.                                     if @skill.id == 854
  466.       common_event = $data_common_events[93]
  467.       $game_system.battle_interpreter.setup(common_event.list, 0)
  468.     end
  469.                                     if @skill.id == 855
  470.       common_event = $data_common_events[93]
  471.       $game_system.battle_interpreter.setup(common_event.list, 0)
  472.     end
  473.                                         if @skill.id == 850
  474.       common_event = $data_common_events[93]
  475.       $game_system.battle_interpreter.setup(common_event.list, 0)
  476.     end
  477.                                             if @skill.id == 871
  478.       common_event = $data_common_events[93]
  479.       $game_system.battle_interpreter.setup(common_event.list, 0)
  480.     end
  481.                                             if @skill.id == 872
  482.       common_event = $data_common_events[93]
  483.       $game_system.battle_interpreter.setup(common_event.list, 0)
  484.     end
  485.                                             if @skill.id == 873
  486.       common_event = $data_common_events[93]
  487.       $game_system.battle_interpreter.setup(common_event.list, 0)
  488.     end
  489.                                             if @skill.id == 874
  490.       common_event = $data_common_events[93]
  491.       $game_system.battle_interpreter.setup(common_event.list, 0)
  492.     end
  493.                                             if @skill.id == 875
  494.       common_event = $data_common_events[93]
  495.       $game_system.battle_interpreter.setup(common_event.list, 0)
  496.     end
  497.                                                 if @skill.id == 876
  498.       common_event = $data_common_events[93]
  499.       $game_system.battle_interpreter.setup(common_event.list, 0)
  500.     end
  501.                                                 if @skill.id == 877
  502.       common_event = $data_common_events[93]
  503.       $game_system.battle_interpreter.setup(common_event.list, 0)
  504.     end
  505.                                                 if @skill.id == 878
  506.       common_event = $data_common_events[93]
  507.       $game_system.battle_interpreter.setup(common_event.list, 0)
  508.     end
  509.                                                 if @skill.id == 879
  510.       common_event = $data_common_events[93]
  511.       $game_system.battle_interpreter.setup(common_event.list, 0)
  512.     end
  513.                                                 if @skill.id == 880
  514.       common_event = $data_common_events[93]
  515.       $game_system.battle_interpreter.setup(common_event.list, 0)
  516.       end
  517.                                                       if @skill.id == 508
  518.       common_event = $data_common_events[94]
  519.       $game_system.battle_interpreter.setup(common_event.list, 0)
  520.     end
  521.                                                           if @skill.id == 510
  522.       common_event = $data_common_events[94]
  523.       $game_system.battle_interpreter.setup(common_event.list, 0)
  524.     end
  525.                                                           if @skill.id == 509
  526.       common_event = $data_common_events[95]
  527.       $game_system.battle_interpreter.setup(common_event.list, 0)
  528.     end
  529.                                                               if @skill.id == 360
  530.       common_event = $data_common_events[96]
  531.       $game_system.battle_interpreter.setup(common_event.list, 0)
  532.     end
  533.                 if @skill.id == 361
  534.       common_event = $data_common_events[96]
  535.       $game_system.battle_interpreter.setup(common_event.list, 0)
  536.     end
  537.                     if @skill.id == 362
  538.       common_event = $data_common_events[97]
  539.       $game_system.battle_interpreter.setup(common_event.list, 0)
  540.     end
  541.                         if @skill.id == 382
  542.       common_event = $data_common_events[98]
  543.       $game_system.battle_interpreter.setup(common_event.list, 0)
  544.     end
  545.                             if @skill.id == 384
  546.       common_event = $data_common_events[98]
  547.       $game_system.battle_interpreter.setup(common_event.list, 0)
  548.     end
  549.                             if @skill.id == 385
  550.       common_event = $data_common_events[98]
  551.       $game_system.battle_interpreter.setup(common_event.list, 0)
  552.     end
  553.                             if @skill.id == 386
  554.       common_event = $data_common_events[98]
  555.       $game_system.battle_interpreter.setup(common_event.list, 0)
  556.     end
  557.                             if @skill.id == 388
  558.       common_event = $data_common_events[99]
  559.       $game_system.battle_interpreter.setup(common_event.list, 0)
  560.     end
  561.                                 if @skill.id == 1515
  562.       common_event = $data_common_events[100]
  563.       $game_system.battle_interpreter.setup(common_event.list, 0)
  564.     end
  565.                                     if @skill.id == 1516
  566.       common_event = $data_common_events[101]
  567.       $game_system.battle_interpreter.setup(common_event.list, 0)
  568.     end
  569.                                         if @skill.id == 1521
  570.       common_event = $data_common_events[102]
  571.       $game_system.battle_interpreter.setup(common_event.list, 0)
  572.     end
  573.                                           if @skill.id == 1522
  574.       common_event = $data_common_events[102]
  575.       $game_system.battle_interpreter.setup(common_event.list, 0)
  576.     end
  577.                                           if @skill.id == 1526
  578.       common_event = $data_common_events[102]
  579.       $game_system.battle_interpreter.setup(common_event.list, 0)
  580.     end
  581.                                           if @skill.id == 1530
  582.       common_event = $data_common_events[102]
  583.       $game_system.battle_interpreter.setup(common_event.list, 0)
  584.     end
  585.                                               if @skill.id == 1547
  586.       common_event = $data_common_events[103]
  587.       $game_system.battle_interpreter.setup(common_event.list, 0)
  588.     end
  589.                                                   if @skill.id == 1549
  590.       common_event = $data_common_events[104]
  591.       $game_system.battle_interpreter.setup(common_event.list, 0)
  592.     end
  593.                                                       if @skill.id == 1550
  594.       common_event = $data_common_events[106]
  595.       $game_system.battle_interpreter.setup(common_event.list, 0)
  596.     end
  597.                                                           if @skill.id == 1553
  598.       common_event = $data_common_events[105]
  599.       $game_system.battle_interpreter.setup(common_event.list, 0)
  600.     end
  601.                                    if @skill.id == 1554
  602.       common_event = $data_common_events[105]
  603.       $game_system.battle_interpreter.setup(common_event.list, 0)
  604.     end
  605.     ########
  606.     ##############################################################
  607.     # 设置动画 ID
  608.     @animation1_id = @skill.animation1_id
  609.     @animation2_id = @skill.animation2_id
  610.     # 设置公共事件 ID
  611.     @common_event_id = @skill.common_event_id
  612.     # 设置对像侧战斗者
  613.     set_target_battlers(@skill.scope)
  614.     # 应用特技效果
  615.     for target in @target_battlers
  616.       target.skill_effect(@active_battler, @skill)
  617.     end
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 生成物品行动结果
  621.   #--------------------------------------------------------------------------
  622.   def make_item_action_result
  623.     # 获取物品
  624.     @item = $data_items[@active_battler.current_action.item_id]
  625.     # 因为物品耗尽而无法使用的情况下
  626.     unless $game_party.item_can_use?(@item.id)
  627.       # 移至步骤 1
  628.       @phase4_step = 1
  629.       return
  630.     end
  631.     # 消耗品的情况下
  632.     if @item.consumable
  633.       # 使用的物品减 1
  634.       $game_party.lose_item(@item.id, 1)
  635.     end
  636.     # 在帮助窗口显示物品名
  637.     @help_window.set_text(@item.name, 1)
  638.     # 设置动画 ID
  639.     @animation1_id = @item.animation1_id
  640.     @animation2_id = @item.animation2_id
  641.     # 设置公共事件 ID
  642.     @common_event_id = @item.common_event_id
  643.     # 确定对像
  644.     index = @active_battler.current_action.target_index
  645.     target = $game_party.smooth_target_actor(index)
  646.     # 设置对像侧战斗者
  647.     set_target_battlers(@item.scope)
  648.     # 应用物品效果
  649.     for target in @target_battlers
  650.       target.item_effect(@item)
  651.     end
  652.   end
  653. #--------------------------------------------------------------------------
  654.    # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  655.    #--------------------------------------------------------------------------
  656.    def update_phase4_step3
  657.      # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  658.      if @animation1_id == 0
  659.        @active_battler.white_flash = true
  660.      else
  661.        @active_battler.animation_id = @animation1_id
  662.        @active_battler.animation_hit = true
  663.      end
  664.      # 对像方动画
  665.      for target in @target_battlers
  666.        target.animation_id = @animation2_id
  667.        target.animation_hit = (target.damage != "Miss")
  668.      end
  669.      # 移至步骤 4
  670.      @phase4_step = 4
  671.    end
  672.    #--------------------------------------------------------------------------
  673.    # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  674.    #--------------------------------------------------------------------------
  675.    def update_phase4_step4
  676.      # 限制动画长度、最低 8 帧
  677.      @wait_count = 8
  678.      # 移至步骤 5
  679.      @phase4_step = 5
  680.    end

  681.   #--------------------------------------------------------------------------
  682.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  683.   #--------------------------------------------------------------------------
  684.   def update_phase4_step5
  685.     # 隐藏帮助窗口
  686.     @help_window.visible = false
  687.     # 刷新状态窗口
  688.     @status_window.refresh
  689.     # 显示伤害
  690.     for target in @target_battlers
  691.       if target.damage != nil
  692.         target.damage_pop = true
  693.       end
  694.     end
  695.     # 移至步骤 6
  696.     @phase4_step = 6
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  700.   #--------------------------------------------------------------------------
  701.   def update_phase4_step6
  702.     # 清除强制行动对像的战斗者
  703.     $game_temp.forcing_battler = nil
  704.         # 公共事件 ID 有效的情况下
  705.     if @common_event_id > 0
  706.       # 设置事件
  707.       common_event = $data_common_events[@common_event_id]
  708.       $game_system.battle_interpreter.setup(common_event.list, 0)
  709.     end
  710.     $game_variables[581] = 0
  711.     $game_variables[582] = 0
  712.     $game_variables[583] = $scene.active_battler.atk
  713.     $game_variables[584] = $scene.active_battler.str
  714.     $game_variables[585] = $scene.active_battler.dex
  715.     $game_variables[586] = $scene.active_battler.int
  716.     if $scene.target_battlers[0] == nil
  717.       $game_variables[587] = 0
  718.       $game_variables[588] = 0
  719.     else
  720.       $game_variables[587] = $scene.target_battlers[0].pdef
  721.       $game_variables[588] = $scene.target_battlers[0].mdef
  722.     end
  723.     # 移至步骤 1
  724.     @phase4_step = 1
  725.   end
  726. end
复制代码



CP战斗1
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始主回合
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :active_battler
  11.   attr_reader   :target_battlers
  12.   attr_reader   :help_window
  13.   def start_phase4
  14.     # 转移到回合 4
  15.     @phase = 4
  16.     # 回合数计数
  17.     $game_temp.battle_turn += 1
  18.     # 搜索全页的战斗事件
  19.     for index in 0...$data_troops[@troop_id].pages.size
  20.       # 获取事件页
  21.       page = $data_troops[@troop_id].pages[index]
  22.       # 本页的范围是 [回合] 的情况下
  23.       if page.span == 1
  24.         # 设置已经执行标志
  25.         $game_temp.battle_event_flags[index] = false
  26.       end
  27.     end
  28.     # 设置角色为非选择状态
  29.     @actor_index = -1
  30.     @active_battler = nil
  31.     # 有效化同伴指令窗口
  32.     @party_command_window.active = false
  33.     @party_command_window.visible = false
  34.     # 无效化角色指令窗口
  35.     @actor_command_window.active = false
  36.     @actor_command_window.visible = false
  37.     # 设置主回合标志
  38.     $game_temp.battle_main_phase = true
  39.     # 生成敌人行动
  40.     for enemy in $game_troop.enemies
  41.       enemy.make_action
  42.     end
  43.     # 生成行动顺序
  44.     make_action_orders
  45.     # 移动到步骤 1
  46.     @phase4_step = 1
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 生成行动循序
  50.   #--------------------------------------------------------------------------
  51.   def make_action_orders
  52.     # 初始化序列 @action_battlers
  53.     @action_battlers = []
  54.     # 添加敌人到 @action_battlers 序列
  55.     for enemy in $game_troop.enemies
  56.       @action_battlers.push(enemy)
  57.     end
  58.     # 添加角色到 @action_battlers 序列
  59.     for actor in $game_party.actors
  60.       @action_battlers.push(actor)
  61.     end
  62.     # 确定全体的行动速度
  63.     for battler in @action_battlers
  64.       battler.make_action_speed
  65.     end
  66.     # 按照行动速度从大到小排列
  67.     @action_battlers.sort! {|a,b|
  68.       b.current_action.speed - a.current_action.speed }
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 刷新画面 (主回合)
  72.   #--------------------------------------------------------------------------
  73.   def update_phase4
  74.     case @phase4_step
  75.     when 1
  76.       update_phase4_step1
  77.     when 2
  78.       update_phase4_step2
  79.     when 3
  80.       update_phase4_step3
  81.     when 4
  82.       update_phase4_step4
  83.     when 5
  84.       update_phase4_step5
  85.     when 6
  86.       update_phase4_step6
  87.     end
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  91.   #--------------------------------------------------------------------------
  92.   def update_phase4_step1
  93.     # 隐藏帮助窗口
  94.     @help_window.visible = false
  95.     # 判定胜败
  96.     if judge
  97.       # 胜利或者失败的情况下 : 过程结束
  98.       return
  99.     end
  100.     # 强制行动的战斗者不存在的情况下
  101.     if $game_temp.forcing_battler == nil
  102.       # 设置战斗事件
  103.       setup_battle_event
  104.       # 执行战斗事件中的情况下
  105.       if $game_system.battle_interpreter.running?
  106.         return
  107.       end
  108.     end
  109.     # 强制行动的战斗者存在的情况下
  110.     if $game_temp.forcing_battler != nil
  111.       # 在头部添加后移动
  112.       @action_battlers.delete($game_temp.forcing_battler)
  113.       @action_battlers.unshift($game_temp.forcing_battler)
  114.     end
  115.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  116.     if @action_battlers.size == 0
  117.       # 开始同伴命令回合
  118.       start_phase2
  119.       return
  120.     end
  121.     # 初始化动画 ID 和公共事件 ID
  122.     @animation1_id = 0
  123.     @animation2_id = 0
  124.     @common_event_id = 0
  125.     # 未行动的战斗者移动到序列的头部
  126.     @active_battler = @action_battlers.shift
  127.     # 如果已经在战斗之外的情况下
  128.     if @active_battler.index == nil
  129.       return
  130.     end
  131.     # 连续伤害
  132.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  133.       @active_battler.slip_damage_effect
  134.       @active_battler.damage_pop = true
  135.     end
  136.         # 自然解除状态
  137.     @active_battler.remove_states_auto
  138.     # 刷新状态窗口
  139.     @status_window.refresh
  140.     # 移至步骤 2
  141.     @phase4_step = 2
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  145.   #--------------------------------------------------------------------------
  146.   def update_phase4_step2
  147.     # 如果不是强制行动
  148.     unless @active_battler.current_action.forcing
  149.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  150.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  151.         # 设置行动为攻击
  152.         @active_battler.current_action.kind = 0
  153.         @active_battler.current_action.basic = 0
  154.       end
  155.       # 限制为 [不能行动] 的情况下
  156.       if @active_battler.restriction == 4
  157.         # 清除行动强制对像的战斗者
  158.         $game_temp.forcing_battler = nil
  159.         # 移至步骤 1
  160.         @phase4_step = 1
  161.         return
  162.       end
  163.     end
  164.     # 清除对像战斗者
  165.     @target_battlers = []
  166.     # 行动种类分支
  167.     case @active_battler.current_action.kind
  168.     when 0  # 基本
  169.       make_basic_action_result
  170.     when 1  # 特技
  171.       make_skill_action_result
  172.     when 2  # 物品
  173.       make_item_action_result
  174.     end
  175.     # 移至步骤 3
  176.     if @phase4_step == 2
  177.       @phase4_step = 3
  178.     end
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 生成基本行动结果
  182.   #--------------------------------------------------------------------------
  183.   def make_basic_action_result
  184.     # 攻击的情况下
  185.     if @active_battler.current_action.basic == 0
  186.       # 设置攻击 ID
  187.       @animation1_id = @active_battler.animation1_id
  188.       @animation2_id = @active_battler.animation2_id
  189.       # 行动方的战斗者是敌人的情况下
  190.       if @active_battler.is_a?(Game_Enemy)
  191.         if @active_battler.restriction == 3
  192.           target = $game_troop.random_target_enemy
  193.         elsif @active_battler.restriction == 2
  194.           target = $game_party.random_target_actor
  195.         else
  196.           index = @active_battler.current_action.target_index
  197.           target = $game_party.smooth_target_actor(index)
  198.         end
  199.       end
  200.       # 行动方的战斗者是角色的情况下
  201.       if @active_battler.is_a?(Game_Actor)
  202.         if @active_battler.restriction == 3
  203.           target = $game_party.random_target_actor
  204.         elsif @active_battler.restriction == 2
  205.           target = $game_troop.random_target_enemy
  206.         else
  207.           index = @active_battler.current_action.target_index
  208.           target = $game_troop.smooth_target_enemy(index)
  209.         end
  210.       end
  211.       # 设置对像方的战斗者序列
  212.       @target_battlers = [target]
  213.       # 应用通常攻击效果
  214.       for target in @target_battlers
  215.         target.attack_effect(@active_battler)
  216.       end
  217.       return
  218.     end
  219.     # 防御的情况下
  220.     if @active_battler.current_action.basic == 1
  221.       # 帮助窗口显示"防御"
  222.       @help_window.set_text($data_system.words.guard, 1)
  223.       return
  224.     end
  225.     # 逃跑的情况下
  226.     if @active_battler.is_a?(Game_Enemy) and
  227.        @active_battler.current_action.basic == 2
  228.       #  帮助窗口显示"逃跑"
  229.       @help_window.set_text("逃跑", 1)
  230.       # 逃跑
  231.       @active_battler.escape
  232.       return
  233.     end
  234.     # 什么也不做的情况下
  235.     if @active_battler.current_action.basic == 3
  236.       # 清除强制行动对像的战斗者
  237.       $game_temp.forcing_battler = nil
  238.       # 移至步骤 1
  239.       @phase4_step = 1
  240.       return
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 设置物品或特技对像方的战斗者
  245.   #     scope : 特技或者是物品的范围
  246.   #--------------------------------------------------------------------------
  247.   def set_target_battlers(scope)
  248.     # 行动方的战斗者是敌人的情况下
  249.     if @active_battler.is_a?(Game_Enemy)
  250.       # 效果范围分支
  251.       case scope
  252.       when 1  # 敌单体
  253.         index = @active_battler.current_action.target_index
  254.         @target_battlers.push($game_party.smooth_target_actor(index))
  255.       when 2  # 敌全体
  256.         for actor in $game_party.actors
  257.           if actor.exist?
  258.             @target_battlers.push(actor)
  259.           end
  260.         end
  261.       when 3  # 我方单体
  262.         index = @active_battler.current_action.target_index
  263.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  264.       when 4  # 我方全体
  265.         for enemy in $game_troop.enemies
  266.           if enemy.exist?
  267.             @target_battlers.push(enemy)
  268.           end
  269.         end
  270.       when 5  # 我方单体 (HP 0)
  271.         index = @active_battler.current_action.target_index
  272.         enemy = $game_troop.enemies[index]
  273.         if enemy != nil and enemy.hp0?
  274.           @target_battlers.push(enemy)
  275.         end
  276.       when 6  # 我方全体 (HP 0)
  277.         for enemy in $game_troop.enemies
  278.           if enemy != nil and enemy.hp0?
  279.             @target_battlers.push(enemy)
  280.           end
  281.         end
  282.       when 7  # 使用者
  283.         @target_battlers.push(@active_battler)
  284.       end
  285.     end
  286.     # 行动方的战斗者是角色的情况下
  287.     if @active_battler.is_a?(Game_Actor)
  288.       # 效果范围分支
  289.       case scope
  290.       when 1  # 敌单体
  291.         index = @active_battler.current_action.target_index
  292.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  293.       when 2  # 敌全体
  294.         for enemy in $game_troop.enemies
  295.           if enemy.exist?
  296.             @target_battlers.push(enemy)
  297.           end
  298.         end
  299.       when 3  # 我方单体
  300.         index = @active_battler.current_action.target_index
  301.         @target_battlers.push($game_party.smooth_target_actor(index))
  302.       when 4  # 我方全体
  303.         for actor in $game_party.actors
  304.           if actor.exist?
  305.             @target_battlers.push(actor)
  306.           end
  307.         end
  308.       when 5  # 我方单体 (HP 0)
  309.         index = @active_battler.current_action.target_index
  310.         actor = $game_party.actors[index]
  311.         if actor != nil and actor.hp0?
  312.           @target_battlers.push(actor)
  313.         end
  314.       when 6  # 我方全体 (HP 0)
  315.         for actor in $game_party.actors
  316.           if actor != nil and actor.hp0?
  317.             @target_battlers.push(actor)
  318.           end
  319.         end
  320.       when 7  # 使用者
  321.         @target_battlers.push(@active_battler)
  322.       end
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 生成特技行动结果
  327.   #--------------------------------------------------------------------------
  328.   def make_skill_action_result
  329.     # 获取特技
  330.     @skill = $data_skills[@active_battler.current_action.skill_id]
  331.     # 如果不是强制行动
  332.     unless @active_battler.current_action.forcing
  333.       # 因为 SP 耗尽而无法使用的情况下
  334.       unless @active_battler.skill_can_use?(@skill.id)
  335.         # 清除强制行动对像的战斗者
  336.         $game_temp.forcing_battler = nil
  337.         # 移至步骤 1
  338.         @phase4_step = 1
  339.         return
  340.       end
  341.     end
  342.     # 消耗 SP
  343.     @active_battler.sp -= @skill.sp_cost
  344.     # 刷新状态窗口
  345.     @status_window.refresh
  346.     # 在帮助窗口显示特技名
  347.     @help_window.set_text(@skill.name, 1)
  348.         #####################################################################
  349.     if @skill.id == 118
  350.       common_event = $data_common_events[71]
  351.       $game_system.battle_interpreter.setup(common_event.list, 0)
  352.     end
  353.     if @skill.id == 127
  354.       common_event = $data_common_events[72]
  355.       $game_system.battle_interpreter.setup(common_event.list, 0)
  356.     end
  357.     if @skill.id == 129
  358.       common_event = $data_common_events[74]
  359.       $game_system.battle_interpreter.setup(common_event.list, 0)
  360.     end
  361.     if @skill.id == 130
  362.       common_event = $data_common_events[73]
  363.       $game_system.battle_interpreter.setup(common_event.list, 0)
  364.     end
  365.     if @skill.id == 131
  366.       common_event = $data_common_events[75]
  367.       $game_system.battle_interpreter.setup(common_event.list, 0)
  368.     end
  369.     if @skill.id == 132
  370.       common_event = $data_common_events[76]
  371.       $game_system.battle_interpreter.setup(common_event.list, 0)
  372.     end
  373.     if @skill.id == 135
  374.       common_event = $data_common_events[77]
  375.       $game_system.battle_interpreter.setup(common_event.list, 0)
  376.     end
  377.     if @skill.id == 152
  378.       common_event = $data_common_events[78]
  379.       $game_system.battle_interpreter.setup(common_event.list, 0)
  380.     end
  381.     if @skill.id == 154
  382.       common_event = $data_common_events[79]
  383.       $game_system.battle_interpreter.setup(common_event.list, 0)
  384.     end
  385.     if @skill.id == 401
  386.       common_event = $data_common_events[45]
  387.       $game_system.battle_interpreter.setup(common_event.list, 0)
  388.     end
  389.     if @skill.id == 168
  390.       common_event = $data_common_events[80]
  391.       $game_system.battle_interpreter.setup(common_event.list, 0)
  392.     end
  393.     if @skill.id == 169
  394.       common_event = $data_common_events[81]
  395.       $game_system.battle_interpreter.setup(common_event.list, 0)
  396.     end
  397.     if @skill.id == 171
  398.       common_event = $data_common_events[82]
  399.       $game_system.battle_interpreter.setup(common_event.list, 0)
  400.     end
  401.     if @skill.id == 172
  402.       common_event = $data_common_events[83]
  403.       $game_system.battle_interpreter.setup(common_event.list, 0)
  404.     end
  405.     if @skill.id == 176
  406.       common_event = $data_common_events[84]
  407.       $game_system.battle_interpreter.setup(common_event.list, 0)
  408.     end
  409.         if @skill.id == 189
  410.       common_event = $data_common_events[85]
  411.       $game_system.battle_interpreter.setup(common_event.list, 0)
  412.     end
  413.         if @skill.id == 190
  414.       common_event = $data_common_events[86]
  415.       $game_system.battle_interpreter.setup(common_event.list, 0)
  416.     end
  417.             if @skill.id == 192
  418.       common_event = $data_common_events[87]
  419.       $game_system.battle_interpreter.setup(common_event.list, 0)
  420.     end
  421.                 if @skill.id == 194
  422.       common_event = $data_common_events[88]
  423.       $game_system.battle_interpreter.setup(common_event.list, 0)
  424.     end
  425.     if @skill.id == 330
  426.       common_event = $data_common_events[89]
  427.       $game_system.battle_interpreter.setup(common_event.list, 0)
  428.     end
  429.         if @skill.id == 332
  430.       common_event = $data_common_events[90]
  431.       $game_system.battle_interpreter.setup(common_event.list, 0)
  432.     end
  433.             if @skill.id == 333
  434.       common_event = $data_common_events[91]
  435.       $game_system.battle_interpreter.setup(common_event.list, 0)
  436.     end
  437.                 if @skill.id == 334
  438.       common_event = $data_common_events[89]
  439.       $game_system.battle_interpreter.setup(common_event.list, 0)
  440.     end
  441.                     if @skill.id == 210
  442.       common_event = $data_common_events[92]
  443.       $game_system.battle_interpreter.setup(common_event.list, 0)
  444.     end
  445.                         if @skill.id == 211
  446.       common_event = $data_common_events[92]
  447.       $game_system.battle_interpreter.setup(common_event.list, 0)
  448.     end
  449.                             if @skill.id == 212
  450.       common_event = $data_common_events[92]
  451.       $game_system.battle_interpreter.setup(common_event.list, 0)
  452.     end
  453.                                 if @skill.id == 851
  454.       common_event = $data_common_events[93]
  455.       $game_system.battle_interpreter.setup(common_event.list, 0)
  456.     end
  457.                                     if @skill.id == 852
  458.       common_event = $data_common_events[93]
  459.       $game_system.battle_interpreter.setup(common_event.list, 0)
  460.     end
  461.                                     if @skill.id == 853
  462.       common_event = $data_common_events[93]
  463.       $game_system.battle_interpreter.setup(common_event.list, 0)
  464.     end
  465.                                     if @skill.id == 854
  466.       common_event = $data_common_events[93]
  467.       $game_system.battle_interpreter.setup(common_event.list, 0)
  468.     end
  469.                                     if @skill.id == 855
  470.       common_event = $data_common_events[93]
  471.       $game_system.battle_interpreter.setup(common_event.list, 0)
  472.     end
  473.                                         if @skill.id == 850
  474.       common_event = $data_common_events[93]
  475.       $game_system.battle_interpreter.setup(common_event.list, 0)
  476.     end
  477.                                             if @skill.id == 871
  478.       common_event = $data_common_events[93]
  479.       $game_system.battle_interpreter.setup(common_event.list, 0)
  480.     end
  481.                                             if @skill.id == 872
  482.       common_event = $data_common_events[93]
  483.       $game_system.battle_interpreter.setup(common_event.list, 0)
  484.     end
  485.                                             if @skill.id == 873
  486.       common_event = $data_common_events[93]
  487.       $game_system.battle_interpreter.setup(common_event.list, 0)
  488.     end
  489.                                             if @skill.id == 874
  490.       common_event = $data_common_events[93]
  491.       $game_system.battle_interpreter.setup(common_event.list, 0)
  492.     end
  493.                                             if @skill.id == 875
  494.       common_event = $data_common_events[93]
  495.       $game_system.battle_interpreter.setup(common_event.list, 0)
  496.     end
  497.                                                 if @skill.id == 876
  498.       common_event = $data_common_events[93]
  499.       $game_system.battle_interpreter.setup(common_event.list, 0)
  500.     end
  501.                                                 if @skill.id == 877
  502.       common_event = $data_common_events[93]
  503.       $game_system.battle_interpreter.setup(common_event.list, 0)
  504.     end
  505.                                                 if @skill.id == 878
  506.       common_event = $data_common_events[93]
  507.       $game_system.battle_interpreter.setup(common_event.list, 0)
  508.     end
  509.                                                 if @skill.id == 879
  510.       common_event = $data_common_events[93]
  511.       $game_system.battle_interpreter.setup(common_event.list, 0)
  512.     end
  513.                                                 if @skill.id == 880
  514.       common_event = $data_common_events[93]
  515.       $game_system.battle_interpreter.setup(common_event.list, 0)
  516.       end
  517.                                                       if @skill.id == 508
  518.       common_event = $data_common_events[94]
  519.       $game_system.battle_interpreter.setup(common_event.list, 0)
  520.     end
  521.                                                           if @skill.id == 510
  522.       common_event = $data_common_events[94]
  523.       $game_system.battle_interpreter.setup(common_event.list, 0)
  524.     end
  525.                                                           if @skill.id == 509
  526.       common_event = $data_common_events[95]
  527.       $game_system.battle_interpreter.setup(common_event.list, 0)
  528.     end
  529.                                                               if @skill.id == 360
  530.       common_event = $data_common_events[96]
  531.       $game_system.battle_interpreter.setup(common_event.list, 0)
  532.     end
  533.                 if @skill.id == 361
  534.       common_event = $data_common_events[96]
  535.       $game_system.battle_interpreter.setup(common_event.list, 0)
  536.     end
  537.                     if @skill.id == 362
  538.       common_event = $data_common_events[97]
  539.       $game_system.battle_interpreter.setup(common_event.list, 0)
  540.     end
  541.                         if @skill.id == 382
  542.       common_event = $data_common_events[98]
  543.       $game_system.battle_interpreter.setup(common_event.list, 0)
  544.     end
  545.                             if @skill.id == 384
  546.       common_event = $data_common_events[98]
  547.       $game_system.battle_interpreter.setup(common_event.list, 0)
  548.     end
  549.                             if @skill.id == 385
  550.       common_event = $data_common_events[98]
  551.       $game_system.battle_interpreter.setup(common_event.list, 0)
  552.     end
  553.                             if @skill.id == 386
  554.       common_event = $data_common_events[98]
  555.       $game_system.battle_interpreter.setup(common_event.list, 0)
  556.     end
  557.                             if @skill.id == 388
  558.       common_event = $data_common_events[99]
  559.       $game_system.battle_interpreter.setup(common_event.list, 0)
  560.     end
  561.                                 if @skill.id == 1515
  562.       common_event = $data_common_events[100]
  563.       $game_system.battle_interpreter.setup(common_event.list, 0)
  564.     end
  565.                                     if @skill.id == 1516
  566.       common_event = $data_common_events[101]
  567.       $game_system.battle_interpreter.setup(common_event.list, 0)
  568.     end
  569.                                         if @skill.id == 1521
  570.       common_event = $data_common_events[102]
  571.       $game_system.battle_interpreter.setup(common_event.list, 0)
  572.     end
  573.                                           if @skill.id == 1522
  574.       common_event = $data_common_events[102]
  575.       $game_system.battle_interpreter.setup(common_event.list, 0)
  576.     end
  577.                                           if @skill.id == 1526
  578.       common_event = $data_common_events[102]
  579.       $game_system.battle_interpreter.setup(common_event.list, 0)
  580.     end
  581.                                           if @skill.id == 1530
  582.       common_event = $data_common_events[102]
  583.       $game_system.battle_interpreter.setup(common_event.list, 0)
  584.     end
  585.                                               if @skill.id == 1547
  586.       common_event = $data_common_events[103]
  587.       $game_system.battle_interpreter.setup(common_event.list, 0)
  588.     end
  589.                                                   if @skill.id == 1549
  590.       common_event = $data_common_events[104]
  591.       $game_system.battle_interpreter.setup(common_event.list, 0)
  592.     end
  593.                                                       if @skill.id == 1550
  594.       common_event = $data_common_events[106]
  595.       $game_system.battle_interpreter.setup(common_event.list, 0)
  596.     end
  597.                                                           if @skill.id == 1553
  598.       common_event = $data_common_events[105]
  599.       $game_system.battle_interpreter.setup(common_event.list, 0)
  600.     end
  601.                                    if @skill.id == 1554
  602.       common_event = $data_common_events[105]
  603.       $game_system.battle_interpreter.setup(common_event.list, 0)
  604.     end
  605.     ########
  606.     ##############################################################
  607.     # 设置动画 ID
  608.     @animation1_id = @skill.animation1_id
  609.     @animation2_id = @skill.animation2_id
  610.     # 设置公共事件 ID
  611.     @common_event_id = @skill.common_event_id
  612.     # 设置对像侧战斗者
  613.     set_target_battlers(@skill.scope)
  614.     # 应用特技效果
  615.     for target in @target_battlers
  616.       target.skill_effect(@active_battler, @skill)
  617.     end
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 生成物品行动结果
  621.   #--------------------------------------------------------------------------
  622.   def make_item_action_result
  623.     # 获取物品
  624.     @item = $data_items[@active_battler.current_action.item_id]
  625.     # 因为物品耗尽而无法使用的情况下
  626.     unless $game_party.item_can_use?(@item.id)
  627.       # 移至步骤 1
  628.       @phase4_step = 1
  629.       return
  630.     end
  631.     # 消耗品的情况下
  632.     if @item.consumable
  633.       # 使用的物品减 1
  634.       $game_party.lose_item(@item.id, 1)
  635.     end
  636.     # 在帮助窗口显示物品名
  637.     @help_window.set_text(@item.name, 1)
  638.     # 设置动画 ID
  639.     @animation1_id = @item.animation1_id
  640.     @animation2_id = @item.animation2_id
  641.     # 设置公共事件 ID
  642.     @common_event_id = @item.common_event_id
  643.     # 确定对像
  644.     index = @active_battler.current_action.target_index
  645.     target = $game_party.smooth_target_actor(index)
  646.     # 设置对像侧战斗者
  647.     set_target_battlers(@item.scope)
  648.     # 应用物品效果
  649.     for target in @target_battlers
  650.       target.item_effect(@item)
  651.     end
  652.   end
  653. #--------------------------------------------------------------------------
  654.    # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  655.    #--------------------------------------------------------------------------
  656.    def update_phase4_step3
  657.      # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  658.      if @animation1_id == 0
  659.        @active_battler.white_flash = true
  660.      else
  661.        @active_battler.animation_id = @animation1_id
  662.        @active_battler.animation_hit = true
  663.      end
  664.      # 对像方动画
  665.      for target in @target_battlers
  666.        target.animation_id = @animation2_id
  667.        target.animation_hit = (target.damage != "Miss")
  668.      end
  669.      # 移至步骤 4
  670.      @phase4_step = 4
  671.    end
  672.    #--------------------------------------------------------------------------
  673.    # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  674.    #--------------------------------------------------------------------------
  675.    def update_phase4_step4
  676.      # 限制动画长度、最低 8 帧
  677.      @wait_count = 8
  678.      # 移至步骤 5
  679.      @phase4_step = 5
  680.    end

  681.   #--------------------------------------------------------------------------
  682.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  683.   #--------------------------------------------------------------------------
  684.   def update_phase4_step5
  685.     # 隐藏帮助窗口
  686.     @help_window.visible = false
  687.     # 刷新状态窗口
  688.     @status_window.refresh
  689.     # 显示伤害
  690.     for target in @target_battlers
  691.       if target.damage != nil
  692.         target.damage_pop = true
  693.       end
  694.     end
  695.     # 移至步骤 6
  696.     @phase4_step = 6
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  700.   #--------------------------------------------------------------------------
  701.   def update_phase4_step6
  702.     # 清除强制行动对像的战斗者
  703.     $game_temp.forcing_battler = nil
  704.         # 公共事件 ID 有效的情况下
  705.     if @common_event_id > 0
  706.       # 设置事件
  707.       common_event = $data_common_events[@common_event_id]
  708.       $game_system.battle_interpreter.setup(common_event.list, 0)
  709.     end
  710.     $game_variables[581] = 0
  711.     $game_variables[582] = 0
  712.     $game_variables[583] = $scene.active_battler.atk
  713.     $game_variables[584] = $scene.active_battler.str
  714.     $game_variables[585] = $scene.active_battler.dex
  715.     $game_variables[586] = $scene.active_battler.int
  716.     if $scene.target_battlers[0] == nil
  717.       $game_variables[587] = 0
  718.       $game_variables[588] = 0
  719.     else
  720.       $game_variables[587] = $scene.target_battlers[0].pdef
  721.       $game_variables[588] = $scene.target_battlers[0].mdef
  722.     end
  723.     # 移至步骤 1
  724.     @phase4_step = 1
  725.   end
  726. end
复制代码



CP战斗2
  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. class XRXS65A
  7.   #--------------------------------------------------------------------------
  8.   # 「アイコン設定」
  9.   #--------------------------------------------------------------------------
  10.   DEFAULT = "046-Skill03" # ディフォルトアイコン
  11.   # アイコンハッシュ  記述方式 : アクターID=>アイコン名
  12.   ICONS = {
  13.     1=>"1号集气",
  14.     2=>"2号集气",
  15.     3=>"3号集气",
  16.     10=>"1号集气",
  17.     13=>"2号集气"
  18.   }
  19.   # アイコンハッシュE  記述方式 : エネミーID=>アイコン名
  20.   ICONE = {
  21.     1=>"046-Skill03",
  22.     2=>"046-Skill03",
  23.   }
  24.   #--------------------------------------------------------------------------
  25.   # 「シンセ・ゲージ」
  26.   #--------------------------------------------------------------------------
  27.   SKIN = "123"  # スキン
  28.   X    =  1         # X 座標
  29.   Y    =  67         # Y 座標
  30. end
  31. #==============================================================================
  32. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  33. #==============================================================================
  34. class CP_Meters
  35.   #--------------------------------------------------------------------------
  36.   # ○ オブジェクト初期化
  37.   #--------------------------------------------------------------------------
  38.   def initialize
  39.     # シンセゲージの生成
  40.     @base = Sprite.new
  41.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  42.     @base.x = XRXS65A::X
  43.     @base.y = XRXS65A::Y
  44.     @base.z = XRXS65A::X
  45.     @width  = @base.bitmap.width
  46.     @height = @base.bitmap.height
  47.     @icon_set = []
  48.     refresh
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ○ リフレッシュ
  52.   #--------------------------------------------------------------------------
  53.   def refresh
  54.     # 生成すべきバトラーの取得
  55.     need_initializes = []
  56.     for battler in $game_party.actors + $game_troop.enemies
  57.       exist = false
  58.       for set in @icon_set
  59.         exist |= (set[1] == battler)
  60.       end
  61.       need_initializes.push(battler) unless exist
  62.     end
  63.     for battler in need_initializes
  64.       iconname = nil
  65.       if battler.is_a?(Game_Actor)
  66.         iconname = XRXS65A::ICONS[battler.id]
  67.       else
  68.         iconname = XRXS65A::ICONE[battler.id]
  69.       end
  70.       if iconname == nil
  71.         iconname = XRXS65A::DEFAULT
  72.       end
  73.       sprite = Sprite.new
  74.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  75.       sprite.y = XRXS65A::Y + @height / 2 - 12
  76.       @icon_set.push([sprite, battler])
  77.     end
  78.     # 更新
  79.     for set in @icon_set
  80.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  81.       set[0].z = set[0].x
  82.       set[0].visible = false if set[1].dead? or !set[1].exist?
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ○ 可視状態
  87.   #--------------------------------------------------------------------------
  88.   def visible=(b)
  89.     @base.visible = b
  90.     @icon_set.each{|set| set[0].visible = b }
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ 解放
  94.   #--------------------------------------------------------------------------
  95.   def dispose
  96.     @base.dispose
  97.     @icon_set.each{|set| set[0].dispose }
  98.   end
  99. end

复制代码

评分

参与人数 1赞 +1 收起 理由
21世纪游戏吧 + 1 塞糖

查看全部评分

梦石
0
星屑
42345
在线时间
6022 小时
注册时间
2006-11-10
回帖
6975
发表于 2018-4-25 15:44:12 | 显示全部楼层
那就在限制不能行动 return之前清除一次状态呗

# 限制为 [不能行动] 的情况下
      if @active_battler.restriction == 4
        # 清除行动强制对像的战斗者
        $game_temp.forcing_battler = nil
       这里也塞一句状态自然解除
        # 移至步骤 1
        @phase4_step = 1
        return
      end

评分

参与人数 3星屑 +50 赞 +2 收起 理由
21世纪游戏吧 + 1 塞糖
guoxiaomi + 50 认可答案
CR~ + 1 认可答案

查看全部评分

回复 1 0

使用道具 举报

梦石
0
星屑
1328
在线时间
354 小时
注册时间
2009-9-14
回帖
211
 楼主| 发表于 2018-4-25 16:13:55 | 显示全部楼层
灯笼菜刀王 发表于 2018-4-25 15:44
那就在限制不能行动 return之前清除一次状态呗

# 限制为 [不能行动] 的情况下

谢谢大神
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部