From 2d8740b1e29fc356fbe88cea21059ec83d8c0cf0 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Fri, 22 Mar 2024 15:42:19 +0100 Subject: feat: minions --- src/shared/minion.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/shared/minion.rs (limited to 'src/shared/minion.rs') 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::(); + replicate.enable_replicate_once::(); + replicate.target::(NetworkTarget::Single(id)); + replicate.target::(NetworkTarget::Single(id)); + replicate.target::(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; -- cgit v1.2.3