diff --git a/languages/zh.js b/languages/zh.js index 73a46207..a10ab7e0 100644 --- a/languages/zh.js +++ b/languages/zh.js @@ -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'}`, diff --git a/script-json_data.js b/script-json_data.js index ddb25a59..1a613d68 100644 --- a/script-json_data.js +++ b/script-json_data.js @@ -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'}`, diff --git a/script-skill-parser.js b/script-skill-parser.js index 6d71ace6..3052dec5 100644 --- a/script-skill-parser.js +++ b/script-skill-parser.js @@ -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; }