aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/nexus.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/nexus.rs')
-rw-r--r--src/shared/nexus.rs77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/shared/nexus.rs b/src/shared/nexus.rs
new file mode 100644
index 0000000..df91db9
--- /dev/null
+++ b/src/shared/nexus.rs
@@ -0,0 +1,77 @@
+use crate::shared::activation::*;
+use crate::shared::buffs::*;
+use crate::shared::faction::*;
+use crate::shared::immovable::*;
+use crate::shared::player::*;
+use crate::shared::shape::*;
+use crate::shared::stats::*;
+use crate::shared::*;
+use bevy::utils::Duration;
+
+#[derive(Bundle)]
+pub struct NexusBundle {
+ id: PlayerId,
+ position: PlayerPosition,
+ color: PlayerColor,
+ imperative: Imperative,
+ cooldown: Cooldown,
+ health: Health,
+ champion: Champion,
+ effective_stats: EffectiveStats,
+ buffs: Buffs,
+ activation: Activation,
+ shape: Shape,
+ nexus: Nexus,
+ immovable: Immovable,
+ faction: Faction,
+ replicate: Replicate,
+}
+
+impl NexusBundle {
+ pub fn new(id: ClientId, position: Vec2, faction: Faction) -> 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::Nexus;
+ let effective_stats = EffectiveStats(champion.base_stats().0);
+ NexusBundle {
+ id: PlayerId(id),
+ position: PlayerPosition(position),
+ color: PlayerColor(faction.to_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::nexus(),
+ nexus: Nexus::default(),
+ immovable: Immovable,
+ faction,
+ replicate,
+ }
+ }
+}
+
+#[derive(Component)]
+pub struct Nexus {
+ pub spawn_minions: Timer,
+}
+
+impl Default for Nexus {
+ fn default() -> Self {
+ let mut spawn_minions = Timer::from_seconds(60., TimerMode::Repeating);
+ spawn_minions.set_elapsed(Duration::from_secs_f32(60.));
+ Nexus { spawn_minions }
+ }
+}