战斗动画,属性更名

This commit is contained in:
草莓 2025-02-01 00:23:21 +08:00
parent 25fb914841
commit 396abfe222
9 changed files with 5965 additions and 5907 deletions

View File

@ -269,7 +269,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_data": "法强",
},
"spelldef": {
"mdef": {
"_leaf": true,
"_type": "textarea",
"_data": "法抗百分比",
@ -280,7 +280,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_data": "100为法强转化为等值魔攻",
"_docs": "魔攻比例"
},
"mdef": {
"mhp": {
"_leaf": true,
"_type": "textarea",
"_data": "100为法强转化为等值护盾",

View File

@ -437,12 +437,14 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"face_440110.webp",
"green.webp",
"hero.webp",
"jianji.webp",
"l.webp",
"lane1.webp",
"light.webp",
"lock.webp",
"lr.webp",
"maba.webp",
"miwu.webp",
"null.webp",
"other_0001.webp",
"other_0002.webp",
@ -1116,7 +1118,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"atk": 100,
"def": 100,
"mdef": 0,
"speed": 0,
"speed": 10,
"money": 0,
"exp": 0,
"equipment": [],
@ -1494,14 +1496,12 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
],
"startText": [
{
"type": "setValue",
"name": "item:book",
"value": "1"
"type": "function",
"function": "function(){\ncore.getItem('book',1);core.getItem('fly',1)\n}"
},
{
"type": "setValue",
"name": "item:fly",
"value": "1"
"type": "insert",
"name": "战斗动画特效注册"
},
{
"type": "insert",

View File

@ -4,7 +4,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10,"magic":false},
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]},
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":10},
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":15},
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redBat": {"name":"红蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8},

View File

