self targeting client
This commit is contained in:
@@ -288,6 +288,7 @@ pub fn cryp_spawn(params: CrypSpawnParams, tx: &mut Transaction, account: &Accou
|
||||
.named(¶ms.name)
|
||||
.level(10)
|
||||
.learn(Skill::Stun)
|
||||
.learn(Skill::Block)
|
||||
.set_account(account.id)
|
||||
.create();
|
||||
|
||||
|
||||
@@ -273,6 +273,10 @@ impl Game {
|
||||
|
||||
// targets can only be added by the owner of the team
|
||||
fn add_target(&mut self, team_id: Uuid, cryp_id: Uuid, skill_id: Uuid) -> Result<&mut Cast, Error> {
|
||||
if self.phase != Phase::Target {
|
||||
return Err(err_msg("game not in target phase"));
|
||||
}
|
||||
|
||||
{
|
||||
// whose team is this?
|
||||
let team = self.team_by_id(team_id);
|
||||
@@ -414,6 +418,10 @@ pub fn game_skill(params: GameSkillParams, tx: &mut Transaction, account: &Accou
|
||||
let game_bytes: Vec<u8> = returned.get("data");
|
||||
let mut game = from_slice::<Game>(&game_bytes)?;
|
||||
|
||||
if game.phase != Phase::Skill {
|
||||
return Err(err_msg("game not in skill phase"))
|
||||
}
|
||||
|
||||
game.add_skill(account.id, params.cryp_id, params.target_team_id, params.skill)?;
|
||||
|
||||
if game.skill_phase_finished() {
|
||||
|
||||
Reference in New Issue
Block a user