查看: 2309|回复: 2

[有事请教] 如何实现 角色攻击时获得被攻击者的id

[复制链接]
梦石
0
星屑
86
在线时间
27 小时
注册时间
2021-8-12
回帖
1
发表于 2021-10-3 18:09:04 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 2587553182 于 2021-10-3 18:10 编辑

如题,想做一个抓捕怪物的脚本。
梦石
0
星屑
2866
在线时间
446 小时
注册时间
2016-9-26
回帖
1175
发表于 2021-10-3 19:05:05 | 显示全部楼层
赋予状态,
判断谁有状态则捕捉谁(本方法若存在复活技能等可针对死者的技能会有bug)
回复

使用道具 举报

梦石
0
星屑
6379
在线时间
608 小时
注册时间
2017-9-27
回帖
205
发表于 2021-10-3 23:26:53 | 显示全部楼层
Game_Action.prototype.makeDamageValue = function(target, critical) {
    var item = this.item();
    var baseValue = this.evalDamageFormula(target);
    var value = baseValue * this.calcElementRate(target);
    $gameVariables.setValue(1,target._actorId);//1号变量代入目标ID
    if (this.isPhysical()) {
        value *= target.pdr;
    }
    if (this.isMagical()) {
        value *= target.mdr;
    }
    if (baseValue < 0) {
        value *= target.rec;
    }
    if (critical) {
        value = this.applyCritical(value);
    }
    value = this.applyVariance(value, item.damage.variance);
    value = this.applyGuard(value, target);
    value = Math.round(value);
    return value;
};
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部