significant events in morgue file, better event logging
This commit is contained in:
parent
de5dacb2ba
commit
738484436b
38 changed files with 246 additions and 102 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{ gamelog, Attributes, Burden, EquipmentChanged, Equipped, InBackpack, Item, Pools };
|
||||
use specs::prelude::*;
|
||||
use std::collections::HashMap;
|
||||
use crate::config::entity::CARRY_CAPACITY_PER_STRENGTH;
|
||||
use crate::data::entity::CARRY_CAPACITY_PER_STRENGTH;
|
||||
|
||||
pub struct EncumbranceSystem {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use crate::config::entity::*;
|
||||
use crate::data::entity::*;
|
||||
use crate::{ Burden, BurdenLevel, Clock, Energy, Name, Position, RunState, TakingTurn };
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
use crate::config::CONFIG;
|
||||
use crate::data::events::*;
|
||||
|
||||
pub struct EnergySystem {}
|
||||
|
||||
|
|
@ -50,10 +51,10 @@ impl<'a> System<'a> for EnergySystem {
|
|||
if energy.current >= TURN_COST {
|
||||
turns.insert(entity, TakingTurn {}).expect("Unable to insert turn for turn counter.");
|
||||
energy.current -= TURN_COST;
|
||||
crate::gamelog::record_event("turns", 1);
|
||||
crate::gamelog::record_event(EVENT::TURN(1));
|
||||
// Handle spawning mobs each turn
|
||||
if CONFIG.logging.log_ticks {
|
||||
console::log(format!("===== TURN {} =====", crate::gamelog::get_event_count("turns")));
|
||||
console::log(format!("===== TURN {} =====", crate::gamelog::get_event_count(EVENT::COUNT_TURN)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use crate::{
|
|||
TakingTurn,
|
||||
};
|
||||
use specs::prelude::*;
|
||||
use crate::data::events::*;
|
||||
|
||||
pub struct RegenSystem {}
|
||||
|
||||
|
|
@ -47,14 +48,14 @@ impl<'a> System<'a> for RegenSystem {
|
|||
return;
|
||||
}
|
||||
// Monster HP regen
|
||||
let current_turn = gamelog::get_event_count("turns");
|
||||
let current_turn = gamelog::get_event_count(EVENT::COUNT_TURN);
|
||||
if current_turn % MONSTER_HP_REGEN_TURN == 0 {
|
||||
for (_e, _p, pool, _player) in (&entities, &positions, &mut pools, !&player).join() {
|
||||
try_hp_regen_tick(pool, MONSTER_HP_REGEN_PER_TICK);
|
||||
}
|
||||
}
|
||||
// Player HP regen
|
||||
let level = gamelog::get_event_count("player_level");
|
||||
let level = gamelog::get_event_count(EVENT::COUNT_LEVEL);
|
||||
if current_turn % get_player_hp_regen_turn(level) == 0 {
|
||||
for (_e, _p, pool, _player) in (&entities, &positions, &mut pools, &player).join() {
|
||||
try_hp_regen_tick(pool, get_player_hp_regen_per_tick(level));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use crate::{
|
|||
};
|
||||
use rltk::prelude::*;
|
||||
use specs::prelude::*;
|
||||
use crate::data::events::*;
|
||||
|
||||
pub struct TurnStatusSystem {}
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ impl<'a> System<'a> for TurnStatusSystem {
|
|||
.colour(WHITE)
|
||||
.append("are confused!");
|
||||
log = true;
|
||||
gamelog::record_event("player_confused", 1);
|
||||
gamelog::record_event(EVENT::PLAYER_CONFUSED(1));
|
||||
} else {
|
||||
logger = logger
|
||||
.append("The")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue