1
0
Fork 0

Add ItemMagicTemplate struct to raws

This commit is contained in:
Timothy Warren 2022-01-31 08:47:18 -05:00
parent 39be37081b
commit 5a0f7b2b05
6 changed files with 65 additions and 8 deletions

View File

@ -6,6 +6,7 @@ use crate::colors;
pub fn tile_glyph(idx: usize, map: &Map) -> (FontCharType, RGB, RGB) {
let (glyph, mut fg, mut bg) = match map.depth {
8 | 9 => get_mushroom_glyph(idx, map),
7 => {
let x = idx as i32 % map.width;
if x > map.width - 16 {

View File

@ -361,6 +361,7 @@ pub fn level_builder(
6 => dwarf_fort_builder(new_depth, rng, width, height),
7 => mushroom_entrance(new_depth, rng, width, height),
8 => mushroom_builder(new_depth, rng, width, height),
9 => mushroom_exit(new_depth, rng, width, height),
_ => random_builder(new_depth, rng, width, height),
}
}

View File

@ -1,4 +1,4 @@
use super::prefab_builder::prefab_sections::UNDERGROUND_FORT;
use super::prefab_builder::prefab_sections::{DROW_ENTRY, UNDERGROUND_FORT};
use super::{
AreaEndingPosition, AreaStartingPosition, BuilderChain, CellularAutomataBuilder,
CullUnreachable, PrefabBuilder, VoronoiSpawning, WaveformCollapseBuilder, XEnd, XStart, YEnd,
@ -43,3 +43,23 @@ pub fn mushroom_builder(
chain
}
pub fn mushroom_exit(
new_depth: i32,
_rng: &mut rltk::RandomNumberGenerator,
width: i32,
height: i32,
) -> BuilderChain {
let mut chain = BuilderChain::new(new_depth, width, height, "Into The Mushroom Grove");
chain
.start_with(CellularAutomataBuilder::new())
.with(WaveformCollapseBuilder::new())
.with(AreaStartingPosition::new(XStart::Center, YStart::Center))
.with(CullUnreachable::new())
.with(AreaStartingPosition::new(XStart::Right, YStart::Center))
.with(AreaEndingPosition::new(XEnd::Left, YEnd::Center))
.with(VoronoiSpawning::new())
.with(PrefabBuilder::sectional(DROW_ENTRY));
chain
}

View File

@ -101,6 +101,10 @@ impl PrefabBuilder {
});
}
'>' => build_data.map.tiles[idx] = TileType::DownStairs,
'e' => {
build_data.map.tiles[idx] = TileType::Floor;
build_data.spawn_list.push((idx, "Dark Elf".to_string()));
}
'g' => {
build_data.map.tiles[idx] = TileType::Floor;
build_data.spawn_list.push((idx, "Goblin".to_string()));

View File

@ -103,3 +103,25 @@ const ORC_CAMP_TXT: &str = "
o
";
#[allow(dead_code)]
pub const DROW_ENTRY: PrefabSection = PrefabSection {
template: DROW_ENTRY_TXT,
width: 12,
height: 10,
placement: (HorizontalPlacement::Center, VerticalPlacement::Center),
};
#[allow(dead_code)]
const DROW_ENTRY_TXT: &str = "
##########
# #
# > #
# #
#e #
e #
#e #
##########
";

View File

@ -2,7 +2,7 @@ use std::collections::HashMap;
use ::serde::Deserialize;
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Item {
pub name: String,
pub renderable: Option<Renderable>,
@ -15,9 +15,10 @@ pub struct Item {
pub vendor_category: Option<String>,
pub magic: Option<MagicItem>,
pub attributes: Option<ItemAttributeBonus>,
pub template_magic: Option<ItemMagicTemplate>,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Renderable {
pub glyph: String,
pub fg: String,
@ -27,13 +28,13 @@ pub struct Renderable {
pub y_size: Option<i32>,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Consumable {
pub effects: HashMap<String, String>,
pub charges: Option<i32>,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Weapon {
pub range: String,
pub attribute: String,
@ -44,23 +45,31 @@ pub struct Weapon {
pub proc_effects: Option<HashMap<String, String>>,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Wearable {
pub armor_class: f32,
pub slot: String,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct MagicItem {
pub class: String,
pub naming: String,
pub cursed: Option<bool>,
}
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct ItemAttributeBonus {
pub might: Option<i32>,
pub fitness: Option<i32>,
pub quickness: Option<i32>,
pub intelligence: Option<i32>,
}
#[derive(Deserialize, Debug, Clone)]
pub struct ItemMagicTemplate {
pub unidentified_name: String,
pub bonus_min: i32,
pub bonus_max: i32,
pub include_cursed: bool,
}