战斗函数修改

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将怪物传进去
return [
[1, "先攻", "怪物首先攻击", "#ffcc33"],
[2, "魔攻", "怪物无视角色的防御", "#bbb0ff"],
[3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"],
[
6,
@ -610,9 +611,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
13,
"衰弱",
"战斗后,角色陷入衰弱状态,攻防暂时下降" +
(core.values.weakValue >= 1
? core.values.weakValue + "点"
: parseInt(core.values.weakValue * 100) + "%"),
(core.values.weakValue >= 1 ?
core.values.weakValue + "点" :
parseInt(core.values.weakValue * 100) + "%"),
"#f0bbcc",
],
[
@ -701,11 +702,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"光环",
function (enemy) {
return (
(enemy.range != null
? (enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") +
(enemy.range != null ?
(enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") +
enemy.haloRange +
"格范围内"
: "同楼层所有") +
"格范围内" :
"同楼层所有") +
"怪物生命提升" +
(enemy.hpBuff || 0) +
"%,攻击提升" +
@ -907,6 +908,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_def = core.getRealStatusOrDefault(hero, "def"),
hero_matk = core.getRealStatusOrDefault(hero, "matk"),
hero_mdef = core.getRealStatusOrDefault(hero, "mdef"),
hero_mhp = core.getRealStatusOrDefault(hero, "mhp"),
hero_speed = core.getRealStatusOrDefault(hero, "speed"),
hero_spell = core.getRealStatusOrDefault(hero, "spell"),
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_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_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"))
@ -964,12 +969,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//——第二部分:变量定义和初始赋值——
// 每回合怪物对勇士造成的战斗伤害
let per_damage = Math.max(mon_atk - hero_def, 0);
//if (enemyInfo.magic) per_damage = Math.max(mon_atk - hero_mdef, 0);
let per_damage = Math.max(mon_atk - hero_def, 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);
//if (hero_magic) hero_per_damage = Math.max(hero_atk - mon_mdef, 0);
let hero_per_damage = Math.max(hero_atk - mon_def, 0),
hero_per_mdamage = Math.floor((hero_spell * hero_matk / 100) * (100 - mon_mdef) / 100);
let damage = 0,
hero_turn = 0,
@ -989,7 +997,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_time = 0; now_mon_hp > 0;
) {
//勇士和怪物的长度
//勇士和怪物的长度。这里需要把if else改成轮次的if和math.min
mon_time = mon_length / mon_speed;
hero_time = hero_length / hero_speed;
if (
@ -1027,7 +1035,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
let hero_diff = {},
mon_diff = {};
//这里插入汇总勇士和怪物在此回合结束时的情况数值,用以跑条动画读取
//这里插入汇总勇士和怪物在此回合结束时的情况变化hp, atk, def, speed, spell, damage, etc),用以跑条动画读取
heroDiffPerTurn.push(hero_diff);
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);
// ------ 支援 ----- //