diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-18 07:26:56 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-18 07:30:53 +0100 |
commit | ad9a34852a289a19e480fc8c20eb2fe22544fadc (patch) | |
tree | 706844838a7e5a75c557d4c8110bdd9f5f5d2a76 /src/shared | |
parent | cc19e7c6a5d91abeb55e00e8ece986101c2293bd (diff) |
feat: vary max health
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/health.rs | 8 | ||||
-rw-r--r-- | src/shared/player.rs | 5 | ||||
-rw-r--r-- | src/shared/stats.rs | 3 |
3 files changed, 6 insertions, 10 deletions
diff --git a/src/shared/health.rs b/src/shared/health.rs index f4a288a..b88f19c 100644 --- a/src/shared/health.rs +++ b/src/shared/health.rs @@ -2,11 +2,3 @@ use crate::shared::*; #[derive(Component, Message, Serialize, Deserialize, Clone, Copy, Debug, PartialEq)] pub struct Health(pub f32); - -pub const MAX_HEALTH: f32 = 100.; - -impl Default for Health { - fn default() -> Self { - Health(MAX_HEALTH) - } -} diff --git a/src/shared/player.rs b/src/shared/player.rs index 4f571d8..c42f5cb 100644 --- a/src/shared/player.rs +++ b/src/shared/player.rs @@ -30,15 +30,16 @@ impl PlayerBundle { replicate.target::<Cooldown>(NetworkTarget::Single(id)); replicate.target::<EffectiveStats>(NetworkTarget::Single(id)); let champion = Champion::default(); + let effective_stats = EffectiveStats(BaseStats::from_champion(champion).0); PlayerBundle { id: PlayerId(id), position: PlayerPosition(position), color: PlayerColor(color), imperative: Imperative::Idle, cooldown: Cooldown::default(), - health: Health::default(), + health: Health(effective_stats.0.max_health), champion, - effective_stats: EffectiveStats(BaseStats::from_champion(champion).0), + effective_stats, buffs: Buffs::default(), activation: Activation::default(), replicate, diff --git a/src/shared/stats.rs b/src/shared/stats.rs index 8513a3c..ae449f0 100644 --- a/src/shared/stats.rs +++ b/src/shared/stats.rs @@ -4,6 +4,7 @@ use crate::shared::*; pub struct Stats { pub attack_range: f32, pub movement_speed: f32, + pub max_health: f32, } #[derive(Component, Message, Clone, Copy, Serialize, Deserialize, PartialEq, Debug)] @@ -18,10 +19,12 @@ impl BaseStats { Champion::Meele => BaseStats(Stats { attack_range: 25., movement_speed: 75., + max_health: 150., }), Champion::Ranged => BaseStats(Stats { attack_range: 60., movement_speed: 85., + max_health: 100., }), } } |