fixes 0/negative mana regen

This commit is contained in:
Llywelwyn 2023-08-22 23:40:22 +01:00
parent 0ff9c1000b
commit f8c74ea6f9

View file

@ -85,11 +85,12 @@ fn try_hp_regen_tick(pool: &mut Pools, amount: i32) {
}
fn get_mana_regen_per_tick(e: Entity, attributes: &ReadStorage<Attributes>) -> i32 {
return if let Some(attributes) = attributes.get(e) {
let regen = if let Some(attributes) = attributes.get(e) {
((attributes.intelligence.bonus + attributes.wisdom.bonus) / 2) + MIN_MP_REGEN_PER_TURN
} else {
MIN_MP_REGEN_PER_TURN
};
return i32::max(regen, 1);
}
fn try_mana_regen_tick(pool: &mut Pools, amount: i32) {