查看: 3081|回复: 6

[已经解决] 谁有灵儿续传范例啊 想研究一下组合技能

[复制链接]
梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2016-2-19 14:39:38 | 显示全部楼层 |阅读模式

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

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

×
有的分享一下
技能.jpg
QQ截图20160219143747.jpg

点评

是的,弄了一年还只是个开头  发表于 2016-2-19 14:48
这画面,一看就是坑爹网页游戏。(我就说说,别在意)  发表于 2016-2-19 14:42

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2016-2-19 15:57:09 | 显示全部楼层
没有 不过要判断合击要先判断角色
大概就是下面的方法 要用在战斗类脚本中

  1. #角色为我方
  2.   if user.is_a?(Game_Actor)
  3. if [1,4].include?(user.id)
  4.      for actor in $game_party.actors
  5. #1号角色发动技能 需要4号角色存在
  6.     if user.id == 1 && actor.id == 4 && actor.hp>0
  7. #然后计算威力
  8.         self.damage+=1111111
  9.     end ; end ; end  ; end
复制代码
学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
回复

使用道具 举报

梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
 楼主| 发表于 2016-2-19 17:03:22 | 显示全部楼层
本帖最后由 金芒芒 于 2016-2-19 17:05 编辑
jiushiainilip19 发表于 2016-2-19 15:57
没有 不过要判断合击要先判断角色
大概就是下面的方法 要用在战斗类脚本中


1号装备只能发挥1技能 +上2号装备就可以发挥3级技能+上3号装备就可以发挥5号技能,,跟天空的回路装备一样
回复

使用道具 举报

梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2016-2-19 21:22:03 | 显示全部楼层
你说的那些我都没玩过 所以不要用游戏说明要求
把你要求的效果说明白些就好 看我能不能帮你搞搞
如果只是发挥技能的话就直接判定角色有没有装备几号装备
if user.armor2_id == XXX #角色装备栏2的装备是什么  看你游戏设定来设定
power*=100 and power/=100
elsif user.armor2_id == XXX #通过elsif的方法可以不断的进行调整
power*=100 and power/=100
end #这个多少威力就自己设定
然后要看你的游戏是不是什么模式  是自动战斗模式还是说动模式
学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
回复

使用道具 举报

梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
 楼主| 发表于 2016-2-20 08:05:55 | 显示全部楼层
jiushiainilip19 发表于 2016-2-19 21:22
你说的那些我都没玩过 所以不要用游戏说明要求
把你要求的效果说明白些就好 看我能不能帮你搞搞
如果只是发 ...

我的游戏是自动战斗模式,你的这段脚本是我想要的,不过这段脚本应该放哪个脚本里呢大哥
回复

使用道具 举报

梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2016-2-20 16:07:11 | 显示全部楼层
本帖最后由 jiushiainilip19 于 2016-2-20 16:08 编辑
金芒芒 发表于 2016-2-20 08:05
我的游戏是自动战斗模式,你的这段脚本是我想要的,不过这段脚本应该放哪个脚本里呢大哥 ...


