战斗函数修改

This commit is contained in:
itcfangye 2025-02-10 20:56:37 +08:00
parent a0cbb8cdb8
commit fcbb8add3e

View File

@ -531,6 +531,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 名字和描述可以直接写字符串也可以写个function将怪物传进去 // 名字和描述可以直接写字符串也可以写个function将怪物传进去
return [ return [
[1, "先攻", "怪物首先攻击", "#ffcc33"], [1, "先攻", "怪物首先攻击", "#ffcc33"],
[2, "魔攻", "怪物无视角色的防御", "#bbb0ff"],
[3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], [3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"],
[ [
6, 6,
@ -610,9 +611,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
13, 13,
"衰弱", "衰弱",
"战斗后,角色陷入衰弱状态,攻防暂时下降" + "战斗后,角色陷入衰弱状态,攻防暂时下降" +
(core.values.weakValue >= 1 (core.values.weakValue >= 1 ?
? core.values.weakValue + "点" core.values.weakValue + "点" :
: parseInt(core.values.weakValue * 100) + "%"), parseInt(core.values.weakValue * 100) + "%"),
"#f0bbcc", "#f0bbcc",
], ],
[ [
@ -701,11 +702,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"光环", "光环",
function (enemy) { function (enemy) {
return ( return (
(enemy.range != null (enemy.range != null ?
? (enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + (enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") +
enemy.haloRange + enemy.haloRange +
"格范围内" "格范围内" :
: "同楼层所有") + "同楼层所有") +
"怪物生命提升" + "怪物生命提升" +
(enemy.hpBuff || 0) + (enemy.hpBuff || 0) +
"%,攻击提升" + "%,攻击提升" +
@ -739,7 +740,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"#c0ddbb", "#c0ddbb",
], ],
]; ];
}, },
"getEnemyInfo": function (enemy, hero, x, y, floorId) { "getEnemyInfo": function (enemy, hero, x, y, floorId) {
// 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用 // 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用
// 例如:坚固、模仿、仿攻等等 // 例如:坚固、模仿、仿攻等等
@ -907,6 +908,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_def = core.getRealStatusOrDefault(hero, "def"), hero_def = core.getRealStatusOrDefault(hero, "def"),
hero_matk = core.getRealStatusOrDefault(hero, "matk"), hero_matk = core.getRealStatusOrDefault(hero, "matk"),
hero_mdef = core.getRealStatusOrDefault(hero, "mdef"), hero_mdef = core.getRealStatusOrDefault(hero, "mdef"),
hero_mhp = core.getRealStatusOrDefault(hero, "mhp"),
hero_speed = core.getRealStatusOrDefault(hero, "speed"), hero_speed = core.getRealStatusOrDefault(hero, "speed"),
hero_spell = core.getRealStatusOrDefault(hero, "spell"), hero_spell = core.getRealStatusOrDefault(hero, "spell"),
origin_hero_hp = core.getStatusOrDefault(hero, "hp"), origin_hero_hp = core.getStatusOrDefault(hero, "hp"),
@ -935,8 +937,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//勇士属性取整 //勇士属性取整
hero_atk = Math.max(0, Math.floor(hero_atk)); hero_atk = Math.max(0, Math.floor(hero_atk));
hero_def = Math.max(0, Math.floor(hero_def)); hero_def = Math.max(0, Math.floor(hero_def));
hero_mdef = Math.max(0, Math.floor(hero_mdef));
hero_speed = Math.max(0, Math.floor(hero_speed)); hero_speed = Math.max(0, Math.floor(hero_speed));
hero_spell = Math.max(0, Math.floor(hero_spell));
hero_matk = Math.min(100, Math.max(0, Math.floor(hero_matk)));
hero_mdef = Math.min(100, Math.max(0, Math.floor(hero_mdef)));
hero_mhp = Math.min(100, Math.max(0, Math.floor(hero_mhp)));
// 如果是无敌属性,且勇士未持有十字架 // 如果是无敌属性,且勇士未持有十字架
if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
@ -964,12 +969,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//——第二部分:变量定义和初始赋值—— //——第二部分:变量定义和初始赋值——
// 每回合怪物对勇士造成的战斗伤害 // 每回合怪物对勇士造成的战斗伤害
let per_damage = Math.max(mon_atk - hero_def, 0); let per_damage = Math.max(mon_atk - hero_def, 0),
//if (enemyInfo.magic) per_damage = Math.max(mon_atk - hero_mdef, 0); per_mdamage = 0;
if (core.hasSpecial(mon_special, 2)) {
per_mdamage = Math.floor(mon_atk * (100 - hero_mdef) / 100);
}
// //
let hero_per_damage = Math.max(hero_atk - mon_def, 0); let hero_per_damage = Math.max(hero_atk - mon_def, 0),
//if (hero_magic) hero_per_damage = Math.max(hero_atk - mon_mdef, 0);
hero_per_mdamage = Math.floor((hero_spell * hero_matk / 100) * (100 - mon_mdef) / 100);
let damage = 0, let damage = 0,
hero_turn = 0, hero_turn = 0,
@ -989,7 +997,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_time = 0; now_mon_hp > 0; hero_time = 0; now_mon_hp > 0;
) { ) {
//勇士和怪物的长度 //勇士和怪物的长度。这里需要把if else改成轮次的if和math.min
mon_time = mon_length / mon_speed; mon_time = mon_length / mon_speed;
hero_time = hero_length / hero_speed; hero_time = hero_length / hero_speed;
if ( if (
@ -1027,7 +1035,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
let hero_diff = {}, let hero_diff = {},
mon_diff = {}; mon_diff = {};
//这里插入汇总勇士和怪物在此回合结束时的情况数值,用以跑条动画读取 //这里插入汇总勇士和怪物在此回合结束时的情况变化hp, atk, def, speed, spell, damage, etc),用以跑条动画读取
heroDiffPerTurn.push(hero_diff); heroDiffPerTurn.push(hero_diff);
enemyDiffPerTurn.push(mon_diff); //将勇士和怪物此回合结束时的属性变动保存到heroPerInfo和enemyPerInfo中用以跑条动画读取 enemyDiffPerTurn.push(mon_diff); //将勇士和怪物此回合结束时的属性变动保存到heroPerInfo和enemyPerInfo中用以跑条动画读取
} }
@ -1059,7 +1067,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
); );
//上面这些还没修改 //上面这些还没修改
//勇士护盾计算 //勇士护盾计算
let barrier = hero_mdef; let barrier = Math.floor(hero_spell * hero_mhp / 100);
// ------ 支援 ----- // // ------ 支援 ----- //