aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/cooldown.rs
blob: bf83e424be5243b45373f2644d9ecb94c45ca758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::shared::*;
use bevy::utils::Duration;
use serde::Deserialize;
use serde::Serialize;
use std::default::Default;

#[derive(Component, Message, Serialize, Deserialize, Clone, Copy, PartialEq, Debug, Default)]
pub struct Cooldown(pub [Duration; 7]);

pub struct BaseCooldown(pub [Duration; 7]);

impl BaseCooldown {
    pub fn from_champion(champion: Champion) -> Self {
        match champion {
            Champion::Meele => {
                BaseCooldown([0.75, 5., 5., 10., 25., 50., 50.].map(Duration::from_secs_f32))
            }
            Champion::Ranged => {
                BaseCooldown([1.25, 5., 5., 10., 25., 50., 50.].map(Duration::from_secs_f32))
            }
        }
    }
}