mirror of
https://github.com/motajs/template.git
synced 2026-08-14 20:52:29 +08:00
20 lines
689 B
TypeScript
20 lines
689 B
TypeScript
import { IEnemyLegacyBridge } from '@user/data-base';
|
|
import { IEnemyAttr } from '@user/data-common';
|
|
|
|
export class EnemyLegacyBridge implements IEnemyLegacyBridge<IEnemyAttr> {
|
|
fromLegacyEnemy(
|
|
enemy: Enemy,
|
|
defaultAttr: Partial<IEnemyAttr>
|
|
): IEnemyAttr {
|
|
return {
|
|
hp: enemy.hp ?? defaultAttr.hp ?? 0,
|
|
atk: enemy.atk ?? defaultAttr.atk ?? 0,
|
|
def: enemy.def ?? defaultAttr.def ?? 0,
|
|
money: enemy.money ?? defaultAttr.money ?? 0,
|
|
exp: enemy.exp ?? defaultAttr.exp ?? 0,
|
|
point: enemy.point ?? defaultAttr.point ?? 0,
|
|
guard: defaultAttr.guard ?? new Set()
|
|
};
|
|
}
|
|
}
|