You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.6 KiB
82 lines
2.6 KiB
import { CounterSkill, Attack, Control, GainsSkill, SufPassiveSkill, Vampire } from './base'; |
|
import i18n from '../i18n'; |
|
import { BattleRole, callReducPercent, replace } from '@/tool'; |
|
const { t } = i18n; |
|
|
|
//化缘 |
|
export class Fate extends GainsSkill { |
|
percent = 20; |
|
name: string = 'fate'; |
|
desc(): string { |
|
return replace(t('skill.fate.1'), [this.percent]); |
|
} |
|
afterBattle(owner: BattleRole, target: BattleRole): void { |
|
target.extraAttr.coins += Math.round(target.attr.coins * (this.percent / 100)); |
|
} |
|
} |
|
//1%生命偷取 |
|
export class Vampire1 extends Vampire { |
|
percent: number = 1; |
|
} |
|
//现原形 |
|
export class Prototype extends Control { |
|
cd: number = 10; |
|
last: number = 2; |
|
rate: number = 100; |
|
bossRate: number = 65; |
|
name: string = 'prototype'; |
|
desc(): string { |
|
return replace(t('skill.prototype.1'), [this.last, this.cd, this.bossRate]); |
|
} |
|
} |
|
//暴击恐惧 |
|
export class CritFear extends SufPassiveSkill { |
|
name: string = 'critFear'; |
|
percent: number = 1000; |
|
desc(): string { |
|
return replace(t('skill.critFear.1'), [this.percent]); |
|
} |
|
trigger(owner: BattleRole, target: BattleRole): boolean { |
|
return owner.crit; |
|
} |
|
takeEffect(owner: BattleRole, target: BattleRole): void { |
|
const additional = Math.ceil((owner.atk * this.percent) / 100); |
|
target.addHp(-1 * additional); |
|
owner.extraDmgLog(replace(t('skill.critFear.2'), [additional])); |
|
} |
|
} |
|
//琉璃盘 |
|
export class Liulipan extends Attack { |
|
order: number = 99; |
|
lv?: number; |
|
name: string = 'liulipan'; |
|
atk: number = 50; |
|
cd: number = 5; |
|
desc(): string { |
|
return replace(t('skill.liulipan.1'), [(this.lv || 1) * this.atk, this.cd]); |
|
} |
|
use(owner: BattleRole, target: BattleRole): void { |
|
owner.extraAttr.baseAtk += (this.lv || 1) * this.atk; |
|
super.use(owner, target); |
|
} |
|
} |
|
//镜花水月 |
|
export class JHSY extends CounterSkill { |
|
name: string = 'JHSY'; |
|
rate: number = 15; |
|
percent: number = 100; |
|
desc(): string { |
|
return replace(t('skill.JHSY.1'), [this.rate, this.percent, this.cd]); |
|
} |
|
trigger(owner: BattleRole, target: BattleRole): boolean { |
|
return Math.random() < this.rate / 100; |
|
} |
|
takeEffect(owner: BattleRole, target: BattleRole): void { |
|
// const reducPercent = callReducPercent(owner.attr.def + owner.extraAttr.def, owner.attr.lv); //目标防御提供的减伤比例 |
|
// const reflected = Math.ceil(((target.baseDmg * this.percent) / 100) * (1 - reducPercent)); |
|
const reflected = Math.ceil(target.baseDmg * (this.percent / 100) * (1 + target.moreBear / 100)); |
|
target.addHp(-1 * reflected); |
|
const log = replace(t('skill.JHSY.2'), [t(owner.type), reflected]); |
|
owner.extraDmgLog(log); |
|
} |
|
}
|
|
|