设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2245|回复: 4

[已经解决] 空手下出错,没装备出错

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1598
在线时间
530 小时
注册时间
2017-10-13
帖子
52
发表于 2017-11-27 14:15:51 | 显示全部楼层 |阅读模式
30星屑
  1. <div class="blockcode"><blockquote>#==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================
  6. Xianfengstate = 50

  7.   #--------------------------------------------------------------------------
  8.   # ● 去后缀处理
  9.   #--------------------------------------------------------------------------
  10. class Window_Base < Window
  11.   def draw_item_name(item, x, y)
  12.     if item == nil
  13.       return
  14.     end
  15.     bitmap = RPG::Cache.icon(item.icon_name)
  16.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  17.     self.contents.font.color = normal_color
  18.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0])
  19.   end
  20. end

  21. class Game_Enemy < Game_Battler
  22.   def name
  23.     return $data_enemies[@enemy_id].name.split("@")[0]
  24.   end
  25.   def ifQungong
  26.     ###如果要改变敌人群体攻击属性的后缀,改下面
  27.     return $data_enemies[@enemy_id].name.split("@")[1] == "群攻"
  28.   end
  29.     def ifXianfeng
  30.     ###如果要改变敌人群体攻击属性的后缀,改下面
  31.     return $data_enemies[@enemy_id].name.split("@")[2] == "仙风"
  32.   end
  33. end
  34. class Scene_Battle
  35.   #--------------------------------------------------------------------------
  36.   # ● 开始主回合
  37.   #--------------------------------------------------------------------------
  38.   def start_phase4  
  39.     # 转移到回合 4
  40.     $game_variables[22] = 0
  41.     $game_variables[33] = 0#策略清零
  42.     $game_variables[34] = 0
  43.     $game_variables[35] = 0
  44.     $game_variables[36] = 0
  45.     $game_variables[37] = 0
  46.     $game_variables[21] = 0
  47.     $game_switches[30] = true#連擊數
  48.     @phase = 4
  49.     # 回合数计数
  50.     $game_temp.battle_turn += 1
  51.     $game_variables[173]+= 1
  52.     # 搜索全页的战斗事件
  53.     for index in 0...$data_troops[@troop_id].pages.size
  54.       # 获取事件页
  55.       page = $data_troops[@troop_id].pages[index]
  56.       # 本页的范围是 [回合] 的情况下
  57.       if page.span == 1
  58.         # 设置已经执行标志
  59.         $game_temp.battle_event_flags[index] = false
  60.       end
  61.     end
  62.     # 设置角色为非选择状态
  63.     @actor_index = -1
  64.     @active_battler = nil
  65.     # 有效化同伴指令窗口
  66.     @party_command_window.active = false
  67.     @party_command_window.visible = false
  68.     # 无效化角色指令窗口
  69.     @actor_command_window.active = false
  70.     @actor_command_window.visible = false
  71.     # 设置主回合标志
  72.     $game_temp.battle_main_phase = true
  73.     # 生成敌人行动
  74.     for enemy in $game_troop.enemies
  75.       enemy.make_action
  76.     end
  77.     # 生成行动顺序
  78.     make_action_orders
  79.     # 移动到步骤 1
  80.     @phase4_step = 1
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 生成行动循序
  84.   #--------------------------------------------------------------------------
  85.   def make_action_orders
  86.     # 初始化序列 @action_battlers
  87.     @action_battlers = []
  88.     # 添加敌人到 @action_battlers 序列
  89.     for enemy in $game_troop.enemies
  90.       @action_battlers.push(enemy)
  91.       if enemy.ifXianfeng
  92.         @action_battlers.push(enemy)
  93.       end
  94.     end
  95.     # 添加角色到 @action_battlers 序列
  96.     for actor in $game_party.actors
  97.       @action_battlers.push(actor)
  98.       if (actor.current_action.basic == 0 and actor.restriction == 0 and  $data_weapons[actor.weapon_id].name.split("@")[2] == "仙风")
  99.       @action_battlers.push(actor)
  100.      else
  101.      if actor.state?(Xianfengstate)
  102.        @action_battlers.push(actor)
  103.      end
  104.      end
  105.   end
  106.   

  107.     # 确定全体的行动速度
  108.     for battler in @action_battlers
  109.       battler.make_action_speed
  110.     end
  111.     # 按照行动速度从大到小排列
  112.     @action_battlers.sort! {|a,b|
  113.       b.current_action.speed - a.current_action.speed }
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 刷新画面 (主回合)
  117.   #--------------------------------------------------------------------------
  118.   def update_phase4
  119.     case @phase4_step
  120.     when 1
  121.       update_phase4_step1
  122.     when 2
  123.       update_phase4_step2
  124.     when 3
  125.       update_phase4_step3
  126.     when 4
  127.       update_phase4_step4
  128.     when 5
  129.       update_phase4_step5
  130.     when 6
  131.       update_phase4_step6
  132.     end
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  136.   #--------------------------------------------------------------------------
  137.   def update_phase4_step1
  138.     # 隐藏帮助窗口
  139.     @help_window.visible = false
  140.     # 判定胜败
  141.     if judge
  142.       # 胜利或者失败的情况下 : 过程结束
  143.       return
  144.     end
  145.     # 强制行动的战斗者不存在的情况下
  146.     if $game_temp.forcing_battler == nil
  147.       # 设置战斗事件
  148.       setup_battle_event
  149.       # 执行战斗事件中的情况下
  150.       if $game_system.battle_interpreter.running?
  151.         return
  152.       end
  153.     end
  154.     # 强制行动的战斗者存在的情况下
  155.     if $game_temp.forcing_battler != nil
  156.       # 在头部添加后移动
  157.       @action_battlers.delete($game_temp.forcing_battler)
  158.       @action_battlers.unshift($game_temp.forcing_battler)
  159.     end
  160.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  161.     if @action_battlers.size == 0
  162.     # 开始同伴命令回合
  163.     if $game_variables[402] > 0
  164.       $game_variables[402] -= 1
  165.     end  
  166.     if $game_variables[402] == 0
  167.      if $game_variables[401] == 0
  168.        $game_variables[401] = rand(20)
  169.      end
  170.      if $game_variables[401] == 1
  171.        $game_variables[401] = rand(10)+10
  172.      end
  173.      if $game_variables[401] == 2
  174.        $game_variables[401] = rand(20)
  175.      end
  176.      if $game_variables[401] == 3
  177.        $game_variables[401] = rand(10)+10
  178.      end     
  179.      if $game_variables[401] <= 10
  180.         $game_variables[401] = 0
  181.      end
  182.      if $game_variables[401] > 10 and $game_variables[151] <= 13
  183.         $game_variables[401] = 1
  184.      end
  185.      if $game_variables[401] > 13 and $game_variables[151] <= 17
  186.         $game_variables[401] = 2
  187.      end
  188.      if $game_variables[401] > 17 and $game_variables[151] <= 20
  189.         $game_variables[401] = 3
  190.      end
  191.      $game_screen.weather($game_variables[401], 9, 1)
  192.       start_phase2
  193.       return
  194.      end
  195.     end
  196.     # 初始化动画 ID 和公共事件 ID
  197.     @animation1_id = 0
  198.     @animation2_id = 0
  199.     @common_event_id = 0
  200.     # 未行动的战斗者移动到序列的头部
  201.     @active_battler = @action_battlers.shift
  202.     # 如果已经在战斗之外的情况下
  203.     if @active_battler.index == nil
  204.       return
  205.     end         
  206.     # 连续伤害
  207.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  208.       @active_battler.slip_damage_effect
  209.       if $game_switches[35] == false and $game_variables[4] != 0
  210.        @active_battler.damage_pop = true
  211.       end
  212.     end
  213.     # 自然解除状态
  214.     if  @active_battler.state?(2) or @active_battler.state?(4) or
  215.         @active_battler.state?(19) or @active_battler.state?(20) or
  216.         @active_battler.state?(21) or @active_battler.state?(22)
  217.       @active_battler.remove_states_auto
  218.     end
  219.     if $game_switches[35] == false and $game_switches[47] == true
  220.         $game_switches[42] = true
  221.         if $game_variables[60] == 2
  222.           @help_window.set_text2(@active_battler.name + "擺脫了疑心計","","",1)  
  223.           @wait_count = 30
  224.         end
  225.         if $game_variables[60] == 4
  226.           @help_window.set_text2(@active_battler.name + "擺脫了混亂計","","",1)  
  227.           @wait_count = 30
  228.         end        
  229.         $game_switches[47] = false
  230.         $game_variables[60] = 0
  231.       end
  232.    
  233.    
  234.     # 刷新状态窗口
  235.     @status_window.refresh
  236.     # 移至步骤 2
  237.     @phase4_step = 2
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  241.   #--------------------------------------------------------------------------
  242.   def update_phase4_step2
  243.     # 如果不是强制行动
  244.     unless @active_battler.current_action.forcing
  245.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  246.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  247.         # 设置行动为攻击
  248.         @active_battler.current_action.kind = 0
  249.         @active_battler.current_action.basic = 0
  250.       end
  251.       # 限制为 [不能行动] 的情况下
  252.       if @active_battler.restriction == 4
  253.         # 清除行动强制对像的战斗者
  254.         $game_temp.forcing_battler = nil
  255.         # 移至步骤 1
  256.         @phase4_step = 1
  257.         return
  258.       end
  259.     end
  260.     # 清除对像战斗者
  261.     @target_battlers = []
  262.     # 行动种类分支
  263.     case @active_battler.current_action.kind
  264.     when 0  # 基本
  265.       make_basic_action_result
  266.     when 1  # 特技
  267.       make_skill_action_result
  268.     when 2  # 物品
  269.       make_item_action_result
  270.     end
  271.     # 移至步骤 3
  272.     if @phase4_step == 2
  273.       @phase4_step = 3
  274.     end
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● 生成基本行动结果
  278.   #--------------------------------------------------------------------------
  279.   def make_basic_action_result
  280.     # 攻击的情况下
  281.     if @active_battler.current_action.basic == 0
  282.       
  283.       # 设置攻击 ID
  284.       @animation1_id = @active_battler.animation1_id
  285.       @animation2_id = @active_battler.animation2_id     
  286.       
  287.       #雷暴
  288.       leiyu = 0  
  289.       
  290.       if @active_battler.element_rate(13) == 50 #追风呼雷豹
  291.         leiyu += 30
  292.       end
  293.       if @active_battler.element_rate(41) == 50
  294.         leiyu += 7
  295.       end
  296.       if @active_battler.element_rate(42) == 50
  297.         leiyu += 8
  298.       end
  299.       if @active_battler.element_rate(43) == 50
  300.         leiyu += 9
  301.       end
  302.       if @active_battler.element_rate(44) == 50
  303.         leiyu += 10
  304.       end     
  305.       if @active_battler.element_rate(181) == 50
  306.         leiyu += 100
  307.       end
  308.       if @active_battler.element_rate(351) == 50
  309.         leiyu += 100
  310.       end
  311.       if $game_troop.random_target_enemy.element_rate(24) == 50
  312.         leiyu -= 999
  313.       end
  314.       if $game_troop.random_target_enemy.element_rate(185) == 50
  315.         leiyu -= 999
  316.       end
  317.       if $game_troop.random_target_enemy.element_rate(122) == 50
  318.         leiyu -= 999
  319.       end
  320.       
  321.     if @active_battler.element_rate(41) < 100 and rand(100) <= 10 + leiyu
  322.       $game_variables[40] = 1      
  323.     end
  324.     if @active_battler.element_rate(42) < 100 and rand(100) <= 10 + leiyu
  325.       $game_variables[40] = 2      
  326.     end
  327.     if @active_battler.element_rate(43) < 100 and rand(100) <= 10 + leiyu
  328.       $game_variables[40] = 3      
  329.     end
  330.     if @active_battler.element_rate(44) < 100 and rand(100) <= 10 + leiyu
  331.       $game_variables[40] = 4      
  332.     end
  333.     if @active_battler.element_rate(201) < 100 and rand(100) <= 30
  334.       $game_variables[40] = 5
  335.     end
  336.     if @active_battler.element_rate(201) < 100 and rand(100) <= 30
  337.       $game_variables[40] = 6
  338.     end   
  339.       
  340.       # 行动方的战斗者是敌人的情况下
  341.       if @active_battler.is_a?(Game_Enemy)
  342.         if @active_battler.restriction == 3
  343.           target = $game_troop.random_target_enemy
  344.         elsif @active_battler.restriction == 2
  345.           target = $game_party.random_target_actor
  346.         else
  347.           #雷玉
  348.           if $game_variables[40] >= 1  
  349.             for actor in $game_party.actors
  350.               if actor.exist?
  351.                 if $game_variables[201] != 5
  352.                     $game_switches[39] = true
  353.                 end
  354.                 if $game_variables[230] != 5
  355.                     $game_switches[39] = true
  356.                 end  
  357.                 @target_battlers.push(actor)
  358.               end
  359.             end
  360.           else  
  361.             index = @active_battler.current_action.target_index
  362.             target = $game_party.smooth_target_actor(index)
  363.           end
  364.         end
  365.       end
  366.       # 行动方的战斗者是角色的情况下
  367.       if @active_battler.is_a?(Game_Actor)
  368.          if @active_battler.restriction == 3
  369.           target = $game_party.random_target_actor
  370.         elsif @active_battler.restriction == 2
  371.           target = $game_troop.random_target_enemy
  372.         else   
  373.             #雷玉
  374.             if $game_variables[40] >= 1  
  375.               for enemy in $game_troop.enemies
  376.                 if enemy.exist?
  377.                   if $game_variables[201] != 5
  378.                     $game_switches[39] = true
  379.                   end
  380.                   if $game_variables[230] != 5
  381.                     $game_switches[39] = true
  382.                   end
  383.                   @target_battlers.push(enemy)
  384.                 end
  385.               end
  386.             else
  387.               if @active_battler.element_rate(214) == 50 and rand(100) < 50
  388.                 index = rand(5)
  389.                 @target_battlers.push($game_troop.smooth_target_enemy(index))
  390.                 index = rand(5)
  391.                 @target_battlers.push($game_troop.smooth_target_enemy(index))
  392.                 index = @active_battler.current_action.target_index
  393.                 @target_battlers.push($game_troop.smooth_target_enemy(index))
  394.                else
  395.                 index = @active_battler.current_action.target_index
  396.                 target = $game_troop.smooth_target_enemy(index)
  397.               end
  398.             end
  399.         end
  400.       end
  401.       if @target_battlers == []
  402.       # 设置对像方的战斗者序列
  403.       @target_battlers = [target]
  404.        # 如果敌人有“群攻”标记
  405.       if @active_battler.is_a?(Game_Enemy)
  406.         if @active_battler.ifQungong
  407.           if @active_battler.restriction == 0
  408.             @target_battlers = []
  409.             for target in $game_party.actors
  410.               if target.exist?
  411.                 @target_battlers.push(target)
  412.               end
  413.             end
  414.           end
  415.         end
  416.       end
  417.     end
  418.      # 如果角色标有群攻或者武器含有“群攻”标记
  419.       if @active_battler.is_a?(Game_Actor)
  420.         ###如果要改变武器群体攻击属性的后缀,改下面
  421.        if $data_weapons[@active_battler.weapon_id].name.split("@")[1] == "群攻"
  422.           if @active_battler.restriction == 0
  423.             @target_battlers = []
  424.             for target in $game_troop.enemies
  425.               if target.exist?
  426.                 @target_battlers.push(target)
  427.               end
  428.             end
  429.           end
  430.         end
  431.       end

  432.    
  433.       
  434.       # 应用通常攻击效果
  435.       for target in @target_battlers
  436.         target.attack_effect(@active_battler)
  437.       end
  438.       
  439.       if @active_battler.is_a?(Game_Actor)
  440.         explus
  441.       end
  442.         text1 = "攻擊"
  443.         text7 = ""
  444.       if $game_switches[36] == true
  445.         text1 = "會心一擊"
  446.       end
  447.       
  448.       if $game_switches[37] == true
  449.         text2 = " 烈風"
  450.         text7 = "發動"
  451.       end
  452.       
  453.       if $game_switches[38] == true
  454.         text3 = " 斬擊"
  455.         text7 = "發動"
  456.       end
  457.       
  458.       if $game_switches[39] == true
  459.         text4 = " 雷暴"
  460.         text7 = "發動"
  461.       end
  462.       
  463.       if $game_switches[40] == true
  464.         text5 = " 冰霜"
  465.         text7 = "發動"
  466.       end
  467.       
  468.       if $game_switches[41] == true
  469.         text6 = " 紅蓮"
  470.         text7 = "發動"
  471.       end
  472.     if $game_switches[35] == false
  473.       $game_switches[42] = true
  474.       @help_window.set_text2(@active_battler.name + text1.to_s + text2.to_s +
  475.       text3.to_s + text4.to_s + text5.to_s + text6.to_s + text7.to_s,"","",1)      
  476.     end  
  477.    
  478.       #属性文字描述重置
  479.       $game_switches[36] = false
  480.       $game_switches[37] = false
  481.       $game_switches[38] = false
  482.       $game_switches[39] = false
  483.       $game_switches[40] = false
  484.       $game_switches[41] = false
  485.    
  486.       return
  487.     end
  488.     # 防御的情况下
  489.     if @active_battler.current_action.basic == 1      
  490.       # 帮助窗口显示"防御"
  491.       @help_window.set_text(@active_battler.name + "防禦", 1)   
  492.       Audio.se_play("Audio/SE/音效03-防御", 100, 100)
  493.       # 回復值的表示
  494.       @target_battlers.push(@active_battler)
  495.       return
  496.     end
  497.     # 逃跑的情况下
  498.     if @active_battler.is_a?(Game_Enemy) and
  499.        @active_battler.current_action.basic == 2
  500.       #  帮助窗口显示"逃跑"
  501.       #@help_window.set_text("劉備軍撤退!", 1)
  502.       # 逃跑
  503.       @active_battler.escape
  504.       return
  505.     end
  506.     # 什么也不做的情况下
  507.     if @active_battler.current_action.basic == 3
  508.       # 清除强制行动对像的战斗者
  509.       $game_temp.forcing_battler = nil
  510.       # 移至步骤 1
  511.       @phase4_step = 1
  512.       return
  513.     end
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ● 设置物品或特技对像方的战斗者
  517.   #     scope : 特技或者是物品的范围
  518.   #--------------------------------------------------------------------------
  519.   def set_target_battlers(scope)
  520.     # 行动方的战斗者是敌人的情况下
  521.     if @active_battler.is_a?(Game_Enemy)
  522.      
  523.       xushi = 0
  524.       skill_leixing = 0
  525.       
  526.       if @skill.atk_f == 1 or @skill.atk_f == 2 or @skill.atk_f == 3
  527.         skill_leixing = 1
  528.       end
  529.       #虚实
  530.       if @active_battler.element_rate(97) < 100 and skill_leixing == 1
  531.         xushi += 2
  532.       end
  533.       
  534.       if @active_battler.element_rate(98) < 100 and skill_leixing == 1
  535.         xushi += 3
  536.       end
  537.       
  538.       if @active_battler.element_rate(99) < 100 and skill_leixing == 1
  539.         xushi += 4
  540.       end
  541.       
  542.       if @active_battler.element_rate(100) < 100 and skill_leixing == 1
  543.         xushi += 5
  544.       end
  545.       if @active_battler.element_rate(262) < 100 and skill_leixing == 1
  546.         xushi += 80
  547.       end

  548.       if @active_battler.element_rate(17) < 100 and skill_leixing == 1
  549.         xushi += 100
  550.       end
  551.       
  552.       if @active_battler.element_rate(232) < 100 and skill_leixing == 1
  553.         xushi += 100
  554.       end
  555.             
  556.       if xushi > 0
  557.         xushi += 10  
  558.       end
  559.       
  560.       if rand(100) < xushi
  561.         scope = 2
  562.       end
  563.       
  564.       #黃帝內經
  565.       if @active_battler.element_rate(30) == 50 and @skill.atk_f == 4 and rand(100) <= 50
  566.         scope = 4
  567.       end
  568.       #治疗
  569.       if @active_battler.element_rate(154) == 50 and @skill.atk_f == 4 and rand(100) <= 50
  570.         scope = 4
  571.       end
  572.       

  573.       # 效果范围分支
  574.       case scope
  575.       when 1  # 敌单体
  576.         index = @active_battler.current_action.target_index
  577.         @target_battlers.push($game_party.smooth_target_actor(index))
  578.       when 2  # 敌全体
  579.         for actor in $game_party.actors
  580.           if actor.exist?
  581.             @target_battlers.push(actor)
  582.           end
  583.         end
  584.       when 3  # 我方单体
  585.         index = @active_battler.current_action.target_index
  586.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  587.       when 4  # 我方全体
  588.         for enemy in $game_troop.enemies
  589.           if enemy.exist?
  590.             @target_battlers.push(enemy)
  591.           end
  592.         end
  593.       when 5  # 我方单体 (HP 0)
  594.         index = @active_battler.current_action.target_index
  595.         enemy = $game_troop.enemies[index]
  596.         if enemy != nil and enemy.hp0?
  597.           @target_battlers.push(enemy)
  598.         end
  599.       when 6  # 我方全体 (HP 0)
  600.         for enemy in $game_troop.enemies
  601.           if enemy != nil and enemy.hp0?
  602.             @target_battlers.push(enemy)
  603.           end
  604.         end
  605.       when 7  # 使用者
  606.         @target_battlers.push(@active_battler)
  607.       end
  608.     end
  609.     # 行动方的战斗者是角色的情况下
  610.     if @active_battler.is_a?(Game_Actor)
  611.      if @active_battler.current_action.kind == 1  
  612.       xushi = 0
  613.       skill_leixing = 0
  614.       
  615.       if @skill.atk_f == 1 or @skill.atk_f == 2 or @skill.atk_f == 3
  616.         skill_leixing = 1
  617.       end
  618.       #虚实
  619.       if @active_battler.element_rate(97) < 100 and skill_leixing == 1
  620.         xushi += 2
  621.       end
  622.       
  623.       if @active_battler.element_rate(98) < 100 and skill_leixing == 1
  624.         xushi += 3
  625.       end
  626.       
  627.       if @active_battler.element_rate(99) < 100 and skill_leixing == 1
  628.         xushi += 5
  629.       end
  630.       
  631.       if @active_battler.element_rate(100) < 100 and skill_leixing == 1
  632.         xushi += 10
  633.       end
  634.       
  635.       if @active_battler.element_rate(17) < 100 and skill_leixing == 1
  636.         xushi += 100
  637.       end
  638.             
  639.       if @active_battler.element_rate(222) < 100 and skill_leixing == 1
  640.         xushi += 100
  641.       end
  642.       
  643.       if @active_battler.element_rate(232) < 100 and skill_leixing == 1
  644.         xushi += 100
  645.       end
  646.       
  647.      if @active_battler.element_rate(262) < 100 and skill_leixing == 1
  648.         xushi += 80
  649.       end
  650.       if xushi > 0
  651.         xushi += 10  
  652.       end
  653.       
  654.       if rand(100) < xushi
  655.         scope = 2
  656.       end
  657.       
  658.       # 天雷
  659.       #黃帝內經
  660.       if @active_battler.element_rate(30) == 50 and @skill.atk_f == 4 and rand(100) <= 50
  661.         scope = 4
  662.       end
  663.       #治疗
  664.       if @active_battler.element_rate(154) == 50 and @skill.atk_f == 4 and rand(100) <= 50
  665.         scope = 4
  666.       end
  667.      end

  668.       # 效果范围分支
  669.       case scope
  670.       when 1  # 敌单体
  671.         index = @active_battler.current_action.target_index
  672.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  673.       when 2  # 敌全体
  674.         for enemy in $game_troop.enemies
  675.           if enemy.exist?
  676.             @target_battlers.push(enemy)
  677.           end
  678.         end
  679.       when 3  # 我方单体
  680.         index = @active_battler.current_action.target_index
  681.         @target_battlers.push($game_party.smooth_target_actor(index))
  682.       when 4  # 我方全体
  683.         for actor in $game_party.actors
  684.           if actor.exist?
  685.             @target_battlers.push(actor)
  686.           end
  687.         end
  688.       when 5  # 我方单体 (HP 0)
  689.         index = @active_battler.current_action.target_index
  690.         actor = $game_party.actors[index]
  691.         if actor != nil and actor.hp0?
  692.           @target_battlers.push(actor)
  693.         end
  694.       when 6  # 我方全体 (HP 0)
  695.         for actor in $game_party.actors
  696.           if actor != nil and actor.hp0?
  697.             @target_battlers.push(actor)
  698.           end
  699.         end
  700.       when 7  # 使用者
  701.         @target_battlers.push(@active_battler)
  702.       end
  703.     end
  704.   end
  705.   #--------------------------------------------------------------------------
  706.   # ● 生成特技行动结果
  707.   #--------------------------------------------------------------------------
  708.   def make_skill_action_result
  709.     # 获取特技
  710.     @skill = $data_skills[@active_battler.current_action.skill_id]
  711.     # 如果不是强制行动
  712.     unless @active_battler.current_action.forcing
  713.       # 因为 SP 耗尽而无法使用的情况下
  714.       #unless @active_battler.skill_can_use?(@skill.id)
  715.         # 清除强制行动对像的战斗者
  716.         #$game_temp.forcing_battler = nil
  717.         # 移至步骤 1
  718.         #@phase4_step = 1
  719.         #return
  720.       #end
  721.     end
  722.     # 消耗 SP
  723.     #if @skill.atk_f == 6
  724.     #   @active_battler.sp = 0
  725.     #end
  726.     #if @skill.atk_f == 7
  727.     #   @active_battler.sp -= @skill.sp_cost
  728.     #end   
  729.    
  730.     # 设置动画 ID
  731.     @animation1_id = @skill.animation1_id
  732.     @animation2_id = @skill.animation2_id
  733.     # 设置公共事件 ID
  734.     @common_event_id = @skill.common_event_id
  735.     # 设置对像侧战斗者
  736.     set_target_battlers(@skill.scope)
  737.     # 应用特技效果
  738.     for target in @target_battlers
  739.       target.skill_effect(@active_battler, @skill)
  740.     end
  741.     # 刷新状态窗口
  742.     #@status_window.refresh  
  743.     # 在帮助窗口显示特技名
  744.     if $game_switches[35] == false
  745.      $game_switches[42] = true
  746.      jicewenzi = "使用"
  747.      shenmou = ""
  748.      if $game_switches[76] == true
  749.        shenmou = "  會心一擊"
  750.      end  
  751.      $game_switches[76] = false
  752.      if @skill.atk_f == 0
  753.        jicewenzi = "佈置"
  754.      end  
  755.      @help_window.set_text2(@active_battler.name + jicewenzi + @skill.name + shenmou,"","", 1)   
  756.    end
  757.    
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # ● 生成物品行动结果
  761.   #--------------------------------------------------------------------------
  762.   def make_item_action_result
  763.     # 获取物品
  764.     @item = $data_items[@active_battler.current_action.item_id]
  765.     # 因为物品耗尽而无法使用的情况下
  766.     unless $game_party.item_can_use?(@item.id)
  767.       # 移至步骤 1
  768.       @phase4_step = 1
  769.       return
  770.     end
  771.     # 消耗品的情况下
  772.     if @item.consumable
  773.       # 使用的物品减 1
  774.       if @active_battler.element_rate(113) < 100
  775.         
  776.         else
  777.          $game_party.lose_item(@item.id, 1)
  778.       end
  779.     end
  780.     # 在帮助窗口显示物品名
  781.     if $game_switches[35] == false
  782.      $game_switches[42] = true
  783.      @help_window.set_text2(@active_battler.name + "使用" + @item.name,"","", 1)
  784.     end
  785.     # 设置动画 ID
  786.     @animation1_id = @item.animation1_id
  787.     @animation2_id = @item.animation2_id
  788.     # 设置公共事件 ID
  789.     @common_event_id = @item.common_event_id
  790.     # 确定对像
  791.     index = @active_battler.current_action.target_index
  792.     target = $game_party.smooth_target_actor(index)
  793.     # 设置对像侧战斗者
  794.     set_target_battlers(@item.scope)
  795.     # 应用物品效果
  796.     for target in @target_battlers
  797.       target.item_effect(@item)
  798.     end
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  802.   #--------------------------------------------------------------------------
  803.   def update_phase4_step3
  804.     if $game_switches[35] == false
  805.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  806.      if @animation1_id == 0
  807.       @active_battler.white_flash = true
  808.      else
  809.       @active_battler.animation_id = @animation1_id
  810.       @active_battler.animation_hit = true
  811.       
  812.       if $game_variables[23] != 0
  813.          @active_battler.animation_id = $game_variables[23]
  814.       end        
  815.      end
  816.    
  817.     end
  818.     # 设置头像
  819.     if @active_battler.is_a?(Game_Actor)
  820.       @head_window_left.set_actor_head(@active_battler)
  821.     elsif @active_battler.is_a?(Game_Enemy)
  822.       @head_window_right.set_enemy_head(@active_battler)
  823.     end
  824.     # 移至步骤 4
  825.     @phase4_step = 4
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  829.   #--------------------------------------------------------------------------
  830.   def update_phase4_step4
  831.     # 对像方动画
  832.     for target in @target_battlers
  833.       target.animation_id = @animation2_id
  834.       
  835.       if $game_variables[40] >= 1
  836.          $game_variables[39] = 203
  837.       end
  838.       
  839.       if $game_variables[39] != 0
  840.         target.animation_id = $game_variables[39]
  841.       end      

  842.       
  843.       
  844.       target.animation_hit = (target.damage != "Miss")

  845.     end  
  846.     # 设置头像
  847.     if target.is_a?(Game_Actor)
  848.       @head_window_left.set_actor_head(target)
  849.     elsif target.is_a?(Game_Enemy)
  850.       @head_window_right.set_enemy_head(target)
  851.     end   

  852.     # 移至步骤 5
  853.     @phase4_step = 5
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  857.   #--------------------------------------------------------------------------
  858.   def update_phase4_step5
  859.     # 隐藏帮助窗口
  860.     @help_window.visible = false
  861.     #觉醒动画
  862.       if $game_variables[2] == 2
  863.          @active_battler.animation_id = 282
  864.          @active_battler.animation_hit = true
  865.          @active_battler.add_state(14)
  866.       end
  867.       
  868.       if $game_variables[3] == 2
  869.          for target in @target_battlers
  870.           target.animation_id = 282
  871.           target.animation_hit = true
  872.           target.add_state(14)
  873.          end
  874.       end
  875.     # 刷新状态窗口
  876.     @status_window.refresh
  877.     # 显示伤害   
  878.      for target in @target_battlers
  879.       if target.damage != nil
  880.         target.damage_pop = true        
  881.       end
  882.      end
  883.       if $game_variables[6] == 265
  884.        for target in @target_battlers
  885.           target.animation_id = 265
  886.           target.animation_hit = true
  887.           @wait_count = 8
  888.           target.hp = 9999
  889.        end
  890.     end
  891.      #文字顯示
  892.     if target != nil
  893.      if $game_switches[35] == false and target.hp == 0
  894.      @help_window.set_text2("","",@active_battler.name + "擊敗了" + target.name,1)
  895.      # 限制动画长度、最低 8 帧
  896.      @wait_count = 20
  897.      end   
  898.     end
  899.    
  900.     # 移至步骤 6
  901.     @phase4_step = 6
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  905.   #--------------------------------------------------------------------------
  906.   def update_phase4_step6
  907.     # 清除强制行动对像的战斗者
  908.    
  909.    
  910.       
  911.       $game_variables[2] = 0
  912.       $game_variables[3] = 0
  913.       $game_variables[6] = 0
  914.       $game_variables[23] = 0
  915.       $game_variables[39] = 0
  916.       $game_variables[40] = 0  
  917.       $game_switches[44] = false

  918.       
  919.     $game_temp.forcing_battler = nil
  920.     # 公共事件 ID 有效的情况下
  921.     if @common_event_id > 0
  922.       # 设置事件
  923.       common_event = $data_common_events[@common_event_id]
  924.       $game_system.battle_interpreter.setup(common_event.list, 0)
  925.     end
  926.     # 刷新状态窗口
  927.     @status_window.refresh   
  928.     #連擊判斷
  929.     #if $game_switches[30] == true and $game_switches[32] == true
  930.     if $game_variables[22] > 0
  931.       $game_variables[22] -= 1
  932.       @phase4_step = 2      
  933.       if judge
  934.       # 胜利或者失败的情况下 : 过程结束      
  935.         return
  936.       end
  937.     else
  938.           ###为二次攻击者重新设置动作
  939.     if @active_battler.is_a?(Game_Enemy)
  940.       @active_battler.make_action
  941.     end
  942.     # 移至步骤 1         
  943.       @phase4_step = 1
  944.       $game_switches[30] = true      
  945.     end  
  946.     # 自然解除状态
  947.     if  not @active_battler.state?(2) and not @active_battler.state?(4) and
  948.         not @active_battler.state?(19) and not @active_battler.state?(20) and
  949.         not @active_battler.state?(21) and not @active_battler.state?(22)
  950.          @active_battler.remove_states_auto
  951.     end     
  952.       if $game_switches[35] == false and $game_switches[47] == true
  953.         $game_switches[42] = true        
  954.         case $game_variables[60]
  955.         when 5,6,7,8,9,10,11,12,13
  956.           @help_window.set_text2(@active_battler.name + "能力恢复正常","","",1)  
  957.           @wait_count = 30
  958.         end        
  959.         if $game_variables[60] == 3
  960.           @help_window.set_text2(@active_battler.name + "擺脫了離間計","","",1)  
  961.           @wait_count = 30
  962.         end
  963.         $game_switches[47] = false
  964.         $game_variables[60] = 0
  965.       end
  966.    
  967.   end
  968. end
