import {MonsterType} from "../utils/monster.utils";
import {IMonster} from '../interfaces/monster';

export class Monster implements IMonster {

  id: number = -1;
  name: string = 'Monster';
  image: string = 'assets/img/pik.webp';
  type: MonsterType = MonsterType.ELECTRIC;
  hp: number = 60;
  figureCaption: string = 'N°001 Monster';

  attackName: string = 'Standard Attack';
  attackStrength: number = 10;
  attackDescription: string = 'This is an attack description...';

  copy(): Monster {
    return Object.assign(new Monster(), this);
  }

  static fromJson(monsterJson: IMonster): Monster {
    return Object.assign(new Monster(), monsterJson);
  }

  toJson(): IMonster {
    const monsterJson: IMonster = Object.assign({}, this)
    delete monsterJson.id;
    return monsterJson;
  }
}

