查看: 2498|回复: 4

[已经解决] 请教一个技能制作的问题

[复制链接]
梦石
0
星屑
224
在线时间
207 小时
注册时间
2013-3-6
回帖
40
发表于 2013-5-7 16:32:01 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 tangyechen 于 2013-5-10 11:10 编辑

我想做一个技能,类似于轩辕剑天之痕 陈靖仇的“移花接木”技能

就是A角色使用了这个技能后,反弹受到的所有伤害(包括物理攻击和特技),但是自身依然会受到伤害!

求教这样的技能应该如何做?


再通俗点:
A发动 移花接木
B对A攻击(或使用特技)
A受到100点伤害
B也受到100点伤害

点评

靠~~~~,现在才发现,给自己人治疗,也会反射。若不想保留该功能,请 @  发表于 2013-5-11 01:22
欢迎光临我的网店,专卖枕头滴:http://shengfudaosl.tmall.com/
梦石
0
星屑
34464
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2013-5-9 01:22:09 | 显示全部楼层
本帖最后由 芯☆淡茹水 于 2013-5-9 01:25 编辑

唔~,做了个伤害反射,是状态,不是特技。

特技的话可附加该反射状态。反射状态设置为  不能抵抗。

该反射状态至少给攻击方保留 1 滴血,也就是不会直接反射死亡

以下工程已设置好,可直接测试。   若有问题,请 @

Project1.rar (262.3 KB, 下载次数: 41)

点评

谢谢,我下载看下  发表于 2013-5-9 12:51

评分

参与人数 1星屑 +60 收起 理由
明特·布兰马修 + 60 认可答案

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
224
在线时间
207 小时
注册时间
2013-3-6
回帖
40
 楼主| 发表于 2013-5-11 20:05:47 | 显示全部楼层
芯☆淡茹水 发表于 2013-5-9 01:22
唔~,做了个伤害反射,是状态,不是特技。

特技的话可附加该反射状态。反射状态设置为  不能抵抗。

发现了一个问题,在使用了移花接木特技后,若给主角施放或解除“状态”类魔法,就会弹出错误对话框。 QQ截图20130511200117.jpg   @芯☆淡茹水
欢迎光临我的网店,专卖枕头滴:http://shengfudaosl.tmall.com/
回复

使用道具 举报

梦石
0
星屑
34464
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2013-5-11 23:14:09 | 显示全部楼层
用以下脚本替换原脚本


[pre lang="ruby" line="1"]#==============================================================================
# 伤害反射的状态 ID
REFLECT_STATE = 17
#==============================================================================
class Scene_Battle
  def update_phase4_step5
    # 隐藏帮助窗口
    @help_window.visible = false
    # 刷新状态窗口
    @status_window.refresh
    # 显示伤害
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
      end
    end
    if @active_battler.is_a?(Game_Enemy)
      for enemy in $game_troop.enemies
        if enemy.exist? and enemy.damage != nil
          enemy.damage_pop = true
        end
      end
    end
    if @active_battler.is_a?(Game_Actor)
      for actor in $game_party.actors
        if actor.exist? and actor.damage != nil
          actor.damage_pop = true
        end
      end
    end
    # 移至步骤 6
    @phase4_step = 6
  end
end
#==============================================================================
class Game_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
      if self.state?(REFLECT_STATE)
        if attacker.hp > 1
          if attacker.hp <= self.damage
            attacker.damage = attacker.hp - 1
          else
            attacker.damage = self.damage
          end
          attacker.hp -= attacker.damage
        else
          attacker.damage = 0
        end
      end
      # 状态变化
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # Miss 的情况下
    else
      # 伤害设置为 "Miss"
      self.damage = "Miss"
      # 清除会心一击标志
      self.critical = false
    end
    # 过程结束
    return true
  end
  #--------------------------------------------------------------------------
  # ● 应用特技效果
  #     user  : 特技的使用者 (battler)
  #     skill : 特技
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # 清除会心一击标志
    self.critical = false
    # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
    # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # 过程结束
      return false
    end
    # 清除有效标志
    effective = false
    # 公共事件 ID 是有效的情况下,设置为有效标志
    effective |= skill.common_event_id > 0
    # 第一命中判定
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # 不确定的特技的情况下设置为有效标志
    effective |= hit < 100
    # 命中的情况下
    if hit_result == true
      # 计算威力
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # 计算倍率
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      # 计算基本伤害
      self.damage = power * rate / 20
      # 属性修正
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # 伤害符号正确的情况下
      if self.damage > 0
        # 防御修正
        if self.guarding?
          self.damage /= 2
        end
      end
      # 分散
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # 不确定的特技的情况下设置为有效标志
      effective |= hit < 100
    end
    # 命中的情况下
    if hit_result == true
      # 威力 0 以外的物理攻击的情况下
      if skill.power != 0 and skill.atk_f > 0
        # 状态冲击解除
        remove_states_shock
        # 设置有效标志
        effective = true
      end
      # HP 的伤害减法运算
      last_hp = self.hp
      self.hp -= self.damage
      if self.state?(REFLECT_STATE) and user != self
        if user.hp > 1
          if user.hp <= self.damage
            user.damage = user.hp - 1
          else
            user.damage = self.damage
          end
          user.hp -= user.damage
        else
          user.damage = 0
        end
      end
      effective |= self.hp != last_hp
      # 状态变化
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      # 威力为 0 的场合
      if skill.power == 0
        # 伤害设置为空的字串
        self.damage = ""
        # 状态没有变化的情况下
        unless @state_changed
          # 伤害设置为 "Miss"
          self.damage = "Miss"
        end
      end
    # Miss 的情况下
    else
      # 伤害设置为 "Miss"
      self.damage = "Miss"
    end
    # 不在战斗中的情况下
    unless $game_temp.in_battle
      # 伤害设置为 nil
      self.damage = nil
    end
    # 过程结束
    return effective
  end
end
#==============================================================================[/pre]

点评

ok 没问题了 多谢~!  发表于 2013-5-14 10:58

评分

参与人数 1星屑 +8 收起 理由
明特·布兰马修 + 8 塞糖

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部