查看: 965|回复: 6

[有事请教] 请问镜子类的反弹伤害技能怎么做呢?

[复制链接]
梦石
0
星屑
377
在线时间
125 小时
注册时间
2023-1-19
回帖
41
发表于 2024-6-2 17:00:54 | 显示全部楼层 |阅读模式
悬赏20星屑已解决
就是类似镜子精灵一类的技能,能反弹一次伤害,不管物理还是魔法伤害都能100%反弹,而且被攻击的人不会受任何伤害。用状态核心怎么写呢?

最佳答案

查看完整内容

// The number of hits before the effect wears off. user._KyrieHits = 1; // Make sure _KyrieHits is a valid finite number. user._KyrieHits = Math.max(user._KyrieHits, 0); // Check to see if any HP damage is dealt. if (value > 0 && (this.isPhysical() || this.isMagical())) { target._KyrieHits -= 1; // Store the original damage value. var originalDamage = value; // Sets the Recoi ...
梦石
0
星屑
658
在线时间
49 小时
注册时间
2022-12-28
回帖
10
发表于 2024-6-2 17:00:55 | 显示全部楼层
haohaoniu 发表于 2024-6-3 14:50
这个好像不能只挡一次就消失,看来只能把伤害从0调成1之后再设置受伤时解除了 ...


<Custom Apply Effect>
  // The number of hits before the effect wears off.
  user._KyrieHits = 1;
  // Make sure _KyrieHits is a valid finite number.
  user._KyrieHits = Math.max(user._KyrieHits, 0);
</Custom Apply Effect>

<Custom React Effect>
// Check to see if any HP damage is dealt.
if (value > 0 && (this.isPhysical() || this.isMagical())) {
  target._KyrieHits -= 1;
  // Store the original damage value.
  var originalDamage = value;
  // Sets the Recoil Rate to 100%.
  var rate = 1.0;
  // Determines the amount of recoil damage dealt.
  var recoil = originalDamage * rate;
  // Rounds up the recoil damage.
  var dmg = Math.ceil(recoil);
  // Makes the attacker lose damage equal to the dmg variable.
  user.gainHp(-1 * dmg);
  // Check to see if the attacker is dead.
  if (user.isDead()) {
    // If the attacker is dead, make it collapse.
    user.performCollapse();
  }
  // Set the target's received damage to 0.
  value = 0;
  
  // Reduce the _KyrieHits counter by 1.
  if (target._KyrieHits <= 0) {
    // Then remove the state.
    target.removeState(stateId);
  }
}
</Custom React Effect>

<Custom Remove Effect>
  // Reset the number of hits to expire the effect.
  user._KyrieHits = 0;
</Custom Remove Effect>

这样也能无伤挡一次
回复

使用道具 举报

梦石
0
星屑
10274
在线时间
1919 小时
注册时间
2020-1-2
回帖
1043
发表于 2024-6-2 22:59:30 | 显示全部楼层
用YEP_buff&statescore   这是LOL反甲效果你可以参考一下
B站没人气的夏目漠漠,直播间:5378938实用插件教程点击红字传送
回复

使用道具 举报

梦石
0
星屑
658
在线时间
49 小时
注册时间
2022-12-28
回帖
10
发表于 2024-6-3 04:52:26 | 显示全部楼层
本帖最后由 Z8K 于 2024-6-3 04:54 编辑

<Custom React Effect>
// Check to see if any HP damage is dealt.
if (value > 0 && (this.isPhysical() || this.isMagical())) {
  // Store the original damage value.
  var originalDamage = value;
  // Sets the Recoil Rate to 100%.
  var rate = 1.0;
  // Determines the amount of recoil damage dealt.
  var recoil = originalDamage * rate;
  // Rounds up the recoil damage.
  var dmg = Math.ceil(recoil);
  // Makes the attacker lose damage equal to the dmg variable.
  user.gainHp(-1 * dmg);
  // Check to see if the attacker is dead.
  if (user.isDead()) {
    // If the attacker is dead, make it collapse.
    user.performCollapse();
  }
  // Set the target's received damage to 0.
  value = 0;
}
</Custom React Effect>

这样就可以了 只是如果要有反弹动画好像就不行

範例:https://imgur.com/5dpDLGe
回复

使用道具 举报

梦石
0
星屑
377
在线时间
125 小时
注册时间
2023-1-19
回帖
41
 楼主| 发表于 2024-6-3 14:50:14 | 显示全部楼层
Z8K 发表于 2024-6-3 04:52
// Check to see if any HP damage is dealt.
if (value > 0 && (this.isPhysical() || this.isMagical()) ...

这个好像不能只挡一次就消失,看来只能把伤害从0调成1之后再设置受伤时解除了
回复

使用道具 举报

梦石
0
星屑
377
在线时间
125 小时
注册时间
2023-1-19
回帖
41
 楼主| 发表于 2024-6-3 21:59:47 | 显示全部楼层
xiamumomo 发表于 2024-6-2 22:59
用YEP_buff&statescore   这是LOL反甲效果你可以参考一下

谢谢帮忙,反伤甲我会写,但是我想要的是镜反那种效果
回复

使用道具 举报

梦石
0
星屑
377
在线时间
125 小时
注册时间
2023-1-19
回帖
41
 楼主| 发表于 2024-6-3 22:01:23 | 显示全部楼层
Z8K 发表于 2024-6-2 17:00
// The number of hits before the effect wears off.
  user._KyrieHits = 1;
  // Make sure _Kyrie ...

感谢,动画我再试试行不行
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部