add rez to plr pve

This commit is contained in:
ntr 2018-10-09 00:16:49 +11:00
parent e99439002f
commit 08b830320a
2 changed files with 11 additions and 1 deletions

View File

@ -112,7 +112,12 @@ pub fn pve(params: CombatPveParams, db: &Db, account: &Account) -> Result<Battle
// tells from_slice to cast into a cryp // tells from_slice to cast into a cryp
let cryp_bytes: Vec<u8> = returned.get("data"); let cryp_bytes: Vec<u8> = returned.get("data");
let plr: Cryp = from_slice::<Cryp>(&cryp_bytes)?; let mut plr: Cryp = from_slice::<Cryp>(&cryp_bytes)?;
// TEMP
if plr.hp.value == 0 {
plr.rez();
}
let mob = generate_mob(&plr); let mob = generate_mob(&plr);
let mut battle = Battle::new(&plr, &mob); let mut battle = Battle::new(&plr, &mob);

View File

@ -186,6 +186,11 @@ impl Cryp {
self.hp.value == 0 self.hp.value == 0
} }
pub fn rez(&mut self) -> &mut Cryp {
self.hp.set(self.stam.value);
self
}
} }
pub fn spawn(params: CrypSpawnParams, db: &Db, account: &Account) -> Result<Cryp, Error> { pub fn spawn(params: CrypSpawnParams, db: &Db, account: &Account) -> Result<Cryp, Error> {