@ -10883,6 +10883,136 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
}
]
}
],
"战斗动画特效注册": [
{
"type": "setanimate",
"name": "sword",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "jianji.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 192,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 192,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 384,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 384,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 576,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 576,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 768,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 768,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 0,
"cy": 2304,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 0,
"acy": 2304,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
}
]
},
"CommonEventTemplate": {

View File

@ -892,171 +892,170 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
};
},
"getDamageInfo": function (enemy, hero, x, y, floorId) {
// 获得战斗伤害信息(实际伤害计算函数)
//
// 参数说明:
// enemy该怪物信息
// hero勇士的当前数据如果对应项不存在则会从core.status.hero中取。
// x,y该怪物的坐标查看手册和强制战斗时为undefined
// floorId该怪物所在的楼层
// 后面三个参数主要是可以在光环等效果上可以适用
floorId = floorId || core.status.floorId;
// 获得战斗伤害信息(实际伤害计算函数)
//
// 参数说明:
// enemy该怪物信息
// hero勇士的当前数据如果对应项不存在则会从core.status.hero中取。
// x,y该怪物的坐标查看手册和强制战斗时为undefined
// floorId该怪物所在的楼层
// 后面三个参数主要是可以在光环等效果上可以适用
floorId = floorId || core.status.floorId;
var hero_hp = core.getRealStatusOrDefault(hero, "hp"),
hero_atk = core.getRealStatusOrDefault(hero, "atk"),
hero_def = core.getRealStatusOrDefault(hero, "def"),
hero_mdef = core.getRealStatusOrDefault(hero, "mdef"),
hero_speed = core.getRealStatusOrDefault(hero, "speed"),
hero_magic = core.getRealStatusOrDefault(hero, "magic"),
origin_hero_hp = core.getStatusOrDefault(hero, "hp"),
origin_hero_atk = core.getStatusOrDefault(hero, "atk"),
origin_hero_def = core.getStatusOrDefault(hero, "def");
var hero_hp = core.getRealStatusOrDefault(hero, "hp"),
hero_atk = core.getRealStatusOrDefault(hero, "atk"),
hero_def = core.getRealStatusOrDefault(hero, "def"),
hero_mdef = core.getRealStatusOrDefault(hero, "mdef"),
hero_speed = core.getRealStatusOrDefault(hero, "speed"),
hero_magic = core.getRealStatusOrDefault(hero, "magic"),
origin_hero_hp = core.getStatusOrDefault(hero, "hp"),
origin_hero_atk = core.getStatusOrDefault(hero, "atk"),
origin_hero_def = core.getStatusOrDefault(hero, "def");
// 怪物的各项数据
// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
var enemyInfo = core.enemys.getEnemyInfo(enemy, hero, x, y, floorId);
var mon_hp = enemyInfo.hp,
mon_atk = enemyInfo.atk,
mon_def = enemyInfo.def,
mon_mdef = enemyInfo.mdef,
mon_speed = enemyInfo.speed,
mon_special = enemyInfo.special,
mon_absorb_damage = enemyInfo.absorb,
mon_barrier = enemyInfo.barrier;
// 怪物的各项数据
// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
var enemyInfo = core.enemys.getEnemyInfo(enemy, hero, x, y, floorId);
var mon_hp = enemyInfo.hp,
mon_atk = enemyInfo.atk,
mon_def = enemyInfo.def,
mon_mdef = enemyInfo.mdef,
mon_speed = enemyInfo.speed,
mon_special = enemyInfo.special,
mon_absorb_damage = enemyInfo.absorb,
mon_barrier = enemyInfo.barrier;
//---第一部分:静态属性修正---
//此处写入静态影响勇士属性的勇士或怪物技能静态影响怪物属性的技能于getEnemyInfo中写入
// 技能的处理
if (core.getFlag("skill", 0) == 1) {
// 开启了技能1二倍斩
hero_atk *= 2; // 计算时攻击力翻倍
}
//勇士属性取整
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));
//---第一部分:静态属性修正---
//此处写入静态影响勇士属性的勇士或怪物技能静态影响怪物属性的技能于getEnemyInfo中写入
// 技能的处理
if (core.getFlag("skill", 0) == 1) {
// 开启了技能1二倍斩
hero_atk *= 2; // 计算时攻击力翻倍
}
//勇士属性取整
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));
// 如果是无敌属性,且勇士未持有十字架
if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
return null; // 不可战斗
// 如果是无敌属性,且勇士未持有十字架
if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
return null; // 不可战斗
// 战前造成的额外伤害(可被护盾抵消)
let init_damage = 0;
// 战前造成的额外伤害(可被护盾抵消)
let init_damage = 0;
// 吸血
if (core.hasSpecial(mon_special, 11)) {
let vampire_damage = hero_hp * enemy.vampire;
// 吸血
if (core.hasSpecial(mon_special, 11)) {
let vampire_damage = hero_hp * enemy.vampire;
// 如果有神圣盾免疫吸血等可以在这里写
// 也可以用hasItem和hasEquip来判定装备
// if (core.hasFlag('shield5')) vampire_damage = 0;
// 如果有神圣盾免疫吸血等可以在这里写
// 也可以用hasItem和hasEquip来判定装备
// if (core.hasFlag('shield5')) vampire_damage = 0;
vampire_damage = Math.floor(vampire_damage) || 0;
// 加到自身
if (enemy.add)
// 如果加到自身
mon_hp += vampire_damage;
vampire_damage = Math.floor(vampire_damage) || 0;
// 加到自身
if (enemy.add)
// 如果加到自身
mon_hp += vampire_damage;
init_damage += vampire_damage;
}
init_damage += vampire_damage;
}
//——第二部分:变量定义和初始赋值——
// 每回合怪物对勇士造成的战斗伤害
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);
if (enemyInfo.magic) per_damage = Math.max(mon_atk - hero_mdef, 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);
//
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 damage = 0,
hero_turn = 0,
mon_turn = 0;
//---第三部分:递归开始---
let length = hero_speed * mon_speed;
let damage = 0,
hero_turn = 0,
mon_turn = 0;
//---第三部分:递归开始---
let length = hero_speed * mon_speed;
for (
let now_mon_hp = mon_hp,
last_mon_hp = mon_hp,
mon_length = length,
hero_length = length,
mon_time = 0,
hero_time = 0;
now_mon_hp > 0;
for (
let now_mon_hp = mon_hp,
last_mon_hp = mon_hp,
mon_length = length,
hero_length = length,
mon_time = 0,
hero_time = 0; now_mon_hp > 0;
) {
//勇士和怪物的长度
mon_time = mon_length / mon_speed;
hero_time = hero_length / hero_speed;
if (
mon_time < hero_time ||
((mon_time = hero_time) && mon_speed > hero_speed)
) {
//怪物攻击的回合
//这里计算怪物攻击时发生的各种变化
) {
//勇士和怪物的长度
mon_time = mon_length / mon_speed;
hero_time = hero_length / hero_speed;
if (
mon_time < hero_time ||
((mon_time = hero_time) && mon_speed > hero_speed)
) {
//怪物攻击的回合
//这里计算怪物攻击时发生的各种变化
//伤害与回合增加
damage += per_damage;
if (core.hasSpecial(mon_special, 6)) {
mon_turn += enemy.n;
} else {
mon_turn += 1;
}
//重新为长度赋值
mon_length = length;
hero_length = hero_length - mon_time * hero_speed;
} else {
//勇士攻击的回合
// 这里计算勇士攻击时发生的各种变化
//伤害与回合增加
damage += per_damage;
if (core.hasSpecial(mon_special, 6)) {
mon_turn += enemy.n;
} else {
mon_turn += 1;
}
//重新为长度赋值
mon_length = length;
hero_length = hero_length - mon_time * hero_speed;
} else {
//勇士攻击的回合
// 这里计算勇士攻击时发生的各种变化
// 伤害与回合数增加
now_mon_hp -= hero_per_damage;
hero_turn += 1; //勇士回合+1如果有勇士每回合多次攻击的情况在这里写判断
// 无法战斗计算
if (hero_turn % 50 == 0) {
if (now_mon_hp >= last_mon_hp) return null;
last_mon_hp = now_mon_hp;
}
//重新为长度赋值
hero_length = length;
mon_length = mon_length - hero_time * mon_speed;
}
}
// 伤害与回合数增加
now_mon_hp -= hero_per_damage;
hero_turn += 1; //勇士回合+1如果有勇士每回合多次攻击的情况在这里写判断
// 无法战斗计算
if (hero_turn % 50 == 0) {
if (now_mon_hp >= last_mon_hp) return null;
last_mon_hp = now_mon_hp;
}
//重新为长度赋值
hero_length = length;
mon_length = mon_length - hero_time * mon_speed;
}
}
//下面这些还没修改
// 连击
if (core.hasSpecial(mon_special, 6)) per_damage *= enemy.n || 2;
//下面这些还没修改
// 连击
if (core.hasSpecial(mon_special, 6)) per_damage *= enemy.n || 2;
// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
let counterDamage = 0;
if (core.hasSpecial(mon_special, 8))
counterDamage += Math.floor(
(enemy.counterAttack || core.values.counterAttack) * hero_atk
);
// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
let counterDamage = 0;
if (core.hasSpecial(mon_special, 8))
counterDamage += Math.floor(
(enemy.counterAttack || core.values.counterAttack) * hero_atk
);
// 先攻
if (core.hasSpecial(mon_special, 1)) init_damage += per_damage;
// 先攻
if (core.hasSpecial(mon_special, 1)) init_damage += per_damage;
// 破甲
if (core.hasSpecial(mon_special, 7))
init_damage += Math.floor(
(enemy.breakArmor || core.values.breakArmor) * hero_def
);
// 破甲
if (core.hasSpecial(mon_special, 7))
init_damage += Math.floor(
(enemy.breakArmor || core.values.breakArmor) * hero_def
);
// 净化
if (core.hasSpecial(mon_special, 9))
init_damage += Math.floor(
(enemy.purify || core.values.purify) * hero_mdef
);
//上面这些还没修改
//勇士护盾计算
let barrier = hero_mdef;
if (enemyInfo.magic) barrier = hero_def;
// 净化
if (core.hasSpecial(mon_special, 9))
init_damage += Math.floor(
(enemy.purify || core.values.purify) * hero_mdef
);
//上面这些还没修改
//勇士护盾计算
let barrier = hero_mdef;
if (enemyInfo.magic) barrier = hero_def;
// ------ 支援 ----- //
// 这个递归最好想明白为什么flag:__extraTurn__是怎么用的
/*var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards);
// ------ 支援 ----- //
// 这个递归最好想明白为什么flag:__extraTurn__是怎么用的
/*var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards);
var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)
turn += core.getFlag("__extraTurn__", 0);
if (guards.length > 0) {
@ -1084,43 +1083,43 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
}
core.removeFlag("__extraTurn__");*/
// ------ 支援END ------ //
// ------ 支援END ------ //
// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
damage += init_damage + hero_turn * counterDamage;
// 再扣去护盾
damage -= barrier;
// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
damage += init_damage + hero_turn * counterDamage;
// 再扣去护盾
damage -= barrier;
// 检查是否允许负伤
if (!core.flags.enableNegativeDamage) damage = Math.max(0, damage);
// 检查是否允许负伤
if (!core.flags.enableNegativeDamage) damage = Math.max(0, damage);
// 最后处理仇恨和固伤(因为这两个不能被护盾减伤)
if (core.hasSpecial(mon_special, 17)) {
// 仇恨
damage += core.getFlag("hatred", 0);
}
if (core.hasSpecial(mon_special, 22)) {
// 固伤
damage += enemy.damage || 0;
}
// 最后处理仇恨和固伤(因为这两个不能被护盾减伤)
if (core.hasSpecial(mon_special, 17)) {
// 仇恨
damage += core.getFlag("hatred", 0);
}
if (core.hasSpecial(mon_special, 22)) {
// 固伤
damage += enemy.damage || 0;
}
return {
mon_hp: Math.floor(mon_hp),
mon_atk: Math.floor(mon_atk),
mon_def: Math.floor(mon_def),
mon_mdef: Math.floor(mon_mdef),
init_damage: Math.floor(init_damage),
per_damage: Math.floor(per_damage),
hero_per_damage: Math.floor(hero_per_damage),
turn: Math.floor(hero_turn),
mon_turn: Math.floor(mon_turn),
damage: Math.floor(damage),
};
/*TODO:return
return {
mon_hp: Math.floor(mon_hp),
mon_atk: Math.floor(mon_atk),
mon_def: Math.floor(mon_def),
mon_mdef: Math.floor(mon_mdef),
init_damage: Math.floor(init_damage),
per_damage: Math.floor(per_damage),
hero_per_damage: Math.floor(hero_per_damage),
turn: Math.floor(hero_turn),
mon_turn: Math.floor(mon_turn),
damage: Math.floor(damage),
};
/*TODO:return
1. 显示怪物是魔攻还是物攻在怪物名字上做颜色变化物攻是黄色魔攻是蓝色
2. 一防减伤是物防还是魔防由怪物是物攻还是魔攻来转换
3. 特殊战斗的怪物在怪物手册里伤害写为特殊战*/
}
}
},
"actions": {
"onKeyUp": function (keyCode, altKey) {

BIN
project/images/jianji.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

BIN
project/images/miwu.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because it is too large Load Diff

View File

@ -544,9 +544,9 @@ p#name {
}
/* 注释下面这三行以开启抗锯齿 */
.anti-aliasing {
/* .anti-aliasing {
image-rendering: pixelated;
}
} */
.warning {
transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s;