From 7ecb4f724b1839da0845dcf0428cae4a16bb0b27 Mon Sep 17 00:00:00 2001 From: Kim Ravn Hansen Date: Thu, 12 Feb 2026 16:54:27 +0100 Subject: [PATCH] Stuff ad things --- models/character.js | 37 +--- models/item.js | 7 +- seeders/characerSeeder.js | 397 +++++++++++++++++--------------------- seeders/itemSeeder.js | 84 +++++++- test.js | 0 5 files changed, 274 insertions(+), 251 deletions(-) mode change 100644 => 100755 test.js diff --git a/models/character.js b/models/character.js index 1bd60fa..f25db49 100755 --- a/models/character.js +++ b/models/character.js @@ -60,8 +60,11 @@ export class Character { /** @type {Set} Things the character is particularly proficient at. */ proficiencies = new Set(); - /** @type {Map 0"); - } - const existingItemCount = this.items.get(item) || 0; - - this.items.set(item, count + existingItemCount); + this.items.add(item) } - clamp(skill, min, max) { - const val = this[skill]; - - if (val === undefined) { - throw new Error(`Invalid skill >>>${skill}<<<`) - } - - if (val < min) { - this[skill] = min - return - } - - if (val > max) { - this.skill = max; - return - } - } // todo removeItem(item, count) } diff --git a/models/item.js b/models/item.js index c74e37c..bfcf2eb 100755 --- a/models/item.js +++ b/models/item.js @@ -41,6 +41,9 @@ export class ItemAttributes { /** @constant @readonly @type {string[]} Type of ammo that this item is, or that this item uses */ skills = []; + + /** @constant @readonly @type {boolean} Can a person wearing this armor be stealthy? */ + sneak; } /** @@ -53,7 +56,7 @@ export class ItemBlueprint extends ItemAttributes { /** * Constructor * - * @param {object} o Object whose attributes we copy + * @param {ItemAttributes} o Object whose attributes we copy */ constructor(o) { super(); @@ -106,4 +109,4 @@ export class ItemBlueprint extends ItemAttributes { * arrows that are consumed. In this case, each individual arrow is not tracked * as its own entity, only the quiver is tracked. */ -export class Item extends ItemAttributes {} +export class Item extends ItemAttributes { } diff --git a/seeders/characerSeeder.js b/seeders/characerSeeder.js index b211ee1..4038dca 100755 --- a/seeders/characerSeeder.js +++ b/seeders/characerSeeder.js @@ -239,8 +239,8 @@ export class CharacterSeeder { c.itemSlots = 5; c.maxHitPoints = c.currentHitPoints = 15; - c.clamp("magic", 1, 10) - c.clamp("meleeCombat", 10, undefined) + c.magic = Math.min(c.magic, 10) + c.meleeCombat = Math.max(c.meleeCombat, 10) this.addProficienciesToCharacter( c, // @@ -252,7 +252,7 @@ export class CharacterSeeder { this.addItemsToCharacter( c, // ":armor.light.leather", - ":weapon.light.dagger", + ":weapon.basic.dagger", ":weapon.light.rapier", ); } @@ -265,9 +265,9 @@ export class CharacterSeeder { c.itemSlots = 5; c.maxHitPoints = c.currentHitPoints = 10 - c.clamp("awareness", 10, undefined) - c.clamp("meleeCombat", 10, undefined) - c.clamp("skulduggery", 1, 10) + c.awareness = Math.max(c.awareness, 10) + c.meleeCombat = Math.max(c.meleeCombat, 10) + c.skulduggery = Math.min(c.skulduggery, 10) this.addProficienciesToCharacter( c, // @@ -282,6 +282,7 @@ export class CharacterSeeder { ":armor.medium.breastplate", ":lighting.bulls_eye_lantern", ":map.city.hovedstad", + ":misc.lamp_oil", ":misc.signal_whistle", ":weapon.specialist.halberd", ); @@ -296,18 +297,18 @@ export class CharacterSeeder { c.itemSlots = 6 c.maxHitPoints = c.currentHitPoints = 10 - c.clamp("grit", 0, 10) - c.clamp("magic", 10, undefined) - c.clamp("meleeCombat", 0, 10) - c.clamp("rangedCombat", 0, 5) + c.grit = Math.min(c.grit, 10) + c.magic = Math.max(c.magic, 10) + c.meleeCombat = Math.min(c.meleeCombat, 10) + c.rangedCombat = Math.min(c.rangedCombat, 10) /* ---- NO PROFICIENCIES ---- */ this.addItemsToCharacter( c, // - "TODO: [TEIR 2 WAND WITH RANDOM SPELL]", - "TODO: [TEIR 1 WAND WITH RANDOM SPELL]", + // "TODO: [TEIR 2 WAND WITH RANDOM SPELL]", + // "TODO: [TEIR 1 WAND WITH RANDOM SPELL]", ); return } @@ -320,6 +321,8 @@ export class CharacterSeeder { c.itemSlots = 7; c.maxHitPoints = c.currentHitPoints = 10 + c.awareness = Math.max(10, c.awareness) + this.addProficienciesToCharacter( c, // ":armor.light", @@ -331,10 +334,8 @@ export class CharacterSeeder { c, // ":armor.light.studded_leather", ":kit.healers_kit", - ":weapon.light.club", - ":weapon.light.dagger", - ":weapon.light.dagger", - ":weapon.light.dagger", + ":weapon.basic.club", + ":weapon.basic.dagger", ":weapon.light.sling", ); return @@ -348,14 +349,15 @@ export class CharacterSeeder { c.itemSlots = 7; c.maxHitPoints = c.currentHitPoints = 20 - c.clamp("awareness", 10, undefined) - c.clamp("grit", 10, undefined) - c.clamp("magic", 1, 10) - c.clamp("meleeCombat", 10, undefined) + c.awareness = Math.max(10, c.awareness); + c.grit = Math.max(10, c.grit); + c.magic = Math.min(10, c.magic); + c.meleeCombat = Math.max(10, c.meleeCombat); this.addProficienciesToCharacter( c, // ":wepaon.heavy", + ":wepaon.light", ); this.addItemsToCharacter( @@ -373,14 +375,15 @@ export class CharacterSeeder { c.itemSlots = 5; c.maxHitPoints = c.currentHitPoints = 10 - c.clamp("awareness", 10, undefined) - c.clamp("magic", 1, 10) - c.clamp("rangedCombat", 10, undefined) + c.awareness = Math.max(10, c.awareness) + c.magic = Math.min(10, c.magic) + c.rangedCombat = Math.max(10, c.rangedCombat) this.addProficienciesToCharacter( c, // ":armor.light", ":weapon.light", + ":weapon.heavy.longbow", ); this.addItemsToCharacter( @@ -394,213 +397,177 @@ export class CharacterSeeder { return } - /* + if (foundation === 9 || foundation === ":skrimisher") { - // - //--------------------------------------------------------------------------------------- - //HEADLINE: ROVER - //--------------------------------------------------------------------------------------- - | {counter:foundation} + c.foundation = "Skirmisher"; - | Rover + c.silver = 15; + c.itemSlots = 6; + c.maxHitPoints = c.currentHitPoints = 15 - |[unstyled] - * Light Armor + c.awareness = Math.max(10, c.awareness) + c.grit = Math.max(10, c.grit) + c.magic = Math.max(5, c.magic) + c.meleeCombat = Math.max(10, c.meleeCombat) + c.skulduggery = Math.max(10, c.skulduggery) - |[unstyled] - * Leather Armor - * Short Sword - * Longbow - * Snare Maker's Kit - * 25 Silver Pieces + this.addProficienciesToCharacter( + c, // + ":armor.light", + ); - |[unstyled] - * 10 Hit Points - * 5 Item Slots - * Magic Reduced to 10 - * Awareness raised to 10 - * Ranged Combat raised to 10 + this.addItemsToCharacter( + c, // + ":armor.light.small_shield", + ":weapon.light.spear", + ); + return + } - // - //--------------------------------------------------------------------------------------- - //HEADLINE: SKIRMISHER - //--------------------------------------------------------------------------------------- - | {counter:foundation} + if (foundation === 10 || foundation === ":sneak") { - | Skirmisher + c.foundation = "Sneak"; - |[unstyled] - * Light Armor - * Shields + c.silver = 30; + c.itemSlots = 6; + c.maxHitPoints = c.currentHitPoints = 10 - |[unstyled] - * Spear - * Small Shield - * 50 Silver Pieces + c.awareness = Math.max(10, c.awareness) + c.meleeCombat = Math.max(10, c.meleeCombat) + c.skulduggery = Math.max(10, c.skulduggery) + + this.addProficienciesToCharacter( + c, // + ":armor.light", + ); + + this.addItemsToCharacter( + c, // + ":weapon.basic.dagger", + ":weapon.light.small_crossbow", + ":kit.poisoners_kit", + ); + return + } + + if (foundation === 11 || foundation === ":spellsword") { + + c.foundation = "Spellsword"; + + c.silver = 30; + c.itemSlots = 5; + c.maxHitPoints = c.currentHitPoints = 12; + + c.grit = Math.max(10, c.grit) + c.magic = Math.max(10, c.magic) + c.meleeCombat = Math.max(10, c.meleeCombat) + c.rangedCombat = Math.min(10, c.rangedCombat) + c.skulduggery = Math.min(10, c.skulduggery) + + this.addProficienciesToCharacter( + c, // + ":weapon.light", + ); + + this.addItemsToCharacter( + c, // + ":weapon.light.rapier", + // "[TODO TIER 1 WAND WITH RANDOM SPELL]", + ); + + return + } + + if (foundation === 12 || foundation === ":spelunker") { + + c.foundation = "Spelunker"; + + c.silver = 5; + c.itemSlots = 4; + c.maxHitPoints = c.currentHitPoints = 10; + + c.awareness = Math.max(10, c.awareness) + c.magic = Math.min(10, c.magic) + c.meleeCombat = Math.max(10, c.meleeCombat) + c.skulduggery = Math.max(10, c.skulduggery) + + this.addProficienciesToCharacter( + c, // + ":weapon.light", + ); + + this.addItemsToCharacter( + c, // + ":kit.map_makers_kit", + ":lighting.bulls_eye_lantern", + ":misc.caltrops", + ":misc.chalk", + ":misc.lamp_oil", + ":weapon.light.spear", + ); + + return + } + + if (foundation === 13 || foundation === ":spit_n_polish") { + + c.foundation = "Spit'n'Polish"; + + c.silver = 10; + c.itemSlots = 2; + c.maxHitPoints = c.currentHitPoints = 10; + + c.magic = Math.min(6, c.magic) + c.meleeCombat = Math.max(10, c.meleeCombat) + + this.addProficienciesToCharacter( + c, // + ":weapon.light", + ":weapon.heavy", + ":armor.heavy", + ":armor.light", + ); + + this.addItemsToCharacter( + c, // + ":weapon.heavy.longsword", + ":armor.heavy.half_plate", + ":armor.heavy.large_shield", + ); + + return + } + + if (foundation === 14 || foundation === ":stiletto") { + + c.foundation = "Stiletto"; + + c.silver = 10; + c.itemSlots = 5; + c.maxHitPoints = c.currentHitPoints = 10; - |[unstyled] - * 15 Hit Points - * 6 Item Slots - * Melee Combat raised to 10 - * Awareness raised to 10 - * Skulduggery raised to 10 - * Grit raised to 10 + c.magic = Math.min(6, c.magic) + c.meleeCombat = Math.max(10, c.meleeCombat) - // - //--------------------------------------------------------------------------------------- - //HEADLINE: SNEAK - //--------------------------------------------------------------------------------------- - | {counter:foundation} + this.addProficienciesToCharacter( + c, // + ":weapon.light", + ":weapon.heavy", + ":armor.heavy", + ":armor.light", + ); - | Sneak + this.addItemsToCharacter( + c, // + ":weapon.heavy.longsword", + ":armor.heavy.half_plate", + ":armor.heavy.large_shield", + ); - |[unstyled] - * Light Armor + return + } - |[unstyled] - * 3 daggers - * Small Crossbow - * Poisoner's Kit - * 30 Silver Pieces - - - |[unstyled] - * 10 Hit Points - * 6 Item Slots - * Melee Combat raised to 10 - * Awareness raised to 10 - * Skulduggery raised to 10 - * Grit raised to 10 - - // - //--------------------------------------------------------------------------------------- - //HEADLINE: SPELLSWORD - //--------------------------------------------------------------------------------------- - | {counter:foundation} - - | Spellsword - - |[unstyled] - - |[unstyled] - * Tier 1 Wand with random spell. - * Longsword - * 30 Silver Pieces - - |[unstyled] - * 12 Hit Points - * 5 Item Slots - * Melee Combat raised to 10 - * Ranged Combat limited to 10 - * Magic raised to 10 - * Skulduggery limited to 10 - * Grit raised to 10 - - // - //--------------------------------------------------------------------------------------- - //HEADLINE: SPELUNKER - //--------------------------------------------------------------------------------------- - | {counter:foundation} - - | Spelunker - - |[unstyled] - * None - - |[unstyled] - * Spear - * Caltrops - * Bull's Eye Lantern - * Map Maker's Kit - * Chalk - * Caltrops - * 5 Silver Pieces - - |[unstyled] - * 10 Hit Points - * 4 Item Slots - * Awareness raised to 10 - * Melee Combat raised to 10 - * Skulduggery raised to 10 - * Magic limited to 10 - - // - //--------------------------------------------------------------------------------------- - //HEADLINE: SPIT'N'POLISH - //--------------------------------------------------------------------------------------- - | {counter:foundation} - - | Spit'n' Polish - - |[unstyled] - * Heavy Armor - * Shield - - |[unstyled] - * Half-Plate - * Large Shield - * Long Sword - * 10 Silver Pieces - - |[unstyled] - * 10 Hit Points - * 2 Item Slots - * Melee Combat raised to 10 - * Magic Reduced to 6 - * Awareness Reduced to 10 - - // - //--------------------------------------------------------------------------------------- - //HEADLINE: STILETTO - //--------------------------------------------------------------------------------------- - | {counter:foundation} - - | Stiletto - - |[unstyled] - * Light Armor - - |[unstyled] - * Padded Armor - * 3 Daggers - * Small Crossbow - * Poisoner's Kit - * 20 Silver Pieces - - |[unstyled] - * 10 Hit Points - * 5 Item Slots - * Melee Combat raised to 10 - * Ranged Combat raised to 10 - * Awareness raised to 10 - * Magic limited to 6 - * Knowledge limited to 10 - - // - //--------------------------------------------------------------------------------------- - //HEADLINE: Tinkerer - //--------------------------------------------------------------------------------------- - | {counter:foundation} - - |Tinkerer - - |[unstyled] - * Light Armor - - |[unstyled] - * Studded Leather - * Wrench (club) - * Tinkerer's Kit - * 30 Silver Pieces - - |[unstyled] - * 10 Hit Points - * 5 Item Slots - * Awareness raised to 10 - * Knowledge raised to 10 - - */ return this.applyFoundation(c, ":random") } } diff --git a/seeders/itemSeeder.js b/seeders/itemSeeder.js index 0060db9..dffc415 100755 --- a/seeders/itemSeeder.js +++ b/seeders/itemSeeder.js @@ -18,13 +18,23 @@ export class ItemSeeder { // \_/\_/ \___|\__,_| .__/ \___/|_| |_|___/ // |_| //------------------------------------------------------- - gGame.addItemBlueprint(":weapon.light.dagger", { + gGame.addItemBlueprint(":weapon.basic.club", { + name: "Club", + description: "A club, it's light, what's more to say?", + itemSlots: 1, + damage: 4, + specialEffect: "TBD", + }); + + gGame.addItemBlueprint(":weapon.basic.dagger", { name: "Dagger", - description: "Small shady blady", - itemSlots: 0.5, + description: "Basic small shady blady", + itemSlots: 1, damage: 3, melee: true, - ranged: true, + ranged: true, // + count: 3, // basic daggers always come in a bundle of three + maxCount: 3, specialEffect: ":effect.weapon.fast", }); @@ -52,6 +62,31 @@ export class ItemSeeder { specialEffect: "TBD", }); + gGame.addItemBlueprint(":weapon.light.small_crossbow", { + name: "Rapier", + description: "Small Crossbow", + itemSlots: 2, + damage: 8, + specialEffect: "TBD", + ammoType: "bolt", + }); + + gGame.addItemBlueprint(":weapon.heavy.longsword", { + name: "Rapier", + description: "Long one-handed sword", + itemSlots: 2, + damage: 8, + specialEffect: "TBD", + }); + + gGame.addItemBlueprint(":weapon.heavy.longbow", { + name: "Rapier", + description: "Longbow", + itemSlots: 3, + damage: 8, + specialEffect: "TBD", + }); + // _ // / \ _ __ _ __ ___ ___ _ __ ___ // / _ \ | '__| '_ ` _ \ / _ \| '__/ __| @@ -63,8 +98,10 @@ export class ItemSeeder { description: "Padded and hardened leather with metal stud reinforcement", itemSlots: 3, specialEffect: "TBD", + sneak: false, armorHitPoints: 10, }); + gGame.addItemBlueprint(":armor.light.leather", { name: "Leather Armor", description: "Padded and hardened leather", @@ -72,6 +109,29 @@ export class ItemSeeder { specialEffect: "TBD", armorHitPoints: 6, }); + gGame.addItemBlueprint(":armor.medium.breastplate", { + name: "Breastplate", + description: "Plate that covers chest, cloth and leather covers the rest", + itemSlots: 3, + specialEffect: "TBD", + armorHitPoints: 10, + }) + + gGame.addItemBlueprint(":armor.heavy.half_plate", { + name: "Half-Plate", + description: "Platemail with near-total coverage", + itemSlots: 4, + specialEffect: "TBD", + armorHitPoints: 6, + }); + + gGame.addItemBlueprint(":armor.heavy.large_shield", { + name: "Large Shield", + description: "Platemail with near-total coverage", + itemSlots: 4, + specialEffect: "TBD", + armorHitPoints: 6, + }); // _ ___ _ // | |/ (_) |_ ___ @@ -96,5 +156,21 @@ export class ItemSeeder { count: 20, maxCount: 20, }); + + gGame.addItemBlueprint(":kit.snare_makers_kit", { + name: "Healer's Kit", + description: "Allows you to create traps and snares", + itemSlots: 2, + specialEffect: "TBD", + count: 20, + maxCount: 20, + }); + + gGame.addItemBlueprint(":kit.map_makers_kit", { + name: "Healer's Kit", + description: "Allows you to create traps and snares", + itemSlots: 1, + specialEffect: "TBD", + }) } } diff --git a/test.js b/test.js old mode 100644 new mode 100755