查看: 3594|回复: 11

[已经过期] 如何让特定的敌人攻击可以进行连击,恢复血量等……

[复制链接]
梦石
0
星屑
1442
在线时间
171 小时
注册时间
2019-10-4
回帖
162
发表于 2020-4-2 23:26:33 | 显示全部楼层 |阅读模式

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

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

×
比如说,敌方队伍有个二刀流剑客,可以进行二次连击。攻击己方。就是说让敌人可以进行连击。我想就是有些敌人有点特殊效果,比如说吸血鬼攻击也可以吸血。恢复自身血量
梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

发表于 2020-4-3 01:55:04 | 显示全部楼层
默认战斗的话,可以看我签名里的《战斗调用公共事件》

点评

范例里是有连击的吧?你如果是攻击触发攻击,需要加一个开关,关闭的时候触发连击并打开开关,打开的时候不触发连击并关闭。  发表于 2020-5-24 18:33
我看过了,但是我肯定自己修改的是错误了,敌方连击进行攻击再一次攻击会停不下来,进入死循环直到把己方人全部砍死,公共事件有点缺陷  发表于 2020-5-23 23:33

评分

参与人数 1赞 +1 收起 理由
taeckle + 1 很强!

查看全部评分

熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复

使用道具 举报

梦石
0
星屑
1442
在线时间
171 小时
注册时间
2019-10-4
回帖
162
 楼主| 发表于 2020-4-19 17:41:49 | 显示全部楼层
guoxiaomi 发表于 2020-4-3 01:55
默认战斗的话,可以看我签名里的《战斗调用公共事件》

你那个我看了,我看的有点蒙。不过我还是谢谢,我自己使用很简单的战斗公共事件实现了,就是在敌人血量降低到某个数值,设置敌人行动攻击连续触发。在中断事件同样达成了连击效果
回复

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2020-4-20 12:16:15 | 显示全部楼层
表示菜鸟纵版都有以上功能。
不过我也是顺手加进去,因为以前攻击两下,全体,吸血什么的几乎是标配。尝试搜索“攻击两次”,“吸血”等关键字看能找到没有。
回复

使用道具 举报

梦石
0
星屑
1442
在线时间
171 小时
注册时间
2019-10-4
回帖
162
 楼主| 发表于 2020-4-22 10:46:50 | 显示全部楼层
enghao_lim 发表于 2020-4-20 12:16
表示菜鸟纵版都有以上功能。
不过我也是顺手加进去,因为以前攻击两下,全体,吸血什么的几乎是标 ...

我是想设置更强大的敌人,是敌方吸取自方的血量,敌方可以进行二连,你说可行吗
回复

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2020-4-24 15:38:39 | 显示全部楼层
契约师Vi 发表于 2020-4-22 10:46
我是想设置更强大的敌人,是敌方吸取自方的血量,敌方可以进行二连,你说可行吗 ...

其实我已经告诉你完全可行了……
看来你连“菜鸟纵版”都没搜索过……
算了我人好,把脚本扒出来给你好了。

举例:
添加一个名为 ☆攻*2 的属性后,不管武器,状态只要勾上这个武器一律视为可攻击两次;敌人则是改属性有效度为B那该敌人默认就会攻击两次。

如果要攻击三次就是 ☆攻*3,以此类推。

其他效果基本同设置方法,只是关键字就不同。

根据你说的效果,只要那个敌人同时拥有以下的属性有效度即可。

ss.png

脚本没什么好看的……
  1. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2. # 菜鸟纵版 v 0.4 by enghao_lim (小lim)
  3. # 03 【战斗特效】插件
  4. # date: 2010/11/11(光棍节快乐!)
  5. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6. # 说明帮助
  7. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8. #
  9. # 01 就是一些基本的战斗特效,设置几乎都是直接在数据库里,简单。
  10. #
  11. # 02 攻击次数就是攻击的次数,与彩虹连击那种效果是不一样的,如默认的"☆攻*2",
  12. #    就代表攻击两次,"☆攻*3"就是攻击三次,可以多设。详情见范例。
  13. #
  14. # 03 吸收也就是攻击过后吸收部分的攻击化为hp,设置方式是像"☆吸*100",就是 100
  15. #    一百八仙的把攻击吸收,"☆吸*50"就是吸收50 %,设置雷同攻击次数设置。
  16. #
  17. # 04 护体效果就是用SP来抵挡伤害。
  18. #
  19. # 05 会心一击就是更改会心一击的几率,"☆会*100"就是一百八仙的会心一击几率。
  20. #
  21. # 06 全体攻击是特地为武器设的,持有该属性的武器,敌人,或者持有该状态的角色将
  22. #    可以执行全体攻击。
  23. #
  24. # 07 重生就是死了会复活的状态,可以多设。
  25. #
  26. # 08 总共六种效果,可是贯穿了许多种类的设置,绝对可以做出付出强悍的组合战斗特
  27. #    效。
  28. #
  29. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  30. # PS: 以下为一些基本设置
  31. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  32. module VBattle

  33.   # - | 设 | 置 | 从 | 此 | 开 | 始 | - - - - - - - - - - - - - - - - - - - -

  34.   # 攻击次数 的属性名称(敌人,技能,武器,与状态)
  35.   Element_multi_attack = "☆攻*"

  36.   # 吸收 的属性名称(敌人,技能,武器,物品)
  37.   Element_absorb = "☆吸*"

  38.   # 护体 的属性名称(防具,状态,敌人)
  39.   Element_protect = "☆护"

  40.   # 会心一击(技能,状态,敌人,武器)
  41.   Element_critical = "☆会*"

  42.   # 全体攻击(武器,状态,敌人)
  43.   Element_full_scope = "☆全"

  44.   # 重生 状态的ID(数组)
  45.   State_revive = [17]

  46.   # 重生 所会恢复的HP %
  47.   Hp_revive = 50

  48.   # 重生 时播放的动画
  49.   Ani_revive = 26

  50.   # - | 设 | 置 | 到 | 此 | 结 | 束 | - - - - - - - - - - - - - - - - - - - -

  51.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  52.   # ◆ 获取连续攻击属性数组
  53.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  54.   def self.get_multi_attack_element
  55.     elements = load_data("data/System.rxdata").elements
  56.     result = []
  57.     (0...elements.size).each{|i|
  58.       if elements[i].include?(Element_multi_attack)
  59.         result.push(i)
  60.       end
  61.     }
  62.     return result
  63.   end

  64.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  65.   # ◆ 获取吸收攻击属性数组
  66.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  67.   def self.get_absorb_element
  68.     elements = load_data("data/System.rxdata").elements
  69.     result = []
  70.     (0...elements.size).each{|i|
  71.       if elements[i].include?(Element_absorb)
  72.         result.push(i)
  73.       end
  74.     }
  75.     return result
  76.   end

  77.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  78.   # ◆ 获取会心一击属性数组
  79.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  80.   def self.get_critical_element
  81.     elements = load_data("data/System.rxdata").elements
  82.     result = []
  83.     (0...elements.size).each{|i|
  84.       if elements[i].include?(Element_critical)
  85.         result.push(i)
  86.       end
  87.     }
  88.     return result
  89.   end

  90.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  91.   # ◆ 获取护体属性编号
  92.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  93.   def self.get_protect_element
  94.     elements = load_data("data/System.rxdata").elements
  95.     result = 0
  96.     (0...elements.size).each{|i|
  97.       if elements[i] == Element_protect
  98.         result = i
  99.         break
  100.       end
  101.     }
  102.     return result
  103.   end

  104.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  105.   # ◆ 获取全体攻击属性编号
  106.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  107.   def self.get_full_scope_element
  108.     elements = load_data("data/System.rxdata").elements
  109.     result = 0
  110.     (0...elements.size).each{|i|
  111.       if elements[i] == Element_full_scope
  112.         result = i
  113.         break
  114.       end
  115.     }
  116.     return result
  117.   end

  118. end

  119. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  120. # ◇ RPG
  121. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  122. module RPG
  123.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  124.   # ◆ 技能
  125.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  126.   class Skill
  127.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  128.     # ◆ 连续攻击
  129.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  130.     def multi_attack
  131.       result = 1
  132.       for element in VBattle::get_multi_attack_element
  133.         if @element_set.include?(element)
  134.           a = $data_system.elements[element].delete(VBattle::Element_multi_attack).to_i
  135.           result = a if a > result
  136.         end
  137.       end
  138.       return result
  139.     end
  140.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  141.     # ◆ 吸收
  142.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  143.     def absorb
  144.       result = 0
  145.       VBattle::get_absorb_element.each{|element|
  146.         if @element_set.include?(element)
  147.           a = $data_system.elements[element].delete(VBattle::Element_absorb).to_i
  148.           result = a if a > result
  149.         end
  150.       }
  151.       result = 100 if result > 100
  152.       return result
  153.     end
  154.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  155.     # ◆ 会心一击追击
  156.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  157.     def critical_chance
  158.       result = 0
  159.       VBattle::get_critical_element.each{|element|
  160.         if @element_set.include?(element)
  161.           a = $data_system.elements[element].delete(VBattle::Element_critical).to_i
  162.           result = a if a > result
  163.         end
  164.       }
  165.       result = 100 if result > 100
  166.       return result
  167.     end
  168.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  169.     # ◆ 获取属性
  170.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  171.     alias old_b_element_set element_set
  172.     def element_set
  173.       result = old_b_element_set
  174.       for element in VBattle::get_multi_attack_element
  175.         result.delete(element)
  176.       end
  177.       for element in VBattle::get_absorb_element
  178.         result.delete(element)
  179.       end
  180.       for element in VBattle::get_critical_element
  181.         result.delete(element)
  182.       end
  183.       result.delete(VBattle::get_full_scope_element)
  184.       result.delete(VBattle::get_protect_element)
  185.       return result
  186.     end
  187.   end
  188.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  189.   # ◆ 武器
  190.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  191.   class Weapon
  192.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  193.     # ◆ 连续攻击
  194.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  195.     def multi_attack
  196.       result = 1
  197.       for element in VBattle::get_multi_attack_element
  198.         if @element_set.include?(element)
  199.           a = $data_system.elements[element].delete(VBattle::Element_multi_attack).to_i
  200.           result = a if a > result
  201.         end
  202.       end
  203.       return result
  204.     end
  205.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  206.     # ◆ 吸收
  207.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  208.     def absorb
  209.       result = 0
  210.       VBattle::get_absorb_element.each{|element|
  211.         if @element_set.include?(element)
  212.           a = $data_system.elements[element].delete(VBattle::Element_absorb).to_i
  213.           result = a if a > result
  214.         end
  215.       }
  216.       result = 100 if result > 100
  217.       return result
  218.     end
  219.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  220.     # ◆ 会心一击追击
  221.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  222.     def critical_chance
  223.       result = 0
  224.       VBattle::get_critical_element.each{|element|
  225.         if @element_set.include?(element)
  226.           a = $data_system.elements[element].delete(VBattle::Element_critical).to_i
  227.           result = a if a > result
  228.         end
  229.       }
  230.       result = 100 if result > 100
  231.       return result
  232.     end
  233.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  234.     # ◆ 全体追击
  235.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  236.     def full_scope
  237.       return true if @element_set.include?(VBattle::get_full_scope_element)
  238.       return false
  239.     end
  240.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  241.     # ◆ 获取属性
  242.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  243.     alias old_b_element_set element_set
  244.     def element_set
  245.       result = old_b_element_set
  246.       for element in VBattle::get_multi_attack_element
  247.         result.delete(element)
  248.       end
  249.       for element in VBattle::get_absorb_element
  250.         result.delete(element)
  251.       end
  252.       for element in VBattle::get_critical_element
  253.         result.delete(element)
  254.       end
  255.       result.delete(VBattle::get_full_scope_element)
  256.       result.delete(VBattle::get_protect_element)
  257.       return result
  258.     end
  259.   end
  260.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  261.   # ◆ 防具
  262.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  263.   class Armor
  264.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  265.     # ◆ 护体
  266.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  267.     def protect?
  268.       return false if VBattle::get_protect_element == 0
  269.       return @guard_element_set.include?(VBattle::get_protect_element)
  270.     end
  271.   end
  272.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  273.   # ◆ 物品
  274.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  275.   class Item
  276.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  277.     # ◆ 吸收
  278.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  279.     def absorb
  280.       result = 0
  281.       VBattle::get_absorb_element.each{|element|
  282.         if @element_set.include?(element)
  283.           a = $data_system.elements[element].delete(VBattle::Element_absorb).to_i
  284.           result = a if a > result
  285.         end
  286.       }
  287.       result = 100 if result > 100
  288.       return result
  289.     end
  290.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  291.     # ◆ 获取属性
  292.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  293.     alias old_b_element_set element_set
  294.     def element_set
  295.       result = old_b_element_set
  296.       for element in VBattle::get_multi_attack_element
  297.         result.delete(element)
  298.       end
  299.       for element in VBattle::get_absorb_element
  300.         result.delete(element)
  301.       end
  302.       for element in VBattle::get_critical_element
  303.         result.delete(element)
  304.       end
  305.       result.delete(VBattle::get_full_scope_element)
  306.       result.delete(VBattle::get_protect_element)
  307.       return result
  308.     end
  309.   end
  310.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  311.   # ◆ 状态
  312.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  313.   class State
  314.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  315.     # ◆ 连续攻击
  316.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  317.     def multi_attack
  318.       result = 1
  319.       for element in VBattle::get_multi_attack_element
  320.         if @guard_element_set.include?(element)
  321.           a = $data_system.elements[element].delete(VBattle::Element_multi_attack).to_i
  322.           result = a if a > result
  323.         end
  324.       end
  325.       return result
  326.     end
  327.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  328.     # ◆ 护体
  329.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  330.     def protect?
  331.       return false if VBattle::get_protect_element == 0
  332.       return @guard_element_set.include?(VBattle::get_protect_element)
  333.     end
  334.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  335.     # ◆ 会心一击追击
  336.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  337.     def critical_chance
  338.       result = 0
  339.       VBattle::get_critical_element.each{|element|
  340.         if @guard_element_set.include?(element)
  341.           a = $data_system.elements[element].delete(VBattle::Element_critical).to_i
  342.           result = a if a > result
  343.         end
  344.       }
  345.       result = 100 if result > 100
  346.       return result
  347.     end
  348.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  349.     # ◆ 全体追击
  350.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  351.     def full_scope
  352.       return true if @guard_element_set.include?(VBattle::get_full_scope_element)
  353.       return false
  354.     end
  355.   end
  356. end

  357. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  358. # ◆ Game_Battler
  359. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  360. class Game_Battler
  361.   attr_accessor :revive_ani
  362.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  363.   # ◆ 初始化
  364.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  365.   alias old_b_initialize initialize
  366.   def initialize
  367.     old_b_initialize
  368.     @revive_ani = 0
  369.   end
  370.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  371.   # ◆ 更改对hp的写入
  372.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  373.   def hp=(n)
  374.     if !$scene.is_a?(Scene_Battle)
  375.       org_hp(n)
  376.       return
  377.     end
  378.     # 护体
  379.     if n < @hp and self.protect?
  380.       damage = @hp - n
  381.       if self.sp >= damage
  382.         self.sp -= damage
  383.       else
  384.         dif = damage - self.sp
  385.         new_hp = @hp-dif
  386.         self.sp = 0
  387.         org_hp(new_hp)
  388.       end
  389.     else
  390.       org_hp(n)
  391.     end
  392.   end
  393.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  394.   # ◆ 原版的hp写入
  395.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  396.   def org_hp(hp)
  397.     # 重生
  398.     id = 0
  399.     revive = false
  400.     @states.each{|state|
  401.       if VBattle::State_revive.include?(state)
  402.         id = state
  403.         revive = true
  404.         break
  405.       end
  406.     }
  407.     if hp <= 0 and revive
  408.       remove_state(id)
  409.       @revive_ani = VBattle::Ani_revive
  410.     end
  411.     # 原本的hp写入方式
  412.     @hp = [[hp, maxhp].min, 0].max
  413.     # 解除附加的战斗不能状态
  414.     for i in 1...$data_states.size
  415.       if $data_states[i].zero_hp
  416.         if self.dead?
  417.           add_state(i)
  418.         else
  419.           remove_state(i)
  420.         end
  421.       end
  422.     end
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # ● 应用通常攻击效果
  426.   #     attacker : 攻击者 (battler)
  427.   #--------------------------------------------------------------------------
  428.   def attack_effect(attacker)
  429.     # 清除会心一击标志
  430.     self.critical = false
  431.     # 第一命中判定
  432.     hit_result = (rand(100) < attacker.hit)
  433.     # 命中的情况下
  434.     if hit_result == true
  435.       # 计算基本伤害
  436.       atk = [attacker.atk - self.pdef / 2, 0].max
  437.       self.damage = atk * (20 + attacker.str) / 20
  438.       # 属性修正
  439.       self.damage *= elements_correct(attacker.element_set)
  440.       self.damage /= 100
  441.       # 伤害符号正确的情况下
  442.       if self.damage > 0
  443.         # 会心一击修正
  444.         if attacker.critical_chance > 0
  445.           if rand(100) < attacker.critical_chance
  446.             self.damage *= 2
  447.             self.critical = true
  448.           end
  449.         else
  450.           if rand(100) < 4 * attacker.dex / self.agi
  451.             self.damage *= 2
  452.             self.critical = true
  453.           end
  454.         end
  455.         # 防御修正
  456.         if self.guarding?
  457.           self.damage /= 2
  458.         end
  459.       end
  460.       # 分散
  461.       if self.damage.abs > 0
  462.         amp = [self.damage.abs * 15 / 100, 1].max
  463.         self.damage += rand(amp+1) + rand(amp+1) - amp
  464.       end
  465.       # 第二命中判定
  466.       eva = 8 * self.agi / attacker.dex + self.eva
  467.       hit = self.damage < 0 ? 100 : 100 - eva
  468.       hit = self.cant_evade? ? 100 : hit
  469.       hit_result = (rand(100) < hit)
  470.     end
  471.     # 命中的情况下
  472.     if hit_result == true
  473.       # 状态冲击解除
  474.       remove_states_shock
  475.       # HP 的伤害计算
  476.       self.hp -= self.damage
  477.       # 状态变化
  478.       @state_changed = false
  479.       states_plus(attacker.plus_state_set)
  480.       states_minus(attacker.minus_state_set)
  481.     # Miss 的情况下
  482.     else
  483.       # 伤害设置为 "Miss"
  484.       self.damage = "Miss"
  485.       # 清除会心一击标志
  486.       self.critical = false
  487.     end
  488.     # 过程结束
  489.     return true
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ● 应用特技效果
  493.   #     user  : 特技的使用者 (battler)
  494.   #     skill : 特技
  495.   #--------------------------------------------------------------------------
  496.   def skill_effect(user, skill)
  497.     # 清除会心一击标志
  498.     self.critical = false
  499.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  500.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  501.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  502.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  503.       # 过程结束
  504.       return false
  505.     end
  506.     # 清除有效标志
  507.     effective = false
  508.     # 公共事件 ID 是有效的情况下,设置为有效标志
  509.     effective |= skill.common_event_id > 0
  510.     # 第一命中判定
  511.     hit = skill.hit
  512.     if skill.atk_f > 0
  513.       hit *= user.hit / 100
  514.     end
  515.     hit_result = (rand(100) < hit)
  516.     # 不确定的特技的情况下设置为有效标志
  517.     effective |= hit < 100
  518.     # 命中的情况下
  519.     if hit_result == true
  520.       # 计算威力
  521.       power = skill.power + user.atk * skill.atk_f / 100
  522.       if power > 0
  523.         power -= self.pdef * skill.pdef_f / 200
  524.         power -= self.mdef * skill.mdef_f / 200
  525.         power = [power, 0].max
  526.       end
  527.       # 计算倍率
  528.       rate = 20
  529.       rate += (user.str * skill.str_f / 100)
  530.       rate += (user.dex * skill.dex_f / 100)
  531.       rate += (user.agi * skill.agi_f / 100)
  532.       rate += (user.int * skill.int_f / 100)
  533.       # 计算基本伤害
  534.       self.damage = power * rate / 20
  535.       # 属性修正
  536.       self.damage *= elements_correct(skill.element_set)
  537.       self.damage /= 100
  538.       # 伤害符号正确的情况下
  539.       if self.damage > 0
  540.         if skill.critical_chance > 0
  541.           self.damage *= 2
  542.           self.critical = true
  543.         end
  544.         # 防御修正
  545.         if self.guarding?
  546.           self.damage /= 2
  547.         end
  548.       end
  549.       # 分散
  550.       if skill.variance > 0 and self.damage.abs > 0
  551.         amp = [self.damage.abs * skill.variance / 100, 1].max
  552.         self.damage += rand(amp+1) + rand(amp+1) - amp
  553.       end
  554.       # 第二命中判定
  555.       eva = 8 * self.agi / user.dex + self.eva
  556.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  557.       hit = self.cant_evade? ? 100 : hit
  558.       hit_result = (rand(100) < hit)
  559.       # 不确定的特技的情况下设置为有效标志
  560.       effective |= hit < 100
  561.     end
  562.     # 命中的情况下
  563.     if hit_result == true
  564.       # 威力 0 以外的物理攻击的情况下
  565.       if skill.power != 0 and skill.atk_f > 0
  566.         # 状态冲击解除
  567.         remove_states_shock
  568.         # 设置有效标志
  569.         effective = true
  570.       end
  571.       # HP 的伤害减法运算
  572.       last_hp = self.hp
  573.       self.hp -= self.damage
  574.       effective |= self.hp != last_hp
  575.       # 状态变化
  576.       @state_changed = false
  577.       effective |= states_plus(skill.plus_state_set)
  578.       effective |= states_minus(skill.minus_state_set)
  579.       # 威力为 0 的场合
  580.       if skill.power == 0
  581.         # 伤害设置为空的字串
  582.         self.damage = ""
  583.         # 状态没有变化的情况下
  584.         unless @state_changed
  585.           # 伤害设置为 "Miss"
  586.           self.damage = "Miss"
  587.         end
  588.       end
  589.     # Miss 的情况下
  590.     else
  591.       # 伤害设置为 "Miss"
  592.       self.damage = "Miss"
  593.     end
  594.     # 不在战斗中的情况下
  595.     unless $game_temp.in_battle
  596.       # 伤害设置为 nil
  597.       self.damage = nil
  598.     end
  599.     # 过程结束
  600.     return effective
  601.   end
  602. end
  603. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  604. # ◆ Game_BattleAction
  605. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  606. class Game_BattleAction
  607.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  608.   # ◆ 是否是普通攻击
  609.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  610.   def is_attack?
  611.     return (@kind == 0 and @basic == 0)
  612.   end
  613.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  614.   # ◆ 是否是使用特技
  615.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  616.   def is_skill?
  617.     return (@kind == 1)
  618.   end
  619.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  620.   # ◆ 是否是使用物品
  621.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  622.   def is_item?
  623.     return (@kind == 2)
  624.   end
  625.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  626.   # ◆ 是否是普通防御
  627.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  628.   def is_defend?
  629.     return (@kind == 0 and @basic == 1)
  630.   end
  631.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  632.   # ◆ 是否是逃跑
  633.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  634.   def is_run?
  635.     return (@kind == 0 and @basic == 2)
  636.   end
  637.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  638.   # ◆ 是不是什么也不做
  639.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  640.   def is_nothing?
  641.     return (@kind == 0 and ![0,1,2].include?(@basic))
  642.   end
  643.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  644.   # ◆ 直接获取技能
  645.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  646.   def skill
  647.     return $data_skills[@skill_id]
  648.   end
  649.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  650.   # ◆ 直接获取物品
  651.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  652.   def item
  653.     return $data_items[@item_id]
  654.   end
  655. end
  656. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  657. # ◆ Game_Actor
  658. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  659. class Game_Actor
  660.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  661.   # ◆ 获取攻击次数
  662.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  663.   def multi_attack
  664.     result = 1
  665.     if @weapons_id != 0
  666.       result = $data_weapons[@weapon_id].multi_attack
  667.     end
  668.     for state in @states
  669.       result = $data_states[state].multi_attack if $data_states[state].multi_attack > result
  670.     end
  671.     return result
  672.   end
  673.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  674.   # ◆ 获取吸收八仙率
  675.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  676.   def absorb
  677.     value = 0
  678.     if @current_action.is_attack?
  679.       value = $data_weapons[@weapon_id].absorb if @weapon_id != 0
  680.     elsif @current_action.is_skill?
  681.       value = @current_action.skill.absorb
  682.     elsif @current_action.is_item?
  683.       value = @current_action.item.absorb
  684.     end
  685.     return value
  686.   end
  687.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  688.   # ◆ 护体
  689.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  690.   def protect?
  691.     result = false
  692.     result |= $data_armors[@armor1_id].protect? if @armor1_id > 0
  693.     result |= $data_armors[@armor2_id].protect? if @armor2_id > 0
  694.     result |= $data_armors[@armor3_id].protect? if @armor3_id > 0
  695.     result |= $data_armors[@armor4_id].protect? if @armor4_id > 0
  696.     for state in @states
  697.       result |= $data_states[state].protect?
  698.     end
  699.     return result
  700.   end
  701.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  702.   # ◆ 会心一击追加
  703.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  704.   def critical_chance
  705.     result = 0
  706.     if @weapon_id != 0
  707.       result = $data_weapons[@weapon_id].critical_chance
  708.     end
  709.     for state in @states
  710.       result = $data_states[state].critical_chance if\
  711.                $data_states[state].critical_chance > result
  712.     end
  713.     return result
  714.   end
  715.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  716.   # ◆ 普通全体攻击
  717.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  718.   def full_scope_attack
  719.     result = false
  720.     result |= $data_weapons[@weapon_id].full_scope if @weapon_id > 0
  721.     result |= @states.any?{|state|$data_states[state].full_scope}
  722.     return result
  723.   end
  724. end

  725. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  726. # ◆ Game_Enemy
  727. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  728. class Game_Enemy
  729.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  730.   # ◆ 获取攻击次数
  731.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  732.   def multi_attack
  733.     result = 1
  734.     for element in VBattle::get_multi_attack_element
  735.       a = $data_enemies[@enemy_id].element_ranks[element]
  736.       b = $data_system.elements[element].delete(VBattle::Element_multi_attack).to_i
  737.       result = b if a != 3 and b > result
  738.     end
  739.     for state in @states
  740.       result = $data_states[state].multi_attack if $data_states[state].multi_attack > result
  741.     end
  742.     return result
  743.   end
  744.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  745.   # ◆ 获取吸收八仙率
  746.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  747.   def absorb
  748.     result = 0
  749.     if @current_action.is_attack?
  750.       for element in VBattle::get_absorb_element
  751.         a = $data_enemies[@enemy_id].element_ranks[element]
  752.         b = $data_system.elements[element].delete(VBattle::Element_absorb).to_i
  753.         result = b if a != 3 and b > result
  754.       end
  755.     elsif @current_action.is_skill?
  756.       result = @current_action.skill.absorb
  757.     end
  758.     return result
  759.   end
  760.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  761.   # ◆ 护体
  762.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  763.   def protect?
  764.     result = false
  765.     result |= ($data_enemies[@enemy_id].\
  766.               element_ranks[VBattle::get_protect_element] != 3\
  767.               if VBattle::get_protect_element != 0)
  768.     for state in @states
  769.       result |= $data_states[state].protect?
  770.     end
  771.     return result
  772.   end
  773.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  774.   # ◆ 获取会心一击几率
  775.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  776.   def critical_chance
  777.     result = 0
  778.     if @current_action.is_attack?
  779.       for element in VBattle::get_critical_element
  780.         a = $data_enemies[@enemy_id].element_ranks[element]
  781.         b = $data_system.elements[element].delete(VBattle::Element_critical).to_i
  782.         result = b if a != 3 and b > result
  783.       end
  784.     end
  785.     for state in @states
  786.       result = $data_states[state].critical_chance if\
  787.                $data_states[state].critical_chance > result
  788.     end
  789.     return result
  790.   end
  791.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  792.   # ◆ 全体攻击
  793.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  794.   def full_scope_attack
  795.     result = false
  796.     result |= ($data_enemies[@enemy_id].\
  797.               element_ranks[VBattle::get_full_scope_element] != 3\
  798.               if VBattle::get_full_scope_element != 0)
  799.     result |= @states.any?{|state|$data_states[state].full_scope}
  800.     return result
  801.   end
  802. end

  803. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  804. # ◆ Scene_Battle
  805. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  806. class Scene_Battle
  807.   #--------------------------------------------------------------------------
  808.   # ● 生成基本行动结果
  809.   #--------------------------------------------------------------------------
  810.   def make_basic_action_result
  811.     # 攻击的情况下
  812.     if @active_battler.current_action.basic == 0
  813.       # 设置攻击 ID
  814.       @animation1_id = @active_battler.animation1_id
  815.       @animation2_id = @active_battler.animation2_id
  816.       # 行动方的战斗者是敌人的情况下
  817.       if @active_battler.is_a?(Game_Enemy)
  818.         if @active_battler.restriction == 3
  819.           target = $game_troop.random_target_enemy
  820.         elsif @active_battler.restriction == 2
  821.           target = $game_party.random_target_actor
  822.         else
  823.           index = @active_battler.current_action.target_index
  824.           target = $game_party.smooth_target_actor(index)
  825.         end
  826.       end
  827.       # 行动方的战斗者是角色的情况下
  828.       if @active_battler.is_a?(Game_Actor)
  829.         if @active_battler.restriction == 3
  830.           target = $game_party.random_target_actor
  831.         elsif @active_battler.restriction == 2
  832.           target = $game_troop.random_target_enemy
  833.         else
  834.           index = @active_battler.current_action.target_index
  835.           target = $game_troop.smooth_target_enemy(index)
  836.         end
  837.       end
  838.       # 设置对像方的战斗者序列
  839.       @target_battlers = [target]
  840.       set_target_battlers(2) if @active_battler.full_scope_attack
  841.       # 应用通常攻击效果
  842.       for target in @target_battlers
  843.         target.attack_effect(@active_battler)
  844.       end
  845.       return
  846.     end
  847.     # 防御的情况下
  848.     if @active_battler.current_action.basic == 1
  849.       # 帮助窗口显示"防御"
  850.       @help_window.set_text($data_system.words.guard, 1)
  851.       return
  852.     end
  853.     # 逃跑的情况下
  854.     if @active_battler.is_a?(Game_Enemy) and
  855.        @active_battler.current_action.basic == 2
  856.       #  帮助窗口显示"逃跑"
  857.       @help_window.set_text("逃跑", 1)
  858.       # 逃跑
  859.       @active_battler.escape
  860.       return
  861.     end
  862.     # 什么也不做的情况下
  863.     if @active_battler.current_action.basic == 3
  864.       # 清除强制行动对像的战斗者
  865.       $game_temp.forcing_battler = nil
  866.       # 移至步骤 1
  867.       @phase4_step = 1
  868.       return
  869.     end
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ● 刷新画面 (角色命令回合 : 基本命令)
  873.   #--------------------------------------------------------------------------
  874.   def update_phase3_basic_command
  875.     # 按下 B 键的情况下
  876.     if Input.trigger?(Input::B)
  877.       # 演奏取消 SE
  878.       $game_system.se_play($data_system.cancel_se)
  879.       # 转向前一个角色的指令输入
  880.       phase3_prior_actor
  881.       return
  882.     end
  883.     # 按下 C 键的情况下
  884.     if Input.trigger?(Input::C)
  885.       # 角色指令窗口光标位置分之
  886.       case @actor_command_window.index
  887.       when 0  # 攻击
  888.         # 演奏确定 SE
  889.         $game_system.se_play($data_system.decision_se)
  890.         # 设置行动
  891.         @active_battler.current_action.kind = 0
  892.         @active_battler.current_action.basic = 0
  893.         if @active_battler.full_scope_attack
  894.           phase3_next_actor
  895.         else
  896.           # 开始选择敌人
  897.           start_enemy_select
  898.         end
  899.       when 1  # 特技
  900.         # 演奏确定 SE
  901.         $game_system.se_play($data_system.decision_se)
  902.         # 设置行动
  903.         @active_battler.current_action.kind = 1
  904.         # 开始选择特技
  905.         start_skill_select
  906.       when 2  # 防御
  907.         # 演奏确定 SE
  908.         $game_system.se_play($data_system.decision_se)
  909.         # 设置行动
  910.         @active_battler.current_action.kind = 0
  911.         @active_battler.current_action.basic = 1
  912.         # 转向下一位角色的指令输入
  913.         phase3_next_actor
  914.       when 3  # 物品
  915.         # 演奏确定 SE
  916.         $game_system.se_play($data_system.decision_se)
  917.         # 设置行动
  918.         @active_battler.current_action.kind = 2
  919.         # 开始选择物品
  920.         start_item_select
  921.       end
  922.       return
  923.     end
  924.   end
  925.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  926.   # ◆ 准备行动
  927.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  928.   alias old_b_update_phase4_step1 update_phase4_step1
  929.   def update_phase4_step1
  930.     old_b_update_phase4_step1
  931.     @attack_turn = 1
  932.     if @active_battler.is_a?(Game_Battler)
  933.       if @active_battler.current_action.is_attack?
  934.         @attack_turn = @active_battler.multi_attack
  935.       elsif @active_battler.current_action.is_skill?
  936.         @attack_turn = @active_battler.current_action.skill.multi_attack
  937.       end
  938.     end
  939.     @max_attack_turn = @attack_turn
  940.   end
  941.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  942.   # ◆ 显示伤害
  943.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  944.   alias old_b_update_phase4_step5 update_phase4_step5
  945.   def update_phase4_step5
  946.     if @active_battler.absorb > 0
  947.       absorb = 0
  948.       for battler in @target_battlers
  949.         if battler.damage.is_a?(Numeric) and battler.damage > 0
  950.           absorb += battler.damage
  951.         end
  952.       end
  953.       if absorb > 0
  954.         @active_battler.damage = -absorb*@active_battler.absorb/100
  955.       end
  956.     end
  957.     old_b_update_phase4_step5
  958.   end
  959.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  960.   # ◆ 刷新
  961.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  962.   alias old_b_update_phase4_step6 update_phase4_step6
  963.   def update_phase4_step6
  964.     @attack_turn -= 1 if @attack_turn > 0
  965.     @target_battlers.each{|target|
  966.       if target.revive_ani != 0 and target.dead?
  967.         target.hp = target.maxhp * VBattle::Hp_revive / 100
  968.         target.animation_id = target.revive_ani
  969.         target.damage = "复活"
  970.         target.damage_pop = true
  971.         target.revive_ani = 0
  972.       end
  973.     }
  974.     all_target_dead = @target_battlers.all?{|b|b.dead?}
  975.     if @active_battler.damage.is_a?(Numeric)
  976.       @active_battler.hp -= @active_battler.damage
  977.       @active_battler.damage_pop = true
  978.       @active_battler.animation_id = 15
  979.       @status_window.refresh
  980.     end
  981.     if @attack_turn == 0 or all_target_dead
  982.       old_b_update_phase4_step6
  983.     else
  984.       @phase4_step = 2
  985.     end
  986.   end
  987. end
