refactors beatitude, and prepping readme for week 7
This commit is contained in:
parent
469d83994e
commit
831720ce37
14 changed files with 172 additions and 63 deletions
23
README.md
23
README.md
|
|
@ -125,3 +125,26 @@ i'll try to remember to update the web version on my page at the end of every we
|
|||
- varying levels of being overweight, with the limit determined by strength, slowing entities down by ~25% per level over unencumbered. right now it's pretty forgiving, and i'd probably like it to stay that way. my ideal balance here would be roughly how it ends up in 5e DnD: everyone can carry a good supply of consumables, but strength characters usually don't carry a much higher quantity of items than anyone else, because the strongest armour is extremely heavy. sort of like a soft strength requirement for the heaviest gear - rather than requiring specific stats or levels to equip it, it's heavy enough that you need to be strong to lug it around. but if someone weaker wanted to, they could, they'd just have to leave some other items behind to do so. or take the speed penalty for being encumbered
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
<details>
|
||||
<summary>week 7</summary>
|
||||
|
||||
- character creation!
|
||||
- it doesn't look too pretty yet, but i managed to get it done in time. classes and ancestries are selectable, with ancestries determining some intrinsic bonuses (dwarves are hardy, catfolk are fast and have claws, etc.) and attribute maximums, and classes determining starting equipment and the actual attribute rolls. along with this, i expanded entity reactions - now a shared ancestry is taken into account first of all, and it checks faction if it doesn't manage to find anything. this means humans wont attack other humans, dwarves wont be attacked by gnomes and other dwarves, etc.
|
||||
|
||||
[image here]
|
||||
|
||||
- better AI
|
||||
- straight from thebracket, with a handful of tweaks of my own, i've finally atomised AI into adjacent, visible, chase, flee, and default systems. most notably,rather than hostile mobs attacking everything and passive mobs doing nothing, every mob has a faction, and most mobs have an ancestry. like mentioned above, mobs will take all this into account when determining how they want to react to any other entity. i see a lot of places to expand on this in the future, like going into alignments and other increasingly-specific reasons why any entity might want to murder another. or make friends with them. taming comes to mind here.
|
||||
|
||||
- an effects system
|
||||
- instead of randomly doing things all around the codebase, everything is in the process of being moved over to an effects system. to put it very simply, there's a big list of every effect that needs to take place on the next tick, and each tick the queue is iterated through, the next effect is checked against a list of every entity that died this turn to make sure that it should still take place (no dead mobs still getting their attacks off), and then it makes the event happen if appropriate. if not, it just gets tossed out. it's all super modular, so effects can pretty much be applied to everything. the same damage and targeting effects work for item use and traps going off, or an entity swinging their sword, for example. i made use of this new system by adding in some aoe scrolls, like mass function and mass healing.
|
||||
|
||||
- better logging
|
||||
- it's still in process, but i'm making every entity name in chat use the proper colour now, and working with the effects system to combine relevant logs all into one line, and make them more specific. generally i'm trying not to include too many numbers in the log; it's just personal preference, but i don't like seeing exactly how much damage every hit has done - i'd rather just see my health bar go up or down, or tell by seeing how fast a mob dies. this took *too much* fumbling with the function that renders my log to the screen, but now it's fixed and works a lot better than before, so it was definitely worth it.
|
||||
|
||||
[image here]
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -210,6 +210,19 @@ pub struct GrantsXP {
|
|||
pub amount: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
|
||||
pub enum BUC {
|
||||
Cursed,
|
||||
Uncursed,
|
||||
Blessed,
|
||||
}
|
||||
|
||||
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Beatitude {
|
||||
pub buc: BUC,
|
||||
pub known: bool,
|
||||
}
|
||||
|
||||
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Item {
|
||||
pub weight: f32, // in lbs
|
||||
|
|
@ -314,9 +327,6 @@ pub struct Equipped {
|
|||
pub slot: EquipmentSlot,
|
||||
}
|
||||
|
||||
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Cursed {}
|
||||
|
||||
#[derive(Component, Debug, ConvertSaveload, Clone)]
|
||||
pub struct ProvidesHealing {
|
||||
pub n_dice: i32,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
use super::{
|
||||
triggers::{BLESSED, UNCURSED},
|
||||
EffectSpawner, EffectType,
|
||||
};
|
||||
use crate::HungerClock;
|
||||
use super::{EffectSpawner, EffectType};
|
||||
use crate::{HungerClock, BUC};
|
||||
use specs::prelude::*;
|
||||
|
||||
pub fn restore_food(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
||||
let buc = if let EffectType::RestoreNutrition { buc } = effect.effect_type { buc } else { UNCURSED };
|
||||
if let EffectType::RestoreNutrition { buc } = &effect.effect_type {
|
||||
if let Some(hc) = ecs.write_storage::<HungerClock>().get_mut(target) {
|
||||
if buc == BLESSED || buc == UNCURSED {
|
||||
if buc == &BUC::Blessed {
|
||||
hc.duration += 600;
|
||||
} else if buc == &BUC::Uncursed {
|
||||
hc.duration += 400;
|
||||
} else {
|
||||
} else if buc == &BUC::Cursed {
|
||||
hc.duration += 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use super::BUC;
|
||||
use crate::spatial;
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
|
|
@ -11,7 +12,6 @@ mod targeting;
|
|||
mod triggers;
|
||||
|
||||
pub use targeting::aoe_tiles;
|
||||
pub use triggers::{BLESSED, CURSED, UNCURSED};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref EFFECT_QUEUE: Mutex<VecDeque<EffectSpawner>> = Mutex::new(VecDeque::new());
|
||||
|
|
@ -29,7 +29,7 @@ pub enum EffectType {
|
|||
Particle { glyph: FontCharType, fg: RGB, bg: RGB, lifespan: f32, delay: f32 },
|
||||
EntityDeath,
|
||||
ItemUse { item: Entity },
|
||||
RestoreNutrition { buc: i32 },
|
||||
RestoreNutrition { buc: BUC },
|
||||
TriggerFire { trigger: Entity },
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use super::{add_effect, spatial, EffectType, Entity, Targets, World};
|
||||
use crate::{
|
||||
gamelog, gui::item_colour_ecs, gui::obfuscate_name_ecs, gui::renderable_colour, Charges, Confusion, Consumable,
|
||||
Cursed, Destructible, Hidden, InflictsDamage, Item, MagicMapper, Player, Prop, ProvidesHealing, ProvidesNutrition,
|
||||
RandomNumberGenerator, Renderable, RunState, SingleActivation,
|
||||
gamelog, gui::item_colour_ecs, gui::obfuscate_name_ecs, gui::renderable_colour, Beatitude, Charges, Confusion,
|
||||
Consumable, Destructible, Hidden, InflictsDamage, Item, MagicMapper, Player, Prop, ProvidesHealing,
|
||||
ProvidesNutrition, RandomNumberGenerator, Renderable, RunState, SingleActivation, BUC,
|
||||
};
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
|
|
@ -40,15 +40,11 @@ pub fn trigger(source: Option<Entity>, trigger: Entity, target: &Targets, ecs: &
|
|||
}
|
||||
}
|
||||
|
||||
pub const BLESSED: i32 = 2;
|
||||
pub const UNCURSED: i32 = 1;
|
||||
pub const CURSED: i32 = 0;
|
||||
|
||||
struct EventInfo {
|
||||
source: Option<Entity>,
|
||||
entity: Entity,
|
||||
target: Targets,
|
||||
buc: i32,
|
||||
buc: BUC,
|
||||
log: bool,
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +53,11 @@ struct EventInfo {
|
|||
// place on the player -- once monsters can use an item, their item usage will make logs for
|
||||
// the player saying they were the one who used the item. This will need refactoring then.
|
||||
fn event_trigger(source: Option<Entity>, entity: Entity, target: &Targets, ecs: &mut World) {
|
||||
let buc = if ecs.read_storage::<Cursed>().get(entity).is_some() { CURSED } else { UNCURSED };
|
||||
let buc = if let Some(beatitude) = ecs.read_storage::<Beatitude>().get(entity) {
|
||||
beatitude.buc.clone()
|
||||
} else {
|
||||
BUC::Uncursed
|
||||
};
|
||||
let mut event = EventInfo { source, entity, target: target.clone(), buc, log: false };
|
||||
let mut logger = gamelog::Logger::new();
|
||||
// PROVIDES NUTRITION
|
||||
|
|
@ -77,14 +77,14 @@ fn event_trigger(source: Option<Entity>, entity: Entity, target: &Targets, ecs:
|
|||
|
||||
fn handle_restore_nutrition(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::Logger) -> gamelog::Logger {
|
||||
if ecs.read_storage::<ProvidesNutrition>().get(event.entity).is_some() {
|
||||
add_effect(event.source, EffectType::RestoreNutrition { buc: event.buc }, event.target.clone());
|
||||
add_effect(event.source, EffectType::RestoreNutrition { buc: event.buc.clone() }, event.target.clone());
|
||||
logger = logger
|
||||
.append("You eat the")
|
||||
.colour(item_colour_ecs(ecs, event.entity))
|
||||
.append_n(obfuscate_name_ecs(ecs, event.entity).0)
|
||||
.colour(WHITE)
|
||||
.period()
|
||||
.buc(event.buc, Some("Blech! Rotten."), Some("Delicious."));
|
||||
.buc(event.buc.clone(), Some("Blech! Rotten."), Some("Delicious."));
|
||||
event.log = true;
|
||||
}
|
||||
return logger;
|
||||
|
|
@ -93,10 +93,10 @@ fn handle_restore_nutrition(ecs: &mut World, event: &mut EventInfo, mut logger:
|
|||
fn handle_magic_mapper(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::Logger) -> gamelog::Logger {
|
||||
if ecs.read_storage::<MagicMapper>().get(event.entity).is_some() {
|
||||
let mut runstate = ecs.fetch_mut::<RunState>();
|
||||
let cursed = if event.buc == CURSED { true } else { false };
|
||||
let cursed = if event.buc == BUC::Cursed { true } else { false };
|
||||
*runstate = RunState::MagicMapReveal { row: 0, cursed: cursed };
|
||||
logger = logger.append("You recall your surroundings!").buc(
|
||||
event.buc,
|
||||
event.buc.clone(),
|
||||
Some("... but forget where you last were."),
|
||||
None,
|
||||
);
|
||||
|
|
@ -121,7 +121,7 @@ fn handle_healing(ecs: &mut World, event: &mut EventInfo, mut logger: gamelog::L
|
|||
.append("You")
|
||||
.colour(WHITE)
|
||||
.append("recover some vigour.")
|
||||
.buc(event.buc, None, Some("You feel great!"));
|
||||
.buc(event.buc.clone(), None, Some("You feel great!"));
|
||||
} else {
|
||||
logger = logger
|
||||
.append("The")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use super::{append_entry, LogFragment};
|
||||
use crate::BUC;
|
||||
use rltk::prelude::*;
|
||||
|
||||
pub struct Logger {
|
||||
|
|
@ -39,10 +40,10 @@ impl Logger {
|
|||
return self;
|
||||
}
|
||||
|
||||
pub fn buc<T: ToString>(mut self, buc: i32, cursed: Option<T>, blessed: Option<T>) -> Self {
|
||||
if buc == crate::effects::CURSED && cursed.is_some() {
|
||||
pub fn buc<T: ToString>(mut self, buc: BUC, cursed: Option<T>, blessed: Option<T>) -> Self {
|
||||
if buc == BUC::Cursed && cursed.is_some() {
|
||||
self.fragments.push(LogFragment { colour: RGB::named(RED), text: cursed.unwrap().to_string() });
|
||||
} else if buc == crate::effects::BLESSED && blessed.is_some() {
|
||||
} else if buc == BUC::Blessed && blessed.is_some() {
|
||||
self.fragments.push(LogFragment { colour: RGB::named(GOLD), text: blessed.unwrap().to_string() });
|
||||
}
|
||||
return self;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use super::{
|
||||
ai::CARRY_CAPACITY_PER_STRENGTH, camera, gamelog, gamesystem, hunger_system::get_hunger_colour,
|
||||
rex_assets::RexAssets, ArmourClassBonus, Attributes, Burden, Charges, Equipped, Hidden, HungerClock, HungerState,
|
||||
InBackpack, MagicItem, MagicItemClass, Map, MasterDungeonMap, Name, ObfuscatedName, Player, Point, Pools, Position,
|
||||
Prop, Renderable, RunState, Skill, Skills, State, Viewshed,
|
||||
rex_assets::RexAssets, ArmourClassBonus, Attributes, Beatitude, Burden, Charges, Equipped, Hidden, HungerClock,
|
||||
HungerState, InBackpack, MagicItem, MagicItemClass, Map, MasterDungeonMap, Name, ObfuscatedName, Player, Point,
|
||||
Pools, Position, Prop, Renderable, RunState, Skill, Skills, State, Viewshed, BUC,
|
||||
};
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
|
|
@ -412,6 +412,7 @@ pub fn obfuscate_name(
|
|||
names: &ReadStorage<Name>,
|
||||
magic_items: &ReadStorage<MagicItem>,
|
||||
obfuscated_names: &ReadStorage<ObfuscatedName>,
|
||||
beatitudes: &ReadStorage<Beatitude>,
|
||||
dm: &MasterDungeonMap,
|
||||
wand: Option<&ReadStorage<Charges>>,
|
||||
) -> (String, String) {
|
||||
|
|
@ -420,6 +421,16 @@ pub fn obfuscate_name(
|
|||
if magic_items.get(item).is_some() {
|
||||
if dm.identified_items.contains(&name.name) {
|
||||
(singular, plural) = (name.name.clone(), name.plural.clone());
|
||||
if wand.is_some() {
|
||||
let wands = wand.unwrap();
|
||||
if let Some(wand) = wands.get(item) {
|
||||
let used = wand.max_uses - wand.uses;
|
||||
for _i in 0..used {
|
||||
singular.push_str("*");
|
||||
plural.push_str("*");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Some(obfuscated) = obfuscated_names.get(item) {
|
||||
(singular, plural) = (obfuscated.name.clone(), obfuscated.plural.clone());
|
||||
} else {
|
||||
|
|
@ -429,13 +440,16 @@ pub fn obfuscate_name(
|
|||
(singular, plural) = (name.name.clone(), name.plural.clone());
|
||||
}
|
||||
}
|
||||
if wand.is_some() {
|
||||
let wands = wand.unwrap();
|
||||
if let Some(wand) = wands.get(item) {
|
||||
let used = wand.max_uses - wand.uses;
|
||||
for _i in 0..used {
|
||||
singular.push_str("*");
|
||||
plural.push_str("*");
|
||||
if let Some(has_beatitude) = beatitudes.get(item) {
|
||||
if has_beatitude.known {
|
||||
let prefix = match has_beatitude.buc {
|
||||
BUC::Cursed => Some("cursed "),
|
||||
BUC::Uncursed => None,
|
||||
BUC::Blessed => Some("blessed "),
|
||||
};
|
||||
if prefix.is_some() {
|
||||
singular.insert_str(0, prefix.unwrap());
|
||||
plural.insert_str(0, prefix.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -450,6 +464,13 @@ pub fn obfuscate_name_ecs(ecs: &World, item: Entity) -> (String, String) {
|
|||
let dm = ecs.fetch::<MasterDungeonMap>();
|
||||
if dm.identified_items.contains(&name.name) {
|
||||
(singular, plural) = (name.name.clone(), name.plural.clone());
|
||||
if let Some(wand) = ecs.read_storage::<Charges>().get(item) {
|
||||
let used = wand.max_uses - wand.uses;
|
||||
for _i in 0..used {
|
||||
singular.push_str("*");
|
||||
plural.push_str("*");
|
||||
}
|
||||
}
|
||||
} else if let Some(obfuscated) = ecs.read_storage::<ObfuscatedName>().get(item) {
|
||||
(singular, plural) = (obfuscated.name.clone(), obfuscated.plural.clone());
|
||||
} else {
|
||||
|
|
@ -459,11 +480,17 @@ pub fn obfuscate_name_ecs(ecs: &World, item: Entity) -> (String, String) {
|
|||
(singular, plural) = (name.name.clone(), name.plural.clone());
|
||||
}
|
||||
}
|
||||
if let Some(wand) = ecs.read_storage::<Charges>().get(item) {
|
||||
let used = wand.max_uses - wand.uses;
|
||||
for _i in 0..used {
|
||||
singular.push_str("*");
|
||||
plural.push_str("*");
|
||||
if let Some(has_beatitude) = ecs.read_storage::<Beatitude>().get(item) {
|
||||
if has_beatitude.known {
|
||||
let prefix = match has_beatitude.buc {
|
||||
BUC::Cursed => Some("cursed "),
|
||||
BUC::Uncursed => None,
|
||||
BUC::Blessed => Some("blessed "),
|
||||
};
|
||||
if prefix.is_some() {
|
||||
singular.insert_str(0, prefix.unwrap());
|
||||
plural.insert_str(0, prefix.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
return (singular, plural);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
gamelog, gui::obfuscate_name, Charges, EquipmentChanged, InBackpack, MagicItem, MasterDungeonMap, Name,
|
||||
gamelog, gui::obfuscate_name, Beatitude, Charges, EquipmentChanged, InBackpack, MagicItem, MasterDungeonMap, Name,
|
||||
ObfuscatedName, Position, WantsToPickupItem,
|
||||
};
|
||||
use specs::prelude::*;
|
||||
|
|
@ -17,6 +17,7 @@ impl<'a> System<'a> for ItemCollectionSystem {
|
|||
WriteStorage<'a, EquipmentChanged>,
|
||||
ReadStorage<'a, MagicItem>,
|
||||
ReadStorage<'a, ObfuscatedName>,
|
||||
ReadStorage<'a, Beatitude>,
|
||||
ReadExpect<'a, MasterDungeonMap>,
|
||||
ReadStorage<'a, Charges>,
|
||||
);
|
||||
|
|
@ -31,6 +32,7 @@ impl<'a> System<'a> for ItemCollectionSystem {
|
|||
mut equipment_changed,
|
||||
magic_items,
|
||||
obfuscated_names,
|
||||
beatitudes,
|
||||
dm,
|
||||
wands,
|
||||
) = data;
|
||||
|
|
@ -47,7 +49,16 @@ impl<'a> System<'a> for ItemCollectionSystem {
|
|||
.append("You pick up the")
|
||||
.item_name_n(format!(
|
||||
"{}",
|
||||
obfuscate_name(pickup.item, &names, &magic_items, &obfuscated_names, &dm, Some(&wands)).0
|
||||
obfuscate_name(
|
||||
pickup.item,
|
||||
&names,
|
||||
&magic_items,
|
||||
&obfuscated_names,
|
||||
&beatitudes,
|
||||
&dm,
|
||||
Some(&wands)
|
||||
)
|
||||
.0
|
||||
))
|
||||
.period()
|
||||
.log();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
gamelog, gui::obfuscate_name, Charges, EquipmentChanged, InBackpack, MagicItem, MasterDungeonMap, Name,
|
||||
gamelog, gui::obfuscate_name, Beatitude, Charges, EquipmentChanged, InBackpack, MagicItem, MasterDungeonMap, Name,
|
||||
ObfuscatedName, Position, WantsToDropItem,
|
||||
};
|
||||
use specs::prelude::*;
|
||||
|
|
@ -17,6 +17,7 @@ impl<'a> System<'a> for ItemDropSystem {
|
|||
WriteStorage<'a, InBackpack>,
|
||||
WriteStorage<'a, EquipmentChanged>,
|
||||
ReadStorage<'a, MagicItem>,
|
||||
ReadStorage<'a, Beatitude>,
|
||||
ReadStorage<'a, ObfuscatedName>,
|
||||
ReadExpect<'a, MasterDungeonMap>,
|
||||
ReadStorage<'a, Charges>,
|
||||
|
|
@ -32,6 +33,7 @@ impl<'a> System<'a> for ItemDropSystem {
|
|||
mut backpack,
|
||||
mut equipment_changed,
|
||||
magic_items,
|
||||
beatitudes,
|
||||
obfuscated_names,
|
||||
dm,
|
||||
wands,
|
||||
|
|
@ -55,7 +57,16 @@ impl<'a> System<'a> for ItemDropSystem {
|
|||
.append("You drop the")
|
||||
.item_name_n(format!(
|
||||
"{}",
|
||||
obfuscate_name(to_drop.item, &names, &magic_items, &obfuscated_names, &dm, Some(&wands)).0
|
||||
obfuscate_name(
|
||||
to_drop.item,
|
||||
&names,
|
||||
&magic_items,
|
||||
&obfuscated_names,
|
||||
&beatitudes,
|
||||
&dm,
|
||||
Some(&wands)
|
||||
)
|
||||
.0
|
||||
))
|
||||
.period()
|
||||
.log();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
gamelog,
|
||||
gui::{item_colour, obfuscate_name},
|
||||
EquipmentChanged, Equippable, Equipped, InBackpack, MagicItem, MasterDungeonMap, Name, ObfuscatedName,
|
||||
Beatitude, EquipmentChanged, Equippable, Equipped, InBackpack, MagicItem, MasterDungeonMap, Name, ObfuscatedName,
|
||||
WantsToUseItem,
|
||||
};
|
||||
use specs::prelude::*;
|
||||
|
|
@ -21,6 +21,7 @@ impl<'a> System<'a> for ItemEquipSystem {
|
|||
WriteStorage<'a, EquipmentChanged>,
|
||||
ReadStorage<'a, MagicItem>,
|
||||
ReadStorage<'a, ObfuscatedName>,
|
||||
ReadStorage<'a, Beatitude>,
|
||||
ReadExpect<'a, MasterDungeonMap>,
|
||||
);
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ impl<'a> System<'a> for ItemEquipSystem {
|
|||
mut dirty,
|
||||
magic_items,
|
||||
obfuscated_names,
|
||||
beatitudes,
|
||||
dm,
|
||||
) = data;
|
||||
let mut remove: Vec<Entity> = Vec::new();
|
||||
|
|
@ -59,7 +61,10 @@ impl<'a> System<'a> for ItemEquipSystem {
|
|||
if target == *player_entity {
|
||||
logger = logger
|
||||
.append("You remove your")
|
||||
.append_n(obfuscate_name(*item, &names, &magic_items, &obfuscated_names, &dm, None).0)
|
||||
.append_n(
|
||||
obfuscate_name(*item, &names, &magic_items, &obfuscated_names, &beatitudes, &dm, None)
|
||||
.0,
|
||||
)
|
||||
.colour(item_colour(*item, &names, &magic_items, &dm))
|
||||
.period();
|
||||
}
|
||||
|
|
@ -74,7 +79,15 @@ impl<'a> System<'a> for ItemEquipSystem {
|
|||
logger = logger
|
||||
.append("You equip the")
|
||||
.append_n(
|
||||
obfuscate_name(wants_to_use_item.item, &names, &magic_items, &obfuscated_names, &dm, None)
|
||||
obfuscate_name(
|
||||
wants_to_use_item.item,
|
||||
&names,
|
||||
&magic_items,
|
||||
&obfuscated_names,
|
||||
&beatitudes,
|
||||
&dm,
|
||||
None,
|
||||
)
|
||||
.0,
|
||||
)
|
||||
.colour(item_colour(wants_to_use_item.item, &names, &magic_items, &dm))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
gamelog,
|
||||
gui::{item_colour, obfuscate_name},
|
||||
Equipped, InBackpack, MagicItem, MasterDungeonMap, Name, ObfuscatedName, WantsToRemoveItem,
|
||||
Beatitude, Equipped, InBackpack, MagicItem, MasterDungeonMap, Name, ObfuscatedName, WantsToRemoveItem,
|
||||
};
|
||||
use specs::prelude::*;
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ impl<'a> System<'a> for ItemRemoveSystem {
|
|||
WriteStorage<'a, InBackpack>,
|
||||
ReadStorage<'a, MagicItem>,
|
||||
ReadStorage<'a, ObfuscatedName>,
|
||||
ReadStorage<'a, Beatitude>,
|
||||
ReadExpect<'a, MasterDungeonMap>,
|
||||
);
|
||||
|
||||
|
|
@ -31,6 +32,7 @@ impl<'a> System<'a> for ItemRemoveSystem {
|
|||
mut backpack,
|
||||
magic_items,
|
||||
obfuscated_names,
|
||||
beatitudes,
|
||||
dm,
|
||||
) = data;
|
||||
|
||||
|
|
@ -40,7 +42,18 @@ impl<'a> System<'a> for ItemRemoveSystem {
|
|||
if entity == *player_entity {
|
||||
gamelog::Logger::new()
|
||||
.append("You unequip the")
|
||||
.append_n(obfuscate_name(to_remove.item, &names, &magic_items, &obfuscated_names, &dm, None).0)
|
||||
.append_n(
|
||||
obfuscate_name(
|
||||
to_remove.item,
|
||||
&names,
|
||||
&magic_items,
|
||||
&obfuscated_names,
|
||||
&beatitudes,
|
||||
&dm,
|
||||
None,
|
||||
)
|
||||
.0,
|
||||
)
|
||||
.colour(item_colour(to_remove.item, &names, &magic_items, &dm))
|
||||
.period()
|
||||
.log();
|
||||
|
|
|
|||
|
|
@ -584,7 +584,6 @@ fn main() -> rltk::BError {
|
|||
gs.ecs.register::<MeleeWeapon>();
|
||||
gs.ecs.register::<NaturalAttacks>();
|
||||
gs.ecs.register::<ArmourClassBonus>();
|
||||
gs.ecs.register::<Cursed>();
|
||||
gs.ecs.register::<MoveMode>();
|
||||
gs.ecs.register::<ProvidesHealing>();
|
||||
gs.ecs.register::<InflictsDamage>();
|
||||
|
|
|
|||
|
|
@ -152,13 +152,14 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
}
|
||||
|
||||
let mut weapon_type = -1;
|
||||
|
||||
let mut buc = BUC::Uncursed;
|
||||
if let Some(flags) = &item_template.flags {
|
||||
for flag in flags.iter() {
|
||||
match flag.as_str() {
|
||||
"CONSUMABLE" => eb = eb.with(Consumable {}),
|
||||
"DESTRUCTIBLE" => eb = eb.with(Destructible {}),
|
||||
"CURSED" => eb = eb.with(Cursed {}),
|
||||
"CURSED" => buc = BUC::Cursed,
|
||||
"BLESSED" => buc = BUC::Blessed,
|
||||
"EQUIP_MELEE" => eb = eb.with(Equippable { slot: EquipmentSlot::Melee }),
|
||||
"EQUIP_SHIELD" => eb = eb.with(Equippable { slot: EquipmentSlot::Shield }),
|
||||
"EQUIP_HEAD" => eb = eb.with(Equippable { slot: EquipmentSlot::Head }),
|
||||
|
|
@ -176,6 +177,8 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
}
|
||||
}
|
||||
}
|
||||
eb = eb.with(Beatitude { buc, known: false });
|
||||
|
||||
let mut base_damage = "1d4";
|
||||
let mut hit_bonus = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ pub fn save_game(ecs: &mut World) {
|
|||
Clock,
|
||||
Confusion,
|
||||
Consumable,
|
||||
Cursed,
|
||||
Destructible,
|
||||
Digger,
|
||||
Door,
|
||||
|
|
@ -179,7 +178,6 @@ pub fn load_game(ecs: &mut World) {
|
|||
Clock,
|
||||
Confusion,
|
||||
Consumable,
|
||||
Cursed,
|
||||
Destructible,
|
||||
Digger,
|
||||
Door,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue