JSFiddle - React, Tailwind, and code Playground
by wrxsti85
JavaScript
class Mon
{
constructor(name)
{
this._name = name;
this._health = 10;
this._defense = 1;
this._attack = 1;
this._speed = 1;
}
get health() { return this._health; }
set health(hlt) { this._health = hlt; }
get defense() { return this._defense; }
set defense(def) { this._defense = def; }
get attack() { return this._attack; }
set attack(atk) { this._attack = atk; }
get speed() { return this._speed; }
set speed(spd) { this._speed = spd; }
damage(dmg) { this._health -= dmg; }
}