Last active
January 6, 2017 21:54
-
-
Save radix/bea119390be3be7b776b83bc1079c819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<A> Creature<A> { | |
pub fn into_vari(self) -> CreatureVari { | |
if self.can_act() { | |
CreatureVari::Able(Creature::<Able> { | |
name: self.name, | |
pos: self.pos, | |
conditions: self.conditions, | |
abilities: self.abilities, | |
cur_energy: self.cur_energy, | |
cur_health: self.cur_health, | |
max_energy: self.max_energy, | |
max_health: self.max_health, | |
_p: PhantomData, | |
}) | |
} else { | |
CreatureVari::Incap(Creature::<Incap> { | |
name: self.name, | |
pos: self.pos, | |
conditions: self.conditions, | |
abilities: self.abilities, | |
cur_energy: self.cur_energy, | |
cur_health: self.cur_health, | |
max_energy: self.max_energy, | |
max_health: self.max_health, | |
_p: PhantomData, | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment