今天不想继续做了
This commit is contained in:
parent
2124420511
commit
aa43b749bc
|
@ -5,18 +5,23 @@ const localTranslating = {
|
||||||
unknown: tp`未知的技能类型:${'type'}`, //type
|
unknown: tp`未知的技能类型:${'type'}`, //type
|
||||||
active_turns: tp`${'actionSkill'},效果 ${'turns'} 回合`, //turns, actionSkill
|
active_turns: tp`${'actionSkill'},效果 ${'turns'} 回合`, //turns, actionSkill
|
||||||
random_skills: tp`随机发动以下技能:${'skills'}`, //skills
|
random_skills: tp`随机发动以下技能:${'skills'}`, //skills
|
||||||
damage_enemy: tp`对${'target'}造成${'damage'}的${'attr'}伤害`, //
|
damage_enemy: tp`对${'target'}造成${'damage'}的${'attr'}伤害`, //target, damage, attr
|
||||||
|
vampire: tp`对${'target'}造成${'damage'}的${'attr'}伤害,并${'icon'}回复伤害值${'heal'}的HP`, //target, damage, attr
|
||||||
delay: tp`${'icon'}延迟敌人的攻击`, //icon
|
delay: tp`${'icon'}延迟敌人的攻击`, //icon
|
||||||
mass_attack: tp`${'icon'}所有攻击变为全体攻击`,
|
mass_attack: tp`${'icon'}所有攻击变为全体攻击`,
|
||||||
leader_change: tp`${'icon'}将自身换为队长,再次使用则换回来`,
|
leader_change: tp`${'icon'}将自身换为队长,再次使用则换回来`,
|
||||||
no_skyfall: tp`${'icon'}天降的宝珠不会消除`,
|
no_skyfall: tp`${'icon'}天降的宝珠不会消除`,
|
||||||
hp_modify: tp`${'icon'}回复 ${'belong_to'}${'value'} 的 ${'stats'}`,
|
self_harm: tp`${'icon'}${'stats'}减少${'value'}`,
|
||||||
heal: tp`${'icon'}回复 ${'belong_to'}${'value'} 的 ${'stats'}`,
|
heal: tp`${'icon'}回复 ${'value'} 的 ${'stats'}`,
|
||||||
defense_break: tp`${'icon'}敌方的防御力减少 ${'value'}`,
|
unbind_normal: tp`${'icon'}封锁状态减少${'value'}`,
|
||||||
|
unbind_awakenings: tp`${'icon'}觉醒无效状态减少${'value'}回合`,
|
||||||
|
unbind_matches: tp`${'icon'}无法消除宝珠状态减少${'value'}回合`,
|
||||||
|
defense_break: tp`${'icon'}敌方的防御力减少${'value'}回合`,
|
||||||
poison: tp`${'icon'}使${'target'}全体中毒,每回合损失${'belong_to'} ${'value'} 的 ${'stats'}`,
|
poison: tp`${'icon'}使${'target'}全体中毒,每回合损失${'belong_to'} ${'value'} 的 ${'stats'}`,
|
||||||
time_extend: tp`${'icon'}宝珠移动时间 ${'value'}`,
|
time_extend: tp`${'icon'}宝珠移动时间 ${'value'}`,
|
||||||
follow_attack: tp`${'icon'}消除宝珠的回合,以${'belong_to'}${'value'}的伤害追打${'target'}(计算防御力)`,//(valueElement)=> [`消除宝珠的回合,以`, valueElement, `的伤害追打敌人`],
|
follow_attack: tp`${'icon'}消除宝珠的回合,以${'belong_to'}${'value'}的伤害追打${'target'}(计算防御力)`,//(valueElement)=> [`消除宝珠的回合,以`, valueElement, `的伤害追打敌人`],
|
||||||
auto_heal: tp`${'icon'}消除宝珠的回合,回复${'belong_to'}${'value'}的 ${'stats'}`,
|
auto_heal_buff: tp`行动结束后${'icon'}回复${'value'}的${'stats'}`,
|
||||||
|
auto_heal: tp`${'icon'}消除宝珠的回合,回复${'belong_to'}${'value'}的${'stats'}`,
|
||||||
ctw: (valueElement)=> [valueElement, `内时间停止,可以任意移动宝珠`],
|
ctw: (valueElement)=> [valueElement, `内时间停止,可以任意移动宝珠`],
|
||||||
gravity: tp`${'icon'}造成${'target'}${'value'}的伤害`,//(valueElement)=> [`造成敌方`, valueElement, `的伤害`],
|
gravity: tp`${'icon'}造成${'target'}${'value'}的伤害`,//(valueElement)=> [`造成敌方`, valueElement, `的伤害`],
|
||||||
resolve: (stats, valueElement, probability)=> [probability ? `有${(probability* 100).keepCounts()}%的几率`:'',`如当前`,valueElement,`,受到单一次致命攻击时,将会以1点 HP 生还`],
|
resolve: (stats, valueElement, probability)=> [probability ? `有${(probability* 100).keepCounts()}%的几率`:'',`如当前`,valueElement,`,受到单一次致命攻击时,将会以1点 HP 生还`],
|
||||||
|
@ -25,11 +30,13 @@ const localTranslating = {
|
||||||
value: {
|
value: {
|
||||||
unknown: tp`[ 未知数值: ${'type'}]`, //type
|
unknown: tp`[ 未知数值: ${'type'}]`, //type
|
||||||
const: tp`${'value'}${'unit'}`,
|
const: tp`${'value'}${'unit'}`,
|
||||||
|
const_to: tp`到${'value'}`,
|
||||||
mul_percent: tp`${'value'}%`,
|
mul_percent: tp`${'value'}%`,
|
||||||
mul_times: tp`×${'value'}倍`,
|
mul_times: tp`×${'value'}倍`,
|
||||||
mul_of_percent: tp`${'stats'}的${'value'}%`,
|
mul_of_percent: tp`${'stats'}的${'value'}%`,
|
||||||
mul_of_times: tp`${'stats'}×${'value'}倍`,
|
mul_of_times: tp`${'stats'}×${'value'}倍`,
|
||||||
hp_scale: tp`${'hp'}为100%时${'min'},${'hp'}为1时${'max'}`,
|
hp_scale: tp`${'hp'}为100%时${'min'},${'hp'}为1时${'max'}`,
|
||||||
|
random_atk: tp`${'atk'}×${'min'}${'max'}倍`,
|
||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
[0]: tp`${'icon'}火`,
|
[0]: tp`${'icon'}火`,
|
||||||
|
@ -75,9 +82,12 @@ const localTranslating = {
|
||||||
unit: {
|
unit: {
|
||||||
seconds: tp`秒`,
|
seconds: tp`秒`,
|
||||||
point: tp`点`,
|
point: tp`点`,
|
||||||
|
turns: tp`回合`,
|
||||||
},
|
},
|
||||||
word: {
|
word: {
|
||||||
|
comma: tp`,`, //逗号
|
||||||
slight_pause: tp`、`, //顿号
|
slight_pause: tp`、`, //顿号
|
||||||
|
range_hyphen: tp`~`, //范围连字符
|
||||||
affix_attr: tp`${'cotent'}属性`, //词缀-属性
|
affix_attr: tp`${'cotent'}属性`, //词缀-属性
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -85,7 +95,9 @@ const localTranslating = {
|
||||||
|
|
||||||
//大数字缩短长度
|
//大数字缩短长度
|
||||||
Number.prototype.bigNumberToString = function() {
|
Number.prototype.bigNumberToString = function() {
|
||||||
let numTemp = this.valueOf();
|
const negative = this < 0;
|
||||||
|
|
||||||
|
let numTemp = negative ? Math.abs(this) : this.valueOf();
|
||||||
if (!numTemp) return "0";
|
if (!numTemp) return "0";
|
||||||
const grouping = Math.pow(10, 4);
|
const grouping = Math.pow(10, 4);
|
||||||
const unit = ['', '万', '亿', '兆', '京', '垓'];
|
const unit = ['', '万', '亿', '兆', '京', '垓'];
|
||||||
|
@ -108,7 +120,7 @@ Number.prototype.bigNumberToString = function() {
|
||||||
let outStr = numPartsStr.join("");
|
let outStr = numPartsStr.join("");
|
||||||
outStr = outStr.replace(/(^零+|零+$)/g, ''); //去除开头的零
|
outStr = outStr.replace(/(^零+|零+$)/g, ''); //去除开头的零
|
||||||
outStr = outStr.replace(/零{2,}/g, '零'); //去除多个连续的零
|
outStr = outStr.replace(/零{2,}/g, '零'); //去除多个连续的零
|
||||||
return outStr;
|
return (negative ? "-" : "") + outStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//查找原先完整技能
|
//查找原先完整技能
|
||||||
|
|
|
@ -7,15 +7,15 @@ function tp(strings, ...keys) {
|
||||||
//let result = [strings[0]];
|
//let result = [strings[0]];
|
||||||
keys.forEach(function(key, i, arr) {
|
keys.forEach(function(key, i, arr) {
|
||||||
let value = Number.isInteger(key) ? values[key] : dict[key];
|
let value = Number.isInteger(key) ? values[key] : dict[key];
|
||||||
if (!(value instanceof Node))
|
|
||||||
{
|
|
||||||
value = document.createTextNode(value);
|
|
||||||
}
|
|
||||||
if (value == undefined)
|
if (value == undefined)
|
||||||
{
|
{
|
||||||
console.log("模板字符串中 %s 未找到输入数据",key);
|
console.log("模板字符串中 %s 未找到输入数据",key);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
if (!(value instanceof Node))
|
||||||
|
{
|
||||||
|
value = document.createTextNode(value);
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
fragment.appendChild(arr.lastIndexOf(key) == i ? value : value.cloneNode(true));
|
fragment.appendChild(arr.lastIndexOf(key) == i ? value : value.cloneNode(true));
|
||||||
}catch(e)
|
}catch(e)
|
||||||
|
@ -91,6 +91,7 @@ const SkillValue = {
|
||||||
const SkillValueKind = {
|
const SkillValueKind = {
|
||||||
Percent: 'mul',
|
Percent: 'mul',
|
||||||
Constant: 'const',
|
Constant: 'const',
|
||||||
|
ConstantTo: 'const-to',
|
||||||
xMaxHP: 'mul-maxhp',
|
xMaxHP: 'mul-maxhp',
|
||||||
xHP: 'mul-hp',
|
xHP: 'mul-hp',
|
||||||
xATK: 'mul-atk',
|
xATK: 'mul-atk',
|
||||||
|
@ -121,8 +122,9 @@ const SkillKinds = {
|
||||||
DamageEnemy: "damage-enemy",
|
DamageEnemy: "damage-enemy",
|
||||||
Vampire: "vampire",
|
Vampire: "vampire",
|
||||||
ReduceDamage: "reduce-damage",
|
ReduceDamage: "reduce-damage",
|
||||||
HPModify: "hp-modify",
|
SelfHarm: "self-harm",
|
||||||
Heal: "heal",
|
Heal: "heal",
|
||||||
|
AutoHealBuff: "auto-heal-buff",
|
||||||
ChangeOrbs: "change-orbs",
|
ChangeOrbs: "change-orbs",
|
||||||
PowerUp: "power-up",
|
PowerUp: "power-up",
|
||||||
CounterAttack: "counter-attack",
|
CounterAttack: "counter-attack",
|
||||||
|
@ -157,6 +159,30 @@ const SkillKinds = {
|
||||||
|
|
||||||
function skillParser(skillId)
|
function skillParser(skillId)
|
||||||
{
|
{
|
||||||
|
/*function merge(skills)
|
||||||
|
{
|
||||||
|
//解封部分的合并
|
||||||
|
let unbinds = skills.filter(skill=>skill.kind == SkillKinds.Unbind);
|
||||||
|
if (unbinds.length>1)
|
||||||
|
{ //把后面的全都合并到第一个
|
||||||
|
unbinds.reduce((pre,cur)=>{
|
||||||
|
pre.normal = pre.normal || cur.normal;
|
||||||
|
pre.awakenings = pre.awakenings || cur.awakenings;
|
||||||
|
pre.matches = pre.matches || cur.matches;
|
||||||
|
return pre
|
||||||
|
});
|
||||||
|
unbinds.shift(); //去除第一个
|
||||||
|
unbinds.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
|
||||||
|
}
|
||||||
|
let fixedDamages = skills.filter(skill=>skill.kind == SkillKinds.DamageEnemy && skill.attr === 'fixed').filter((skill,idx,arr)=>skill.id==arr[0].id);
|
||||||
|
if (fixedDamages.length>1)
|
||||||
|
{ //把后面的全都合并到第一个
|
||||||
|
fixedDamages[0].times = 5;
|
||||||
|
fixedDamages.shift(); //去除第一个
|
||||||
|
fixedDamages.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
const skill = Skills[skillId];
|
const skill = Skills[skillId];
|
||||||
if (!skill) return [];
|
if (!skill) return [];
|
||||||
if (!parsers[skill.type]) {
|
if (!parsers[skill.type]) {
|
||||||
|
@ -167,6 +193,7 @@ function skillParser(skillId)
|
||||||
const skills = (Array.isArray(result) ? result : [result])
|
const skills = (Array.isArray(result) ? result : [result])
|
||||||
.filter(s => Boolean(s))
|
.filter(s => Boolean(s))
|
||||||
.map(s => ({ id: skillId, type: skill.type, params: skill.params, ...s }));
|
.map(s => ({ id: skillId, type: skill.type, params: skill.params, ...s }));
|
||||||
|
//merge(skills);
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +221,9 @@ const v = {
|
||||||
constant: function(value) {
|
constant: function(value) {
|
||||||
return { kind: SkillValueKind.Constant, value: value || 0 };
|
return { kind: SkillValueKind.Constant, value: value || 0 };
|
||||||
},
|
},
|
||||||
|
constantTo: function(value) {
|
||||||
|
return { kind: SkillValueKind.ConstantTo, value: value || 1 };
|
||||||
|
},
|
||||||
xMaxHP: function(value) {
|
xMaxHP: function(value) {
|
||||||
return { kind: SkillValueKind.xMaxHP, value: (value / 100) || 1 };
|
return { kind: SkillValueKind.xMaxHP, value: (value / 100) || 1 };
|
||||||
},
|
},
|
||||||
|
@ -302,8 +332,8 @@ const p = {
|
||||||
function activeTurns(turns, skill) {
|
function activeTurns(turns, skill) {
|
||||||
return skill ? { kind: SkillKinds.ActiveTurns, turns: turns, skill: skill } : null;
|
return skill ? { kind: SkillKinds.ActiveTurns, turns: turns, skill: skill } : null;
|
||||||
}
|
}
|
||||||
function damageEnemy(target, attr, damage, selfHP) {
|
function damageEnemy(target, attr, damage) {
|
||||||
return { kind: SkillKinds.DamageEnemy, target: target, attr: attr, damage: damage, selfHP: selfHP };
|
return { kind: SkillKinds.DamageEnemy, target: target, attr: attr, damage: damage };
|
||||||
}
|
}
|
||||||
function vampire(attr, damageValue, healValue) {
|
function vampire(attr, damageValue, healValue) {
|
||||||
return { kind: SkillKinds.Vampire, attr: attr, damage: damageValue, heal: healValue };
|
return { kind: SkillKinds.Vampire, attr: attr, damage: damageValue, heal: healValue };
|
||||||
|
@ -311,12 +341,15 @@ function vampire(attr, damageValue, healValue) {
|
||||||
function reduceDamage(attrs, percent, condition) {
|
function reduceDamage(attrs, percent, condition) {
|
||||||
return { kind: SkillKinds.ReduceDamage, attrs: attrs, percent: percent, condition: condition };
|
return { kind: SkillKinds.ReduceDamage, attrs: attrs, percent: percent, condition: condition };
|
||||||
}
|
}
|
||||||
function HPModify(value) {
|
function selfHarm(value) {
|
||||||
return { kind: SkillKinds.HPModify, value: value };
|
return { kind: SkillKinds.SelfHarm, value: value };
|
||||||
}
|
}
|
||||||
function heal(value) {
|
function heal(value) {
|
||||||
return { kind: SkillKinds.Heal, value: value };
|
return { kind: SkillKinds.Heal, value: value };
|
||||||
}
|
}
|
||||||
|
function autoHealBuff(value) {
|
||||||
|
return { kind: SkillKinds.AutoHealBuff, value: value };
|
||||||
|
}
|
||||||
function changeOrbs() {
|
function changeOrbs() {
|
||||||
return { kind: SkillKinds.ChangeOrbs, changes: Array.from(arguments) };
|
return { kind: SkillKinds.ChangeOrbs, changes: Array.from(arguments) };
|
||||||
}
|
}
|
||||||
|
@ -343,8 +376,8 @@ function orbDropIncrease(value, attrs) {
|
||||||
function resolve(min, condition) {
|
function resolve(min, condition) {
|
||||||
return { kind: SkillKinds.Resolve, min: min, max: 1, condition: condition };
|
return { kind: SkillKinds.Resolve, min: min, max: 1, condition: condition };
|
||||||
}
|
}
|
||||||
function unbind(normal, awakenings) {
|
function unbind(normal, awakenings, matches) {
|
||||||
return { kind: SkillKinds.Unbind, normal: normal, awakenings: awakenings };
|
return { kind: SkillKinds.Unbind, normal: normal, awakenings: awakenings , matches: matches};
|
||||||
}
|
}
|
||||||
function boardChange(attrs) {
|
function boardChange(attrs) {
|
||||||
return { kind: SkillKinds.BoardChange, attrs: attrs };
|
return { kind: SkillKinds.BoardChange, attrs: attrs };
|
||||||
|
@ -389,8 +422,8 @@ const parsers = {
|
||||||
[4](mul) { return poison(v.xATK(mul)); },
|
[4](mul) { return poison(v.xATK(mul)); },
|
||||||
[5](time) { return CTW(v.constant(time)); },
|
[5](time) { return CTW(v.constant(time)); },
|
||||||
[6](percent) { return gravity(v.xHP(percent)); },
|
[6](percent) { return gravity(v.xHP(percent)); },
|
||||||
[7](mul) { return HPModify(v.xRCV(mul)); },
|
[7](mul) { return heal(v.xRCV(mul)); },
|
||||||
[8](value) { return HPModify(v.constant(value)); },
|
[8](value) { return heal(v.constant(value)); },
|
||||||
[9](from, to) { return changeOrbs({ kind: 'from', from: [from || 0], to: [to || 0] }); },
|
[9](from, to) { return changeOrbs({ kind: 'from', from: [from || 0], to: [to || 0] }); },
|
||||||
[10]() { return dropRefresh(); },
|
[10]() { return dropRefresh(); },
|
||||||
[11](attr, mul) { return powerUp([attr], null, p.mul({ atk: mul })); },
|
[11](attr, mul) { return powerUp([attr], null, p.mul({ atk: mul })); },
|
||||||
|
@ -463,10 +496,30 @@ const parsers = {
|
||||||
|
|
||||||
[79](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ atk: mul, rcv: mul })); },
|
[79](type1, type2, mul) { return powerUp(null, [type1, type2], p.mul({ atk: mul, rcv: mul })); },
|
||||||
|
|
||||||
[84](attr, min, max, percent) { return damageEnemy('single', attr, v.randomATK(min, max), percent ? v.xHP(percent) : v.constant(1)); },
|
[84](attr, min, max, percent) {
|
||||||
[85](attr, min, max, percent) { return damageEnemy('all', attr, v.randomATK(min, max), percent ? v.xHP(percent) : v.constant(1)); },
|
return [
|
||||||
[86](attr, value, _, percent) { return damageEnemy('single', attr, v.constant(value), percent ? v.xHP(percent) : v.constant(1)); },
|
selfHarm(percent ? v.xHP(100 - percent) : v.constantTo(1)),
|
||||||
[87](attr, value, _, percent) { return damageEnemy('all', attr, v.constant(value), percent ? v.xHP(percent) : v.constant(1)); },
|
damageEnemy('single', attr, v.randomATK(min, max))
|
||||||
|
];
|
||||||
|
},
|
||||||
|
[85](attr, min, max, percent) {
|
||||||
|
return [
|
||||||
|
selfHarm(percent ? v.xHP(100 - percent) : v.constantTo(1)),
|
||||||
|
damageEnemy('all', attr, v.randomATK(min, max))
|
||||||
|
];
|
||||||
|
},
|
||||||
|
[86](attr, value, _, percent) {
|
||||||
|
return [
|
||||||
|
selfHarm(percent ? v.xHP(100 - percent) : v.constantTo(1)),
|
||||||
|
damageEnemy('single', attr, v.constant(value))
|
||||||
|
];
|
||||||
|
},
|
||||||
|
[87](attr, value, _, percent) {
|
||||||
|
return [
|
||||||
|
selfHarm(percent ? v.xHP(100 - percent) : v.constantTo(1)),
|
||||||
|
damageEnemy('all', attr, v.constant(value))
|
||||||
|
];
|
||||||
|
},
|
||||||
[88](turns, type, mul) { return activeTurns(turns, powerUp(null, [type], p.mul({ atk: mul }))); },
|
[88](turns, type, mul) { return activeTurns(turns, powerUp(null, [type], p.mul({ atk: mul }))); },
|
||||||
|
|
||||||
[90](turns, attr1, attr2, mul) { return activeTurns(turns, powerUp([attr1, attr2], null, p.mul({ atk: mul }))); },
|
[90](turns, attr1, attr2, mul) { return activeTurns(turns, powerUp([attr1, attr2], null, p.mul({ atk: mul }))); },
|
||||||
|
@ -497,7 +550,7 @@ const parsers = {
|
||||||
[116](...ids) { return ids.flatMap(id => this.parser(id)); },
|
[116](...ids) { return ids.flatMap(id => this.parser(id)); },
|
||||||
[117](bind, rcv, constant, hp, awokenBind) {
|
[117](bind, rcv, constant, hp, awokenBind) {
|
||||||
return [
|
return [
|
||||||
rcv ? HPModify(v.xRCV(rcv)) : hp ? HPModify(v.xMaxHP(hp)) : constant ? HPModify(v.constant(constant)) : null,
|
rcv ? heal(v.xRCV(rcv)) : hp ? heal(v.xMaxHP(hp)) : constant ? heal(v.constant(constant)) : null,
|
||||||
(bind || awokenBind) ? unbind(bind || 0, awokenBind || 0) : null,
|
(bind || awokenBind) ? unbind(bind || 0, awokenBind || 0) : null,
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
},
|
},
|
||||||
|
@ -656,7 +709,12 @@ const parsers = {
|
||||||
powerUp(flags(attrs), flags(types), p.mul({ hp, atk, rcv }))
|
powerUp(flags(attrs), flags(types), p.mul({ hp, atk, rcv }))
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
[179](turns, value, percent) { return activeTurns(turns, heal(value ? v.constant(value) : v.xMaxHP(percent))); },
|
[179](turns, value, percent, bind, awokenBind) {
|
||||||
|
return [
|
||||||
|
(bind || awokenBind) ? unbind(bind || 0, awokenBind || 0) : null,
|
||||||
|
activeTurns(turns, autoHealBuff(value ? v.constant(value) : v.xMaxHP(percent)))
|
||||||
|
].filter(Boolean);
|
||||||
|
},
|
||||||
[180](turns, percent) { return activeTurns(turns, orbDropIncrease(v.percent(percent), 'enhanced')); },
|
[180](turns, percent) { return activeTurns(turns, orbDropIncrease(v.percent(percent), 'enhanced')); },
|
||||||
|
|
||||||
[182](attrs, len, mul, percent) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul, 100], [0, 0]), undefined, v.percent(percent)); },
|
[182](attrs, len, mul, percent) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul, 100], [0, 0]), undefined, v.percent(percent)); },
|
||||||
|
@ -682,6 +740,12 @@ const parsers = {
|
||||||
[188](value) {
|
[188](value) {
|
||||||
return damageEnemy('single', 'fixed', v.constant(value));
|
return damageEnemy('single', 'fixed', v.constant(value));
|
||||||
},
|
},
|
||||||
|
[195](percent) {
|
||||||
|
return selfHarm(percent ? v.xHP(percent) : v.constantTo(1));
|
||||||
|
},
|
||||||
|
[196](matches) {
|
||||||
|
return unbind(0,0,matches);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//将内容添加到代码片段
|
//将内容添加到代码片段
|
||||||
|
@ -699,6 +763,7 @@ DocumentFragment.prototype.ap = function(arg)
|
||||||
{
|
{
|
||||||
this.appendChild(document.createTextNode(arg));
|
this.appendChild(document.createTextNode(arg));
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//将数组和分隔符添加到一个代码片段,类似join
|
//将数组和分隔符添加到一个代码片段,类似join
|
||||||
|
@ -745,6 +810,11 @@ function renderSkill(skill, option = {})
|
||||||
return idoc;
|
return idoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(skill))
|
||||||
|
{
|
||||||
|
frg.ap(skill.map(_skill=>renderSkill(_skill)));
|
||||||
|
return frg;
|
||||||
|
}
|
||||||
let dict;
|
let dict;
|
||||||
switch (skill.kind) {
|
switch (skill.kind) {
|
||||||
case SkillKinds.Unknown: {
|
case SkillKinds.Unknown: {
|
||||||
|
@ -758,7 +828,7 @@ function renderSkill(skill, option = {})
|
||||||
let turns = skill.turns, actionSkill = skill.skill;
|
let turns = skill.turns, actionSkill = skill.skill;
|
||||||
dict = {
|
dict = {
|
||||||
turns: turns,
|
turns: turns,
|
||||||
actionSkill: actionSkill,
|
actionSkill: renderSkill(actionSkill),
|
||||||
};
|
};
|
||||||
frg.ap(tsp.skill.active_turns(dict));
|
frg.ap(tsp.skill.active_turns(dict));
|
||||||
break;
|
break;
|
||||||
|
@ -805,26 +875,36 @@ function renderSkill(skill, option = {})
|
||||||
frg.ap(tsp.skill.no_skyfall(dict));
|
frg.ap(tsp.skill.no_skyfall(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SkillKinds.HPModify: { //主动立刻回血
|
case SkillKinds.SelfHarm: { //主动自残
|
||||||
|
let value = skill.value;
|
||||||
dict = {
|
dict = {
|
||||||
icon: skill.value.value > 0 ? createIcon("heal", "hp-incr") : createIcon("heal", "hp-decr"),
|
icon: createIcon("heal", "hp-decr"),
|
||||||
belong_to: option.forTurns ? tsp.target.team() : tsp.target.self(),
|
value: renderValue(value, {percent: true}),
|
||||||
value: renderValue(skill.value, {percent: option.forTurns}),
|
|
||||||
stats: tsp.stats.hp(),
|
stats: tsp.stats.hp(),
|
||||||
};
|
};
|
||||||
frg.ap(tsp.skill.hp_modify(dict));
|
frg.ap(tsp.skill.self_harm(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SkillKinds.Heal: { //主动回血buff
|
case SkillKinds.Heal: { //主动回血buff
|
||||||
|
let value = skill.value;
|
||||||
dict = {
|
dict = {
|
||||||
icon: createIcon("auto-heal"),
|
icon: createIcon("heal", "hp-incr"),
|
||||||
belong_to: tsp.target.team(),
|
//icon: createIcon("auto-heal"),
|
||||||
value: renderValue(skill.value),
|
value: renderValue(value, {unit: tsp.unit.point, percent: value.kind == SkillValueKind.xRCV ? false : true}),
|
||||||
stats: tsp.stats.hp(),
|
stats: tsp.stats.hp(),
|
||||||
};
|
};
|
||||||
frg.ap(tsp.skill.heal(dict));
|
frg.ap(tsp.skill.heal(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SkillKinds.AutoHealBuff: { //自动回血buff
|
||||||
|
dict = {
|
||||||
|
icon: createIcon("auto-heal"),
|
||||||
|
value: renderValue(skill.value, {unit: tsp.unit.point, percent: true}),
|
||||||
|
stats: tsp.stats.hp(),
|
||||||
|
};
|
||||||
|
frg.ap(tsp.skill.auto_heal_buff(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SkillKinds.DefenseBreak: { //破防
|
case SkillKinds.DefenseBreak: { //破防
|
||||||
dict = {
|
dict = {
|
||||||
icon: createIcon("defense-break"),
|
icon: createIcon("defense-break"),
|
||||||
|
@ -878,7 +958,6 @@ function renderSkill(skill, option = {})
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SkillKinds.Gravity: { //重力
|
case SkillKinds.Gravity: { //重力
|
||||||
console.log(skill.value)
|
|
||||||
frg.ap(tsp.skill.gravity({
|
frg.ap(tsp.skill.gravity({
|
||||||
icon: createIcon("gravity"),
|
icon: createIcon("gravity"),
|
||||||
target: tsp.target.enemy(),
|
target: tsp.target.enemy(),
|
||||||
|
@ -892,11 +971,10 @@ function renderSkill(skill, option = {})
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SkillKinds.DamageEnemy: {
|
case SkillKinds.DamageEnemy: { //大炮和固伤
|
||||||
let attr = skill.attr, target = skill.target, selfHP = skill.selfHP, damage = skill.damage;
|
let attr = skill.attr, target = skill.target, damage = skill.damage;
|
||||||
if (attr == null) break; //没有属性时,编号为0的空技能
|
if (attr == null) break; //没有属性时,编号为0的空技能
|
||||||
dict = {
|
dict = {
|
||||||
icon: attr === 'fixed' ? createIcon("damage-enemy-fixed") : createIcon("damage-enemy"),
|
|
||||||
target: target === 'all' ? tsp.target.enemy_all() : target === 'single' ? tsp.target.enemy_one() : tsp.target.enemy_attr({attr: renderAttrs(target)}),
|
target: target === 'all' ? tsp.target.enemy_all() : target === 'single' ? tsp.target.enemy_one() : tsp.target.enemy_attr({attr: renderAttrs(target)}),
|
||||||
damage: renderValue(damage, {unit: tsp.unit.point}),
|
damage: renderValue(damage, {unit: tsp.unit.point}),
|
||||||
attr: renderAttrs(attr, {affix: (attr === 'self' || attr === 'fixed') ? false : true})
|
attr: renderAttrs(attr, {affix: (attr === 'self' || attr === 'fixed') ? false : true})
|
||||||
|
@ -904,6 +982,31 @@ function renderSkill(skill, option = {})
|
||||||
frg.ap(tsp.skill.damage_enemy(dict));
|
frg.ap(tsp.skill.damage_enemy(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SkillKinds.Vampire: {
|
||||||
|
let attr = skill.attr, damage = skill.damage, heal = skill.heal;
|
||||||
|
dict = {
|
||||||
|
icon: createIcon("heal", "hp-incr"),
|
||||||
|
target: tsp.target.enemy_one(),
|
||||||
|
damage: renderValue(damage),
|
||||||
|
attr: renderAttrs(attr, {affix: (attr === 'self' || attr === 'fixed') ? false : true}),
|
||||||
|
heal: renderValue(heal, {percent: true}),
|
||||||
|
};
|
||||||
|
frg.ap(tsp.skill.vampire(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SkillKinds.Unbind: {
|
||||||
|
let normal = skill.normal, awakenings = skill.awakenings, matches = skill.matches;
|
||||||
|
console.log(normal,awakenings)
|
||||||
|
let effects = [];
|
||||||
|
if (normal)
|
||||||
|
effects.push(tsp.skill.unbind_normal({icon: createIcon("unbind-normal"), value: normal}));
|
||||||
|
if (awakenings)
|
||||||
|
effects.push(tsp.skill.unbind_awakenings({icon: createIcon("unbind-awakenings"), value: awakenings}));
|
||||||
|
if (matches)
|
||||||
|
effects.push(tsp.skill.unbind_matches({icon: createIcon("unbind-matches"), value: matches}));
|
||||||
|
frg.ap(effects.nodeJoin(tsp.word.comma()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
case SkillKinds.BoardChange: {
|
case SkillKinds.BoardChange: {
|
||||||
|
@ -1347,7 +1450,8 @@ function renderPowerUp(powerUp: SkillPowerUp) {
|
||||||
function renderValue(_value, option = {}) {
|
function renderValue(_value, option = {}) {
|
||||||
const frg = document.createDocumentFragment();
|
const frg = document.createDocumentFragment();
|
||||||
if (typeof localTranslating == "undefined") return frg;
|
if (typeof localTranslating == "undefined") return frg;
|
||||||
const tspv = localTranslating.skill_parse.value;
|
const tsp = localTranslating.skill_parse
|
||||||
|
const tspv = tsp.value;
|
||||||
const od = option.decimalDigits, os = option.plusSign;
|
const od = option.decimalDigits, os = option.plusSign;
|
||||||
let dict;
|
let dict;
|
||||||
switch (_value.kind) {
|
switch (_value.kind) {
|
||||||
|
@ -1370,6 +1474,13 @@ function renderValue(_value, option = {}) {
|
||||||
frg.ap(tspv.const(dict));
|
frg.ap(tspv.const(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SkillValueKind.ConstantTo: {
|
||||||
|
dict = {
|
||||||
|
value: _value.value.keepCounts(od,os)
|
||||||
|
};
|
||||||
|
frg.ap(tspv.const_to(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SkillValueKind.xMaxHP: {
|
case SkillValueKind.xMaxHP: {
|
||||||
dict = {
|
dict = {
|
||||||
value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
|
value: option.percent ? (_value.value * 100).keepCounts(od,os) : _value.value.keepCounts(od,os),
|
||||||
|
@ -1467,43 +1578,21 @@ function renderValue(_value, option = {}) {
|
||||||
frg.ap(tspv.hp_scale(dict));
|
frg.ap(tspv.hp_scale(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SkillValueKind.RandomATK: {
|
||||||
|
let min = _value.min, max = _value.max;
|
||||||
|
dict = {
|
||||||
|
min: min.keepCounts(od,os),
|
||||||
|
atk: renderStat('atk'),
|
||||||
|
};
|
||||||
|
if (max != min)
|
||||||
|
{
|
||||||
|
dict.max = tsp.word.range_hyphen().ap(max.keepCounts(od,os));
|
||||||
|
}
|
||||||
|
|
||||||
|
frg.ap(tspv.random_atk(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
case SkillValueKind.Percent: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value * 100)}%</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.Constant: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value)}{unit ? ` ${unit}` : ''}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xMaxHP: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value * 100)}% of {renderStat('maxhp')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xHP: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value * 100)}% of {renderStat('hp')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xATK: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value)} × {renderStat('atk')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xRCV: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value)} × {renderStat('rcv')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xTeamRCV: {
|
|
||||||
const { value } = _value as SkillValue.Simple;
|
|
||||||
return <span>{formatNumber(value)} × {renderStat('teamrcv')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.xTeamATK: {
|
|
||||||
const { value, attrs } = _value as SkillValue.WithAttributes;
|
|
||||||
return <span>{formatNumber(value)} × {renderAttrs(attrs)} {renderStat('teamatk')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.HPScale: {
|
|
||||||
const { min, max } = _value as SkillValue.Scale;
|
|
||||||
return <span>({formatNumber(min)} ⇔ {formatNumber(max)} ∝ {renderStat('hp')}) × {renderStat('atk')}</span>;
|
|
||||||
}
|
|
||||||
case SkillValueKind.RandomATK: {
|
case SkillValueKind.RandomATK: {
|
||||||
const { min, max } = _value as SkillValue.Scale;
|
const { min, max } = _value as SkillValue.Scale;
|
||||||
if (min === max) {
|
if (min === max) {
|
||||||
|
|
10
style.css
10
style.css
|
@ -3138,7 +3138,15 @@ table .orb-icon
|
||||||
{
|
{
|
||||||
background-position-y:calc(-36px * 15);
|
background-position-y:calc(-36px * 15);
|
||||||
}
|
}
|
||||||
.icon-skill[data-icon-type="damage-enemy-fixed"]
|
.icon-skill[data-icon-type="unbind-normal"]
|
||||||
{
|
{
|
||||||
background-position-y:calc(-36px * 16);
|
background-position-y:calc(-36px * 16);
|
||||||
|
}
|
||||||
|
.icon-skill[data-icon-type="unbind-awakenings"]
|
||||||
|
{
|
||||||
|
background-position-y:calc(-36px * 17);
|
||||||
|
}
|
||||||
|
.icon-skill[data-icon-type="unbind-matches"]
|
||||||
|
{
|
||||||
|
background-position-y:calc(-36px * 18);
|
||||||
}
|
}
|
Loading…
Reference in New Issue