Project1

标题: 关于插件Visu Skills States Core的问题(已解决) [打印本页]

作者: catxiaolang    时间: 2023-8-5 21:56
标题: 关于插件Visu Skills States Core的问题(已解决)
本帖最后由 catxiaolang 于 2023-8-6 13:02 编辑

来自Visu Skills States Core 的一个功能,可以在状态消失时执行一些东西

原文如下:

<JS On Erase State> code code </JS On Erase State>

Used for: State Notetags
When a state is erased, run the code added by this notetag.
The 'user' variable refers to the current active battler.
The 'target' variable refers to the battler affected by this state.
The 'origin' variable refers to the one who applied this state.
The 'state' variable refers to the current state being affected.

由于不懂代码,
我试着让GPT-4帮忙解释了一下它的意思,
并设计了一个DEBUFF技能让它实现,以便理解。
于是整出了这个:


技能:延迟爆炸
给敌方单体埋入一颗定时炸弹,2回合后爆炸,对敌方全体造成施法者150%法术攻击力的伤害。


于是制作了一个持续2回合的状态,下面是GPT给出的代码,把它粘贴在状态备注里:

<JS On Erase State>
  const damageMultiplier = 1.5; // 伤害倍率,150%为1.5
  const spellPower = origin.mat; // 获取状态来源的法术攻击力
  const damage = Math.floor(spellPower * damageMultiplier); // 计算伤害值

  const allies = target.friendsUnit().members(); // 获取状态目标的所有队友
  allies.forEach(function(actor) {
    actor.gainHp(-damage); // 对每个队友造成伤害
  });
</JS On Erase State>


定时炸弹的基本功能还是能顺利执行的,
但是衍生了新的问题:

1.敌人受到伤害时没有飙数字;
2.受到这个伤害而死亡的敌人图像不会消失,而是和它的空血条一起残留在场上;
3.不知如何给这个爆炸赋予音效和动画特效

求教各位大佬了

===编辑===

已解决,让GPT-4添加了缺失的代码就可以了




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