查看: 2988|回复: 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 | 显示全部楼层
  1. Game_Action.prototype.apply = function(target) {
  2.     const result = target.result();
  3.     this.subject().clearResult();
  4.     result.clear();
  5.     result.used = this.testApply(target);
  6.     result.missed = result.used && Math.random() >= this.itemHit(target);
  7.     result.evaded = !result.missed && Math.random() < this.itemEva(target);
  8.     result.physical = this.isPhysical();
  9.     result.drain = this.isDrain();
  10.     if (result.isHit()) {
  11.         if (this.item().damage.type > 0) {
  12.             result.critical = Math.random() < this.itemCri(target);
  13.             const value = this.makeDamageValue(target, result.critical);
  14.             this.executeDamage(target, value);
  15.         }
  16.         for (const effect of this.item().effects) {
  17.             this.applyItemEffect(target, effect);
  18.         }
  19.         this.applyItemUserEffect(target);
  20.     }
  21.     this.updateLastTarget(target);
  22. };
复制代码


里面的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.

在本版发帖返回顶部