diff --git a/raws/items.json b/raws/items.json index 5c14fff..568e14d 100644 --- a/raws/items.json +++ b/raws/items.json @@ -50,7 +50,7 @@ }, { "id": "scroll_magicmap_cursed", - "name": { "name": "scroll of magic mapping", "plural": "scrolls of magic mapping" }, + "name": { "name": "cursed scroll of magic mapping", "plural": "cursed scrolls of magic mapping" }, "renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 }, "flags": ["CONSUMABLE", "DESTRUCTIBLE", "CURSED"], "effects": { "magicmapper": "" } @@ -69,6 +69,13 @@ "flags": ["EQUIP_MELEE"], "effects": { "melee_power_bonus": "2" } }, + { + "id": "equip_longsword", + "name": { "name": "longsword", "plural": "longswords" }, + "renderable": { "glyph": ")", "fg": "#FFF8DC", "bg": "#000000", "order": 2 }, + "flags": ["EQUIP_MELEE"], + "effects": { "melee_power_bonus": "3" } + }, { "id": "equip_smallshield", "name": { "name": "buckler", "plural": "bucklers" }, @@ -78,11 +85,18 @@ }, { "id": "equip_mediumshield", - "name": { "name": "medium shield", "plural": "medium shield" }, + "name": { "name": "medium shield", "plural": "medium shields" }, "renderable": { "glyph": "[", "fg": "#C0C0C0", "bg": "#000000", "order": 2 }, "flags": ["EQUIP_SHIELD"], "effects": { "defence_bonus": "2", "melee_power_bonus": "-1" } }, + { + "id": "equip_largeshield", + "name": { "name": "large shield", "plural": "large shields" }, + "renderable": { "glyph": "[", "fg": "#FFF8DC", "bg": "#000000", "order": 2 }, + "flags": ["EQUIP_SHIELD"], + "effects": { "defence_bonus": "4", "melee_power_bonus": "-2" } + }, { "id": "wand_magicmissile", "name": { "name": "wand of magic missile", "plural": "wands of magic missile" }, @@ -120,7 +134,7 @@ { "id": "food_apple", "name": { "name": "apple", "plural": "apples" }, - "renderable": { "glyph": "%", "fg": "#008000", "bg": "#000000", "order": 2 }, + "renderable": { "glyph": "%", "fg": "#00FF00", "bg": "#000000", "order": 2 }, "flags": ["FOOD", "CONSUMABLE"] } ] diff --git a/raws/mobs.json b/raws/mobs.json index 3c722ae..094eee5 100644 --- a/raws/mobs.json +++ b/raws/mobs.json @@ -1,12 +1,4 @@ [ - { - "id": "orc", - "name": "orc", - "renderable": { "glyph": "o", "fg": "#00FF00", "bg": "#000000", "order": 1 }, - "flags": ["BLOCKS_TILE"], - "stats": { "max_hp": 8, "hp": 8, "defence": 0, "power": 3 }, - "vision_range": 12 - }, { "id": "goblin", "name": "goblin", @@ -15,12 +7,44 @@ "stats": { "max_hp": 6, "hp": 6, "defence": 0, "power": 2 }, "vision_range": 12 }, + { + "id": "kobold", + "name": "kobold", + "renderable": { "glyph": "k", "fg": "#FF7F50", "bg": "#000000", "order": 1 }, + "flags": ["BLOCKS_TILE"], + "stats": { "max_hp": 6, "hp": 6, "defence": 0, "power": 1 }, + "vision_range": 8 + }, { "id": "goblin_chieftain", "name": "goblin chieftain", "renderable": { "glyph": "G", "fg": "#00FF00", "bg": "#000000", "order": 1 }, "flags": ["BLOCKS_TILE"], + "stats": { "max_hp": 8, "hp": 8, "defence": 1, "power": 2 }, + "vision_range": 12 + }, + { + "id": "orc", + "name": "orc", + "renderable": { "glyph": "o", "fg": "#00FF00", "bg": "#000000", "order": 1 }, + "flags": ["BLOCKS_TILE"], "stats": { "max_hp": 8, "hp": 8, "defence": 0, "power": 3 }, "vision_range": 12 + }, + { + "id": "orc_large", + "name": "large orc", + "renderable": { "glyph": "o", "fg": "#008000", "bg": "#000000", "order": 1 }, + "flags": ["BLOCKS_TILE"], + "stats": { "max_hp": 12, "hp": 12, "defence": 1, "power": 3 }, + "vision_range": 12 + }, + { + "id": "ogre", + "name": "ogre", + "renderable": { "glyph": "O", "fg": "#00FF00", "bg": "#000000", "order": 1 }, + "flags": ["BLOCKS_TILE"], + "stats": { "max_hp": 12, "hp": 12, "defence": 3, "power": 3 }, + "vision_range": 8 } ] diff --git a/raws/props.json b/raws/props.json index 670472f..d9a5408 100644 --- a/raws/props.json +++ b/raws/props.json @@ -12,6 +12,13 @@ "flags": ["HIDDEN", "ENTRY_TRIGGER", "SINGLE_ACTIVATION"], "effects": { "damage": "6" } }, + { + "id": "trap_stonefall", + "name": "stonefall trap", + "renderable": { "glyph": "^", "fg": "#C0C0C0", "bg": "#000000", "order": 2 }, + "flags": ["HIDDEN", "ENTRY_TRIGGER", "SINGLE_ACTIVATION"], + "effects": { "damage": "12" } + }, { "id": "trap_confusion", "name": "magic trap", diff --git a/raws/spawn_tables.json b/raws/spawn_tables.json index d15e90d..65d2c7b 100644 --- a/raws/spawn_tables.json +++ b/raws/spawn_tables.json @@ -4,8 +4,10 @@ "table": [ { "id": "equip_dagger", "weight": 4, "min": 0, "max": 100 }, { "id": "equip_shortsword", "weight": 2, "min": 0, "max": 100 }, + { "id": "equip_longsword", "weight": 1, "min": 2, "max": 100 }, { "id": "equip_smallshield", "weight": 4, "min": 0, "max": 100 }, - { "id": "equip_mediumshield", "weight": 2, "min": 0, "max": 100 } + { "id": "equip_mediumshield", "weight": 2, "min": 0, "max": 100 }, + { "id": "equip_largeshield", "weight": 1, "min": 2, "max": 100 } ] }, { @@ -18,8 +20,10 @@ { "id": "scrolls", "table": [ - { "id": "scroll_fireball", "weight": 2, "min": 0, "max": 100 }, + { "id": "scroll_fireball", "weight": 2, "min": 2, "max": 100 }, + { "id": "scroll_fireball_cursed", "weight": 2, "min": 2, "max": 100 }, { "id": "scroll_confusion", "weight": 2, "min": 0, "max": 100 }, + { "id": "scroll_magicmap_cursed", "weight": 2, "min": 0, "max": 100 }, { "id": "scroll_magicmap", "weight": 2, "min": 0, "max": 100 } ] }, @@ -27,7 +31,7 @@ "id": "wands", "table": [ { "id": "wand_magicmissile", "weight": 1, "min": 0, "max": 100 }, - { "id": "wand_fireball", "weight": 1, "min": 0, "max": 100 }, + { "id": "wand_fireball", "weight": 1, "min": 2, "max": 100 }, { "id": "wand_confusion", "weight": 1, "min": 0, "max": 100 }, { "id": "wand_digging", "weight": 1, "min": 0, "max": 100 } ] @@ -42,16 +46,20 @@ { "id": "mobs", "table": [ - { "id": "goblin", "weight": 6, "min": 0, "max": 100 }, - { "id": "orc", "weight": 2, "min": 0, "max": 100 }, - { "id": "goblin_chieftain", "weight": 1, "min": 0, "max": 100 } + { "id": "goblin", "weight": 10, "min": 0, "max": 100 }, + { "id": "kobold", "weight": 10, "min": 0, "max": 3 }, + { "id": "orc", "weight": 4, "min": 1, "max": 100 }, + { "id": "orc_large", "weight": 1, "min": 3, "max": 100 }, + { "id": "goblin_chieftain", "weight": 1, "min": 3, "max": 100 }, + { "id": "ogre", "weight": 1, "min": 4, "max": 100 } ] }, { "id": "traps", "table": [ { "id": "trap_bear", "weight": 2, "min": 0, "max": 100 }, - { "id": "trap_confusion", "weight": 1, "min": 0, "max": 100 } + { "id": "trap_confusion", "weight": 1, "min": 0, "max": 100 }, + { "id": "trap_stonefall", "weight": 1, "min": 3, "max": 100 } ] } ] diff --git a/src/map_builders/door_placement.rs b/src/map_builders/door_placement.rs index 6f32dcd..5c26eb9 100644 --- a/src/map_builders/door_placement.rs +++ b/src/map_builders/door_placement.rs @@ -30,7 +30,7 @@ impl DoorPlacement { // There are no corridors - scan for possible places let tiles = build_data.map.tiles.clone(); for (i, tile) in tiles.iter().enumerate() { - if *tile == TileType::Floor && self.door_possible(build_data, i) && rng.roll_dice(1, 3) == 1 { + if *tile == TileType::Floor && self.door_possible(build_data, i) && rng.roll_dice(1, 6) == 1 { build_data.spawn_list.push((i, "door".to_string())); } } diff --git a/src/map_builders/mod.rs b/src/map_builders/mod.rs index c547158..a492d37 100644 --- a/src/map_builders/mod.rs +++ b/src/map_builders/mod.rs @@ -302,11 +302,11 @@ pub fn random_builder(new_depth: i32, rng: &mut rltk::RandomNumberGenerator, wid } */ + builder.with(DoorPlacement::new()); + if rng.roll_dice(1, 20) == 1 { builder.with(PrefabBuilder::sectional(prefab_builder::prefab_sections::UNDERGROUND_FORT)); } - - builder.with(DoorPlacement::new()); builder.with(PrefabBuilder::vaults()); // Regardless of anything else, fill the edges back in with walls. We can't walk // there anyway, and we don't want an open line of sight into the unmapped void. diff --git a/src/spawner.rs b/src/spawner.rs index e3dc5ea..cd2328c 100644 --- a/src/spawner.rs +++ b/src/spawner.rs @@ -21,7 +21,7 @@ pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity { .with(Player {}) .with(Viewshed { visible_tiles: Vec::new(), range: 12, dirty: true }) .with(Name { name: "wanderer".to_string(), plural: "wanderers".to_string() }) - .with(CombatStats { max_hp: 8, hp: 8, defence: 0, power: 4 }) + .with(CombatStats { max_hp: 12, hp: 12, defence: 0, power: 4 }) .with(HungerClock { state: HungerState::Satiated, duration: 50 }) .with(Attributes { strength: Attribute { base: 10, modifiers: 0, bonus: 0 }, @@ -82,7 +82,16 @@ pub fn spawn_region( let spawn_table; match category.as_ref() { "mob" => spawn_table = mob_table(map_depth), - "item" => spawn_table = item_table(map_depth), + "item" => { + let item_category = item_category_table().roll(rng); + match item_category.as_ref() { + "equipment" => spawn_table = equipment_table(map_depth), + "potion" => spawn_table = potion_table(map_depth), + "scroll" => spawn_table = scroll_table(map_depth), + "wand" => spawn_table = wand_table(map_depth), + _ => spawn_table = debug_table(), + } + } "food" => spawn_table = food_table(map_depth), "trap" => spawn_table = trap_table(map_depth), _ => spawn_table = debug_table(), @@ -125,21 +134,13 @@ fn category_table() -> RandomTable { return RandomTable::new().add("mob", 12).add("item", 6).add("food", 2).add("trap", 1); } -fn debug_table() -> RandomTable { - return RandomTable::new().add("debug", 1); +// 3 scrolls : 3 potions : 1 equipment : 1 wand? +fn item_category_table() -> RandomTable { + return RandomTable::new().add("equipment", 1).add("potion", 3).add("scroll", 3).add("wand", 1); } -// 6 equipment : 10 potions : 10 scrolls : 2 cursed scrolls -fn item_table(map_depth: i32) -> RandomTable { - return RandomTable::new() - // Equipment - .add_table(equipment_table(map_depth)) - // Potions - .add_table(potion_table(map_depth)) - // Scrolls - .add_table(scroll_table(map_depth)) - // Wands - .add_table(wand_table(map_depth)); +fn debug_table() -> RandomTable { + return RandomTable::new().add("debug", 1); } pub fn equipment_table(map_depth: i32) -> RandomTable { diff --git a/wasm/rust-llyrl.js b/wasm/rust-llyrl.js index 649bd40..703dbb5 100644 --- a/wasm/rust-llyrl.js +++ b/wasm/rust-llyrl.js @@ -801,16 +801,16 @@ function __wbg_get_imports() { const ret = wasm.memory; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper702 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 116, __wbg_adapter_20); + imports.wbg.__wbindgen_closure_wrapper718 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_20); return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper1684 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 357, __wbg_adapter_23); + imports.wbg.__wbindgen_closure_wrapper1688 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 359, __wbg_adapter_23); return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper1686 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 357, __wbg_adapter_23); + imports.wbg.__wbindgen_closure_wrapper1690 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 359, __wbg_adapter_23); return addHeapObject(ret); }; diff --git a/wasm/rust-llyrl_bg.wasm b/wasm/rust-llyrl_bg.wasm index 323fb28..3151c41 100644 Binary files a/wasm/rust-llyrl_bg.wasm and b/wasm/rust-llyrl_bg.wasm differ