diff --git a/raws/mobs.json b/raws/mobs.json index df6b2f4..93b9b05 100644 --- a/raws/mobs.json +++ b/raws/mobs.json @@ -5,7 +5,7 @@ "renderable": { "glyph": "@", "fg": "#EE82EE", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, - "quips": ["Drink?"] + "quips": ["Drink?", "Something to eat?", "Don't go out on an empty stomach."] }, { "id": "npc_townsperson", @@ -13,7 +13,7 @@ "renderable": { "glyph": "@", "fg": "#9fa86c", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, - "quips": ["You won't catch me quipping."] + "quips": ["Hello!", "Good morning.", ""] }, { "id": "npc_drunk", @@ -21,7 +21,7 @@ "renderable": { "glyph": "@", "fg": "#a0a83c", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, - "quips": ["Hic!", "H-Hic'."] + "quips": ["Hic!", "H-Hic'.", "Get me 'nother, would you?"] }, { "id": "npc_fisher", @@ -29,7 +29,7 @@ "renderable": { "glyph": "@", "fg": "#3ca3a8", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, - "quips": ["Placeholder."] + "quips": ["Hey."] }, { "id": "npc_dockworker", @@ -37,13 +37,14 @@ "renderable": { "glyph": "@", "fg": "#68d8de", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, - "quips": ["Placeholder."] + "quips": ["No boat for a few days.", "Not much for us to do."] }, { "id": "npc_priest", "name": "priest", "renderable": { "glyph": "@", "fg": "#FFFFFF", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], + "quips": ["Light's givings.", "", "Bless you."], "vision_range": 4 }, { @@ -52,6 +53,7 @@ "renderable": { "glyph": "@", "fg": "#946123", "bg": "#000000", "order": 1 }, "flags": ["BYSTANDER", "BLOCKS_TILE"], "vision_range": 4, + "quips": ["You're not borrowing my pick."], "attacks": [ { "name": "hits", "hit_bonus": 0, "damage": "1d8"} ] @@ -63,7 +65,7 @@ "flags": ["BYSTANDER", "BLOCKS_TILE"], "level": 2, "vision_range": 4, - "quips": ["You wont catch me down the mine.", "I'm not paid enough for that."], + "quips": ["You wont catch me down the mine.", "Staying out of trouble?"], "attacks": [ { "name": "hits", "hit_bonus": 0, "damage": "1d8"} ], @@ -77,6 +79,7 @@ "level": 2, "bac": 6, "vision_range": 12, + "quips": ["", "", ""], "attacks": [ { "name": "bites", "hit_bonus": 0, "damage": "1d6"} ] @@ -92,6 +95,28 @@ { "name": "bites", "hit_bonus": 0, "damage": "1d2"} ] }, + { + "id": "chicken", + "name": "chicken", + "renderable": { "glyph": "c", "fg": "#BB6000", "bg": "#000000", "order": 1 }, + "flags": ["BYSTANDER", "BLOCKS_TILE"], + "bac": 8, + "vision_range": 4, + "attacks": [ + { "name": "bites", "hit_bonus": 0, "damage": "1d3"} + ] + }, + { + "id": "chicken_little", + "name": "chick", + "renderable": { "glyph": "c", "fg": "#fae478", "bg": "#000000", "order": 1 }, + "flags": ["BYSTANDER", "BLOCKS_TILE"], + "bac": 10, + "vision_range": 4, + "attacks": [ + { "name": "bites", "hit_bonus": 0, "damage": "1d2"} + ] + }, { "id": "rat_giant", "name": "giant rat", diff --git a/raws/props.json b/raws/props.json index 1b8d75e..91d244c 100644 --- a/raws/props.json +++ b/raws/props.json @@ -5,6 +5,12 @@ "renderable": { "glyph": "+", "fg": "#00FFFF", "bg": "#000000", "order": 2 }, "flags": ["BLOCKS_TILE", "BLOCKS_VISIBILITY", "DOOR", "PROP"] }, + { + "id": "prop_altar", + "name": "altar", + "renderable": { "glyph": "_", "fg": "#FFFFFF", "bg": "#000000", "order": 2 }, + "flags": ["PROP"] + }, { "id": "prop_keg", "name": "keg", diff --git a/raws/spawn_tables.json b/raws/spawn_tables.json index 3437fee..bc0fc41 100644 --- a/raws/spawn_tables.json +++ b/raws/spawn_tables.json @@ -61,6 +61,7 @@ { "id": "mobs", "table": [ + { "id": "chicken", "weight": 1, "difficulty": 1}, { "id": "rat", "weight": 1, "difficulty": 1}, { "id": "goblin", "weight": 3, "difficulty": 1}, { "id": "kobold", "weight": 1, "difficulty": 1}, diff --git a/src/main.rs b/src/main.rs index 8dff816..07de74e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -566,7 +566,7 @@ fn main() -> rltk::BError { raws::load_raws(); gs.ecs.insert(rltk::RandomNumberGenerator::new()); - gs.ecs.insert(Map::new(1, 64, 64, 0)); + gs.ecs.insert(Map::new(1, 64, 64, 0, "New Map")); gs.ecs.insert(Point::new(0, 0)); let player_entity = spawner::player(&mut gs.ecs, 0, 0); gs.ecs.insert(player_entity); diff --git a/src/map/mod.rs b/src/map/mod.rs index 85fe93b..eb2626e 100644 --- a/src/map/mod.rs +++ b/src/map/mod.rs @@ -24,6 +24,7 @@ pub struct Map { pub additional_fg_offset: rltk::RGB, pub blocked: Vec, pub id: i32, + pub name: String, pub difficulty: i32, pub bloodstains: HashSet, pub view_blocked: HashSet, @@ -38,7 +39,7 @@ impl Map { (y as usize) * (self.width as usize) + (x as usize) } - pub fn new(new_id: i32, width: i32, height: i32, difficulty: i32) -> Map { + pub fn new(new_id: i32, width: i32, height: i32, difficulty: i32, name: S) -> Map { let map_tile_count = (width * height) as usize; let mut map = Map { tiles: vec![TileType::Wall; map_tile_count], @@ -52,6 +53,7 @@ impl Map { additional_fg_offset: rltk::RGB::from_u8(HALF_OFFSET, HALF_OFFSET, HALF_OFFSET), blocked: vec![false; map_tile_count], id: new_id, + name: name.to_string(), difficulty: difficulty, bloodstains: HashSet::new(), view_blocked: HashSet::new(), diff --git a/src/map_builders/mod.rs b/src/map_builders/mod.rs index 695a510..37eb7dd 100644 --- a/src/map_builders/mod.rs +++ b/src/map_builders/mod.rs @@ -92,13 +92,13 @@ pub struct BuilderChain { } impl BuilderChain { - pub fn new(new_id: i32, width: i32, height: i32, difficulty: i32) -> BuilderChain { + pub fn new(new_id: i32, width: i32, height: i32, difficulty: i32, name: S) -> BuilderChain { BuilderChain { starter: None, builders: Vec::new(), build_data: BuilderMap { spawn_list: Vec::new(), - map: Map::new(new_id, width, height, difficulty), + map: Map::new(new_id, width, height, difficulty, name), starting_position: None, rooms: None, corridors: None, @@ -296,7 +296,7 @@ pub fn random_builder( difficulty: i32, ) -> BuilderChain { rltk::console::log(format!("DEBUGINFO: Building random (ID:{}, DIFF:{})", new_id, difficulty)); - let mut builder = BuilderChain::new(new_id, width, height, difficulty); + let mut builder = BuilderChain::new(new_id, width, height, difficulty, ""); let type_roll = rng.roll_dice(1, 2); let mut want_doors = true; match type_roll { diff --git a/src/map_builders/town.rs b/src/map_builders/town.rs index 9bb1b6c..f065fd0 100644 --- a/src/map_builders/town.rs +++ b/src/map_builders/town.rs @@ -2,9 +2,9 @@ use super::{BuilderChain, BuilderMap, InitialMapBuilder, Position, TileType}; use std::collections::HashSet; pub fn town_builder(new_id: i32, _rng: &mut rltk::RandomNumberGenerator, width: i32, height: i32) -> BuilderChain { - let difficulty = 7; + let difficulty = 0; rltk::console::log(format!("DEBUGINFO: Building town (ID:{}, DIFF:{})", new_id, difficulty)); - let mut chain = BuilderChain::new(new_id, width, height, difficulty); + let mut chain = BuilderChain::new(new_id, width, height, difficulty, ""); chain.start_with(TownBuilder::new()); return chain; @@ -71,7 +71,7 @@ impl TownBuilder { building_size[1].2 = BuildingTag::Temple; building_size[2].2 = BuildingTag::Mine; building_size[3].2 = BuildingTag::PlayerHouse; - for b in building_size.iter_mut().skip(3) { + for b in building_size.iter_mut().skip(4) { b.2 = BuildingTag::NPCHouse } let last_idx = building_size.len() - 1; @@ -121,12 +121,21 @@ impl TownBuilder { ) { for idx in available_building_tiles.iter() { if rng.roll_dice(1, 40) == 1 { - let roll = rng.roll_dice(1, 3); + let roll = rng.roll_dice(1, 6); match roll { 1 => build_data.spawn_list.push((*idx, "npc_fisher".to_string())), 2 => build_data.spawn_list.push((*idx, "npc_dockworker".to_string())), - 3 => build_data.spawn_list.push((*idx, "npc_townsperson".to_string())), - _ => build_data.spawn_list.push((*idx, "npc_drunk".to_string())), + 3 => build_data.spawn_list.push((*idx, "npc_drunk".to_string())), + 4 => build_data.spawn_list.push((*idx, "npc_townsperson".to_string())), + 5 => build_data.spawn_list.push((*idx, "npc_guard".to_string())), + _ => { + let animal_roll = rng.roll_dice(1, 3); + match animal_roll { + 1 => build_data.spawn_list.push((*idx, "chicken_little".to_string())), + 2 => build_data.spawn_list.push((*idx, "chicken".to_string())), + _ => build_data.spawn_list.push((*idx, "dog_little".to_string())), + } + } } } } @@ -171,12 +180,11 @@ impl TownBuilder { let mut to_place: Vec<&str> = vec![ "npc_barkeep", "npc_townsperson", - "npc_townsperson", "npc_drunk", "npc_drunk", - "npc_guard", "prop_keg", "prop_table", + "prop_table", "prop_chair", "prop_chair", ]; @@ -189,8 +197,17 @@ impl TownBuilder { build_data: &mut BuilderMap, rng: &mut rltk::RandomNumberGenerator, ) { - let mut to_place: Vec<&str> = - vec!["npc_priest", "prop_chair", "prop_chair", "prop_table", "prop_candle", "prop_candle"]; + let mut to_place: Vec<&str> = vec![ + "npc_priest", + "prop_altar", + "prop_chair", + "prop_chair", + "prop_chair", + "prop_table", + "prop_table", + "prop_candle", + "prop_candle", + ]; self.random_building_spawn(building, build_data, rng, &mut to_place, 0) } @@ -203,7 +220,7 @@ impl TownBuilder { // Place exit let exit_idx = build_data.map.xy_idx(building.0 + (building.2 / 2), building.1 + (building.3 / 2)); build_data.map.tiles[exit_idx] = TileType::DownStair; - let mut to_place: Vec<&str> = vec!["npc_miner", "npc_miner", "npc_guard"]; + let mut to_place: Vec<&str> = vec!["npc_miner", "npc_miner", "npc_guard", "prop_chair"]; self.random_building_spawn(building, build_data, rng, &mut to_place, exit_idx) } @@ -213,7 +230,7 @@ impl TownBuilder { build_data: &mut BuilderMap, rng: &mut rltk::RandomNumberGenerator, ) { - let mut to_place: Vec<&str> = vec!["prop_bed", "prop_table"]; + let mut to_place: Vec<&str> = vec!["prop_bed", "prop_table", "dog_little", "prop_chair", "prop_chair"]; self.random_building_spawn(building, build_data, rng, &mut to_place, 0); } @@ -223,7 +240,7 @@ impl TownBuilder { build_data: &mut BuilderMap, rng: &mut rltk::RandomNumberGenerator, ) { - let mut to_place: Vec<&str> = vec!["prop_bed", "prop_table"]; + let mut to_place: Vec<&str> = vec!["npc_townsperson", "prop_bed", "prop_table", "prop_chair"]; self.random_building_spawn(building, build_data, rng, &mut to_place, 0); } @@ -233,7 +250,7 @@ impl TownBuilder { build_data: &mut BuilderMap, rng: &mut rltk::RandomNumberGenerator, ) { - let mut to_place: Vec<&str> = vec!["rat", "rat", "rat"]; + let mut to_place: Vec<&str> = vec!["rat", "rat", "rat", "prop_table", "prop_chair"]; self.random_building_spawn(building, build_data, rng, &mut to_place, 0); } @@ -335,7 +352,7 @@ impl TownBuilder { const BORDER: i32 = 4; const OFFSET_FROM_LEFT: i32 = 25 + BORDER; - const PATH_OFFSET_FROM_CENTRE: i32 = 4; + const PATH_OFFSET_FROM_CENTRE: i32 = 10; const HALF_PATH_THICKNESS: i32 = 3; let wall_gap_y = diff --git a/src/map_builders/wfc/mod.rs b/src/map_builders/wfc/mod.rs index c30a631..46168da 100644 --- a/src/map_builders/wfc/mod.rs +++ b/src/map_builders/wfc/mod.rs @@ -31,8 +31,13 @@ impl WaveFunctionCollapseBuilder { let constraints = patterns_to_constraints(patterns, CHUNK_SIZE); self.render_tile_gallery(&constraints, CHUNK_SIZE, build_data); - build_data.map = - Map::new(build_data.map.id, build_data.map.width, build_data.map.height, build_data.map.difficulty); + build_data.map = Map::new( + build_data.map.id, + build_data.map.width, + build_data.map.height, + build_data.map.difficulty, + &build_data.map.name, + ); loop { let mut solver = Solver::new(constraints.clone(), CHUNK_SIZE, &build_data.map); while !solver.iteration(&mut build_data.map, rng) { @@ -47,7 +52,7 @@ impl WaveFunctionCollapseBuilder { } fn render_tile_gallery(&mut self, constraints: &[MapChunk], chunk_size: i32, build_data: &mut BuilderMap) { - build_data.map = Map::new(0, build_data.width, build_data.height, 0); + build_data.map = Map::new(0, build_data.width, build_data.height, 0, &build_data.map.name); let mut counter = 0; let mut x = 1; let mut y = 1; @@ -63,7 +68,7 @@ impl WaveFunctionCollapseBuilder { if y + chunk_size > build_data.map.height { // Move to the next page build_data.take_snapshot(); - build_data.map = Map::new(0, build_data.width, build_data.height, 0); + build_data.map = Map::new(0, build_data.width, build_data.height, 0, &build_data.map.name); x = 1; y = 1;