复制代码

点评

菜鸟横版我看过啦。,但是还是不会啊,除非用了你的菜鸟战斗方式,方法是这样我懂,怎么实现是关键,不懂写具体的。属性怎么定义  发表于 2020-5-19 22:58
回复 1 0

使用道具 举报

梦石
0
星屑
1357
在线时间
207 小时
注册时间
2019-3-30
回帖
22
发表于 2020-4-26 00:58:41 | 显示全部楼层
@enghao_lim 大佬你这个我默认战斗的会提示错误有联系方式吗?地图行走变得非常卡
回复

使用道具 举报

梦石
0
星屑
1357
在线时间
207 小时
注册时间
2019-3-30
回帖
22
发表于 2020-4-26 01:00:40 | 显示全部楼层
冥域圣君 发表于 2020-4-26 00:58
@enghao_lim 大佬你这个我默认战斗的会提示错误有联系方式吗?地图行走变得非常卡 ...

@enghao_lim
回复

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2020-5-18 00:06:42 | 显示全部楼层
冥域圣君 发表于 2020-4-26 00:58
@enghao_lim 大佬你这个我默认战斗的会提示错误有联系方式吗?地图行走变得非常卡 ...

你得贴出错误啊。
我测试了默认战斗并没有问题的说,而且这脚本和行走图扯不上关系,何来变卡一说。
如果你还用了其他脚本我就不能保证兼容性了。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部