设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1875|回复: 4
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
224
在线时间
207 小时
注册时间
2013-3-6
帖子
49
跳转到指定楼层
1
发表于 2013-5-7 16:32:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

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

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


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

点评

靠~~~~,现在才发现,给自己人治疗,也会反射。若不想保留该功能,请 @  发表于 2013-5-11 01:22
欢迎光临我的网店,专卖枕头滴:http://shengfudaosl.tmall.com/

Lv5.捕梦者

梦石
0
星屑
31989
在线时间
5081 小时
注册时间
2012-11-19
帖子
4877

开拓者

2
发表于 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 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
31989
在线时间
5081 小时
注册时间
2012-11-19
帖子
4877

开拓者

4
发表于 2013-5-11 23:14:09 | 只看该作者
用以下脚本替换原脚本


RUBY 代码复制
  1. #==============================================================================
  2. # 伤害反射的状态 ID
  3. REFLECT_STATE = 17
  4. #==============================================================================
  5. class Scene_Battle
  6.   def update_phase4_step5
  7.     # 隐藏帮助窗口
  8.     @help_window.visible = false
  9.     # 刷新状态窗口
  10.     @status_window.refresh
  11.     # 显示伤害
  12.     for target in @target_battlers
  13.       if target.damage != nil
  14.         target.damage_pop = true
  15.       end
  16.     end
  17.     if @active_battler.is_a?(Game_Enemy)
  18.       for enemy in $game_troop.enemies
  19.         if enemy.exist? and enemy.damage != nil
  20.           enemy.damage_pop = true
  21.         end
  22.       end
  23.     end
  24.     if @active_battler.is_a?(Game_Actor)
  25.       for actor in $game_party.actors
  26.         if actor.exist? and actor.damage != nil
  27.           actor.damage_pop = true
  28.         end
  29.       end
  30.     end
  31.     # 移至步骤 6
  32.     @phase4_step = 6
  33.   end
  34. end
  35. #==============================================================================
  36. class Game_Battler
  37. #--------------------------------------------------------------------------
  38.   def attack_effect(attacker)
  39.     # 清除会心一击标志
  40.     self.critical = false
  41.     # 第一命中判定
  42.     hit_result = (rand(100) < attacker.hit)
  43.     # 命中的情况下
  44.     if hit_result == true
  45.       # 计算基本伤害
  46.       atk = [attacker.atk - self.pdef / 2, 0].max
  47.       self.damage = atk * (20 + attacker.str) / 20
  48.       # 属性修正
  49.       self.damage *= elements_correct(attacker.element_set)
  50.       self.damage /= 100
  51.       # 伤害符号正确的情况下
  52.       if self.damage > 0
  53.         # 会心一击修正
  54.         if rand(100) < 4 * attacker.dex / self.agi
  55.           self.damage *= 2
  56.           self.critical = true
  57.         end
  58.         # 防御修正
  59.         if self.guarding?
  60.           self.damage /= 2
  61.         end
  62.       end
  63.       # 分散
  64.       if self.damage.abs > 0
  65.         amp = [self.damage.abs * 15 / 100, 1].max
  66.         self.damage += rand(amp+1) + rand(amp+1) - amp
  67.       end
  68.       # 第二命中判定
  69.       eva = 8 * self.agi / attacker.dex + self.eva
  70.       hit = self.damage < 0 ? 100 : 100 - eva
  71.       hit = self.cant_evade? ? 100 : hit
  72.       hit_result = (rand(100) < hit)
  73.     end
  74.     # 命中的情况下
  75.     if hit_result == true
  76.       # 状态冲击解除
  77.       remove_states_shock
  78.       # HP 的伤害计算
  79.       self.hp -= self.damage
  80.       if self.state?(REFLECT_STATE)
  81.         if attacker.hp > 1
  82.           if attacker.hp <= self.damage
  83.             attacker.damage = attacker.hp - 1
  84.           else
  85.             attacker.damage = self.damage
  86.           end
  87.           attacker.hp -= attacker.damage
  88.         else
  89.           attacker.damage = 0
  90.         end
  91.       end
  92.       # 状态变化
  93.       @state_changed = false
  94.       states_plus(attacker.plus_state_set)
  95.       states_minus(attacker.minus_state_set)
  96.     # Miss 的情况下
  97.     else
  98.       # 伤害设置为 "Miss"
  99.       self.damage = "Miss"
  100.       # 清除会心一击标志
  101.       self.critical = false
  102.     end
  103.     # 过程结束
  104.     return true
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 应用特技效果
  108.   #     user  : 特技的使用者 (battler)
  109.   #     skill : 特技
  110.   #--------------------------------------------------------------------------
  111.   def skill_effect(user, skill)
  112.     # 清除会心一击标志
  113.     self.critical = false
  114.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  115.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  116.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  117.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  118.       # 过程结束
  119.       return false
  120.     end
  121.     # 清除有效标志
  122.     effective = false
  123.     # 公共事件 ID 是有效的情况下,设置为有效标志
  124.     effective |= skill.common_event_id > 0
  125.     # 第一命中判定
  126.     hit = skill.hit
  127.     if skill.atk_f > 0
  128.       hit *= user.hit / 100
  129.     end
  130.     hit_result = (rand(100) < hit)
  131.     # 不确定的特技的情况下设置为有效标志
  132.     effective |= hit < 100
  133.     # 命中的情况下
  134.     if hit_result == true
  135.       # 计算威力
  136.       power = skill.power + user.atk * skill.atk_f / 100
  137.       if power > 0
  138.         power -= self.pdef * skill.pdef_f / 200
  139.         power -= self.mdef * skill.mdef_f / 200
  140.         power = [power, 0].max
  141.       end
  142.       # 计算倍率
  143.       rate = 20
  144.       rate += (user.str * skill.str_f / 100)
  145.       rate += (user.dex * skill.dex_f / 100)
  146.       rate += (user.agi * skill.agi_f / 100)
  147.       rate += (user.int * skill.int_f / 100)
  148.       # 计算基本伤害
  149.       self.damage = power * rate / 20
  150.       # 属性修正
  151.       self.damage *= elements_correct(skill.element_set)
  152.       self.damage /= 100
  153.       # 伤害符号正确的情况下
  154.       if self.damage > 0
  155.         # 防御修正
  156.         if self.guarding?
  157.           self.damage /= 2
  158.         end
  159.       end
  160.       # 分散
  161.       if skill.variance > 0 and self.damage.abs > 0
  162.         amp = [self.damage.abs * skill.variance / 100, 1].max
  163.         self.damage += rand(amp+1) + rand(amp+1) - amp
  164.       end
  165.       # 第二命中判定
  166.       eva = 8 * self.agi / user.dex + self.eva
  167.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  168.       hit = self.cant_evade? ? 100 : hit
  169.       hit_result = (rand(100) < hit)
  170.       # 不确定的特技的情况下设置为有效标志
  171.       effective |= hit < 100
  172.     end
  173.     # 命中的情况下
  174.     if hit_result == true
  175.       # 威力 0 以外的物理攻击的情况下
  176.       if skill.power != 0 and skill.atk_f > 0
  177.         # 状态冲击解除
  178.         remove_states_shock
  179.         # 设置有效标志
  180.         effective = true
  181.       end
  182.       # HP 的伤害减法运算
  183.       last_hp = self.hp
  184.       self.hp -= self.damage
  185.       if self.state?(REFLECT_STATE) and user != self
  186.         if user.hp > 1
  187.           if user.hp <= self.damage
  188.             user.damage = user.hp - 1
  189.           else
  190.             user.damage = self.damage
  191.           end
  192.           user.hp -= user.damage
  193.         else
  194.           user.damage = 0
  195.         end
  196.       end
  197.       effective |= self.hp != last_hp
  198.       # 状态变化
  199.       @state_changed = false
  200.       effective |= states_plus(skill.plus_state_set)
  201.       effective |= states_minus(skill.minus_state_set)
  202.       # 威力为 0 的场合
  203.       if skill.power == 0
  204.         # 伤害设置为空的字串
  205.         self.damage = ""
  206.         # 状态没有变化的情况下
  207.         unless @state_changed
  208.           # 伤害设置为 "Miss"
  209.           self.damage = "Miss"
  210.         end
  211.       end
  212.     # Miss 的情况下
  213.     else
  214.       # 伤害设置为 "Miss"
  215.       self.damage = "Miss"
  216.     end
  217.     # 不在战斗中的情况下
  218.     unless $game_temp.in_battle
  219.       # 伤害设置为 nil
  220.       self.damage = nil
  221.     end
  222.     # 过程结束
  223.     return effective
  224.   end
  225. end
  226. #==============================================================================

点评

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

评分

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

查看全部评分

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-3 10:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表