rate/api/src/entities/card.ts
Yanis Rigaudeau 39ba4856a2
wip
2023-02-05 22:06:48 +01:00

38 lines
835 B
TypeScript

import { CardCtor, CardInfo, CardRarity, CombatStats } from '@core';
import { Entity } from './entity';
export class Card extends Entity implements CardInfo {
name: string;
rarity: keyof typeof CardRarity;
stats: CombatStats;
thumbnail: string;
model: string;
constructor(raw: CardCtor) {
super(raw);
this.name = raw.name || '';
this.rarity = raw.rarity || CardRarity.COMMON;
this.stats = raw.stats || {
baseAtk: 0,
baseCrit: 0,
baseDef: 0,
multAtk: 0,
multCrit: 0,
multDef: 0,
};
this.thumbnail = raw.thumbnail || '';
this.model = raw.model || '';
}
Info(): CardInfo {
return {
uuid: this.uuid,
name: this.name,
rarity: this.rarity,
stats: this.stats,
thumbnail: this.thumbnail,
model: this.model,
};
}
}