几率盾解析错误

This commit is contained in:
枫谷剑仙 2021-12-25 15:16:24 +08:00
parent 428cef8709
commit d872e69e71
3 changed files with 10 additions and 8 deletions

View File

@ -84,7 +84,7 @@
rate_multiply_drop: tp`${'icon'}怪物蛋掉落率`,
rate_multiply_coin: tp`${'icon'}金币掉落率`,
rate_multiply_exp: tp`${'icon'}等级经验倍率`,
reduce_damage: tp`${'condition'}受到的${'attrs'}伤害${'icon'}减少${'value'}`,
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'}`,

View File

@ -100,7 +100,7 @@ let localTranslating = {
rate_multiply_drop: tp`${'icon'}Drop rate`,
rate_multiply_coin: tp`${'icon'}Coins`,
rate_multiply_exp: tp`${'icon'}Rank EXP`,
reduce_damage: tp`${'condition'}${'icon'}Reduces ${'attrs'} damage taken by ${'value'}`,
reduce_damage: tp`${'condition'}${'chance'}${'icon'}Reduces ${'attrs'} damage taken by ${'value'}`,
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'}`,

View File

@ -815,8 +815,8 @@ function damageEnemy(target, attr, damage) {
function vampire(attr, damageValue, healValue) {
return { kind: SkillKinds.Vampire, attr: attr, damage: damageValue, heal: healValue };
}
function reduceDamage(attrs, percent, condition) {
return { kind: SkillKinds.ReduceDamage, attrs: attrs, percent: percent, condition: condition };
function reduceDamage(attrs, percent, condition, prob) {
return { kind: SkillKinds.ReduceDamage, attrs: attrs, percent: percent, condition: condition, prob: prob || 1 };
}
function selfHarm(value) {
return { kind: SkillKinds.SelfHarm, value: value };
@ -962,12 +962,12 @@ const parsers = {
[35](mul, percent) { return vampire('self', v.xATK(mul), v.percent(percent)); },
[36](attr1, attr2, percent) { return reduceDamage([attr1, attr2], v.percent(percent)); },
[37](attr, mul) { return damageEnemy('single', attr, v.xATK(mul)); },
[38](max, _, percent) { return reduceDamage('all', v.percent(percent), max === 100 ? c.hp(max, max) : c.hp(0, max)); },
[38](max, prob, percent) { return reduceDamage('all', v.percent(percent), max === 100 ? c.hp(max, max) : c.hp(0, max), v.percent(prob)); },
[39](percent, stats1, stats2, mul) { return powerUp(null, null, p.mul(p.stats(mul, stats1, stats2)), c.hp(0, percent)); },
[40](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ atk: mul })); },
[41](prob, mul, attr) { return counterAttack(attr ?? 0, v.percent(prob), v.percent(mul)); },
[42](targetAttr, dmgAttr, value) { return damageEnemy(targetAttr, dmgAttr, v.constant(value)); },
[43](min, max, percent) { return reduceDamage('all', v.percent(percent), c.hp(min, max)); },
[43](min, prob, percent) { return reduceDamage('all', v.percent(percent), c.hp(min, 100), v.percent(prob)); },
[44](percent, stats1, stats2, mul) { return powerUp(null, null, p.mul(p.stats(mul, stats1, stats2)), c.hp(percent, 100)); },
[45](attr, mul) { return powerUp([attr], null, p.mul({ hp: mul, atk: mul })); },
[46](attr1, attr2, mul) { return powerUp([attr1, attr2], null, p.mul({ hp: mul })); },
@ -2110,13 +2110,15 @@ function renderSkill(skill, option = {})
break;
}
case SkillKinds.ReduceDamage: {
let attrs = skill.attrs, percent = skill.percent, condition = skill.condition;
let attrs = skill.attrs, percent = skill.percent, condition = skill.condition, prob = skill.prob;
dict = {
icon: createIcon(skill.kind),
attrs: renderAttrs(attrs, {affix: true}),
value: renderValue(percent, {percent: true}),
condition: condition ? renderCondition(condition) : null,
chance: prob.value < 1 ? tsp.value.prob({value: renderValue(prob, { percent:true })}) : null,
};
if (condition) dict.condition = renderCondition(condition);
console.log(prob.value < 1 ? tsp.value.prob({value: renderValue(prob, { percent:true })}) : null)
frg.ap(tsp.skill.reduce_damage(dict));
break;
}