合并多个相同怪物显示

This commit is contained in:
ckcz123 2021-07-30 16:31:42 +08:00
parent 7876b74b9a
commit a5897b9c89
3 changed files with 12 additions and 5 deletions

View File

@ -383,6 +383,15 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x
x = null; x = null;
y = null; y = null;
} else { } else {
// 检查enemys里面是否使用了存在的内容
for (var i = 0; i < enemys.length; ++i) {
var one = enemys[i];
if (id == one.id && one.locs != null &&
locEnemyInfo.atk == one.atk && locEnemyInfo.def == one.def && locEnemyInfo.hp == one.hp) {
one.locs.push([x, y]);
return;
}
}
enemyInfo = locEnemyInfo; enemyInfo = locEnemyInfo;
} }
var id = enemy.id + ":" + x + ":" + y; var id = enemy.id + ":" + x + ":" + y;
@ -400,8 +409,7 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x
e[v] = enemyInfo[v]; e[v] = enemyInfo[v];
} }
if (x != null && y != null) { if (x != null && y != null) {
e.x = x; e.locs = [[x, y]];
e.y = y;
} }
["name", "money", "exp", "point"].forEach(function (one) { ["name", "money", "exp", "point"].forEach(function (one) {
e[one] = core.getEnemyValue(enemy, one, x, y, floorId); e[one] = core.getEnemyValue(enemy, one, x, y, floorId);

View File

@ -1488,7 +1488,6 @@ events.prototype._action_setViewport = function (data, x, y, prefix) {
} else { } else {
data.loc = this.__action_getLoc(data.loc, x, y, prefix); data.loc = this.__action_getLoc(data.loc, x, y, prefix);
} }
console.log(data.loc);
this.__action_doAsyncFunc(data.async, core.moveViewport, data.loc[0], data.loc[1], data.moveMode, data.time); this.__action_doAsyncFunc(data.async, core.moveViewport, data.loc[0], data.loc[1], data.moveMode, data.time);
} }

View File

@ -2289,8 +2289,8 @@ ui.prototype._drawBookDetail_origin = function (enemy, texts) {
// 怪物数值和原始值不一样时,在详细信息页显示原始数值 // 怪物数值和原始值不一样时,在详细信息页显示原始数值
var originEnemy = core.enemys._getCurrentEnemys_getEnemy(enemy.id); var originEnemy = core.enemys._getCurrentEnemys_getEnemy(enemy.id);
var content = []; var content = [];
if (enemy.x != null && enemy.y != null) { if (enemy.locs != null && enemy.locs.length >= 0) {
texts.push("\r[#FF6A6A]\\d怪物坐标\\d\r[][" + enemy.x + ", " + enemy.y + ']'); texts.push("\r[#FF6A6A]\\d怪物坐标\\d\r[]" + JSON.stringify(enemy.locs));
} }
["hp", "atk", "def", "point", "money", "exp"].forEach(function (one) { ["hp", "atk", "def", "point", "money", "exp"].forEach(function (one) {
if (enemy[one] == null || originEnemy[one] == null) return; if (enemy[one] == null || originEnemy[one] == null) return;