从条件开始就非常复杂
This commit is contained in:
parent
1fb918ff88
commit
a4bd5478ac
|
@ -58,7 +58,7 @@
|
||||||
board7x6: tp`【${'icon'}7×6版面】`,
|
board7x6: tp`【${'icon'}7×6版面】`,
|
||||||
counter_attack: tp`受到${'target'}攻击时,${'prob'}进行受到伤害${'value'}的${'attr'}${'icon'}反击`,
|
counter_attack: tp`受到${'target'}攻击时,${'prob'}进行受到伤害${'value'}的${'attr'}${'icon'}反击`,
|
||||||
change_orbs: tp`${'from'}→${'to'}`,
|
change_orbs: tp`${'from'}→${'to'}`,
|
||||||
generate_orbs: tp`${'exclude'}生成${'orbs'}各${'count'}个`,
|
generate_orbs: tp`${'exclude'}生成${'orbs'}各${'value'}个`,
|
||||||
fixed_orbs: tp`在${'position'}产生${'orbs'}`,
|
fixed_orbs: tp`在${'position'}产生${'orbs'}`,
|
||||||
orb_drop_increase: tp`${'orbs'}的掉落率提高到${'value'}`,
|
orb_drop_increase: tp`${'orbs'}的掉落率提高到${'value'}`,
|
||||||
attr_absorb: tp`${'icon'}属性吸收`,
|
attr_absorb: tp`${'icon'}属性吸收`,
|
||||||
|
@ -68,13 +68,31 @@
|
||||||
void_enemy_buff: tp`敌人的 ${'buff'} 无效化`,
|
void_enemy_buff: tp`敌人的 ${'buff'} 无效化`,
|
||||||
change_attribute: tp`将${'target'}变为${'attrs'}`,
|
change_attribute: tp`将${'target'}变为${'attrs'}`,
|
||||||
set_orb_state_enhanced: tp`强化${'orbs'}(每颗宝珠效力增加${'value'})`,
|
set_orb_state_enhanced: tp`强化${'orbs'}(每颗宝珠效力增加${'value'})`,
|
||||||
set_orb_state_locked: tp`将${'orbs'}锁定${'count'}`,
|
set_orb_state_locked: tp`将${'orbs'}锁定${'value'}`,
|
||||||
set_orb_state_unlocked: tp`${'icon'}解除所有宝珠的锁定状态`,
|
set_orb_state_unlocked: tp`${'icon'}解除所有宝珠的锁定状态`,
|
||||||
set_orb_state_bound: tp`无法消除${'orbs'}`,
|
set_orb_state_bound: tp`无法消除${'orbs'}`,
|
||||||
rate_multiply: tp`作为队长进入地下城时,${'rate'}变为${'value'}`,
|
rate_multiply: tp`作为队长进入地下城时,${'rate'}变为${'value'}`,
|
||||||
rate_multiply_drop: tp`${'icon'}怪物蛋掉落率`,
|
rate_multiply_drop: tp`${'icon'}怪物蛋掉落率`,
|
||||||
rate_multiply_coin: tp`${'icon'}金币掉落率`,
|
rate_multiply_coin: tp`${'icon'}金币掉落率`,
|
||||||
rate_multiply_exp: tp`${'icon'}等级经验倍率`,
|
rate_multiply_exp: tp`${'icon'}等级经验倍率`,
|
||||||
|
reduce_damage: tp`${'condition'}受到的${'attrs'}伤害${'icon'}减少${'value'}`,
|
||||||
|
},
|
||||||
|
cond: {
|
||||||
|
unknown: tp`[ 未知条件 ]`,
|
||||||
|
hp_equal: tp`${'hp'} == ${'min'} 时`,
|
||||||
|
hp_less_or_equal: tp`${'hp'} ≤ ${'max'} 时`,
|
||||||
|
hp_greater_or_equal: tp`${'hp'} ≥ ${'min'} 时`,
|
||||||
|
hp_belong_to_range: tp`${'hp'} ∈ [${'min'},${'max'}] 时`,
|
||||||
|
use_skill: tp`使用技能时`,
|
||||||
|
multi_player: tp`协力时`,
|
||||||
|
remain_orbs: tp`剩余宝珠 ≤ ${'value'} 时`,
|
||||||
|
exact_combo: tp`≥ ${'value'}连击 时`,
|
||||||
|
exact_match_length: tp`相连消除 ≥ ${'value'}${'orbs'}时`,
|
||||||
|
exact_match_enhanced: tp`并且其中包含至少一个强化宝珠`,
|
||||||
|
|
||||||
|
compo_type_card: tp`队伍中同时存在 ${'ids'} 时`,
|
||||||
|
compo_type_series: tp`队员组成全为 ${'ids'} 系列时`,
|
||||||
|
compo_type_evolution: tp`队员组成全为 ${'ids'} 进化时`,
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
top: tp`上方第${'pos'}横行`,
|
top: tp`上方第${'pos'}横行`,
|
||||||
|
@ -126,6 +144,7 @@
|
||||||
range_hyphen: tp`~`, //范围连字符
|
range_hyphen: tp`~`, //范围连字符
|
||||||
affix_attr: tp`${'cotent'}属性`, //词缀-属性
|
affix_attr: tp`${'cotent'}属性`, //词缀-属性
|
||||||
affix_orb: tp`${'cotent'}宝珠`, //词缀-宝珠
|
affix_orb: tp`${'cotent'}宝珠`, //词缀-宝珠
|
||||||
|
affix_type: tp`${'cotent'}类型`, //词缀-类型
|
||||||
affix_exclude: tp`${'cotent'}以外`, //词缀-属性
|
affix_exclude: tp`${'cotent'}以外`, //词缀-属性
|
||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -136,9 +155,25 @@
|
||||||
[4]: tp`${'icon'}暗`,
|
[4]: tp`${'icon'}暗`,
|
||||||
[5]: tp`${'icon'}回复`,
|
[5]: tp`${'icon'}回复`,
|
||||||
[6]: tp`${'icon'}空`,
|
[6]: tp`${'icon'}空`,
|
||||||
|
all: tp`所有`,
|
||||||
self: tp`${'icon'}自身属性`,
|
self: tp`${'icon'}自身属性`,
|
||||||
fixed: tp`${'icon'}无视防御固定`,
|
fixed: tp`${'icon'}无视防御固定`,
|
||||||
},
|
},
|
||||||
|
types: {
|
||||||
|
[0]: tp`${'icon'}进化用`,
|
||||||
|
[1]: tp`${'icon'}平衡`,
|
||||||
|
[2]: tp`${'icon'}体力`,
|
||||||
|
[3]: tp`${'icon'}回复`,
|
||||||
|
[4]: tp`${'icon'}龙`,
|
||||||
|
[5]: tp`${'icon'}神`,
|
||||||
|
[6]: tp`${'icon'}攻击`,
|
||||||
|
[7]: tp`${'icon'}恶魔`,
|
||||||
|
[8]: tp`${'icon'}攻击`,
|
||||||
|
[9]: tp`${'icon'}特别保护`,
|
||||||
|
[12]: tp`${'icon'}能力觉醒用`,
|
||||||
|
[14]: tp`${'icon'}强化合成用`,
|
||||||
|
[15]: tp`${'icon'}贩卖用`,
|
||||||
|
},
|
||||||
orbs: {
|
orbs: {
|
||||||
[0]: tp`${'icon'}火`,
|
[0]: tp`${'icon'}火`,
|
||||||
[1]: tp`${'icon'}水`,
|
[1]: tp`${'icon'}水`,
|
||||||
|
@ -150,8 +185,8 @@
|
||||||
[7]: tp`${'icon'}毒`,
|
[7]: tp`${'icon'}毒`,
|
||||||
[8]: tp`${'icon'}剧毒`,
|
[8]: tp`${'icon'}剧毒`,
|
||||||
[9]: tp`${'icon'}炸弹`,
|
[9]: tp`${'icon'}炸弹`,
|
||||||
all: tp`${'icon'}所有`,
|
all: tp`所有`,
|
||||||
any: tp`${'icon'}任何`,
|
any: tp`任何`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1396,7 @@ function parseSkillDescription(skill) {
|
||||||
lnk.textContent = cid;
|
lnk.textContent = cid;
|
||||||
if (idx < arr.length-1) lnk.insertAdjacentText('afterend', "、");;
|
if (idx < arr.length-1) lnk.insertAdjacentText('afterend', "、");;
|
||||||
});
|
});
|
||||||
fragment.appendChild(document.createTextNode(`合作角色时,所有宠物的${getFixedHpAtkRcvString({hp:sk[3],atk:sk[4],rcv:sk[5]})}`));
|
fragment.appendChild(document.createTextNode(`系列角色时,所有宠物的${getFixedHpAtkRcvString({hp:sk[3],atk:sk[4],rcv:sk[5]})}`));
|
||||||
return fragment;
|
return fragment;
|
||||||
break;
|
break;
|
||||||
case 176:
|
case 176:
|
||||||
|
|
|
@ -79,7 +79,43 @@ Attributes.orbs = function () {
|
||||||
this.Bomb,
|
this.Bomb,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
//代码来自于 https://www.jianshu.com/p/3644833bca33
|
||||||
|
function isEqual(obj1,obj2) {
|
||||||
|
//判断是否是对象或数组
|
||||||
|
function isObject(obj) {
|
||||||
|
return typeof obj === 'object' && obj !== null;
|
||||||
|
}
|
||||||
|
// 两个数据有任何一个不是对象或数组
|
||||||
|
if (!isObject(obj1) || !isObject(obj2)) {
|
||||||
|
// 值类型(注意:参与equal的一般不会是函数)
|
||||||
|
return obj1 === obj2;
|
||||||
|
}
|
||||||
|
// 如果传的两个参数都是同一个对象或数组
|
||||||
|
if (obj1 === obj2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 两个都是对象或数组,而且不相等
|
||||||
|
// 1.先比较obj1和obj2的key的个数,是否一样
|
||||||
|
const obj1Keys = Object.keys(obj1);
|
||||||
|
const obj2Keys = Object.keys(obj2);
|
||||||
|
if (obj1Keys.length !== obj2Keys.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果key的个数相等,就是第二步
|
||||||
|
// 2.以obj1为基准,和obj2依次递归比较
|
||||||
|
for (let key in obj1) {
|
||||||
|
// 比较当前key的value --- 递归
|
||||||
|
const res = isEqual(obj1[key], obj2[key]);
|
||||||
|
if (!res) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.全相等
|
||||||
|
return true
|
||||||
|
}
|
||||||
class Board
|
class Board
|
||||||
{
|
{
|
||||||
#rowCount = 6;
|
#rowCount = 6;
|
||||||
|
@ -954,6 +990,7 @@ const parsers = {
|
||||||
[202](id) {
|
[202](id) {
|
||||||
return henshin(id);
|
return henshin(id);
|
||||||
},
|
},
|
||||||
|
[203](evotype, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp, atk, rcv }), c.compo('evolution', [evotype])); },
|
||||||
[215](turns, attrs) { return activeTurns(turns, setOrbState(flags(attrs), 'bound')); },
|
[215](turns, attrs) { return activeTurns(turns, setOrbState(flags(attrs), 'bound')); },
|
||||||
[218](turns) { return skillBoost(v.constant(-turns)); },
|
[218](turns) { return skillBoost(v.constant(-turns)); },
|
||||||
|
|
||||||
|
@ -1333,7 +1370,7 @@ function renderSkill(skill, option = {})
|
||||||
dict = {
|
dict = {
|
||||||
exclude: exclude.length ? tsp.word.affix_exclude({cotent: renderOrbs(exclude)}) : void 0,
|
exclude: exclude.length ? tsp.word.affix_exclude({cotent: renderOrbs(exclude)}) : void 0,
|
||||||
orbs: renderOrbs(orbs),
|
orbs: renderOrbs(orbs),
|
||||||
count: count,
|
value: count,
|
||||||
};
|
};
|
||||||
let board = new Board();
|
let board = new Board();
|
||||||
board.generateOrbs(orbs, count);
|
board.generateOrbs(orbs, count);
|
||||||
|
@ -1436,7 +1473,7 @@ function renderSkill(skill, option = {})
|
||||||
}
|
}
|
||||||
case "locked":{
|
case "locked":{
|
||||||
if (arg.count.value < 42)
|
if (arg.count.value < 42)
|
||||||
dict.count = renderValue(arg.count, {unit: tsp.unit.unit});
|
dict.value = renderValue(arg.count, {unit: tsp.unit.unit});
|
||||||
frg.ap(tsp.skill.set_orb_state_locked(dict));
|
frg.ap(tsp.skill.set_orb_state_locked(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1461,6 +1498,17 @@ function renderSkill(skill, option = {})
|
||||||
frg.ap(tsp.skill.rate_multiply(dict));
|
frg.ap(tsp.skill.rate_multiply(dict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SkillKinds.ReduceDamage: {
|
||||||
|
let attrs = skill.attrs, percent = skill.percent, condition = skill.condition;
|
||||||
|
dict = {
|
||||||
|
icon: createIcon(skill.kind),
|
||||||
|
attrs: renderAttrs(attrs, {affix: true}),
|
||||||
|
value: renderValue(percent, {percent: true}),
|
||||||
|
};
|
||||||
|
if (condition) dict.condition = renderCondition(condition);
|
||||||
|
frg.ap(tsp.skill.reduce_damage(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
case SkillKinds.ReduceDamage: {
|
case SkillKinds.ReduceDamage: {
|
||||||
|
@ -1523,13 +1571,21 @@ function renderAttrs(attrs, option = {}) {
|
||||||
if (typeof localTranslating == "undefined") return frg;
|
if (typeof localTranslating == "undefined") return frg;
|
||||||
|
|
||||||
const tsp = localTranslating.skill_parse;
|
const tsp = localTranslating.skill_parse;
|
||||||
const contentFrg = attrs.map(attr => {
|
let contentFrg;
|
||||||
const icon = document.createElement("icon");
|
if (isEqual(attrs, Attributes.all()))
|
||||||
icon.className = "attr";
|
{
|
||||||
icon.setAttribute("data-attr-icon",attr);
|
contentFrg = option.any ? tsp.attrs.any() : tsp.attrs.all();
|
||||||
return tsp.attrs[attr]({icon: icon});
|
}
|
||||||
})
|
else
|
||||||
.nodeJoin(tsp.word.slight_pause());
|
{
|
||||||
|
contentFrg = attrs.map(attr => {
|
||||||
|
const icon = document.createElement("icon");
|
||||||
|
icon.className = "attr";
|
||||||
|
icon.setAttribute("data-attr-icon",attr);
|
||||||
|
return tsp.attrs[attr]({icon: icon});
|
||||||
|
})
|
||||||
|
.nodeJoin(tsp.word.slight_pause());
|
||||||
|
}
|
||||||
frg.ap(option.affix ? tsp.word.affix_attr({cotent: contentFrg}) : contentFrg);
|
frg.ap(option.affix ? tsp.word.affix_attr({cotent: contentFrg}) : contentFrg);
|
||||||
return frg;
|
return frg;
|
||||||
}
|
}
|
||||||
|
@ -1542,17 +1598,8 @@ function renderOrbs(attrs, option = {}) {
|
||||||
|
|
||||||
const tsp = localTranslating.skill_parse;
|
const tsp = localTranslating.skill_parse;
|
||||||
let contentFrg;
|
let contentFrg;
|
||||||
if (attrs.includes(0) &&
|
|
||||||
attrs.includes(1) &&
|
if (isEqual(attrs, Attributes.orbs()))
|
||||||
attrs.includes(2) &&
|
|
||||||
attrs.includes(3) &&
|
|
||||||
attrs.includes(4) &&
|
|
||||||
attrs.includes(5) &&
|
|
||||||
attrs.includes(6) &&
|
|
||||||
attrs.includes(7) &&
|
|
||||||
attrs.includes(8) &&
|
|
||||||
attrs.includes(9)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
contentFrg = option.any ? tsp.orbs.any() : tsp.orbs.all();
|
contentFrg = option.any ? tsp.orbs.any() : tsp.orbs.all();
|
||||||
}
|
}
|
||||||
|
@ -1571,13 +1618,90 @@ function renderOrbs(attrs, option = {}) {
|
||||||
return frg;
|
return frg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
function renderTypes(types, option = {}) {
|
||||||
function renderTypes(types: Types | Types[]) {
|
|
||||||
if (!Array.isArray(types))
|
if (!Array.isArray(types))
|
||||||
types = [types];
|
types = [types ?? 0];
|
||||||
return types.map(type => <Asset assetId={`type-${type}`} key={type} className="CardSkill-icon" />);
|
const frg = document.createDocumentFragment();
|
||||||
|
if (typeof localTranslating == "undefined") return frg;
|
||||||
|
|
||||||
|
const tsp = localTranslating.skill_parse;
|
||||||
|
const contentFrg = types.map(attr => {
|
||||||
|
const icon = document.createElement("icon");
|
||||||
|
icon.className = "type";
|
||||||
|
icon.setAttribute("data-type-icon",attr);
|
||||||
|
return tsp.types[attr]({icon: icon});
|
||||||
|
})
|
||||||
|
.nodeJoin(tsp.word.slight_pause());
|
||||||
|
frg.ap(option.affix ? tsp.word.affix_type({cotent: contentFrg}) : contentFrg);
|
||||||
|
return frg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderCondition(cond) {
|
||||||
|
const frg = document.createDocumentFragment();
|
||||||
|
const tsp = localTranslating.skill_parse;
|
||||||
|
if (cond.hp) {
|
||||||
|
let dict = {
|
||||||
|
hp: renderStat('hp'),
|
||||||
|
min: renderValue(v.percent(cond.hp.min * 100), {percent: true}),
|
||||||
|
max: renderValue(v.percent(cond.hp.max * 100), {percent: true}),
|
||||||
|
};
|
||||||
|
if (cond.hp.min === cond.hp.max)
|
||||||
|
frg.ap(tsp.cond.hp_equal(dict));
|
||||||
|
else if (cond.hp.min === 0)
|
||||||
|
frg.ap(tsp.cond.hp_less_or_equal(dict));
|
||||||
|
else if (cond.hp.max === 1)
|
||||||
|
frg.ap(tsp.cond.hp_greater_or_equal(dict));
|
||||||
|
else
|
||||||
|
frg.ap(tsp.cond.hp_belong_to_range(dict));
|
||||||
|
} else if (cond.useSkill) {
|
||||||
|
frg.ap(tsp.cond.use_skill());
|
||||||
|
} else if (cond.multiplayer) {
|
||||||
|
frg.ap(tsp.cond.multi_player());
|
||||||
|
} else if (cond.remainOrbs) {
|
||||||
|
let dict = {
|
||||||
|
count: renderValue(v.constant(cond.remainOrbs.count), {unit: tsp.unit.unit}),
|
||||||
|
};
|
||||||
|
frg.ap(tsp.cond.remain_orbs(dict));
|
||||||
|
} else if (cond.exact) {
|
||||||
|
if (cond.exact.type === 'combo') {
|
||||||
|
let dict = {value: cond.exact.value};
|
||||||
|
frg.ap(tsp.cond.exact_combo(dict));
|
||||||
|
} else if (cond.exact.type === 'match-length') {
|
||||||
|
let dict = {
|
||||||
|
value: cond.exact.value,
|
||||||
|
orbs: cond.exact.attrs === 'enhanced' ? tsp.cond.exact_match_enhanced() : renderOrbs(cond.exact.attrs)
|
||||||
|
};
|
||||||
|
frg.ap(tsp.cond.exact_match_length(dict));
|
||||||
|
} else if (cond.exact.type === 'match-count') {
|
||||||
|
}
|
||||||
|
} else if (cond.compo) {
|
||||||
|
let dict = {};
|
||||||
|
switch (cond.compo.type)
|
||||||
|
{
|
||||||
|
case 'card':{
|
||||||
|
dict.ids = cond.compo.ids.join();
|
||||||
|
frg.ap(tsp.cond.compo_type_card(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'series':{
|
||||||
|
dict.ids = cond.compo.ids.join();
|
||||||
|
frg.ap(tsp.cond.compo_type_series(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'evolution':{
|
||||||
|
dict.ids = cond.compo.ids.join();
|
||||||
|
frg.ap(tsp.cond.compo_type_evolution(dict));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
frg.ap(tsp.cond.unknown());
|
||||||
|
}
|
||||||
|
return frg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
function renderCondition(cond: SkillCondition) {
|
function renderCondition(cond: SkillCondition) {
|
||||||
if (cond.hp) {
|
if (cond.hp) {
|
||||||
|
|
|
@ -3480,4 +3480,8 @@ table .orb-icon
|
||||||
.icon-skill[data-icon-type="rate-mul-exp"]
|
.icon-skill[data-icon-type="rate-mul-exp"]
|
||||||
{
|
{
|
||||||
background-position-y:calc(-36px * 31);
|
background-position-y:calc(-36px * 31);
|
||||||
|
}
|
||||||
|
.icon-skill[data-icon-type="reduce-damage"]
|
||||||
|
{
|
||||||
|
background-position-y:calc(-36px * 32);
|
||||||
}
|
}
|
Loading…
Reference in New Issue