refactor items logic
This commit is contained in:
@@ -2,7 +2,12 @@ import { type World, type EntityId, type RunState, type Tile, type Actor, type V
|
||||
import { TileType } from "../../core/terrain";
|
||||
import { idx } from "./world-logic";
|
||||
import { GAME_CONFIG } from "../../core/config/GameConfig";
|
||||
import { ITEMS } from "../../core/config/Items";
|
||||
import {
|
||||
createConsumable,
|
||||
createMeleeWeapon,
|
||||
createRangedWeapon,
|
||||
createArmour
|
||||
} from "../../core/config/Items";
|
||||
import { seededRandom } from "../../core/math";
|
||||
import * as ROT from "rot-js";
|
||||
|
||||
@@ -53,11 +58,11 @@ export function generateWorld(floor: number, runState: RunState): { world: World
|
||||
...runState.inventory.items,
|
||||
// Add starting items for testing if empty
|
||||
...(runState.inventory.items.length === 0 ? [
|
||||
{ ...ITEMS["health_potion"], quantity: 2 },
|
||||
ITEMS["iron_sword"],
|
||||
{ ...ITEMS["throwing_dagger"], quantity: 3 },
|
||||
ITEMS["pistol"],
|
||||
ITEMS["leather_armor"]
|
||||
createConsumable("health_potion", 2),
|
||||
createMeleeWeapon("iron_sword"),
|
||||
createConsumable("throwing_dagger", 3),
|
||||
createRangedWeapon("pistol"),
|
||||
createArmour("leather_armor")
|
||||
] : [])
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user