复制代码

添加仿仙剑群攻后。在没有装备的情况下提示[img]file:///C:\Users\Administrator\Documents\Tencent Files\545011180\Image\Group\EH3WH~0B2EA)@S))V][G0}E.png[/img] QQ图片20171127141500.png 求帮忙解决 谢谢

最佳答案

查看完整内容

这里name出问题是读取不到,读取不到多半是因为@active_battler.weapon_id的问题,p一下@active_battler.weapon_id估计得出来是nil,在这个条件分歧前面加上if @active_battler.weapon_id!=nil的判断估计就行了

Lv4.逐梦者

梦石
0
星屑
9273
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

发表于 2017-11-27 14:15:52 | 显示全部楼层
  1. if $data_weapons[@active_battler.weapon_id].name.split("@")[1] == "群攻"
复制代码
这里name出问题是读取不到,读取不到多半是因为@active_battler.weapon_id的问题,p一下@active_battler.weapon_id估计得出来是nil,在这个条件分歧前面加上if @active_battler.weapon_id!=nil的判断估计就行了
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

Lv5.捕梦者 (版主)

遠航の猫咪

梦石
3
星屑
22385
在线时间
2335 小时
注册时间
2005-10-15
帖子
1160

开拓者

发表于 2017-11-27 16:53:01 | 显示全部楼层
只是需要武器攻击全体,武器攻击多次的话……你用我刚发布的装备系统增强1.1脚本……那个没有冲突。
SailCat (小猫子·要开心一点) 共上站 24 次,发表过 11 篇文章 上 次 在: [2006年01月28日11:41:18 星期六] 从 [162.105.120.91] 到本站一游。
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1387
在线时间
184 小时
注册时间
2007-2-28
帖子
145
发表于 2017-11-27 16:55:08 | 显示全部楼层
本帖最后由 梦幻想 于 2017-11-27 17:34 编辑

应该是因为武器为空所以无法找到name
423行加个判断  if  active_battler.weapon_id !=0试试?
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1598
在线时间
530 小时
注册时间
2017-10-13
帖子
52
 楼主| 发表于 2017-11-27 17:15:05 | 显示全部楼层
SailCat 发表于 2017-11-27 16:53
只是需要武器攻击全体,武器攻击多次的话……你用我刚发布的装备系统增强1.1脚本……那个没有冲突。 ...

谢谢。我用不可取消装备的了。。
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-3-29 01:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表