Project1

标题: 问下该脚本怎么写 [打印本页]

作者: cZooCz    时间: 2008-4-6 06:56
标题: 问下该脚本怎么写
关于战斗
if 角色id 攻击某敌人的情况下
  被攻击者??%附加状态id
end
也就是说我方某角色攻击敌人的话·有一定几率给被攻击敌人附加某状态. [LINE]1,#dddddd[/LINE]此贴于 2008-4-13 1:00:13 被版主水迭澜提醒,请楼主看到后对本贴做出回应。 [LINE]1,#dddddd[/LINE]本贴由论坛斑竹禾西结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
作者: 魔影    时间: 2008-4-6 09:13
      if attacker.is_a?(Game_Actor) and attacker.id == 1
        if rand(100) < 50
         add_state(1)
        end
      end



在Game_Battler 3下修改测试OK
  #--------------------------------------------------------------------------
  # ● 应用通常攻击效果
  #     attacker : 攻击者 (battler)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # 清除会心一击标志
    self.critical = false
    # 第一命中判定
    hit_result = (rand(100) < attacker.hit)
    # 命中的情况下
    if hit_result == true
      # 计算基本伤害
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      # 属性修正
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # 伤害符号正确的情况下
      if self.damage > 0
        # 会心一击修正
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        # 防御修正
        if self.guarding?
          self.damage /= 2
        end
      end
      # 分散
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # 命中的情况下
    if hit_result == true
      # 状态冲击解除
      remove_states_shock
      # HP 的伤害计算
      self.hp -= self.damage
      # 状态变化
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
      
      if attacker.is_a?(Game_Actor) and attacker.id == 1
        if rand(100) < 50
         add_state(1)
        end
      end

      
    # Miss 的情况下
    else
      # 伤害设置为 "Miss"
      self.damage = "Miss"
      # 清除会心一击标志
      self.critical = false
    end
    # 过程结束
    return true
  end

作者: cZooCz    时间: 2008-4-6 09:37
经测试···没效果···脚本好像没一句有关被攻击敌人{/gg}
作者: 魔影    时间: 2008-4-6 09:59
是否新定义了Game_Battler
作者: 禾西    时间: 2008-4-6 10:02
只有一半的機率,遇不上也很正常。

這裏關於畀攻擊者的語句是:

self.
作者: 魔影    时间: 2008-4-6 10:04
      if attacker.is_a?(Game_Actor) and attacker.id == 1
        if rand(100) < 50 and self.id == 2   #特定ID敌人
         add_state(3)
        end
      end

也可以这样
作者: cZooCz    时间: 2008-4-6 10:40
不要特定的···因为没个敌人都可能被附加···
还有我是在新工程里测试的···命中率调到了99还是没效果
作者: cZooCz    时间: 2008-4-7 21:18
顶贴~~~咦人捏
作者: 魔影    时间: 2008-4-7 23:12
在新工程里我十分肯定确定是可以的。       至于你 说新工程都不行 我只能怀疑你的使用方式或变通能力了




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