修改战后使用点位属性

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

@ -284,14 +284,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
},
"afterBattle": function (enemyId, x, y) {
// 战斗结束后触发的事件
// 获得战斗伤害信息
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
var enemy = damageInfo.enemyInfo;
var enemy = core.getEnemyInfo(enemyId, hero, x, y)
var special = enemy.special;
console.log(enemy)
// 播放战斗音效和动画
// 默认播放的动画;你也可以使用
var animate = "hand"; // 默认动画
var animate = 'hand'; // 默认动画
// 检查当前装备是否存在攻击动画
var equipId = core.getEquip(0);
if (equipId && (core.material.items[equipId].equip || {}).animate)
@ -301,13 +298,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 检查该动画是否存在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);
else core.drawHeroAnimate(animate);
if (x != null && y != null)
core.drawAnimate(animate, x, y);
else
core.drawHeroAnimate(animate);
// 获得战斗伤害信息
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
console.log(damageInfo)
// 战斗伤害
var damage = damageInfo.damage;
// 当前战斗回合数,可用于战后所需的判定
@ -316,7 +317,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (damage == null || damage >= core.status.hero.hp) {
core.status.hero.hp = 0;
core.updateStatusBar(false, true);
core.events.lose("战斗失败");
core.events.lose('战斗失败');
return;
}
@ -335,42 +336,42 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 获得金币
var money = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].money;
}, core.getEnemyInfo(enemy, null, x, y).money);
if (core.hasItem("coin")) money *= 2; // 幸运金币:双倍
if (core.hasFlag("curse")) money = 0; // 诅咒效果
}, core.getEnemyValue(enemy, "money", x, y));
if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍
if (core.hasFlag('curse')) money = 0; // 诅咒效果
core.status.hero.money += money;
core.status.hero.statistics.money += money;
// 获得经验
var exp = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].exp;
}, core.getEnemyInfo(enemy, null, x, y).exp);
if (core.hasFlag("curse")) exp = 0;
}, core.getEnemyValue(enemy, "exp", x, y));
if (core.hasFlag('curse')) exp = 0;
core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp;
var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y);
if (core.flags.statusBarItems.indexOf("enableMoney") >= 0)
hint += "," + core.getStatusLabel("money") + "+" + money; // hint += ",金币+" + money;
if (core.flags.statusBarItems.indexOf("enableExp") >= 0)
hint += "," + core.getStatusLabel("exp") + "+" + exp; // hint += ",经验+" + exp;
if (core.flags.statusBarItems.indexOf('enableMoney') >= 0)
hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money;
if (core.flags.statusBarItems.indexOf('enableExp') >= 0)
hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp;
core.drawTip(hint, enemy.id);
// 中毒
if (core.enemys.hasSpecial(special, 12)) {
core.triggerDebuff("get", "poison");
core.triggerDebuff('get', 'poison');
}
// 衰弱
if (core.enemys.hasSpecial(special, 13)) {
core.triggerDebuff("get", "weak");
core.triggerDebuff('get', 'weak');
}
// 诅咒
if (core.enemys.hasSpecial(special, 14)) {
core.triggerDebuff("get", "curse");
core.triggerDebuff('get', 'curse');
}
// 仇恨怪物将仇恨值减半
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)) {
@ -379,45 +380,41 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
// 退化
if (core.enemys.hasSpecial(special, 21)) {
core.status.hero.atk -= enemy.atkValue || 0;
core.status.hero.def -= enemy.defValue || 0;
core.status.hero.atk -= (enemy.atkValue || 0);
core.status.hero.def -= (enemy.defValue || 0);
if (core.status.hero.atk < 0) core.status.hero.atk = 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);
if (skill == 1) {
// 技能1二倍斩
var skill = core.getFlag('skill', 0);
if (skill == 1) { // 技能1二倍斩
core.status.hero.mana -= 5; // 扣除5点魔力值
}
// 关闭技能
core.setFlag("skill", 0);
core.setFlag("skillName", "无");
core.setFlag('skill', 0);
core.setFlag('skillName', '无');
}
// 事件的处理
var todo = [];
// 加点事件
var point =
guards.reduce(function (curr, g) {
var point = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].point;
}, core.getEnemyValue(enemy, "point", x, y)) || 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) {
core.push(
todo,
core.floors[core.status.floorId].afterBattle[x + "," + y]
);
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
}
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);
// 删除该点设置的怪物信息
delete((flags.enemyOnPoint || {})[core.status.floorId] || {})[
x + "," + y
];
delete((flags.enemyOnPoint || {})[core.status.floorId] || {})[x + "," + y];
// 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率
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();
else core.clearContinueAutomaticRoute();
if (core.status.event.id == null)
core.continueAutomaticRoute();
else
core.clearContinueAutomaticRoute();
},
"afterOpenDoor": function (doorId, x, y) {
// 开一个门后触发的事件
@ -1137,8 +1135,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_per_damage: Math.floor(hero_per_damage),
turn: Math.floor(hero_turn),
mon_turn: Math.floor(mon_turn),
damage: Math.floor(damage),
enemyInfo: enemyInfo
damage: Math.floor(damage)
};
/*TODO:return
1. 显示怪物是魔攻还是物攻在怪物名字上做颜色变化物攻是黄色魔攻是蓝色

View File

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