scroll of remove curse - NYI

This commit is contained in:
Llywelwyn 2023-08-22 08:56:06 +01:00
parent e403a6d845
commit 5a42ee283d
7 changed files with 44 additions and 18 deletions

View file

@ -19,6 +19,15 @@
"effects": { "healing": "2d4+2" }, "effects": { "healing": "2d4+2" },
"magic": { "class": "uncommon", "naming": "potion" } "magic": { "class": "uncommon", "naming": "potion" }
}, },
{
"id": "scroll_removecurse",
"name": { "name": "scroll of remove curse", "plural": "scrolls of remove curse" },
"renderable": { "glyph": "?", "fg": "#0FFFFF", "bg": "#000000", "order": 2 },
"weight": 0.5,
"value": 50,
"flags": ["CONSUMABLE", "DESTRUCTIBLE", "REMOVE_CURSE"],
"magic": { "class": "uncommon", "naming": "scroll" }
},
{ {
"id": "scroll_health", "id": "scroll_health",
"name": { "name": "scroll of healing word", "plural": "scrolls of healing word" }, "name": { "name": "scroll of healing word", "plural": "scrolls of healing word" },
@ -100,8 +109,8 @@
"renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 }, "renderable": { "glyph": "?", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
"weight": 0.5, "weight": 0.5,
"value": 50, "value": 50,
"flags": ["CONSUMABLE", "DESTRUCTIBLE"], "flags": ["CONSUMABLE", "DESTRUCTIBLE", "MAGICMAP"],
"effects": { "magicmapper": "" }, "effects": {},
"magic": { "class": "common", "naming": "scroll" } "magic": { "class": "common", "naming": "scroll" }
}, },
{ {
@ -364,8 +373,8 @@
"renderable": { "glyph": "/", "fg": "#00FFFF", "bg": "#000000", "order": 2 }, "renderable": { "glyph": "/", "fg": "#00FFFF", "bg": "#000000", "order": 2 },
"weight": 2, "weight": 2,
"value": 300, "value": 300,
"flags": ["CHARGES"], "flags": ["CHARGES", "DIGGER"],
"effects": { "ranged": "10", "digger": "" }, "effects": { "ranged": "10" },
"magic": { "class": "rare", "naming": "wand" } "magic": { "class": "rare", "naming": "wand" }
}, },
{ {

View file

@ -47,6 +47,7 @@
{ {
"id": "scrolls", "id": "scrolls",
"table": [ "table": [
{ "id": "scroll_removecurse", "weight": 2, "difficulty": 1},
{ "id": "scroll_confusion", "weight": 2, "difficulty": 1}, { "id": "scroll_confusion", "weight": 2, "difficulty": 1},
{ "id": "scroll_magicmap", "weight": 2, "difficulty": 1}, { "id": "scroll_magicmap", "weight": 2, "difficulty": 1},
{ "id": "scroll_embers", "weight": 2, "difficulty": 2}, { "id": "scroll_embers", "weight": 2, "difficulty": 2},

View file

@ -442,6 +442,9 @@ pub struct SpawnParticleBurst {
#[derive(Component, Debug, Serialize, Deserialize, Clone)] #[derive(Component, Debug, Serialize, Deserialize, Clone)]
pub struct Destructible {} pub struct Destructible {}
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
pub struct RemovesCurse {}
#[derive(Component, Debug, Serialize, Deserialize, Clone)] #[derive(Component, Debug, Serialize, Deserialize, Clone)]
pub struct Digger {} pub struct Digger {}

View file

@ -1,8 +1,8 @@
use crate::{ use crate::{
gamelog, gamelog,
gui::{item_colour, obfuscate_name}, gui::{item_colour, obfuscate_name},
Beatitude, EquipmentChanged, Equippable, Equipped, InBackpack, MagicItem, MasterDungeonMap, Name, ObfuscatedName, Beatitude, EquipmentChanged, Equippable, Equipped, IdentifiedItem, InBackpack, MagicItem, MasterDungeonMap, Name,
WantsToUseItem, BUC, ObfuscatedName, WantsToUseItem, BUC,
}; };
use specs::prelude::*; use specs::prelude::*;
@ -14,6 +14,7 @@ impl<'a> System<'a> for ItemEquipSystem {
ReadExpect<'a, Entity>, ReadExpect<'a, Entity>,
Entities<'a>, Entities<'a>,
WriteStorage<'a, WantsToUseItem>, WriteStorage<'a, WantsToUseItem>,
WriteStorage<'a, IdentifiedItem>,
ReadStorage<'a, Name>, ReadStorage<'a, Name>,
ReadStorage<'a, Equippable>, ReadStorage<'a, Equippable>,
WriteStorage<'a, Equipped>, WriteStorage<'a, Equipped>,
@ -31,6 +32,7 @@ impl<'a> System<'a> for ItemEquipSystem {
player_entity, player_entity,
entities, entities,
mut wants_to_use_item, mut wants_to_use_item,
mut identified_items,
names, names,
equippable, equippable,
mut equipped, mut equipped,
@ -120,6 +122,12 @@ impl<'a> System<'a> for ItemEquipSystem {
.colour(rltk::WHITE) .colour(rltk::WHITE)
.period(); .period();
logger.log(); logger.log();
identified_items
.insert(
target,
IdentifiedItem { name: names.get(wants_to_use_item.item).unwrap().name.clone() },
)
.expect("Unable to insert IdentifiedItem");
} }
remove.push(target); remove.push(target);
} }

View file

@ -617,6 +617,7 @@ fn main() -> rltk::BError {
gs.ecs.register::<EntryTrigger>(); gs.ecs.register::<EntryTrigger>();
gs.ecs.register::<EntityMoved>(); gs.ecs.register::<EntityMoved>();
gs.ecs.register::<MultiAttack>(); gs.ecs.register::<MultiAttack>();
gs.ecs.register::<RemovesCurse>();
gs.ecs.register::<ParticleLifetime>(); gs.ecs.register::<ParticleLifetime>();
gs.ecs.register::<SpawnParticleSimple>(); gs.ecs.register::<SpawnParticleSimple>();
gs.ecs.register::<SpawnParticleBurst>(); gs.ecs.register::<SpawnParticleBurst>();

View file

@ -10,6 +10,8 @@ use specs::prelude::*;
use specs::saveload::{MarkedBuilder, SimpleMarker}; use specs::saveload::{MarkedBuilder, SimpleMarker};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
/// Applies effects to the entity - e.g. "healing: 1d4+1", where
/// effects are components on the entity with varying parameters.
macro_rules! apply_effects { macro_rules! apply_effects {
($effects:expr, $eb:expr) => { ($effects:expr, $eb:expr) => {
for effect in $effects.iter() { for effect in $effects.iter() {
@ -27,8 +29,6 @@ macro_rules! apply_effects {
"aoe" => $eb = $eb.with(AOE { radius: effect.1.parse::<i32>().unwrap() }), "aoe" => $eb = $eb.with(AOE { radius: effect.1.parse::<i32>().unwrap() }),
"confusion" => $eb = $eb.with(Confusion { turns: effect.1.parse::<i32>().unwrap() }), "confusion" => $eb = $eb.with(Confusion { turns: effect.1.parse::<i32>().unwrap() }),
"ac" => $eb = $eb.with(ArmourClassBonus { amount: effect.1.parse::<i32>().unwrap() }), "ac" => $eb = $eb.with(ArmourClassBonus { amount: effect.1.parse::<i32>().unwrap() }),
"magicmapper" => $eb = $eb.with(MagicMapper {}),
"digger" => $eb = $eb.with(Digger {}),
"particle_line" => $eb = $eb.with(parse_particle_line(&effect.1)), "particle_line" => $eb = $eb.with(parse_particle_line(&effect.1)),
"particle_burst" => $eb = $eb.with(parse_particle_burst(&effect.1)), "particle_burst" => $eb = $eb.with(parse_particle_burst(&effect.1)),
"particle" => $eb = $eb.with(parse_particle(&effect.1)), "particle" => $eb = $eb.with(parse_particle(&effect.1)),
@ -38,11 +38,13 @@ macro_rules! apply_effects {
}; };
} }
/// Applies flags to the entity - e.g. "blocks_tile", where
/// flags are components that have no parameters to modify.
macro_rules! apply_flags { macro_rules! apply_flags {
($flags:expr, $eb:expr) => { ($flags:expr, $eb:expr) => {
for flag in $flags.iter() { for flag in $flags.iter() {
match flag.as_str() { match flag.as_str() {
// --- PROP/ITEM FLAGS BEGIN HERE --- // --- PROP FLAGS BEGIN HERE ---
"HIDDEN" => $eb = $eb.with(Hidden {}), "HIDDEN" => $eb = $eb.with(Hidden {}),
"BLOCKS_TILE" => $eb = $eb.with(BlocksTile {}), "BLOCKS_TILE" => $eb = $eb.with(BlocksTile {}),
"BLOCKS_VISIBILITY" => $eb = $eb.with(BlocksVisibility {}), "BLOCKS_VISIBILITY" => $eb = $eb.with(BlocksVisibility {}),
@ -53,15 +55,16 @@ macro_rules! apply_flags {
$eb = $eb.with(BlocksVisibility {}); $eb = $eb.with(BlocksVisibility {});
$eb = $eb.with(BlocksTile {}); $eb = $eb.with(BlocksTile {});
} }
// RESTORES NUTRITION // --- EFFECT FLAGS ---
"FOOD" => $eb = $eb.with(ProvidesNutrition {}), "FOOD" => $eb = $eb.with(ProvidesNutrition {}),
// IS DELETED ON USE
"CONSUMABLE" => $eb = $eb.with(Consumable {}), "CONSUMABLE" => $eb = $eb.with(Consumable {}),
// HAS CHARGES
"CHARGES" => $eb = $eb.with(Charges { uses: 3, max_uses: 3 }), "CHARGES" => $eb = $eb.with(Charges { uses: 3, max_uses: 3 }),
"REMOVE_CURSE" => $eb = $eb.with(RemovesCurse {}),
"DIGGER" => $eb = $eb.with(Digger {}),
"MAGICMAP" => $eb = $eb.with(MagicMapper {}),
// CAN BE DESTROYED BY DAMAGE // CAN BE DESTROYED BY DAMAGE
"DESTRUCTIBLE" => $eb = $eb.with(Destructible {}), "DESTRUCTIBLE" => $eb = $eb.with(Destructible {}),
// EQUIP SLOTS // --- EQUIP SLOTS ---
"EQUIP_MELEE" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Melee }), "EQUIP_MELEE" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Melee }),
"EQUIP_SHIELD" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Shield }), "EQUIP_SHIELD" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Shield }),
"EQUIP_HEAD" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Head }), "EQUIP_HEAD" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Head }),
@ -70,23 +73,22 @@ macro_rules! apply_flags {
"EQUIP_HANDS" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Hands }), "EQUIP_HANDS" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Hands }),
"EQUIP_NECK" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Neck }), "EQUIP_NECK" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Neck }),
"EQUIP_BACK" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Back }), "EQUIP_BACK" => $eb = $eb.with(Equippable { slot: EquipmentSlot::Back }),
// --- MOB FLAGS BEGIN HERE --- // --- MOB ANCESTRIES ---
// RACES
"IS_PLAYER" => $eb = $eb.with(Player {}), "IS_PLAYER" => $eb = $eb.with(Player {}),
"IS_HUMAN" => $eb = $eb.with(HasAncestry { name: Ancestry::Human }), "IS_HUMAN" => $eb = $eb.with(HasAncestry { name: Ancestry::Human }),
"IS_DWARF" => $eb = $eb.with(HasAncestry { name: Ancestry::Dwarf }), "IS_DWARF" => $eb = $eb.with(HasAncestry { name: Ancestry::Dwarf }),
"IS_ELF" => $eb = $eb.with(HasAncestry { name: Ancestry::Elf }), "IS_ELF" => $eb = $eb.with(HasAncestry { name: Ancestry::Elf }),
"IS_CATFOLK" => $eb = $eb.with(HasAncestry { name: Ancestry::Catfolk }), "IS_CATFOLK" => $eb = $eb.with(HasAncestry { name: Ancestry::Catfolk }),
"IS_GNOME" => $eb = $eb.with(HasAncestry { name: Ancestry::Gnome }), "IS_GNOME" => $eb = $eb.with(HasAncestry { name: Ancestry::Gnome }),
// FACTIONS // --- MOB FACTIONS ---
"MINDLESS" => $eb = $eb.with(Faction { name: "mindless".to_string() }), "MINDLESS" => $eb = $eb.with(Faction { name: "mindless".to_string() }),
"NEUTRAL" => $eb = $eb.with(Faction { name: "neutral".to_string() }), "NEUTRAL" => $eb = $eb.with(Faction { name: "neutral".to_string() }),
"HERBIVORE" => $eb = $eb.with(Faction { name: "herbivore".to_string() }), "HERBIVORE" => $eb = $eb.with(Faction { name: "herbivore".to_string() }),
"CARNIVORE" => $eb = $eb.with(Faction { name: "carnivore".to_string() }), "CARNIVORE" => $eb = $eb.with(Faction { name: "carnivore".to_string() }),
// MOVEMENT FLAGS (DEFAULTS TO WANDERING) // --- MOVEMENT MODES --- ( defaults to WANDER )
"STATIC" => $eb = $eb.with(MoveMode { mode: Movement::Static }), "STATIC" => $eb = $eb.with(MoveMode { mode: Movement::Static }),
"RANDOM_PATH" => $eb = $eb.with(MoveMode { mode: Movement::RandomWaypoint { path: None } }), "RANDOM_PATH" => $eb = $eb.with(MoveMode { mode: Movement::RandomWaypoint { path: None } }),
// ATTRIBUTES/MISC // --- RANDOM MOB ATTRIBUTES ---
"SMALL_GROUP" => {} // These flags are for region spawning, "SMALL_GROUP" => {} // These flags are for region spawning,
"LARGE_GROUP" => {} // and don't need to apply a component. "LARGE_GROUP" => {} // and don't need to apply a component.
"MULTIATTACK" => $eb = $eb.with(MultiAttack {}), "MULTIATTACK" => $eb = $eb.with(MultiAttack {}),

View file

@ -100,6 +100,7 @@ pub fn save_game(ecs: &mut World) {
ProvidesNutrition, ProvidesNutrition,
Quips, Quips,
Ranged, Ranged,
RemovesCurse,
Renderable, Renderable,
SingleActivation, SingleActivation,
Skills, Skills,
@ -222,6 +223,7 @@ pub fn load_game(ecs: &mut World) {
ProvidesNutrition, ProvidesNutrition,
Quips, Quips,
Ranged, Ranged,
RemovesCurse,
Renderable, Renderable,
SingleActivation, SingleActivation,
Skills, Skills,