disable flag for client side

This commit is contained in:
ntr 2019-05-28 22:42:51 +10:00
parent 50440a5452
commit 7c9dacd5be
4 changed files with 20 additions and 9 deletions

View File

@ -39,9 +39,6 @@
*SERVER* *SERVER*
* var / skill info rpc
* thresholds / bonuses
* std game mode * std game mode
* time control * time control
* animation delay phase end * animation delay phase end
@ -49,8 +46,6 @@
* eth adapter * eth adapter
* pay for rerolls * pay for rerolls
* strike speed conversion
* disabled skills set before skill phase * disabled skills set before skill phase
so client can display so client can display

View File

@ -69,7 +69,7 @@ function Skill(props) {
return ( return (
<button <button
disabled={!!cdText || ko} disabled={cdText || s.disabled || ko}
className={`construct-skill-btn ${side} ${(targeting || highlight) ? 'active' : ''}`} className={`construct-skill-btn ${side} ${(targeting || highlight) ? 'active' : ''}`}
type="submit" type="submit"
onClick={onClick}> onClick={onClick}>

View File

@ -48,6 +48,8 @@ pub struct ConstructSkill {
pub skill: Skill, pub skill: Skill,
pub self_targeting: bool, pub self_targeting: bool,
pub cd: Cooldown, pub cd: Cooldown,
// used for UI on client
pub disabled: bool,
} }
impl ConstructSkill { impl ConstructSkill {
@ -56,6 +58,7 @@ impl ConstructSkill {
skill, skill,
self_targeting: skill.self_targeting(), self_targeting: skill.self_targeting(),
cd: skill.base_cd(), cd: skill.base_cd(),
disabled: false,
} }
} }
} }

View File

@ -168,8 +168,21 @@ impl Game {
.expect("could not set phase end"); .expect("could not set phase end");
for player in self.players.iter_mut() { for player in self.players.iter_mut() {
if player.skills_required() != 0 { if player.skills_required() == 0 {
player.set_ready(false); continue;
}
player.set_ready(false);
for construct in player.constructs.iter_mut() {
for i in 0..construct.skills.len() {
if let Some(d) = construct.disabled(construct.skills[i].skill) {
info!("{:?} disabled {:?}", construct.skills[i].skill, d);
construct.skills[i].disabled = true;
} else {
construct.skills[i].disabled = false;
}
}
} }
} }