Merge branch 'master' of ssh://mnml.gg:40022/~/mnml

This commit is contained in:
Mashy 2019-05-29 11:50:15 +10:00
commit fc07bffb93
5 changed files with 26 additions and 13 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,13 +46,9 @@
* eth adapter * eth adapter
* pay for rerolls * pay for rerolls
* strike speed conversion
* disabled skills set before skill phase
so client can display
* remove test variants of skills * remove test variants of skills
* itemise all skills and warn on some
## SOON ## SOON

View File

@ -313,7 +313,7 @@ CONSTRUCT DAMAGE
} }
*/ */
.resolving .skills button { .resolving .skills button {
display: none; opacity: 0;
} }
/* /*

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,
} }
} }
} }
@ -101,7 +104,7 @@ impl ConstructEffect {
Some(EffectMeta::Multiplier(s)) => s, Some(EffectMeta::Multiplier(s)) => s,
_ => 0 _ => 0
} }
} }
} }

View File

@ -38,6 +38,7 @@ pub struct Game {
pub log: Vec<String>, pub log: Vec<String>,
pub instance: Option<Uuid>, pub instance: Option<Uuid>,
phase_end: DateTime<Utc>, phase_end: DateTime<Utc>,
phase_start: DateTime<Utc>,
} }
impl Game { impl Game {
@ -53,6 +54,7 @@ impl Game {
log: vec![], log: vec![],
instance: None, instance: None,
phase_end: Utc::now(), phase_end: Utc::now(),
phase_start: Utc::now(),
}; };
} }
@ -92,6 +94,7 @@ impl Game {
let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", "); let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", ");
self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description)); self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description));
player.constructs.sort_unstable_by_key(|c| c.id);
self.players.push(player); self.players.push(player);
Ok(self) Ok(self)
@ -163,13 +166,27 @@ impl Game {
} }
fn skill_phase_start(mut self) -> Game { fn skill_phase_start(mut self) -> Game {
self.phase_start = Utc::now();
self.phase_end = Utc::now() self.phase_end = Utc::now()
.checked_add_signed(Duration::seconds(60)) .checked_add_signed(Duration::seconds(60))
.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;
}
}
} }
} }