查看: 2938|回复: 2

[有事请教] 战斗中如何获取所选敌人ID?(已解决)

[复制链接]
梦石
0
星屑
398
在线时间
46 小时
注册时间
2021-8-1
回帖
1
发表于 2021-8-14 11:58:04 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 lty184 于 2021-8-15 13:49 编辑

最终需求是,在对敌人使用物品的时候,获取所选敌人的ID...

求指教~
梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-15 00:57:06 | 显示全部楼层
[pre lang="js"]Game_Action.prototype.apply = function(target) {
    const result = target.result();
    this.subject().clearResult();
    result.clear();
    result.used = this.testApply(target);
    result.missed = result.used && Math.random() >= this.itemHit(target);
    result.evaded = !result.missed && Math.random() < this.itemEva(target);
    result.physical = this.isPhysical();
    result.drain = this.isDrain();
    if (result.isHit()) {
        if (this.item().damage.type > 0) {
            result.critical = Math.random() < this.itemCri(target);
            const value = this.makeDamageValue(target, result.critical);
            this.executeDamage(target, value);
        }
        for (const effect of this.item().effects) {
            this.applyItemEffect(target, effect);
        }
        this.applyItemUserEffect(target);
    }
    this.updateLastTarget(target);
};[/pre]

里面的target就是敌人的基本数据 target._enemyId 就能看到他的ID了, 你想测试的话可以在 const result = target.result();上面 加上console.log(target._enemyId)
但是敌人跟角色的ID是不一样的 相同的敌人公用相同的ID 所以你会看到敌人名字出会出现A,B,C..
你可以在rmmz_objects 里面找到
回复 1 0

使用道具 举报

梦石
0
星屑
398
在线时间
46 小时
注册时间
2021-8-1
回帖
1
 楼主| 发表于 2021-8-15 13:49:04 | 显示全部楼层
MH-Pride 发表于 2021-8-15 00:57
Game_Action.prototype.apply = function(target) {
    const result = target.result();
    this.subjec ...

多谢指教
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部