import { CounterSkill, Attack, Control, GainsSkill, SufPassiveSkill, Vampire, PrePassiveSkill } from './base'; import i18n from '../i18n'; import { BattleRole, replace } from '@/tool'; const { t } = i18n; export class BHXDJC extends PrePassiveSkill { name: string = 'bhxdjc'; hpPercent: number = 60; shieldPercentOfHp: number = 80; triggered: boolean = false; desc(): string { return replace(t('skill.bhxdjc.1'), [this.hpPercent, this.shieldPercentOfHp]); } trigger(owner: BattleRole, target: BattleRole): boolean { return !this.triggered && owner.attr.curHp / owner.attr.hp < this.hpPercent / 100; } takeEffect(owner: BattleRole, target: BattleRole): void { this.triggered = true; owner.shield = Math.ceil((owner.attr.hp * this.shieldPercentOfHp) / 100); const log = replace(t('skill.bhxdjc.2'), [owner.shield]); owner.battleLog(log); } }