插入战斗类,不要插入到main前 我这里是写出来告诉你 你自己手动添加进去就好了  自动战斗的话要看你用的那个脚本
需要你自己在自动战斗脚本中添加释放技能几率的判定
我个人是使用技能冷却配合自动战斗 比如在某个状态下必定释放这个技能



  1. #==============================================================================
  2. # ■ Game_Battler (分割定义 3)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  5. # 超级类来使用。
  6. #==============================================================================

  7. class Game_Battler
  8.   #--------------------------------------------------------------------------
  9.   # ● 可以使用特技的判定
  10.   #     skill_id : 特技 ID
  11.   #--------------------------------------------------------------------------
  12.   def skill_can_use?(skill_id)
  13.     # SP 不足的情况下不能使用
  14.     if $data_skills[skill_id].sp_cost > self.sp
  15.       return false
  16.     end
  17.     # 战斗不能的情况下不能使用
  18.     if dead?
  19.       return false
  20.     end
  21.     # 沉默状态的情况下、物理特技以外的特技不能使用
  22.     if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
  23.       return false
  24.     end
  25.     # 获取可以使用的时机
  26.     occasion = $data_skills[skill_id].occasion
  27.     # 战斗中的情况下
  28.     if $game_temp.in_battle
  29.       # [平时] 或者是 [战斗中] 可以使用
  30.       return (occasion == 0 or occasion == 1)
  31.     # 不是战斗中的情况下
  32.     else
  33.       # [平时] 或者是 [菜单中] 可以使用
  34.       return (occasion == 0 or occasion == 2)
  35.     end
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 应用通常攻击效果
  39.   #     attacker : 攻击者 (battler)
  40.   #--------------------------------------------------------------------------
  41.   def attack_effect(attacker)
  42.     # 清除会心一击标志
  43.     self.critical = false
  44.     # 第一命中判定
  45.     hit_result = (rand(100) < attacker.hit)
  46.     # 命中的情况下
  47.     if hit_result == true
  48.       # 计算基本伤害
  49.       atk = [attacker.atk - self.pdef / 2, 0].max
  50.       self.damage = atk * (20 + attacker.str) / 20
  51.       
  52.       # 属性修正
  53.       self.damage *= elements_correct(attacker.element_set)
  54.       self.damage /= 100
  55.       # 伤害符号正确的情况下
  56.       if self.damage > 0
  57.         # 会心一击修正
  58.         if rand(100) < 4 * attacker.dex / self.agi
  59.           self.damage *= 2
  60.           self.critical = true
  61.         end
  62.         # 防御修正
  63.         if self.guarding?
  64.           self.damage /= 2
  65.         end
  66.       end
  67.       # 分散
  68.       if self.damage.abs > 0
  69.         amp = [self.damage.abs * 15 / 100, 1].max
  70.         self.damage += rand(amp+1) + rand(amp+1) - amp
  71.       end
  72.       # 第二命中判定
  73.       eva = 8 * self.agi / attacker.dex + self.eva
  74.       hit = self.damage < 0 ? 100 : 100 - eva
  75.       hit = self.cant_evade? ? 100 : hit
  76.       hit_result = (rand(100) < hit)
  77.     end
  78.     # 命中的情况下
  79.     if hit_result == true
  80.       # 状态冲击解除
  81.       remove_states_shock
  82.       # HP 的伤害计算
  83.       self.hp -= self.damage
  84.       # 状态变化
  85.       @state_changed = false
  86.       states_plus(attacker.plus_state_set)
  87.       states_minus(attacker.minus_state_set)
  88.     # Miss 的情况下
  89.     else
  90.       # 伤害设置为 "Miss"
  91.       self.damage = "Miss"
  92.       # 清除会心一击标志
  93.       self.critical = false
  94.     end
  95.     # 过程结束
  96.     return true
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 应用特技效果
  100.   #     user  : 特技的使用者 (battler)
  101.   #     skill : 特技
  102.   #--------------------------------------------------------------------------
  103.   def skill_effect(user, skill)
  104.     # 清除会心一击标志
  105.     self.critical = false
  106.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  107.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  108.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  109.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  110.       # 过程结束
  111.       return false
  112.     end
  113.     # 清除有效标志
  114.     effective = false
  115.     # 公共事件 ID 是有效的情况下,设置为有效标志
  116.     effective |= skill.common_event_id > 0
  117.     # 第一命中判定
  118.     hit = skill.hit
  119.     if skill.atk_f > 0
  120.       hit *= user.hit / 100
  121.     end
  122.     hit_result = (rand(100) < hit)
  123.     # 不确定的特技的情况下设置为有效标志
  124.     effective |= hit < 100
  125.     # 命中的情况下
  126.     if hit_result == true
  127.       # 计算威力
  128.       power = skill.power + user.atk * skill.atk_f / 100
  129.       if power > 0
  130.         power -= self.pdef * skill.pdef_f / 200
  131.         power -= self.mdef * skill.mdef_f / 200
  132.         power = [power, 0].max
  133.       end
  134.       
  135. ##############################################################      
  136. #   合击 需要 2 3号角色在队伍中由2号角色发动  指定威力
  137. #  如需要指定技能就添加 if skill.id == xx
  138. ##############################################################   
  139.         if user.is_a?(Game_Actor)
  140.         if [2,3].include?(user.id)
  141.         for actor in $game_party.actors
  142.          if user.id == 2 && actor.id == 3 && actor.hp>0
  143.           power*=190000000
  144.         end ; end ; end  ; end
  145. ##############################################################      
  146. #   合击 需要 2 3号角色在队伍中由2号角色发动  
  147. ##############################################################   
  148.             
  149.       
  150.       
  151.       # 计算倍率
  152.       rate = 20
  153.       rate += (user.str * skill.str_f / 100)
  154.       rate += (user.dex * skill.dex_f / 100)
  155.       rate += (user.agi * skill.agi_f / 100)
  156.       rate += (user.int * skill.int_f / 100)
  157.       # 计算基本伤害
  158.       self.damage = power * rate / 20
  159.       # 属性修正
  160.       self.damage *= elements_correct(skill.element_set)
  161.       self.damage /= 100
  162.       # 伤害符号正确的情况下
  163.       if self.damage > 0
  164.         # 防御修正
  165.         if self.guarding?
  166.           self.damage /= 2
  167.         end
  168.       end
  169.       
  170. ##############################################################      
  171. #   合击 需要 1 2号角色在队伍中由1号角色发动  指定伤害
  172. #  如需要指定技能就添加 if skill.id == xx
  173. ##############################################################   
  174.         if user.is_a?(Game_Actor)
  175.         if [1,2].include?(user.id)
  176.         for actor in $game_party.actors
  177.          if user.id == 1 && actor.id == 2 && actor.hp>0
  178.          if skill.id == 57 #########技能
  179.         self.damage+=1111111
  180.         end ; end ; end  ; end;end
  181. ##############################################################      
  182. #   合击 需要 1 2号角色在队伍中由1号角色发动  
  183. ##############################################################   
  184.       
  185.    



  186.       
  187.       # 分散
  188.       if skill.variance > 0 and self.damage.abs > 0
  189.         amp = [self.damage.abs * skill.variance / 100, 1].max
  190.         self.damage += rand(amp+1) + rand(amp+1) - amp
  191.       end
  192.       # 第二命中判定
  193.       eva = 8 * self.agi / user.dex + self.eva
  194.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  195.       hit = self.cant_evade? ? 100 : hit
  196.       hit_result = (rand(100) < hit)
  197.       # 不确定的特技的情况下设置为有效标志
  198.       effective |= hit < 100
  199.     end
  200.     # 命中的情况下
  201.     if hit_result == true
  202.       # 威力 0 以外的物理攻击的情况下
  203.       if skill.power != 0 and skill.atk_f > 0
  204.         # 状态冲击解除
  205.         remove_states_shock
  206.         # 设置有效标志
  207.         effective = true
  208.       end
  209.       # HP 的伤害减法运算
  210.       last_hp = self.hp
  211.       self.hp -= self.damage
  212.       effective |= self.hp != last_hp
  213.       # 状态变化
  214.       @state_changed = false
  215.       effective |= states_plus(skill.plus_state_set)
  216.       effective |= states_minus(skill.minus_state_set)
  217.       # 威力为 0 的场合
  218.       if skill.power == 0
  219.         # 伤害设置为空的字串
  220.         self.damage = ""
  221.         # 状态没有变化的情况下
  222.         unless @state_changed
  223.           # 伤害设置为 "Miss"
  224.           self.damage = "Miss"
  225.         end
  226.       end
  227.     # Miss 的情况下
  228.     else
  229.       # 伤害设置为 "Miss"
  230.       self.damage = "Miss"
  231.     end
  232.     # 不在战斗中的情况下
  233.     unless $game_temp.in_battle
  234.       # 伤害设置为 nil
  235.       self.damage = nil
  236.     end
  237.     # 过程结束
  238.     return effective
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 应用物品效果
  242.   #     item : 物品
  243.   #--------------------------------------------------------------------------
  244.   def item_effect(item)
  245.     # 清除会心一击标志
  246.     self.critical = false
  247.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  248.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  249.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  250.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  251.       # 过程结束
  252.       return false
  253.     end
  254.     # 清除有效标志
  255.     effective = false
  256.     # 公共事件 ID 是有效的情况下,设置为有效标志
  257.     effective |= item.common_event_id > 0
  258.     # 命中判定
  259.     hit_result = (rand(100) < item.hit)
  260.     # 不确定的特技的情况下设置为有效标志
  261.     effective |= item.hit < 100
  262.     # 命中的情况
  263.     if hit_result == true
  264.       # 计算回复量
  265.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  266.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  267.       if recover_hp < 0
  268.         recover_hp += self.pdef * item.pdef_f / 20
  269.         recover_hp += self.mdef * item.mdef_f / 20
  270.         recover_hp = [recover_hp, 0].min
  271.       end
  272.       # 属性修正
  273.       recover_hp *= elements_correct(item.element_set)
  274.       recover_hp /= 100
  275.       recover_sp *= elements_correct(item.element_set)
  276.       recover_sp /= 100
  277.       # 分散
  278.       if item.variance > 0 and recover_hp.abs > 0
  279.         amp = [recover_hp.abs * item.variance / 100, 1].max
  280.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  281.       end
  282.       if item.variance > 0 and recover_sp.abs > 0
  283.         amp = [recover_sp.abs * item.variance / 100, 1].max
  284.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  285.       end
  286.       # 回复量符号为负的情况下
  287.       if recover_hp < 0
  288.         # 防御修正
  289.         if self.guarding?
  290.           recover_hp /= 2
  291.         end
  292.       end
  293.       # HP 回复量符号的反转、设置伤害值
  294.       self.damage = -recover_hp
  295.       # HP 以及 SP 的回复
  296.       last_hp = self.hp
  297.       last_sp = self.sp
  298.       self.hp += recover_hp
  299.       self.sp += recover_sp
  300.       effective |= self.hp != last_hp
  301.       effective |= self.sp != last_sp
  302.       # 状态变化
  303.       @state_changed = false
  304.       effective |= states_plus(item.plus_state_set)
  305.       effective |= states_minus(item.minus_state_set)
  306.       # 能力上升值有效的情况下
  307.       if item.parameter_type > 0 and item.parameter_points != 0
  308.         # 能力值的分支
  309.         case item.parameter_type
  310.         when 1  # MaxHP
  311.           @maxhp_plus += item.parameter_points
  312.         when 2  # MaxSP
  313.           @maxsp_plus += item.parameter_points
  314.         when 3  # 力量
  315.           @str_plus += item.parameter_points
  316.         when 4  # 灵巧
  317.           @dex_plus += item.parameter_points
  318.         when 5  # 速度
  319.           @agi_plus += item.parameter_points
  320.         when 6  # 魔力
  321.           @int_plus += item.parameter_points
  322.         end
  323.         # 设置有效标志
  324.         effective = true
  325.       end
  326.       # HP 回复率与回复量为 0 的情况下
  327.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  328.         # 设置伤害为空的字符串
  329.         self.damage = ""
  330.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  331.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  332.            (item.parameter_type == 0 or item.parameter_points == 0)
  333.           # 状态没有变化的情况下
  334.           unless @state_changed
  335.             # 伤害设置为 "Miss"
  336.             self.damage = "Miss"
  337.           end
  338.         end
  339.       end
  340.     # Miss 的情况下
  341.     else
  342.       # 伤害设置为 "Miss"
  343.       self.damage = "Miss"
  344.     end
  345.     # 不在战斗中的情况下
  346.     unless $game_temp.in_battle
  347.       # 伤害设置为 nil
  348.       self.damage = nil
  349.     end
  350.     # 过程结束
  351.     return effective
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 应用连续伤害效果
  355.   #--------------------------------------------------------------------------
  356.   def slip_damage_effect
  357.     # 设置伤害
  358.     self.damage = self.maxhp / 10
  359.     # 分散
  360.     if self.damage.abs > 0
  361.       amp = [self.damage.abs * 15 / 100, 1].max
  362.       self.damage += rand(amp+1) + rand(amp+1) - amp
  363.     end
  364.     # HP 的伤害减法运算
  365.     self.hp -= self.damage
  366.     # 过程结束
  367.     return true
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● 属性修正计算
  371.   #     element_set : 属性
  372.   #--------------------------------------------------------------------------
  373.   def elements_correct(element_set)
  374.     # 无属性的情况
  375.     if element_set == []
  376.       # 返回 100
  377.       return 100
  378.     end
  379.     # 在被赋予的属性中返回最弱的
  380.     # ※过程 element_rate 是、本类以及继承的 Game_Actor
  381.     #   和 Game_Enemy 类的定义
  382.     weakest = -100
  383.     for i in element_set
  384.       weakest = [weakest, self.element_rate(i)].max
  385.     end
  386.     return weakest
  387.   end
  388. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
回复

使用道具 举报

梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
 楼主| 发表于 2016-2-20 16:21:46 | 显示全部楼层
jiushiainilip19 发表于 2016-2-20 16:07
插入战斗类,不要插入到main前 我这里是写出来告诉你 你自己手动添加进去就好了  自动战斗的话要看你用的 ...

谢了,大神在人间
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部