diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-22 15:42:19 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-22 15:42:19 +0100 |
commit | 2d8740b1e29fc356fbe88cea21059ec83d8c0cf0 (patch) | |
tree | 63dce5c6502861d52a1d982b705c65a2d2e4c60d /src/shared/minion.rs | |
parent | 91419fb01ef5dcdc06d9f6774d16d3ccca1e4b57 (diff) |
feat: minions
Diffstat (limited to 'src/shared/minion.rs')
-rw-r--r-- | src/shared/minion.rs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/shared/minion.rs b/src/shared/minion.rs new file mode 100644 index 0000000..5d41f7a --- /dev/null +++ b/src/shared/minion.rs @@ -0,0 +1,60 @@ +use crate::shared::activation::*; +use crate::shared::buffs::*; +use crate::shared::player::*; +use crate::shared::shape::*; +use crate::shared::stats::*; +use crate::shared::*; + +#[derive(Bundle)] +pub struct MinionBundle { + id: PlayerId, + position: PlayerPosition, + color: PlayerColor, + imperative: Imperative, + cooldown: Cooldown, + health: Health, + champion: Champion, + effective_stats: EffectiveStats, + buffs: Buffs, + activation: Activation, + shape: Shape, + minion: Minion, + replicate: Replicate, +} + +impl MinionBundle { + pub fn new(id: ClientId, position: Vec2, color: Color) -> Self { + let mut replicate = Replicate { + replication_group: ReplicationGroup::default().set_priority(10.), + ..Default::default() + }; + replicate.enable_replicate_once::<PlayerId>(); + replicate.enable_replicate_once::<PlayerColor>(); + replicate.target::<Champion>(NetworkTarget::Single(id)); + replicate.target::<Cooldown>(NetworkTarget::Single(id)); + replicate.target::<EffectiveStats>(NetworkTarget::Single(id)); + let champion = Champion::Minion; + let effective_stats = EffectiveStats(champion.base_stats().0); + MinionBundle { + id: PlayerId(id), + position: PlayerPosition(position), + color: PlayerColor(color), + imperative: Imperative::Idle, + cooldown: Cooldown::default(), + health: Health { + health: effective_stats.0.max_health, + shield: 0., + }, + champion, + effective_stats, + buffs: Buffs::default(), + activation: Activation::default(), + shape: Shape::minion(), + minion: Minion, + replicate, + } + } +} + +#[derive(Component, Message, Serialize, Deserialize, Clone, Copy, Debug, PartialEq)] +pub struct Minion; |