cleans up flags, adds aoe trap
This commit is contained in:
parent
5a4d3bf067
commit
6eab48e616
6 changed files with 30 additions and 17 deletions
|
|
@ -3,55 +3,55 @@
|
|||
"id": "door",
|
||||
"name": "door",
|
||||
"renderable": { "glyph": "+", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
|
||||
"flags": ["BLOCKS_TILE", "BLOCKS_VISIBILITY", "DOOR", "PROP"]
|
||||
"flags": ["DOOR"]
|
||||
},
|
||||
{
|
||||
"id": "prop_altar",
|
||||
"name": "altar",
|
||||
"renderable": { "glyph": "_", "fg": "#FFFFFF", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_keg",
|
||||
"name": "keg",
|
||||
"renderable": { "glyph": "φ", "fg": "#AAAAAA", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_table",
|
||||
"name": "table",
|
||||
"renderable": { "glyph": "-", "fg": "#AAAAAA", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_hay",
|
||||
"name": "hay",
|
||||
"renderable": { "glyph": "%", "fg": "#c7ad39", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_statue",
|
||||
"name": "statue",
|
||||
"renderable": { "glyph": "@", "fg": "#ffffff", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_bed",
|
||||
"name": "bed",
|
||||
"renderable": { "glyph": "=", "fg": "#AAAAAA", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_chair",
|
||||
"name": "chair",
|
||||
"renderable": { "glyph": "└", "fg": "#AAAAAA", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "prop_candle",
|
||||
"name": "candle",
|
||||
"renderable": { "glyph": "Ä", "fg": "#FFA500", "bg": "#000000", "order": 2 },
|
||||
"flags": ["PROP"]
|
||||
"flags": []
|
||||
},
|
||||
{
|
||||
"id": "trap_bear",
|
||||
|
|
@ -61,11 +61,11 @@
|
|||
"effects": { "damage": "2d4" }
|
||||
},
|
||||
{
|
||||
"id": "trap_mine",
|
||||
"name": "mine",
|
||||
"id": "trap_mini_mine",
|
||||
"name": "mini-mine",
|
||||
"renderable": { "glyph": "^", "fg": "#ff1e00", "bg": "#000000", "order": 2 },
|
||||
"flags": ["HIDDEN", "ENTRY_TRIGGER", "SINGLE_ACTIVATION"],
|
||||
"effects": { "damage": "2d8", "aoe": "3" }
|
||||
"flags": ["ENTRY_TRIGGER", "SINGLE_ACTIVATION"],
|
||||
"effects": { "damage": "2d4", "aoe": "3" }
|
||||
},
|
||||
{
|
||||
"id": "trap_stonefall",
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
"table": [
|
||||
{ "id": "trap_bear", "weight": 2, "difficulty": 1},
|
||||
{ "id": "trap_confusion", "weight": 1, "difficulty": 1},
|
||||
{ "id": "trap_mini_mine", "weight": 1, "difficulty": 3},
|
||||
{ "id": "trap_stonefall", "weight": 1, "difficulty": 5}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,9 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
}
|
||||
// If there was XP, run through XP-gain and level-up.
|
||||
if xp_gain != 0 {
|
||||
if let None = pools.get(source) {
|
||||
return;
|
||||
}
|
||||
let mut source_pools = pools.get_mut(source).unwrap();
|
||||
let source_attributes = attributes.get(source).unwrap();
|
||||
source_pools.xp += xp_gain;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ fn handle_damage(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::Lo
|
|||
if ecs.read_storage::<Player>().get(target).is_some() {
|
||||
logger = logger
|
||||
.colour(renderable_colour(&renderables, target))
|
||||
.append(obfuscate_name_ecs(ecs, target).0)
|
||||
.append("You")
|
||||
.colour(WHITE)
|
||||
.append("are hit!");
|
||||
} else if ecs.read_storage::<Item>().get(target).is_some() {
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@ pub fn spawn_named_prop(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
eb = eb.with(get_renderable_component(renderable));
|
||||
}
|
||||
eb = eb.with(Name { name: prop_template.name.clone(), plural: prop_template.name.clone() });
|
||||
eb = eb.with(Prop {});
|
||||
|
||||
if let Some(flags) = &prop_template.flags {
|
||||
for flag in flags.iter() {
|
||||
|
|
@ -530,8 +531,15 @@ pub fn spawn_named_prop(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
"BLOCKS_VISIBILITY" => eb = eb.with(BlocksVisibility {}),
|
||||
"ENTRY_TRIGGER" => eb = eb.with(EntryTrigger {}),
|
||||
"SINGLE_ACTIVATION" => eb = eb.with(SingleActivation {}),
|
||||
"DOOR" => eb = eb.with(Door { open: false }),
|
||||
"PROP" => eb = eb.with(Prop {}),
|
||||
"DOOR" => {
|
||||
// TODO: Spawn some doors open?
|
||||
let open = false;
|
||||
eb = eb.with(Door { open: open });
|
||||
if !open {
|
||||
eb = eb.with(BlocksTile {});
|
||||
eb = eb.with(BlocksVisibility {});
|
||||
}
|
||||
}
|
||||
_ => rltk::console::log(format!("Unrecognised flag: {}", flag.as_str())),
|
||||
}
|
||||
}
|
||||
|
|
@ -545,6 +553,7 @@ pub fn spawn_named_prop(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
let (n_dice, sides, modifier) = parse_dice_string(effect.1.as_str());
|
||||
eb = eb.with(InflictsDamage { n_dice, sides, modifier })
|
||||
}
|
||||
"aoe" => eb = eb.with(AOE { radius: effect.1.parse::<i32>().unwrap() }),
|
||||
"healing" => {
|
||||
let (n_dice, sides, modifier) = parse_dice_string(effect.1.as_str());
|
||||
eb = eb.with(ProvidesHealing { n_dice, sides, modifier })
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl<'a> System<'a> for TriggerSystem {
|
|||
}
|
||||
}
|
||||
add_effect(
|
||||
Some(entity),
|
||||
Some(entity_id),
|
||||
EffectType::TriggerFire { trigger: entity_id },
|
||||
if let Some(aoe) = aoes.get(entity_id) {
|
||||
Targets::TileList {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue