max skills

This commit is contained in:
ntr 2018-11-23 13:40:44 +11:00
parent e566bbc7e9
commit fa603009a1
2 changed files with 7 additions and 1 deletions

View File

@ -359,6 +359,12 @@ pub fn cryp_spawn(params: CrypSpawnParams, tx: &mut Transaction, account: &Accou
pub fn cryp_learn(params: CrypLearnParams, tx: &mut Transaction, account: &Account) -> Result<Cryp, Error> {
let mut cryp = cryp_get(tx, params.id, account.id)?;
let max_skills = 4;
if cryp.skills.len() >= max_skills {
return Err(format_err!("cryp at max skills ({:?})", max_skills));
}
cryp = cryp.learn(params.skill);
return cryp_write(cryp, tx);
}

View File

@ -747,7 +747,7 @@ mod tests {
use cryp::*;
fn create_test_game() -> Game {
let x = Cryp::new()
let mut x = Cryp::new()
.named(&"pronounced \"creeep\"".to_string())
.level(8)
.learn(Skill::TestStun)