1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::{
    constants::ReturnCode,
    objects::{Attackable, SharedCreepProperties, StructureProperties, StructureTower},
};

impl StructureTower {
    pub fn attack<T>(&self, target: &T) -> ReturnCode
    where
        T: Attackable,
    {
        js_unwrap! { @{self.as_ref()}.attack( @{target.as_ref()} ) }
    }

    pub fn heal<T>(&self, target: &T) -> ReturnCode
    where
        T: SharedCreepProperties,
    {
        js_unwrap! { @{self.as_ref()}.heal( @{target.as_ref()} ) }
    }

    pub fn repair<T>(&self, target: &T) -> ReturnCode
    where
        T: StructureProperties,
    {
        js_unwrap! { @{self.as_ref()}.repair( @{target.as_ref()} ) }
    }
}