diff options
| author | troido <troido@protonmail.com> | 2020-02-24 12:38:23 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-24 12:38:23 +0100 |
| commit | 715c9106dbff4524f3fdf5d23f762e5e6518e0cb (patch) | |
| tree | cf5dc0c5d30fc9ba7e38bdff40907fe4a96261a2 /src/components | |
| parent | 4718cfdc7c2bf67d2389ca18ab035fe5a0887ff0 (diff) | |
healing works now too, the first time based system
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/mod.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/components/mod.rs b/src/components/mod.rs index 330bc67..7ca0eba 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -123,16 +123,17 @@ pub struct Attacked { pub attacks: Vec<Attack> } -pub fn add_attack(attacked: &mut WriteStorage<Attacked> , ent: Entity, attack: Attack) { - attacked - .entry(ent) - .unwrap() - .or_insert_with(Attacked::default) - .attacks - .push(attack); +impl Attacked { + pub fn add_attack(attacked: &mut WriteStorage<Attacked> , ent: Entity, attack: Attack) { + attacked + .entry(ent) + .unwrap() + .or_insert_with(Attacked::default) + .attacks + .push(attack); + } } - #[derive(Default, Component, Debug, Clone)] #[storage(NullStorage)] pub struct Entered; @@ -153,3 +154,11 @@ pub struct Fighter { pub attack: Attack } +#[derive(Component, Debug, Clone)] +#[storage(HashMapStorage)] +pub struct Healing { + pub delay: i64, + pub health: i64, + pub next_heal: Option<i64> +} + |
