diff --git a/models/character.js b/models/character.js index 594deed..b7fd05b 100755 --- a/models/character.js +++ b/models/character.js @@ -1,5 +1,3 @@ -import * as roll from "../utils/dice.js"; -import * as id from "../utils/id.js"; import { Item } from "./item.js"; /** @@ -68,7 +66,7 @@ export class Character { /** * @param {string} name The name of the character */ - constructor(name, initialize) { + constructor(name) { this.name = name; } diff --git a/models/game.js b/models/game.js index eb34908..94f1350 100755 --- a/models/game.js +++ b/models/game.js @@ -102,7 +102,7 @@ export class Game { const existing = this._itemBlueprints.get(blueprintId); if (existing) { - console.debug("we tried to create the same item blueprint more than once", blueprintId, attributes); + console.warn("we tried to create the same item blueprint more than once", blueprintId, attributes); return existing; } diff --git a/models/item.js b/models/item.js index 2713cf9..c74e37c 100755 --- a/models/item.js +++ b/models/item.js @@ -72,7 +72,7 @@ export class ItemBlueprint extends ItemAttributes { o.itemSlots = Number(o.itemSlots); - for (const [key, _] of Object.entries(this)) { + for (const [key] in this) { if (o[key] !== "undefied") { this[key] = o[key]; } diff --git a/seeders/characerSeeder.js b/seeders/characerSeeder.js index 55a5ea7..7320952 100755 --- a/seeders/characerSeeder.js +++ b/seeders/characerSeeder.js @@ -91,6 +91,13 @@ export class CharacterSeeder { c.rangedCombat = roll.d6() + 2; c.skulduggery = roll.d6() + 2; + this.applyAncestry(c); + this.applyFoundation(c); + + return c; + } + + applyAncestry(c) { let ancestryId = roll.d8(); switch (ancestryId) { case 1: @@ -135,12 +142,6 @@ export class CharacterSeeder { default: throw new Error(`Logic error, ancestry d8() roll of ${ancestryId} was out of scope"`); } - - this.applyFoundation(c); - - console.debug(c); - - return c; } /** @@ -233,7 +234,7 @@ export class CharacterSeeder { // Skills this.addSkillsToCharacter( c, // - ":perk.two_weapons", // TODO: perks should be their own thing, and not a part of the skill system? + ":weapon.style.two_weapons", ":armor.light", ); @@ -248,27 +249,40 @@ export class CharacterSeeder { ":weapon.light.dagger", ); break; + case 4: + case ":guard": + c.foundation = "Guard"; + + // + // Stats + c.maxHitPoints = c.currentHitPoints = 15; + c.meleeCombat = Math.max(c.meleeCombat, 10); + c.magic = Math.min(c.magic, 10); + + // + // Skills + this.addSkillsToCharacter( + c, // + ":armor.medium", + ":weapon.weird.halberd", + ); + + // + // Gear + c.silver = 50; + c.itemSlots = 5; + this.addItemsToCharacter( + c, // + ":armor.medium.breastplate", + ":weapon.weird.halberd", + ":lighting.bulls_eye_lantern", + ":misc.signal_whistle", + ":maps.area.hvedstad", + ); + break; /* -// -//--------------------------------------------------------------------------------------- -//HEADLINE: Fencer -//--------------------------------------------------------------------------------------- -| {counter:foundation} - -|Fencer - -|[unstyled] -* Light Armor - -|[unstyled] -* Leather -* Rapier -* Dagger -* 40 Silver Pieces - -|[unstyled] // //--------------------------------------------------------------------------------------- diff --git a/seeders/itemSeeder.js b/seeders/itemSeeder.js index ecefad0..0060db9 100755 --- a/seeders/itemSeeder.js +++ b/seeders/itemSeeder.js @@ -8,7 +8,7 @@ import { gGame } from "../models/globals.js"; // |___|\__\___|_| |_| |_| |_|\___|_| |_| |_| .__/|_|\__,_|\__\___||___/ // |_| // -// Seed the Game.ItemBlueprint store + export class ItemSeeder { seed() { // __ __ diff --git a/test.js b/test.js old mode 100755 new mode 100644 index 7fa23b3..9978d0c --- a/test.js +++ b/test.js @@ -1,17 +1,26 @@ -class Nugga { - mufassa = 22; - constructor() { - this.fjæsing = 22; - console.debug(Object.prototype.hasOwnProperty.call(this, "fjæsing")); - } +let cnt = 0; - diller(snaps = this.fjæsing) { - console.log(snaps); - } +let val = Math.floor(Math.random() * 5); + +switch (val) { + case cnt++: + console.log("zero"); + break; + case cnt++: + console.log("one"); + break; + case cnt++: + console.log("two"); + break; + case cnt++: + console.log("three"); + break; + case cnt++: + console.log("four"); + break; + case cnt++: + console.log("five"); + break; + default: + console.log("waaat", { val }); } - -class Dugga extends Nugga {} - -const n = new Dugga(); - -console.log(n, n.diller(), n instanceof Dugga);