Browse Source

增加随机变身技能的解析

tags/v21.8
枫谷剑仙 4 years ago
parent
commit
bedacd5741
4 changed files with 33 additions and 9 deletions
  1. +2
    -1
      languages/zh.js
  2. +5
    -2
      script-json_data.js
  3. +21
    -6
      script-skill-parser.js
  4. +5
    -0
      script-universal_function.js

+ 2
- 1
languages/zh.js View File

@@ -87,7 +87,8 @@
reduce_damage: tp`${'condition'}受到的${'attrs'}伤害${'chance'}${'icon'}减少${'value'}`,
power_up: tp`${'condition'}${'targets'}${'target'}${'value'}${'reduceDamage'}${'addCombo'}${'followAttack'}`,
power_up_targets: tp`${'attrs_types'}的 `,
henshin: tp`变身为${'card'}`,
henshin: tp`变身为${'cards'}`,
random_henshin: tp`随机变身为${'cards'}`,
void_poison: tp`消除${'poison'}时不会受到毒伤害`,
skill_proviso: tp`${'condition'}才能发动后续效果`,
obstruct_opponent: tp`对${'target'}施加敌对技能效果:${'skills'}`,


+ 5
- 2
script-json_data.js View File

@@ -104,6 +104,7 @@ let localTranslating = {
power_up: tp`${'condition'}${'targets'}${'value'}${'reduceDamage'}${'addCombo'}${'followAttack'}`,
power_up_targets: tp`[${'attrs_types'}]'s `, //attrs, types, attrs_types
henshin: tp`Transforms into ${'card'}`,
random_henshin: tp`Random transforms into ${'cards'}`,
void_poison: tp`Voids ${'poison'} damage`,
skill_proviso: tp`The follow-up effect can only be activates ${'condition'}`,
obstruct_opponent: tp`Apply obstruct skill effect to ${'target'}: ${'skills'}`,
@@ -3226,10 +3227,12 @@ const specialSearchFunctions = (function() {
]},
{group:true,name:"======Evo type======",otLangName:{chs:"======进化类型======",cht:"======進化類型======"}, functions: [
{name:"No Henshin",otLangName:{chs:"非变身",cht:"非變身"},
function:cards=>cards.filter(card=>!Array.isArray(card.henshinFrom) && !card.henshinTo)
function:cards=>cards.filter(card=>
!Array.isArray(card.henshinFrom) &&
!Array.isArray(card.henshinTo))
},
{name:"Before Henshin",otLangName:{chs:"变身前",cht:"變身前"},
function:cards=>cards.filter(card=>card.henshinTo)
function:cards=>cards.filter(card=>Array.isArray(card.henshinTo))
},
{name:"After Henshin",otLangName:{chs:"变身后",cht:"變身後"},
function:cards=>cards.filter(card=>Array.isArray(card.henshinFrom))


+ 21
- 6
script-skill-parser.js View File

@@ -906,7 +906,14 @@ function autoPath() { return { kind: SkillKinds.AutoPath }; }
function leaderChange(type = 0) { return { kind: SkillKinds.LeaderChange, type: type }; }
function board7x6() { return { kind: SkillKinds.Board7x6 }; }
function noSkyfall() { return { kind: SkillKinds.NoSkyfall }; }
function henshin(id) { return { kind: SkillKinds.Henshin, id: id }; }
function henshin(id, random = false) {
return {
kind: SkillKinds.Henshin,
id: Array.isArray(id) ? id[0] : id, //兼容旧程序
ids: Array.isArray(id) ? id : [id],
random: random
};
}
function voidPoison() { return { kind: SkillKinds.VoidPoison }; }
function skillProviso(cond) { return { kind: SkillKinds.SkillProviso, cond: cond }; }
function obstructOpponent(type, pos, ids) {
@@ -1421,6 +1428,9 @@ const parsers = {
[235](attr, _, len, atk, percent, combo, damage) {
return powerUp(null, null, p.mul({ atk: atk || 100}), c.exact('match-length', len, flags(attr), true), v.percent(percent), [combo ? addCombo(combo) : null, damage ? followAttackFixed(damage) : null].filter(Boolean));
},
[236](...ids) { //随机变身
return henshin(ids.distinct(), true);
},
[1000](type, pos, ...ids) {
const posType = (type=>{
switch (type) {
@@ -2205,13 +2215,18 @@ function renderSkill(skill, option = {})
break;
}
case SkillKinds.Henshin: { //变身
let id = skill.id;
const dom = cardN(id);
dom.monDom.onclick = changeToIdInSkillDetail;
let ids = skill.ids, random = skill.random;
let doms = ids.map(id=>{
let dom = cardN(id);
dom.monDom.onclick = changeToIdInSkillDetail;
return dom; })
dict = {
card: dom,
cards: doms.nodeJoin(),
}
frg.ap(tsp.skill.henshin(dict));
frg.ap(random ?
tsp.skill.random_henshin(dict) :
tsp.skill.henshin(dict)
);
break;
}
case SkillKinds.VoidPoison: { //毒无效


+ 5
- 0
script-universal_function.js View File

@@ -106,6 +106,11 @@ Array.prototype.deleteLatter = function(item = null) {
this.splice(index + 1);
return this;
}
//数组去重
Array.prototype.distinct = function() {
let _set = new Set(this);
return Array.from(_set)
}
Array.prototype.randomShift = function() {
return this.splice(Math.random() * this.length, 1)?.[0];
}


Loading…
Cancel
Save