|
|
|
import { SufPassiveSkill, PrePassiveSkill, CounterSkill } from './base';
|
|
|
|
import { createt } from '../i18n';
|
|
|
|
import { BattleRole, replace } from '@/tool';
|
|
|
|
import { BaseAtkPercentBuff, DmgReducBuff } from './buff';
|
|
|
|
const st = createt('skill.');
|
|
|
|
const t = createt('');
|
|
|
|
|
|
|
|
//断
|
|
|
|
export class Duan extends SufPassiveSkill {
|
|
|
|
name: string = 'duan';
|
|
|
|
hpPercent: number = 20;
|
|
|
|
order: number = 999;
|
|
|
|
dmg: number = 999999999;
|
|
|
|
desc(): string {
|
|
|
|
return replace(st('duan.1'), [this.hpPercent]);
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return owner.dmg > 0 && target.attr.curHp / target.attr.hp < this.hpPercent / 100;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
target.addHp(-1 * this.dmg);
|
|
|
|
owner.battleLog(replace(st('duan.2'), [this.hpPercent, this.dmg]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//红眼
|
|
|
|
export class HongYan extends PrePassiveSkill {
|
|
|
|
name: string = 'hongyan';
|
|
|
|
hpPercent: number = 65;
|
|
|
|
atk: number = 2000;
|
|
|
|
atkPercent: number = 200;
|
|
|
|
desc(): string {
|
|
|
|
return replace(st('hongyan.1'), [this.hpPercent, this.atk, this.atkPercent]);
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return owner.attr.curHp / owner.attr.hp < this.hpPercent / 100;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
owner.extraAttr.baseAtk += this.atk;
|
|
|
|
}
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void {
|
|
|
|
if (this.trigger(owner, target)) {
|
|
|
|
const additional = Math.ceil((owner.atk * this.atkPercent) / 100);
|
|
|
|
target.addHp(-1 * additional);
|
|
|
|
owner.battleLog(replace(st('hongyan.2'), [this.hpPercent, additional]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//杀意
|
|
|
|
export class ShaYi extends SufPassiveSkill {
|
|
|
|
name: string = 'shayi';
|
|
|
|
atkPercent: number = 3;
|
|
|
|
maxLayer: number = 10;
|
|
|
|
reduc: number = 3;
|
|
|
|
retains: string[] = ['percent', 'maxLayer'];
|
|
|
|
desc(): string {
|
|
|
|
return replace(st('shayi.1'), [this.atkPercent, this.reduc, this.maxLayer]);
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return owner.dmg > 0;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
const shayi = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer);
|
|
|
|
owner.putBuff(shayi, this.retains);
|
|
|
|
owner.battleLog(replace(st('shayi.2'), [shayi.layer]));
|
|
|
|
}
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void {
|
|
|
|
if (target.crit) {
|
|
|
|
const shayi = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer);
|
|
|
|
shayi.layer = -1 * this.reduc;
|
|
|
|
owner.putBuff(shayi, this.retains);
|
|
|
|
owner.battleLog(replace(st('shayi.3'), [this.reduc]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//怒目
|
|
|
|
export class NuMu extends CounterSkill {
|
|
|
|
name: string = 'numu';
|
|
|
|
atkPercent: number = 3;
|
|
|
|
layer: number = 0;
|
|
|
|
maxLayer: number = 10;
|
|
|
|
desc(): string {
|
|
|
|
return replace(st('numu.1'), [this.atkPercent, this.maxLayer]);
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return target.dmg > 0;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
const numu = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer);
|
|
|
|
owner.putBuff(numu);
|
|
|
|
owner.battleLog(replace(st('numu.2'), [numu.layer]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//龙腾
|
|
|
|
export class LongTeng extends CounterSkill {
|
|
|
|
name: string = 'longteng';
|
|
|
|
dmgReduc: number = 8;
|
|
|
|
rate: number = 8;
|
|
|
|
shieldPercentOfHp: number = 8;
|
|
|
|
desc(): string {
|
|
|
|
return replace(st('longteng.1'), [this.dmgReduc, this.rate, this.shieldPercentOfHp]);
|
|
|
|
}
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void {
|
|
|
|
owner.putBuff(new DmgReducBuff(this.name, this.dmgReduc, 9999));
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return target.dmg > 0 && Math.random() < this.rate / 100;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
const shield = Math.ceil((owner.attr.hp * this.shieldPercentOfHp) / 100);
|
|
|
|
owner.shield += shield;
|
|
|
|
owner.battleLog(replace(st('longteng.2'), [shield]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//幸运数字
|
|
|
|
export class XingYunShuZi extends SufPassiveSkill {
|
|
|
|
name: string = 'xingyunshuzi';
|
|
|
|
num: number = 0;
|
|
|
|
desc(): string {
|
|
|
|
return st('xingyunshuzi.1');
|
|
|
|
}
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void {
|
|
|
|
this.num = Math.ceil(Math.random() * 9);
|
|
|
|
owner.battleLog(replace(st('xingyunshuzi.2'), [t(owner.type), this.num]));
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return this.num > 0 && owner.dmg % 10 == this.num;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
const dmg = owner.dmg * this.num;
|
|
|
|
target.addHp(-1 * dmg);
|
|
|
|
owner.battleLog(replace(st('xingyunshuzi.3'), [t(target.type), dmg]));
|
|
|
|
}
|
|
|
|
}
|