这代码真难写

This commit is contained in:
枫谷剑仙 2021-04-09 19:46:15 +08:00
parent f347c97712
commit 1ed2959b6b
2 changed files with 38 additions and 17 deletions

View File

@ -9,12 +9,12 @@ const localTranslating = {
mass_attack: tp`${'icon'}所有攻击变为全体攻击`,
leader_change: tp`${'icon'}将自身换为队长,再次使用则换回来`,
no_skyfall: tp`${'icon'}天降的宝珠不会消除`,
heal: tp`${'icon'}回复 ${'value'}${'stats'}`,
heal: tp`${'icon'}回复 ${'belong_to'}${'value'}${'stats'}`,
defense_break: tp`${'icon'}敌方的防御力减少 ${'value'}`,
poison: tp`${'icon'}使${'target'}全体中毒,每回合损失${'belong_to'} ${'value'}${'stats'}`,
time_extend: (valueElement)=> [`宝珠移动时间`, valueElement],
follow_attack: (valueElement)=> [`消除宝珠的回合,以`, valueElement, `的伤害追打敌人`],
auto_heal: (valueElement)=> [`消除宝珠的回合,回复`, valueElement, `的 HP`],
time_extend: tp`${'icon'}宝珠移动时间 ${'value'}`,
follow_attack: tp`${'icon'}消除宝珠的回合,以${'belong_to'}${'value'}的伤害追打${'target'}(计算防御力)`,//(valueElement)=> [`消除宝珠的回合,以`, valueElement, `的伤害追打敌人`],
auto_heal: tp`${'icon'}消除宝珠的回合,回复${'belong_to'}${'value'}${'stats'}`,
ctw: (valueElement)=> [valueElement, `内时间停止,可以任意移动宝珠`],
gravity: tp`造成${'target'}${'value'}的伤害`,//(valueElement)=> [`造成敌方`, valueElement, `的伤害`],
resolve: (stats, valueElement, probability)=> [probability ? `${(probability* 100).keepCounts()}%的几率`:'',`如当前`,valueElement,`受到单一次致命攻击时将会以1点 HP 生还`],
@ -31,6 +31,7 @@ const localTranslating = {
target: {
self: tp`发动者自身`,
enemy: tp`敌人`,
team: tp`队伍`,
},
stats: {
unknown: tp`[ 未知状态: ${'type'}]`, //type

View File

@ -11,13 +11,19 @@ function tp(strings, ...keys) {
{
value = document.createTextNode(value);
}
try{
//console.log(value);
fragment.appendChild(value);
}catch(e)
if (value == undefined)
{
console.log(value, e);
console.log(keys, values);
console.log("模板字符串中 %s 未找到输入数据",key);
}else
{
try{
//console.log(value);
fragment.appendChild(value);
}catch(e)
{
console.log(value, e);
console.log(keys, values);
}
}
fragment.appendChild(document.createTextNode(strings[i + 1]));
});
@ -769,10 +775,10 @@ function renderSkill(skill, option = {})
break;
}
case SkillKinds.Heal: { //回血主动
console.log(skill)
dict = {
icon: option.forTurns ? createIcon("auto-heal") : createIcon("heal", "hp-incr"),
value: renderValue(skill.value),
belong_to: option.forTurns ? tsp.target.team() : tsp.target.self(),
value: renderValue(skill.value, {percent: option.forTurns}),
stats: tsp.stats.hp(),
};
atf(tsp.skill.heal(dict));
@ -798,17 +804,31 @@ function renderSkill(skill, option = {})
break;
}
case SkillKinds.TimeExtend: { //时间变化buff
atf(createIcon("status-time", SkillValue.isLess(skill.value) ? "time-decr" : "time-incr"));
atf(tsp.skill.time_extend(renderValue(skill.value, { unit: tsp.unit.seconds, plusSign:true, percent:true })));
dict = {
icon: createIcon("status-time", SkillValue.isLess(skill.value) ? "time-decr" : "time-incr"),
value: renderValue(skill.value, { unit:tsp.unit.seconds, plusSign:true, percent:true }),
};
atf(tsp.skill.time_extend(dict));
break;
}
case SkillKinds.FollowAttack: { //队长技追打
atf(tsp.skill.follow_attack(renderValue(skill.value)));
dict = {
//icon: createIcon("follow_attack"),
belong_to: tsp.target.self(),
target: tsp.target.enemy(),
value: renderValue(skill.value),
};
atf(tsp.skill.follow_attack(dict));
break;
}
case SkillKinds.AutoHeal: { //队长技自动回血
atf(createIcon("auto-heal"));
atf(tsp.skill.auto_heal(renderValue(skill.value)));
dict = {
icon: createIcon("auto-heal"),
belong_to: tsp.target.self(),
value: renderValue(skill.value),
stats: tsp.stats.hp(),
};
atf(tsp.skill.auto_heal(dict));
break;
}
case SkillKinds.CTW: { //时间暂停