修改战后使用点位属性

This commit is contained in:
草莓 2025-03-04 19:25:08 +08:00
parent 69b04d852d
commit 11c2174bcd
2 changed files with 179 additions and 182 deletions

View File

@ -172,7 +172,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
else core.setWeather(); else core.setWeather();
// ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等 // ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等
}, },
"afterChangeFloor": function (floorId) { "afterChangeFloor": function (floorId) {
// 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行 // 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行
// floorId是切换到的楼层 // floorId是切换到的楼层
@ -192,7 +192,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.plugin.bfs(); core.plugin.bfs();
} }
} }
}, },
"flyTo": function (toId, callback) { "flyTo": function (toId, callback) {
// 楼层传送器的使用从当前楼层飞往toId // 楼层传送器的使用从当前楼层飞往toId
// 如果不能飞行请返回false // 如果不能飞行请返回false
@ -243,7 +243,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}); });
return true; return true;
}, },
"beforeBattle": function (enemyId, x, y) { "beforeBattle": function (enemyId, x, y) {
// 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子) // 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子)
// 此函数在“检测能否战斗和自动存档”【之后】执行。如果需要更早的战前事件,请在插件中覆重写 core.events.doSystemEvent 函数。 // 此函数在“检测能否战斗和自动存档”【之后】执行。如果需要更早的战前事件,请在插件中覆重写 core.events.doSystemEvent 函数。
@ -284,14 +284,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}, },
"afterBattle": function (enemyId, x, y) { "afterBattle": function (enemyId, x, y) {
// 战斗结束后触发的事件 // 战斗结束后触发的事件
// 获得战斗伤害信息 var enemy = core.getEnemyInfo(enemyId, hero, x, y)
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
var enemy = damageInfo.enemyInfo;
var special = enemy.special; var special = enemy.special;
console.log(enemy)
// 播放战斗音效和动画 // 播放战斗音效和动画
// 默认播放的动画;你也可以使用 // 默认播放的动画;你也可以使用
var animate = "hand"; // 默认动画 var animate = 'hand'; // 默认动画
// 检查当前装备是否存在攻击动画 // 检查当前装备是否存在攻击动画
var equipId = core.getEquip(0); var equipId = core.getEquip(0);
if (equipId && (core.material.items[equipId].equip || {}).animate) if (equipId && (core.material.items[equipId].equip || {}).animate)
@ -301,13 +298,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 检查该动画是否存在SE如果不存在则使用默认音效 // 检查该动画是否存在SE如果不存在则使用默认音效
if (!(core.material.animates[animate] || {}).se) if (!(core.material.animates[animate] || {}).se)
core.playSound("attack.opus"); core.playSound('attack.mp3');
// 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身 // 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身
if (x != null && y != null) core.drawAnimate(animate, x, y); if (x != null && y != null)
else core.drawHeroAnimate(animate); core.drawAnimate(animate, x, y);
else
core.drawHeroAnimate(animate);
// 获得战斗伤害信息
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
console.log(damageInfo)
// 战斗伤害 // 战斗伤害
var damage = damageInfo.damage; var damage = damageInfo.damage;
// 当前战斗回合数,可用于战后所需的判定 // 当前战斗回合数,可用于战后所需的判定
@ -316,7 +317,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (damage == null || damage >= core.status.hero.hp) { if (damage == null || damage >= core.status.hero.hp) {
core.status.hero.hp = 0; core.status.hero.hp = 0;
core.updateStatusBar(false, true); core.updateStatusBar(false, true);
core.events.lose("战斗失败"); core.events.lose('战斗失败');
return; return;
} }
@ -335,42 +336,42 @@ 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.material.enemys[g[2]].money;
}, core.getEnemyInfo(enemy, null, x, y).money); }, 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; // 诅咒效果
core.status.hero.money += money; core.status.hero.money += money;
core.status.hero.statistics.money += money; core.status.hero.statistics.money += money;
// 获得经验 // 获得经验
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.material.enemys[g[2]].exp;
}, core.getEnemyInfo(enemy, null, x, y).exp); }, core.getEnemyValue(enemy, "exp", x, y));
if (core.hasFlag("curse")) exp = 0; if (core.hasFlag('curse')) exp = 0;
core.status.hero.exp += exp; core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp; core.status.hero.statistics.exp += exp;
var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y); var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y);
if (core.flags.statusBarItems.indexOf("enableMoney") >= 0) if (core.flags.statusBarItems.indexOf('enableMoney') >= 0)
hint += "," + core.getStatusLabel("money") + "+" + money; // hint += ",金币+" + money; hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money;
if (core.flags.statusBarItems.indexOf("enableExp") >= 0) if (core.flags.statusBarItems.indexOf('enableExp') >= 0)
hint += "," + core.getStatusLabel("exp") + "+" + exp; // hint += ",经验+" + exp; hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp;
core.drawTip(hint, enemy.id); core.drawTip(hint, enemy.id);
// 中毒 // 中毒
if (core.enemys.hasSpecial(special, 12)) { if (core.enemys.hasSpecial(special, 12)) {
core.triggerDebuff("get", "poison"); core.triggerDebuff('get', 'poison');
} }
// 衰弱 // 衰弱
if (core.enemys.hasSpecial(special, 13)) { if (core.enemys.hasSpecial(special, 13)) {
core.triggerDebuff("get", "weak"); core.triggerDebuff('get', 'weak');
} }
// 诅咒 // 诅咒
if (core.enemys.hasSpecial(special, 14)) { if (core.enemys.hasSpecial(special, 14)) {
core.triggerDebuff("get", "curse"); core.triggerDebuff('get', 'curse');
} }
// 仇恨怪物将仇恨值减半 // 仇恨怪物将仇恨值减半
if (core.enemys.hasSpecial(special, 17)) { if (core.enemys.hasSpecial(special, 17)) {
core.setFlag("hatred", Math.floor(core.getFlag("hatred", 0) / 2)); core.setFlag('hatred', Math.floor(core.getFlag('hatred', 0) / 2));
} }
// 自爆 // 自爆
if (core.enemys.hasSpecial(special, 19)) { if (core.enemys.hasSpecial(special, 19)) {
@ -379,45 +380,41 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
// 退化 // 退化
if (core.enemys.hasSpecial(special, 21)) { if (core.enemys.hasSpecial(special, 21)) {
core.status.hero.atk -= enemy.atkValue || 0; core.status.hero.atk -= (enemy.atkValue || 0);
core.status.hero.def -= enemy.defValue || 0; core.status.hero.def -= (enemy.defValue || 0);
if (core.status.hero.atk < 0) core.status.hero.atk = 0; if (core.status.hero.atk < 0) core.status.hero.atk = 0;
if (core.status.hero.def < 0) core.status.hero.def = 0; if (core.status.hero.def < 0) core.status.hero.def = 0;
} }
// 增加仇恨值 // 增加仇恨值
core.setFlag("hatred", core.getFlag("hatred", 0) + core.values.hatred); core.setFlag('hatred', core.getFlag('hatred', 0) + core.values.hatred);
// 战后的技能处理,比如扣除魔力值 // 战后的技能处理,比如扣除魔力值
if (core.flags.statusBarItems.indexOf("enableSkill") >= 0) { if (core.flags.statusBarItems.indexOf('enableSkill') >= 0) {
// 检测当前开启的技能类型 // 检测当前开启的技能类型
var skill = core.getFlag("skill", 0); var skill = core.getFlag('skill', 0);
if (skill == 1) { if (skill == 1) { // 技能1二倍斩
// 技能1二倍斩
core.status.hero.mana -= 5; // 扣除5点魔力值 core.status.hero.mana -= 5; // 扣除5点魔力值
} }
// 关闭技能 // 关闭技能
core.setFlag("skill", 0); core.setFlag('skill', 0);
core.setFlag("skillName", "无"); core.setFlag('skillName', '无');
} }
// 事件的处理 // 事件的处理
var todo = []; var todo = [];
// 加点事件 // 加点事件
var point = var point = guards.reduce(function (curr, g) {
guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].point; return curr + core.material.enemys[g[2]].point;
}, 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] }]);
} }
// 战后事件 // 战后事件
if (core.status.floorId != null) { if (core.status.floorId != null) {
core.push( core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
todo,
core.floors[core.status.floorId].afterBattle[x + "," + y]
);
} }
core.push(todo, enemy.afterBattle); core.push(todo, enemy.afterBattle);
@ -434,9 +431,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (todo.length > 0) core.insertAction(todo, x, y); if (todo.length > 0) core.insertAction(todo, x, y);
// 删除该点设置的怪物信息 // 删除该点设置的怪物信息
delete((flags.enemyOnPoint || {})[core.status.floorId] || {})[ delete((flags.enemyOnPoint || {})[core.status.floorId] || {})[x + "," + y];
x + "," + y
];
// 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率 // 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率
if (core.getBlock(x, y) != null) { if (core.getBlock(x, y) != null) {
@ -451,8 +446,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
// 如果已有事件正在处理中 // 如果已有事件正在处理中
if (core.status.event.id == null) core.continueAutomaticRoute(); if (core.status.event.id == null)
else core.clearContinueAutomaticRoute(); core.continueAutomaticRoute();
else
core.clearContinueAutomaticRoute();
}, },
"afterOpenDoor": function (doorId, x, y) { "afterOpenDoor": function (doorId, x, y) {
// 开一个门后触发的事件 // 开一个门后触发的事件
@ -1137,8 +1135,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_per_damage: Math.floor(hero_per_damage), hero_per_damage: Math.floor(hero_per_damage),
turn: Math.floor(hero_turn), turn: Math.floor(hero_turn),
mon_turn: Math.floor(mon_turn), mon_turn: Math.floor(mon_turn),
damage: Math.floor(damage), damage: Math.floor(damage)
enemyInfo: enemyInfo
}; };
/*TODO:return /*TODO:return
1. 显示怪物是魔攻还是物攻在怪物名字上做颜色变化物攻是黄色魔攻是蓝色 1. 显示怪物是魔攻还是物攻在怪物名字上做颜色变化物攻是黄色魔攻是蓝色

View File

@ -15242,7 +15242,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
block && block &&
block?.event && block?.event &&
!main.replayChecking && !main.replayChecking &&
!core.isReplaying() !core.isReplaying() && !core.getFlag("__isFlying__", false)
) { ) {
const dirEntries = allChangeEntries.find( const dirEntries = allChangeEntries.find(
(v) => v[1] === block.event.id (v) => v[1] === block.event.id