fix:enemy

This commit is contained in:
ShakeFlower 2025-02-15 00:35:24 +08:00
parent 024f40bdf2
commit 266a343924

View File

@ -173,6 +173,7 @@ enemys.prototype.getEnemyValue = function (enemy, name, x, y, floorId) {
if (core.isset(name) && pointInfo[name] != null) { if (core.isset(name) && pointInfo[name] != null) {
return pointInfo[name]; return pointInfo[name];
} }
// enemy有三种可能null,字符串完整的enemy
if (enemy == null) { if (enemy == null) {
var block = core.getBlock(x, y, floorId); var block = core.getBlock(x, y, floorId);
if (block == null) return null; // 无enemy且无x,y时返回null无enemy有x,y将读取该点信息 if (block == null) return null; // 无enemy且无x,y时返回null无enemy有x,y将读取该点信息
@ -182,9 +183,9 @@ enemys.prototype.getEnemyValue = function (enemy, name, x, y, floorId) {
enemy = core.material.enemys[enemy]; enemy = core.material.enemys[enemy];
if (enemy == null) return null; if (enemy == null) return null;
} }
enemy = core.clone(enemy);
if (!core.isset(name)) { // 仅name不填时返回该enemy的完整数据有x,y将用该点信息覆盖core.material.enemys相应属性 if (!core.isset(name)) { // 仅name不填时返回该enemy的完整数据有x,y将用该点信息覆盖core.material.enemys相应属性
enemy = core.clone(enemy);
for (let status in pointInfo) { for (let status in pointInfo) {
if (pointInfo.hasOwnProperty(status)) enemy[status] = pointInfo[status]; if (pointInfo.hasOwnProperty(status)) enemy[status] = pointInfo[status];
} }