Project1

标题: 请问如何做这个技能? [打印本页]

作者: 梦幻之旅    时间: 2012-4-4 21:07
标题: 请问如何做这个技能?
比如说,敌人把伤害打过来时自己自动使用这个技能,让伤害让别的同伴承受或者反弹给敌人?
是否要脚本?dsu_plus_rewardpost_czw
作者: kangxi0109    时间: 2012-4-4 22:48
本帖最后由 kangxi0109 于 2012-4-4 23:05 编辑

要脚本。另外,敌人攻击的时候我方是不能使用技能的,因为这是回合制的游戏,你说的是被动技能吧。
修改Game_Battler 3:
  1.   #--------------------------------------------------------------------------
  2.   # ● 应用通常攻击效果
  3.   #     attacker : 攻击者 (battler)
  4.   #--------------------------------------------------------------------------
  5.   def attack_effect(attacker)
  6.     # 清除会心一击标志
  7.     self.critical = false
  8.     # 第一命中判定
  9.     hit_result = (rand(100) < attacker.hit)
  10.     # 命中的情况下
  11.     if hit_result == true
  12.       # 计算基本伤害
  13.       atk = [attacker.atk - self.pdef / 2, 0].max
  14.       self.damage = atk * (20 + attacker.str) / 20
  15.       # 属性修正
  16.       self.damage *= elements_correct(attacker.element_set)
  17.       self.damage /= 100
  18.       # 伤害符号正确的情况下
  19.       if self.damage > 0
  20.         # 会心一击修正
  21.         if rand(100) < 4 * attacker.dex / self.agi
  22.           self.damage *= 2
  23.           self.critical = true
  24.         end
  25.         # 防御修正
  26.         if self.guarding?
  27.           self.damage /= 2
  28.         end
  29.       end
  30.       # 分散
  31.       if self.damage.abs > 0
  32.         amp = [self.damage.abs * 15 / 100, 1].max
  33.         self.damage += rand(amp+1) + rand(amp+1) - amp
  34.       end
  35.       # 第二命中判定
  36.       eva = 8 * self.agi / attacker.dex + self.eva
  37.       hit = self.damage < 0 ? 100 : 100 - eva
  38.       hit = self.cant_evade? ? 100 : hit
  39.       hit_result = (rand(100) < hit)
  40.     end
  41.     # 命中的情况下
  42.     if hit_result == true
  43.       # 状态冲击解除
  44.       remove_states_shock
  45.       # HP 的伤害计算
  46.       #-------------------
  47.       #==========================================================================
  48.       #若果攻击方学会1号技能的场合,受到普通攻击带有反射效果。
  49.       if attacker.is_a?(Game_Enemy)#攻击方为敌人的场合
  50.         if self.skills.include?(1)
  51.                 attacker.hp -= self.damage/2#敌人分担伤害值一半
  52.                 self.damage = self.damage/2#角色伤害降低一半
  53.       end
  54.          end
  55.       #==========================================================================
  56.       self.hp -= self.damage
复制代码

作者: YeYe.    时间: 2012-4-4 23:28


敌人的技能设置一个开关,概率调到最高,然后主角技能攻击带公共事件 打开XX开关




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1