查看: 2865|回复: 2

[已经解决] 多秒技能

[复制链接]
梦石
0
星屑
1025
在线时间
6 小时
注册时间
2015-6-19
回帖
0
发表于 2015-6-28 00:26:20 | 显示全部楼层 |阅读模式

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

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

×
求多秒技能的脚本
梦石
0
星屑
462
在线时间
871 小时
注册时间
2014-5-5
回帖
914
发表于 2015-6-29 12:39:30 | 显示全部楼层
  1. # ▽△▽ XRXS.付加属性名称判定 ▽△▽  built 091221
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # --- XRXS. 付加属性名称判定モジュール ---
  5. #==============================================================================
  6. module XRXS
  7.   #--------------------------------------------------------------------------
  8.   # ○ 配列が指定名の属性を持つか判定
  9.   #--------------------------------------------------------------------------
  10.   def XRXS.element_check(set, element_name)
  11.     returnar = [false, 0, 0, []] # 存在したか?, 固定値の合計、%値の合計
  12.     return returnar if !set.is_a?(Array) or set.size == 0 or element_name == ""
  13.     for i in set
  14.       if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
  15.         returnar[0] = true
  16.         if $2 == nil
  17.           returnar[1] += $1.to_i
  18.           returnar[3].push($1.to_i)
  19.         else
  20.           returnar[2] += $1.to_i
  21.         end
  22.       end
  23.     end
  24.     return returnar
  25.   end
  26.   def XRXS.element_include?(set, element_name)
  27.     return element_check(set, element_name)[0]
  28.   end
  29.   def XRXS.element_amount(set, element_name)
  30.     return element_check(set, element_name)[1]
  31.   end
  32.   def XRXS.element_percent(set, element_name)
  33.     return element_check(set, element_name)[2]
  34.   end
  35.   def XRXS.element_numbers(set, element_name)
  36.     return element_check(set, element_name)[3]
  37.   end
  38. end
复制代码
  1. # ▽△▽ XRXS. 装備属性取得機構 ▽△▽ built 221114
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # --- XRXS. 装備属性取得機構 ---
  5. #==============================================================================
  6. class Game_Battler
  7.   #--------------------------------------------------------------------------
  8.   # ○ スキルの属性取得
  9.   #--------------------------------------------------------------------------
  10.   def skill_element_set(skill)
  11.     return skill.nil? ? [] : skill.element_set
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ○ 全装備の属性取得
  15.   #--------------------------------------------------------------------------
  16.   def equip_element_set
  17.     return self.element_set + self.guard_element_set
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ○ 全防具の属性取得
  21.   #--------------------------------------------------------------------------
  22.   def guard_element_set
  23.     return []
  24.   end
  25. end
  26. class Game_Actor < Game_Battler
  27.   def guard_element_set
  28.     set = []
  29.     for id in self.armor_ids
  30.       next if id.nil?
  31.       armor = $data_armors[id]
  32.       set += (armor != nil ? armor.guard_element_set : [])
  33.     end
  34.     return set
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ○ 武器 ID配列
  38.   #--------------------------------------------------------------------------
  39.   def weapon_ids
  40.     @weapon_ids = [] if @weapon_ids == nil
  41.     @weapon_ids[0] = @weapon_id
  42.     return @weapon_ids
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ○ 防具 ID配列
  46.   #--------------------------------------------------------------------------
  47.   def armor_ids
  48.     @armor_ids = [] if @armor_ids == nil
  49.     @armor_ids[0] = @armor1_id
  50.     @armor_ids[1] = @armor2_id
  51.     @armor_ids[2] = @armor3_id
  52.     @armor_ids[3] = @armor4_id
  53.     return @armor_ids
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ 装備配列の取得
  57.   #--------------------------------------------------------------------------
  58.   def equipments
  59.     equipments = []
  60.     self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
  61.     self.armor_ids.each {|id| equipments.push($data_armors[id])}
  62.     return equipments
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ○ 装備中?
  66.   #--------------------------------------------------------------------------
  67.   def equiping?(item)
  68.     case item
  69.     when RPG::Weapon
  70.       return self.weapon_ids.include?(item.id)
  71.     when RPG::Armor
  72.       return self.armor_ids.include?(item.id)
  73.     else
  74.       return false
  75.     end   
  76.   end
  77. end
复制代码
  1. # ▼▲▼ XRXS38. 属性修正计算数限制 ▼▲▼ built 081012
  2. # by 桜雅 在土 (原作)
  3. #    Tetra-Z   (強化)
  4. #==============================================================================
  5. # 简介:此脚本会将“系统默认的属性修正”和“战斗特殊效果属性”分开计算;
  6. #       插入此脚本后,“战斗特殊效果属性”将“不计算属性有效度”。
  7. #==============================================================================
  8. # □ カスタマイズポイント
  9. #==============================================================================
  10. module XRXS38
  11.   # 属性的限制数量
  12.   ELEMENTS_NUMBER_LIMIT = 16
  13.   # 属性修正的计算方法
  14.   #        0 : 最大(默认的计算方法)
  15.   #        1 : 乘法
  16.   #        2 : 平均
  17.   #        3 : 最小
  18.   ELEMENT_CORRECT_METHOD = 1
  19. end
  20. #==============================================================================
  21. # ■ Game_Battler
  22. #==============================================================================
  23. class Game_Battler
  24. #--------------------------------------------------------------------------
  25. # ● 属性修正的计算 + 倍率计算公式
  26. #--------------------------------------------------------------------------
  27.   alias xrxs38_elements_correct elements_correct
  28.   def elements_correct(element_set)
  29.     elements = element_set.dup
  30.     # 属性数量的限制
  31.     for element_id in element_set
  32.       if element_id >XRXS38:: ELEMENTS_NUMBER_LIMIT
  33.         elements.delete(element_id)
  34.       end
  35.     end
  36.     #无属性的场合返回100
  37.     return 100 if elements.size == 0
  38.     #
  39.     case XRXS38::ELEMENT_CORRECT_METHOD
  40.     when 0 # 最大
  41.       return xrxs38_elements_correct(elements)
  42.     when 1 # 乘法
  43.       result = 100.0
  44.       minus_enable = false
  45.       for i in elements
  46.         n = self.element_rate(i)
  47.         minus_enable |= (n < 0)
  48.         result *= n / 100.0
  49.       end
  50.       result = -1 * result.abs if minus_enable
  51.       return result.to_i
  52.     when 2 # 平均
  53.       rates = []
  54.       result = 0
  55.       for i in elements
  56.         rates.push(self.element_rate(i))
  57.       end
  58.       for rate in rates
  59.         result += rate
  60.       end
  61.       return result / rates.size
  62.     when 3 # 最小
  63.       for i in elements
  64.         n = self.element_rate(i)
  65.         result = n if result.nil? or result > n
  66.       end
  67.       return result
  68.     end
  69.   end  
  70. end
复制代码
  1. #==============================================================================
  2. #[仿大话梦幻]多体攻击(俗称秒2~秒7,非全体攻击)Ver0.03b
  3. #
  4. #by SixRice = 66fan
  5. #==============================================================================
  6. #适用战斗系统:默认回合制,CP半即时;RTAB不适用
  7. #
  8. #很简单的脚本,不推荐作为外挂脚本来用。希望大家能看懂之后添加近自己的游戏中去。
  9. #
  10. #重定义部分:set_target_battlers,其余为新定义。
  11. #
  12. #上面三个XRXS的脚本不要删除,请尊重别人的版权。
  13. #
  14. #Ver0.03根据玩家的建议,追加范围变成按照对象的速度排序。
  15. #
  16. #Ver0.02新增随机范围
  17. #       修正0.01中,如果什么范围都不选,会变成全体攻击的BUG
  18. #
  19. #==============================================================================
  20. # 使用说明:
  21. #1,单体目标的情况下,以下秒几的效果为追加范围
  22. #2,全体目标的情况下,以下秒几的效果为固定范围
  23. #3,如果附加了“随机”属性,
  24. #   单体攻击追加范围变成 0 到 X,
  25. #   全体攻击固定范围变成 1 到 X,
  26. #   举例:单体攻击,追加范围“秒7”,“随机”,实际范围是 1 +(0 ~ 7)
  27. #         全体攻击,固定范围“秒8”,“随机”,实际范围是 1 ~ 8
  28. #
  29. # 如有其他特殊要求,请看懂脚本自行设置。
  30. #==============================================================================
  31. module SXR
  32. #==============================================================================
  33. #属性名(同时存在的话,取最大值;同时包括多体范围和随机范围的话,取随机范围。)
  34. #==============================================================================
  35. ADD_TARGET2 = "秒2"#1体目标,追加1体序列
  36. ADD_TARGET3 = "秒3"#1体目标,追加2体序列
  37. ADD_TARGET4 = "秒4"#1体目标,追加3体序列
  38. ADD_TARGET5 = "秒5"#1体目标,追加4体序列
  39. ADD_TARGET6 = "秒6"#1体目标,追加5体序列
  40. ADD_TARGET7 = "秒7"#1体目标,追加6体序列
  41. ADD_TARGET8 = "秒8"#1体目标,追加7体序列
  42. ARA_TARGET = "随机"#单选无效,配合上面才能产生效果,将追加改为随机追加
  43. end
  44. #==============================================================================
  45. # ■ Game_BattleAction
  46. #==============================================================================
  47. class Game_BattleAction
  48. attr_accessor :add_target
  49. attr_accessor :ara_target
  50. #------------------------------------------------------------------------------
  51. # ○ clear
  52. #------------------------------------------------------------------------------
  53.   alias sxr_clear clear
  54.   def clear
  55.     sxr_clear
  56.     clear_sxr_add_target
  57.   end
  58. #------------------------------------------------------------------------------
  59. # ○ 特殊效果clear
  60. #------------------------------------------------------------------------------
  61. def clear_sxr_add_target
  62.     self.add_target = 0
  63.     self.ara_target = 0
  64.   end  
  65. #------------------------------------------------------------------------------
  66. # ○ 无效化特殊效果
  67. #------------------------------------------------------------------------------
  68.   def nillize_sxr_add_target
  69.     self.add_target = nil
  70.     self.ara_target = nil
  71.   end
  72. end   
  73. #==============================================================================
  74. # ■ Game_Battler
  75. #==============================================================================
  76. class Game_Battler
  77. #------------------------------------------------------------------------------
  78. # ○追加目标范围设定
  79. #------------------------------------------------------------------------------
  80. def set_sxr_add_target(set)
  81. # 追加/固定目标范围强制值
  82. self.current_action.add_target =
  83. XRXS.element_include?(set, SXR::ADD_TARGET8) ? 8 :
  84. XRXS.element_include?(set, SXR::ADD_TARGET7) ? 7 :
  85. XRXS.element_include?(set, SXR::ADD_TARGET6) ? 6 :
  86. XRXS.element_include?(set, SXR::ADD_TARGET5) ? 5 :
  87. XRXS.element_include?(set, SXR::ADD_TARGET4) ? 4 :
  88. XRXS.element_include?(set, SXR::ADD_TARGET3) ? 3 :
  89. XRXS.element_include?(set, SXR::ADD_TARGET2) ? 2 :
  90. 0
  91. # 是否随机目标范围
  92. self.current_action.ara_target =
  93. XRXS.element_include?(set, SXR::ARA_TARGET) ? 1 :
  94. 0
  95. end
  96. end
  97. #==============================================================================
  98. # ■ Scene_Battle
  99. #==============================================================================
  100. class Scene_Battle
  101. #--------------------------------------------------------------------------
  102. # ● 主处理
  103. #--------------------------------------------------------------------------
  104.   alias sxr_main main
  105.   def main
  106.     # recall
  107.     sxr_main
  108.     # 清空角色的特殊效果设置
  109.     for actor in $game_party.actors
  110.       actor.current_action.clear_sxr_add_target
  111.       actor.current_action.nillize_sxr_add_target
  112.     end
  113.   end  
  114.   #--------------------------------------------------------------------------
  115.   # ● 设置物品或特技对像方的战斗者
  116.   #     scope : 特技或者是物品的范围
  117.   #--------------------------------------------------------------------------
  118.   def set_target_battlers(scope)
  119.     # 行动方的战斗者是敌人的情况下
  120.     if @active_battler.is_a?(Game_Enemy)
  121.       # 效果范围分支
  122.       case scope
  123.       when 1  # 敌单体
  124.       
  125.         for actor in $game_party.actors
  126.           if actor.exist?
  127.             @target_battlers.push(actor)
  128.           end
  129.         end
  130. index = @active_battler.current_action.target_index
  131. @target_battlers.push($game_party.smooth_target_actor(index))        
  132. @target_battlers.delete($game_party.smooth_target_actor(index))
  133. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
  134. @target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
  135. @target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
  136. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
  137. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
  138. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
  139. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
  140. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
  141. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
  142. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
  143. @target_battlers.push($game_party.smooth_target_actor(index))
  144.         
  145.       when 2  # 敌全体
  146.         for actor in $game_party.actors
  147.           if actor.exist?
  148.             @target_battlers.push(actor)
  149. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)            
  150. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  151. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  152. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  153. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  154. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  155. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  156. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  157. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  158.           end
  159.         end
  160.       when 3  # 我方单体
  161.       
  162.           for enemy in $game_troop.enemies
  163.           if enemy.exist?
  164.             @target_battlers.push(enemy)
  165.           end
  166.         end
  167. index = @active_battler.current_action.target_index
  168. @target_battlers.push($game_troop.smooth_target_enemy(index))        
  169. @target_battlers.delete($game_troop.smooth_target_enemy(index))
  170. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
  171. @target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
  172. @target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
  173. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
  174. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
  175. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
  176. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
  177. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
  178. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
  179. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
  180. @target_battlers.push($game_troop.smooth_target_enemy(index))

  181.       when 4  # 我方全体
  182.         for enemy in $game_troop.enemies
  183.           if enemy.exist?
  184.             @target_battlers.push(enemy)
  185. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)            
  186. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  187. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  188. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  189. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  190. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  191. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  192. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  193. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  194.           end
  195.         end
  196.       when 5  # 我方单体 (HP 0)
  197.         index = @active_battler.current_action.target_index
  198.         enemy = $game_troop.enemies[index]
  199.         if enemy != nil and enemy.hp0?
  200.           @target_battlers.push(enemy)
  201.         end
  202.       when 6  # 我方全体 (HP 0)
  203.         for enemy in $game_troop.enemies
  204.           if enemy != nil and enemy.hp0?
  205.             @target_battlers.push(enemy)
  206. @target_battlers.sort! {|a,b| b.agi - a.agi }  #(0.03)         
  207. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  208. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  209. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  210. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  211. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  212. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  213. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  214. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  215.           end
  216.         end
  217.       when 7  # 使用者
  218.         @target_battlers.push(@active_battler)
  219.       end
  220.     end
  221.     # 行动方的战斗者是角色的情况下
  222.     if @active_battler.is_a?(Game_Actor)      
  223. @active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
  224.       # 效果范围分支
  225.       case scope
  226.       when 1  # 敌单体
  227.         
  228.           for enemy in $game_troop.enemies
  229.           if enemy.exist?
  230.             @target_battlers.push(enemy)
  231.           end
  232.         end
  233. index = @active_battler.current_action.target_index
  234. @target_battlers.push($game_troop.smooth_target_enemy(index))        
  235. @target_battlers.delete($game_troop.smooth_target_enemy(index))
  236. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
  237. @target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
  238. @target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
  239. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
  240. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
  241. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
  242. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
  243. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
  244. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
  245. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
  246. @target_battlers.push($game_troop.smooth_target_enemy(index))

  247.       when 2  # 敌全体
  248.         for enemy in $game_troop.enemies
  249.           if enemy.exist?
  250.             @target_battlers.push(enemy)
  251. @target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)           
  252. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  253. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  254. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  255. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  256. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  257. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  258. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  259. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  260.           end
  261.         end
  262.       when 3  # 我方单体
  263.       
  264.         for actor in $game_party.actors
  265.           if actor.exist?
  266.             @target_battlers.push(actor)
  267.           end
  268.         end
  269. index = @active_battler.current_action.target_index
  270. @target_battlers.push($game_party.smooth_target_actor(index))        
  271. @target_battlers.delete($game_party.smooth_target_actor(index))
  272. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
  273. @target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
  274. @target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
  275. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
  276. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
  277. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
  278. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
  279. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
  280. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
  281. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
  282. @target_battlers.push($game_party.smooth_target_actor(index))

  283.       when 4  # 我方全体
  284.         for actor in $game_party.actors
  285.           if actor.exist?
  286.             @target_battlers.push(actor)
  287. @target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)            
  288. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  289. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  290. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  291. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  292. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  293. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  294. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  295. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  296.           end
  297.         end
  298.       when 5  # 我方单体 (HP 0)
  299.         index = @active_battler.current_action.target_index
  300.         actor = $game_party.actors[index]
  301.         if actor != nil and actor.hp0?
  302.           @target_battlers.push(actor)
  303.         end
  304.       when 6  # 我方全体 (HP 0)
  305.         for actor in $game_party.actors
  306.           if actor != nil and actor.hp0?
  307.             @target_battlers.push(actor)
  308. @target_battlers.sort! {|a,b| b.agi - a.agi }  #(0.03)         
  309. @target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
  310. @target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
  311. @target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
  312. @target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
  313. @target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
  314. @target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
  315. @target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
  316. @target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2            
  317.           end
  318.         end
  319.       when 7  # 使用者
  320.         @target_battlers.push(@active_battler)
  321.       end
  322.     end
  323.   end
  324. #--------------------------------------------------------------------------
  325. # ● 生成特技行动结果
  326. #--------------------------------------------------------------------------
  327.   alias sxr_make_skill_action_result make_skill_action_result
  328.     def make_skill_action_result
  329.     # 获取特技
  330.     @skill = $data_skills[@active_battler.current_action.skill_id]
  331.     # 获取行动者特技附加的战斗特效
  332.     @active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
  333.     # recall
  334.    sxr_make_skill_action_result
  335.   end
  336. end
