atomising item use: refactors BUC

This commit is contained in:
Llywelwyn 2023-08-17 02:00:05 +01:00
parent a00b7ae805
commit 6677181a4e
4 changed files with 36 additions and 10 deletions

View file

@ -39,6 +39,15 @@ 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() {
self.fragments.push(LogFragment { colour: RGB::named(RED), text: cursed.unwrap().to_string() });
} else if buc == crate::effects::BLESSED && blessed.is_some() {
self.fragments.push(LogFragment { colour: RGB::named(GOLD), text: blessed.unwrap().to_string() });
}
return self;
}
/// Pushes the finished log entry.
pub fn log(self) {
return append_entry(self.fragments);