38 lines
835 B
TypeScript
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,
|
|
};
|
|
}
|
|
}
|