levels, and ui changes

This commit is contained in:
Llywelwyn 2023-07-29 05:56:52 +01:00
parent be2c8a35a5
commit 3dab5202f8
15 changed files with 337 additions and 104 deletions

View file

@ -149,17 +149,22 @@ pub struct WantsToMelee {
pub target: Entity,
}
#[derive(Component, Debug, ConvertSaveload, Clone)]
pub struct GrantsXP {
pub amount: i32,
}
#[derive(Component, Debug, ConvertSaveload, Clone)]
pub struct SufferDamage {
pub amount: Vec<i32>,
pub amount: Vec<(i32, bool)>,
}
impl SufferDamage {
pub fn new_damage(store: &mut WriteStorage<SufferDamage>, victim: Entity, amount: i32) {
pub fn new_damage(store: &mut WriteStorage<SufferDamage>, victim: Entity, amount: i32, from_player: bool) {
if let Some(suffering) = store.get_mut(victim) {
suffering.amount.push(amount);
suffering.amount.push((amount, from_player));
} else {
let dmg = SufferDamage { amount: vec![amount] };
let dmg = SufferDamage { amount: vec![(amount, from_player)] };
store.insert(victim, dmg).expect("Unable to insert damage.");
}
}