fix:afterBattle适配新getEnemyValue

This commit is contained in:
lizhuoyuan 2025-02-13 15:25:34 +08:00
parent 99979add4f
commit 7bfa08c91c
3 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
{ {
"greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]}, "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[26]},
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"slimelord": {"name":"怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]}, "slimelord": {"name":"怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"bat": {"name":"小蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]}, "bat": {"name":"小蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},

View File

@ -19,7 +19,7 @@ main.floors.MT0=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0,201, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0,201, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0,201, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0,201,202, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],

View File

@ -261,7 +261,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"afterBattle": function (enemyId, x, y) { "afterBattle": function (enemyId, x, y) {
// 战斗结束后触发的事件 // 战斗结束后触发的事件
var enemy = core.material.enemys[enemyId]; var enemy = core.getEnemyValue(enemyId, null, x, y);
var special = enemy.special; var special = enemy.special;
// 播放战斗音效和动画 // 播放战斗音效和动画
@ -302,8 +302,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.hero.hp -= damage; core.status.hero.hp -= damage;
core.status.hero.statistics.battleDamage += damage; core.status.hero.statistics.battleDamage += damage;
core.status.hero.statistics.battle++; core.status.hero.statistics.battle++;
// 计算当前怪物的支援怪物 // 计算当前怪物的支援怪物
// guard:一个形如[[1, 1, 'greenSlime'], [[2, 2, 'redSlime']]]的数组
var guards = []; var guards = [];
if (x != null && y != null) { if (x != null && y != null) {
guards = core.getFlag("__guards__" + x + "_" + y, []); guards = core.getFlag("__guards__" + x + "_" + y, []);
@ -330,7 +331,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 获得金币 // 获得金币
var money = guards.reduce(function (curr, g) { var money = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].money; return curr + core.getEnemyValue(g[2], "money", g[0], g[1]);
}, core.getEnemyValue(enemy, "money", x, y)); }, core.getEnemyValue(enemy, "money", x, y));
if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍 if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍
if (core.hasFlag('curse')) money = 0; // 诅咒效果 if (core.hasFlag('curse')) money = 0; // 诅咒效果
@ -340,8 +341,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 获得经验 // 获得经验
var exp = guards.reduce(function (curr, g) { var exp = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].exp; return curr + core.getEnemyValue(g[2], "exp", g[0], g[1]);
}, core.getEnemyValue(enemy, "exp", x, y)); }, core.getEnemyValue(g[2], "exp", x, y));
if (core.hasFlag('curse')) exp = 0; if (core.hasFlag('curse')) exp = 0;
if (failMove) exp = 0; // 败移效果 if (failMove) exp = 0; // 败移效果
core.status.hero.exp += exp; core.status.hero.exp += exp;
@ -393,7 +394,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 加点事件 // 加点事件
var point = guards.reduce(function (curr, g) { var point = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].point; return curr + core.getEnemyValue(g[2], "point", g[0], g[1]);
}, core.getEnemyValue(enemy, "point", x, y)) || 0; }, core.getEnemyValue(enemy, "point", x, y)) || 0;
if (core.flags.enableAddPoint && point > 0) { if (core.flags.enableAddPoint && point > 0) {
core.push(todo, [{ "type": "insert", "name": "加点事件", "args": [point] }]); core.push(todo, [{ "type": "insert", "name": "加点事件", "args": [point] }]);