mirror of
https://github.com/motajs/template.git
synced 2026-10-20 05:40:18 +08:00
28 lines
856 B
TypeScript
28 lines
856 B
TypeScript
import { IEnemyFinalEffect, IEnemyHandler } from '@user/data-system';
|
|
import { IEnemyAttr, IHeroAttr } from '@user/data-common';
|
|
|
|
export class MainEnemyFinalEffect implements IEnemyFinalEffect<
|
|
IEnemyAttr,
|
|
IHeroAttr
|
|
> {
|
|
readonly priority: number = 0;
|
|
|
|
apply(handler: IEnemyHandler<IEnemyAttr, IHeroAttr>): void {
|
|
const enemy = handler.enemy;
|
|
const heroAtk = handler.hero.getFinalAttribute('atk');
|
|
const heroDef = handler.hero.getFinalAttribute('def');
|
|
|
|
// 3 - 坚固
|
|
if (enemy.hasSpecial(3)) {
|
|
const target = Math.max(enemy.getAttribute('def'), heroAtk - 1);
|
|
enemy.setAttribute('def', target);
|
|
}
|
|
|
|
// 8 - 模仿
|
|
if (enemy.hasSpecial(8)) {
|
|
enemy.setAttribute('atk', heroAtk);
|
|
enemy.setAttribute('def', heroDef);
|
|
}
|
|
}
|
|
}
|