Update some of the exercises

This commit is contained in:
Steve Kinney
2024-09-16 13:13:38 -06:00
parent a028678660
commit 1747f705a6
15 changed files with 1617 additions and 597 deletions

View File

@@ -0,0 +1,26 @@
import { Person } from './person.js';
import { rollDice } from './roll-dice.js';
export class Character extends Person {
constructor(firstName, lastName, role) {
super(firstName, lastName);
this.role = role;
this.level = 1;
this.createdAt = new Date();
this.lastModified = this.createdAt;
this.strength = rollDice(4, 6);
this.dexterity = rollDice(4, 6);
this.intelligence = rollDice(4, 6);
this.wisdom = rollDice(4, 6);
this.charisma = rollDice(4, 6);
this.constitution = rollDice(4, 6);
}
levelUp() {
this.level++;
this.lastModified = new Date();
}
}