diff --git a/content/core/actions/CoreActions.ts b/content/core/actions/CoreActions.ts new file mode 100644 index 0000000..63ec66c --- /dev/null +++ b/content/core/actions/CoreActions.ts @@ -0,0 +1,16 @@ +import { registerAction } from '@actions'; +import { Game } from '@game'; + +registerAction('Gather Flint', (qty) => { + Game.current.board.addTask({ + taskId: 'core:gather-flint', + options: {} + }) +}); + +registerAction('Gather Slate', (qty) => { + Game.current.board.addTask({ + taskId: 'core:gather-slate', + options: {} + }) +}); diff --git a/content/core/items/Items.ts b/content/core/items/Items.ts index 6bb224f..9b29d29 100644 --- a/content/core/items/Items.ts +++ b/content/core/items/Items.ts @@ -1,18 +1,13 @@ import { Item } from '@items'; -export const LOG = new Item() - .setName("Log") - .setId('core:resources/log'); - -export const ROCK = new Item() - .setName("Rock") - .setId('core:resources/rock'); - -export const STICK = new Item() - .setName("Stick") - .setId('core:resources/stick'); +export const LOG = new Item().setName("Log").setId('core:resources/log'); +export const STICK = new Item().setName("Stick").setId('core:resources/stick'); +export const FLINT_NORMAL = new Item().setName("Flint").setId('core:flint'); +export const FLINT_FLAKE = new Item().setName("Flint Flake").setId('core:flint-flake'); +export const SANDSTONE_NORMAL = new Item().setName("Sandstone").setId('core:sandstone'); +export const SLATE_NORMAL = new Item().setName("Slate").setId('core:slate'); // slate, flint X normal, flake -// limestone: large, small -// shale \ No newline at end of file +// limestone, shale, sandstone: large, small +// shale - igneous. metamorphasis => slate \ No newline at end of file diff --git a/content/core/tasks/GatherRocksTask.ts b/content/core/tasks/GatherRocksTask.ts index 02d3160..794fdf7 100644 --- a/content/core/tasks/GatherRocksTask.ts +++ b/content/core/tasks/GatherRocksTask.ts @@ -1,22 +1,36 @@ import { Task, registerTask } from "@tasks"; import chalk from 'chalk'; import { Game } from '@game'; -import { ROCK } from '../items/Items.js'; +import { FLINT_NORMAL, SLATE_NORMAL } from '../items/Items.js'; -class GatherRocksTask extends Task { - work = 100; +registerTask('core:gather-flint', class GatherFlintTask extends Task { + work = 1000; reward(): void { - Game.current.inv.add(ROCK, 1); + Game.current.inv.add(FLINT_NORMAL, 1); } get title() { - return chalk.yellow('Chop Trees'); + return 'Gather Flint'; } get status() { - return chalk.yellow('LOGGING'); + return 'SCAVENGING'; } -} +}); -registerTask('core:gather-rocks', GatherRocksTask); \ No newline at end of file +registerTask('core:gather-slate', class GatherSlateTask extends Task { + work = 1000; + + reward(): void { + Game.current.inv.add(SLATE_NORMAL, 1); + } + + get title() { + return 'Gather Slate'; + } + + get status() { + return 'SCAVENGING'; + } +}); \ No newline at end of file diff --git a/package.json b/package.json index f8c38a8..f1cc8b2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "chalk": "^4.1.1", "deepmerge": "^4.2.2", "faker": "^5.5.3", - "frigid": "^1.3.12", + "frigid": "^1.3.13", "fs-extra": "^10.0.0", "get-port": "^5.1.1", "mocha": "^9.0.1", diff --git a/src/Pawn.ts b/src/Pawn.ts index 1adbae8..237fc8f 100644 --- a/src/Pawn.ts +++ b/src/Pawn.ts @@ -7,21 +7,14 @@ import { render } from './ui/UI.js'; import { Memory } from './Memory.js'; import { getTheme } from './registries/Themes.js'; -const LABORS = { - CUT_TREE: Symbol('CUT_TREE'), - MINING: Symbol('CUT_TREE'), -} - -const SKILLS = { - PICKAXE: Symbol('PICKAXE'), - HATCHET: Symbol('HATCHET') -} - // const STATUS = { // IDLE: Symbol('IDLE') // } const energyScale = 0.1; +const MAX_ENERGY = 100; + +// TODO add stats getter to return % of all stats export class Pawn extends Serializable implements Tickable { name: { @@ -46,7 +39,7 @@ export class Pawn extends Serializable implements Tickable { if(this.awake === false) { this.energy += energyScale * 4; - if(this.energy >= 100) { + if(this.energy >= MAX_ENERGY) { this.awake = true; } } else { @@ -88,7 +81,7 @@ export class Pawn extends Serializable implements Tickable { this.name.first = faker.name.firstName(this.sex); } this.awake ??= true; - this.energy ??= 100; + this.energy ??= MAX_ENERGY; this.memories ??= []; if(!this.age) { this.age = Math.floor(525600 * (16 + Math.random() * 9)); diff --git a/yarn.lock b/yarn.lock index 93b9a85..7f38f58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -316,7 +316,7 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -frigid@^1.3.12: +frigid@^1.3.13: version "1.3.13" resolved "https://registry.yarnpkg.com/frigid/-/frigid-1.3.13.tgz#27d8592ec1aeb72964fbc4014e38e6c366c5e3b7" integrity sha512-suwEa7JuMvNqIlVpc848wIptC8o3Ztvadv8a1HojbaNcYdowOlqWi/ieSgQZkBVCpmrBOq7IeuaB6p4BvCUdHQ==