shield specs

This commit is contained in:
ntr 2019-03-14 16:04:18 +11:00
parent 52cf570a70
commit 43775ea23d
4 changed files with 29 additions and 8 deletions

View File

@ -164,15 +164,11 @@ pub fn player_state(params: PlayerStateParams, tx: &mut Transaction, account: &A
}
pub fn player_cryps_set(params: PlayerCrypsSetParams, tx: &mut Transaction, account: &Account) -> Result<Player, Error> {
if params.instance_id != Uuid::nil() {
return Err(err_msg("only the global team can be replaced"));
}
if params.cryp_ids.len() != 3 {
return Err(err_msg("team size is 3"));
}
let mut player = player_get(tx, account.id, params.instance_id)?;
let mut player = player_get(tx, account.id, Uuid::nil())?;
let cryps = params.cryp_ids
.iter()

View File

@ -585,7 +585,6 @@ struct PlayerCrypsSetMsg {
#[derive(Debug,Clone,Serialize,Deserialize)]
pub struct PlayerCrypsSetParams {
pub instance_id: Uuid,
pub cryp_ids: Vec<Uuid>,
}

View File

@ -7,6 +7,8 @@ pub enum Spec {
RedDamageI,
GreenDamageI,
BlueDamageI,
RedShieldI,
BlueShieldI,
}
impl Spec {
@ -15,6 +17,8 @@ impl Spec {
Spec::RedDamageI => Stat::RedDamage,
Spec::GreenDamageI => Stat::GreenDamage,
Spec::BlueDamageI => Stat::BlueDamage,
Spec::RedShieldI => Stat::RedShield,
Spec::BlueShieldI => Stat::BlueShield,
Spec::SpeedI => Stat::Speed,
Spec::StaminaI => Stat::Stamina,
}
@ -27,6 +31,8 @@ impl Spec {
Spec::BlueDamageI => modified + (base * 5 / 100),
Spec::SpeedI => modified + (base * 5 / 100),
Spec::StaminaI => modified + (base * 5 / 100),
Spec::RedShieldI => modified + 50,
Spec::BlueShieldI => modified + 50,
}
}

View File

@ -16,7 +16,6 @@ use rpc::{VboxAcceptParams, VboxDiscardParams, VboxCombineParams, VboxApplyParam
use skill::{Skill};
use spec::{Spec};
use player::{Player, player_get, player_update};
use cryp::{cryp_get, cryp_write};
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
pub enum Var {
@ -42,6 +41,8 @@ pub enum Var {
RedDamageI,
BlueDamageI,
GreenDamageI,
RedShieldI,
BlueShieldI,
SpeedI,
Amplify,
@ -85,6 +86,10 @@ impl Var {
Var::Stun |
Var::Debuff |
Var::Buff => true,
Var::Protection |
Var::Damage => true,
_ => false,
}
}
@ -118,6 +123,8 @@ impl Var {
Var::Triage => Ok(VarEffect::Skill),
Var::StaminaI |
Var::RedShieldI |
Var::BlueShieldI |
Var::SpeedI => Ok(VarEffect::Spec),
_ => Err(err_msg("var has no effect on cryps"))
@ -158,8 +165,12 @@ impl Var {
fn spec(&self) -> Spec {
match *self {
Var::StaminaI => Spec::StaminaI,
Var::RedDamageI => Spec::RedDamageI,
Var::SpeedI => Spec::SpeedI,
Var::RedDamageI => Spec::RedDamageI,
Var::BlueDamageI => Spec::BlueDamageI,
Var::GreenDamageI => Spec::GreenDamageI,
Var::RedShieldI => Spec::RedShieldI,
Var::BlueShieldI => Spec::BlueShieldI,
_ => panic!("not a spec var"),
}
}
@ -374,6 +385,15 @@ impl Vbox {
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
},
Var::Protection => match colour_code {
ColourCode::RR => Var::RedShieldI,
ColourCode::GG => return Err(err_msg("unhandled skill combo")),
ColourCode::BB => Var::BlueShieldI,
ColourCode::RG => return Err(err_msg("unhandled skill combo")),
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
},
_ => panic!("wrong base {:?}", base),
};