复制代码
感觉有点多、、、、
4个要一起用才可以~

点评

这个多体技能还需要在数据库中设置,所以建议楼主用楼下的。  发表于 2015-7-1 23:46

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
1748
在线时间
485 小时
注册时间
2006-1-7
回帖
996
发表于 2015-7-1 23:44:18 | 显示全部楼层
本帖最后由 白鬼 于 2015-7-1 23:45 编辑

楼上手快。有一个简化的版本,一个独立脚本。在脚本中设置,不用占用数据库了
楼主可以尝试一下
多秒技能脚本多秒技能脚本


  1. class Scene_Battle
  2.   def set_target_battlers(item, type)
  3.    
  4.     @多秒_特技 = {} # 初始化多秒功能哈希
  5.     @多秒_物品 = {} # 初始化多秒功能哈希
  6.         
  7.     # ---------------------------
  8.     # 特技多秒 设置
  9.     # ---------------------------
  10.         
  11.     @多秒_特技[57] = 3 # 57号技能 秒3 默认十字斩秒三
  12.    
  13.     # ---------------------------
  14.     # 物品多秒 设置
  15.     # ---------------------------
  16.         
  17.     @多秒_物品[40] = 5 # 40号物品 秒5 设置 : 敌单体即可 HP 回复量 为负值
  18.    
  19.     # ------------------------------------------------------
  20.     # PS 如果设置了多秒 数据库 中效果范围怎么设置都可以
  21.     # 但必须明确是对敌使用还是对同伴使用,并且明确 是否
  22.     # HP 0 时使用!
  23.     # ------------------------------------------------------
  24.    
  25.     if @active_battler.is_a?(Game_Enemy)
  26.       case item.scope
  27.       when 1  # 敌单体
  28.         index = @active_battler.current_action.target_index
  29.         @target_battlers.push($game_party.smooth_target_actor(index))
  30.         敌方秒(0, item, 0, type, $game_party.smooth_target_actor(index))
  31.       when 2  # 敌全体
  32.         index = @active_battler.current_action.target_index
  33.         for actor in $game_party.actors
  34.           if actor.exist?
  35.             @target_battlers.push(actor)
  36.           end
  37.         end
  38.         敌方秒(0, item, 0, type, $game_party.smooth_target_actor(index))
  39.       when 3  # 我方单体
  40.         index = @active_battler.current_action.target_index
  41.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  42.         敌方秒(0, item, 1, type, $game_troop.smooth_target_enemy(index))
  43.       when 4  # 我方全体
  44.         index = @active_battler.current_action.target_index
  45.         for enemy in $game_troop.enemies
  46.           if enemy.exist?
  47.             @target_battlers.push(enemy)
  48.           end
  49.         end
  50.         敌方秒(0, item, 1, type, $game_troop.smooth_target_enemy(index))
  51.       when 5  # 我方单体 (HP 0)
  52.         index = @active_battler.current_action.target_index
  53.         enemy = $game_troop.enemies[index]
  54.         if enemy != nil and enemy.hp0?
  55.           @target_battlers.push(enemy)
  56.         end
  57.         敌方秒(1, item, 1, type, $game_troop.smooth_target_enemy(index))
  58.       when 6  # 我方全体 (HP 0)
  59.         index = @active_battler.current_action.target_index
  60.         for enemy in $game_troop.enemies
  61.           if enemy != nil and enemy.hp0?
  62.             @target_battlers.push(enemy)
  63.           end
  64.         end
  65.         敌方秒(1, item, 1, type, $game_troop.smooth_target_enemy(index))
  66.       when 7  # 使用者
  67.         @target_battlers.push(@active_battler)
  68.       end
  69.     end
  70.     if @active_battler.is_a?(Game_Actor)
  71.       # 效果范围分支
  72.       case item.scope
  73.       when 1  # 敌单体
  74.         index = @active_battler.current_action.target_index
  75.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  76.         我方秒(0, item, 0, type, $game_troop.smooth_target_enemy(index))
  77.       when 2  # 敌全体
  78.         index = @active_battler.current_action.target_index
  79.         for enemy in $game_troop.enemies
  80.           if enemy.exist?
  81.             @target_battlers.push(enemy)
  82.           end
  83.         end
  84.         我方秒(0, item, 0, type, $game_troop.smooth_target_enemy(index))
  85.       when 3  # 我方单体
  86.         index = @active_battler.current_action.target_index
  87.         @target_battlers.push($game_party.smooth_target_actor(index))
  88.         我方秒(0, item, 1, type, $game_party.smooth_target_actor(index))
  89.       when 4  # 我方全体
  90.         index = @active_battler.current_action.target_index
  91.         for actor in $game_party.actors
  92.           if actor.exist?
  93.             @target_battlers.push(actor)
  94.           end
  95.         end
  96.         我方秒(0, item, 1, type, $game_party.smooth_target_actor(index))
  97.       when 5  # 我方单体 (HP 0)
  98.         index = @active_battler.current_action.target_index
  99.         actor = $game_party.actors[index]
  100.         if actor != nil and actor.hp0?
  101.           @target_battlers.push(actor)
  102.         end
  103.         我方秒(1, item, 1, type, $game_party.smooth_target_actor(index))
  104.       when 6  # 我方全体 (HP 0)
  105.         index = @active_battler.current_action.target_index
  106.         for actor in $game_party.actors
  107.           if actor != nil and actor.hp0?
  108.             @target_battlers.push(actor)
  109.           end
  110.         end
  111.         我方秒(1, item, 1, type, $game_party.smooth_target_actor(index))
  112.       when 7  # 使用者
  113.         @target_battlers.push(@active_battler)
  114.       end
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 生成特技行动结果
  119.   #--------------------------------------------------------------------------
  120.   def make_skill_action_result
  121.     # 获取特技
  122.     @skill = $data_skills[@active_battler.current_action.skill_id]
  123.     # 如果不是强制行动
  124.     unless @active_battler.current_action.forcing
  125.       # 因为 SP 耗尽而无法使用的情况下
  126.       unless @active_battler.skill_can_use?(@skill.id)
  127.         # 清除强制行动对像的战斗者
  128.         $game_temp.forcing_battler = nil
  129.         # 移至步骤 1
  130.         @phase4_step = 1
  131.         return
  132.       end
  133.     end
  134.     # 消耗 SP
  135.     @active_battler.sp -= @skill.sp_cost
  136.     # 刷新状态窗口
  137.     @status_window.refresh
  138.     # 在帮助窗口显示特技名
  139.     @help_window.set_text(@skill.name, 1)
  140.     # 设置动画 ID
  141.     @animation1_id = @skill.animation1_id
  142.     @animation2_id = @skill.animation2_id
  143.     # 设置公共事件 ID
  144.     @common_event_id = @skill.common_event_id
  145.     # 设置对像侧战斗者
  146.    
  147.     # ---------------------------------------
  148.     set_target_battlers(@skill, 0)
  149.     # ---------------------------------------
  150.    
  151.     # 应用特技效果
  152.     for target in @target_battlers
  153.       target.skill_effect(@active_battler, @skill)
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 生成物品行动结果
  158.   #--------------------------------------------------------------------------
  159.   def make_item_action_result
  160.     # 获取物品
  161.     @item = $data_items[@active_battler.current_action.item_id]
  162.     # 因为物品耗尽而无法使用的情况下
  163.     unless $game_party.item_can_use?(@item.id)
  164.       # 移至步骤 1
  165.       @phase4_step = 1
  166.       return
  167.     end
  168.     # 消耗品的情况下
  169.     if @item.consumable
  170.       # 使用的物品减 1
  171.       $game_party.lose_item(@item.id, 1)
  172.     end
  173.     # 在帮助窗口显示物品名
  174.     @help_window.set_text(@item.name, 1)
  175.     # 设置动画 ID
  176.     @animation1_id = @item.animation1_id
  177.     @animation2_id = @item.animation2_id
  178.     # 设置公共事件 ID
  179.     @common_event_id = @item.common_event_id
  180.     # 确定对像
  181.     index = @active_battler.current_action.target_index
  182.     target = $game_party.smooth_target_actor(index)
  183.     # 设置对像侧战斗者
  184.    
  185.     # ---------------------------------------
  186.     set_target_battlers(@item, 1)
  187.     # ---------------------------------------
  188.    
  189.     # 应用物品效果
  190.     for target in @target_battlers
  191.       target.item_effect(@item)
  192.     end
  193.   end
  194.   
  195.   def 敌方秒(n, item, t, type, 目标)
  196.     # ----------------------------------------
  197.     return if @多秒_特技[item.id].nil? and @多秒_物品[item.id].nil?
  198.     @target_battlers = []
  199.     case t
  200.     when 0
  201.       for actor in $game_party.actors
  202.         @target_battlers.push(actor) if actor.exist?
  203.       end
  204.     when 1
  205.       for enemy in $game_troop.enemies
  206.         @target_battlers.push(enemy) if enemy.exist?
  207.       end
  208.     end
  209.     return if @多秒_特技[item.id] >= @target_battlers.size
  210.     while @target_battlers.size > @多秒_特技[item.id]
  211.       a = rand(@target_battlers.size)
  212.       unless a == @target_battlers.size - 1 or
  213.         # 如果用了我发布的嘲讽状态脚本 请把后边的注释去掉!
  214.         @target_battlers[a] == 目标# or @target_battlers[a].state? Wall
  215.         @target_battlers.delete_at(a)
  216.       end
  217.     end
  218.     # -------------------------------------------
  219.   end
  220.   #   参数   是否hp0 项目 对敌还是对友 特技还是物品 目标
  221.   def 我方秒(n, item, t, type, 目标)
  222.     # ----------------------------------------
  223.     return if @多秒_特技[item.id].nil? and @多秒_物品[item.id].nil?
  224.     @target_battlers = []
  225.     case type
  226.     when 0 # 特技
  227.       case t
  228.       when 0
  229.         for enemy in $game_troop.enemies
  230.           case n
  231.           when 0
  232.             @target_battlers.push(enemy) if enemy.exist?
  233.           when 1
  234.             @target_battlers.push(enemy) unless enemy.exist?
  235.           end
  236.         end
  237.       when 1
  238.         for actor in $game_party.actors
  239.           case n
  240.           when 0
  241.             @target_battlers.push(actor) if actor.exist?
  242.           when 1
  243.             @target_battlers.push(actor) unless actor.exist?
  244.           end
  245.         end
  246.       end
  247.       return if @多秒_特技[item.id] >= @target_battlers.size
  248.       while @target_battlers.size > @多秒_特技[item.id]
  249.         a = rand(@target_battlers.size)
  250.         unless a == @target_battlers.size - 1 or
  251.           @target_battlers[a] == 目标
  252.           @target_battlers.delete_at(a)
  253.         end
  254.       end
  255.     when 1 # 物品
  256.       case t
  257.       when 0
  258.         for enemy in $game_troop.enemies
  259.           case n
  260.           when 0
  261.             @target_battlers.push(enemy) if enemy.exist?
  262.           when 1
  263.             @target_battlers.push(enemy) unless enemy.exist?
  264.           end
  265.         end
  266.       when 1
  267.         for actor in $game_party.actors
  268.           case n
  269.           when 0
  270.             @target_battlers.push(actor) if actor.exist?
  271.           when 1
  272.             @target_battlers.push(actor) unless actor.exist?
  273.           end
  274.         end
  275.       end
  276.       return if @多秒_物品[item.id] >= @target_battlers.size
  277.       while @target_battlers.size > @多秒_物品[item.id]
  278.         a = rand(@target_battlers.size)
  279.         unless a == @target_battlers.size - 1 or
  280.           @target_battlers[a] == 目标
  281.           @target_battlers.delete_at(a)
  282.         end
  283.       end
  284.     end
  285.     # ----------------------------------------
  286.   end
  287. end
复制代码

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 认可答案

查看全部评分

初从文,三年不中;后习武,校场发一矢,中鼓吏,逐之出;遂学医,有所成。自撰一良方,服之,卒。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部