This commit is contained in:
Kim Ravn Hansen
2025-10-21 11:20:41 +02:00
parent e62c34e69e
commit 8a8434f5ac
6 changed files with 67 additions and 46 deletions

View File

@@ -1,5 +1,3 @@
import * as roll from "../utils/dice.js";
import * as id from "../utils/id.js";
import { Item } from "./item.js"; import { Item } from "./item.js";
/** /**
@@ -68,7 +66,7 @@ export class Character {
/** /**
* @param {string} name The name of the character * @param {string} name The name of the character
*/ */
constructor(name, initialize) { constructor(name) {
this.name = name; this.name = name;
} }

View File

@@ -102,7 +102,7 @@ export class Game {
const existing = this._itemBlueprints.get(blueprintId); const existing = this._itemBlueprints.get(blueprintId);
if (existing) { 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; return existing;
} }

View File

@@ -72,7 +72,7 @@ export class ItemBlueprint extends ItemAttributes {
o.itemSlots = Number(o.itemSlots); o.itemSlots = Number(o.itemSlots);
for (const [key, _] of Object.entries(this)) { for (const [key] in this) {
if (o[key] !== "undefied") { if (o[key] !== "undefied") {
this[key] = o[key]; this[key] = o[key];
} }

View File

@@ -91,6 +91,13 @@ export class CharacterSeeder {
c.rangedCombat = roll.d6() + 2; c.rangedCombat = roll.d6() + 2;
c.skulduggery = roll.d6() + 2; c.skulduggery = roll.d6() + 2;
this.applyAncestry(c);
this.applyFoundation(c);
return c;
}
applyAncestry(c) {
let ancestryId = roll.d8(); let ancestryId = roll.d8();
switch (ancestryId) { switch (ancestryId) {
case 1: case 1:
@@ -135,12 +142,6 @@ export class CharacterSeeder {
default: default:
throw new Error(`Logic error, ancestry d8() roll of ${ancestryId} was out of scope"`); 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 // Skills
this.addSkillsToCharacter( this.addSkillsToCharacter(
c, // 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", ":armor.light",
); );
@@ -248,27 +249,40 @@ export class CharacterSeeder {
":weapon.light.dagger", ":weapon.light.dagger",
); );
break; 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]
// //
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------

View File

@@ -8,7 +8,7 @@ import { gGame } from "../models/globals.js";
// |___|\__\___|_| |_| |_| |_|\___|_| |_| |_| .__/|_|\__,_|\__\___||___/ // |___|\__\___|_| |_| |_| |_|\___|_| |_| |_| .__/|_|\__,_|\__\___||___/
// |_| // |_|
// //
// Seed the Game.ItemBlueprint store
export class ItemSeeder { export class ItemSeeder {
seed() { seed() {
// __ __ // __ __

41
test.js Executable file → Normal file
View File

@@ -1,17 +1,26 @@
class Nugga { let cnt = 0;
mufassa = 22;
constructor() { let val = Math.floor(Math.random() * 5);
this.fjæsing = 22;
console.debug(Object.prototype.hasOwnProperty.call(this, "fjæsing")); 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 });
} }
diller(snaps = this.fjæsing) {
console.log(snaps);
}
}
class Dugga extends Nugga {}
const n = new Dugga();
console.log(n, n.diller(), n instanceof Dugga);