index fix

This commit is contained in:
ntr 2019-04-10 20:20:23 +10:00
parent 4c5719c568
commit 3b41500364
4 changed files with 14 additions and 4 deletions

View File

@ -190,6 +190,8 @@ function GamePanel(props) {
} }
function OpponentCryp(cryp, i) { function OpponentCryp(cryp, i) {
const ko = cryp.green_life.value === 0 ? 'ko' : '';
const stats = [STATS.greenLife, STATS.redLife, STATS.blueLife].map((s, j) => ( const stats = [STATS.greenLife, STATS.redLife, STATS.blueLife].map((s, j) => (
<figure key={j} alt={s.stat}> <figure key={j} alt={s.stat}>
{s.svg(`stat-icon ${s.colour}`)} {s.svg(`stat-icon ${s.colour}`)}
@ -200,7 +202,7 @@ function GamePanel(props) {
return ( return (
<div <div
key={i} key={i}
className="cryp-box" className={`cryp-box ${ko}`}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
onClick={() => selectSkillTarget(cryp.id)} > onClick={() => selectSkillTarget(cryp.id)} >
<div className="cryp-box-top"> <div className="cryp-box-top">

View File

@ -19,7 +19,9 @@
*CLIENT* *CLIENT*
* general * general
* icons change with % * icons change with %
* colour vbox icons
* game
* resolve animations + effects
*SERVER* *SERVER*
var / skill info rpc var / skill info rpc

View File

@ -118,7 +118,13 @@ impl Player {
false => 2, false => 2,
}; };
if self.vbox.bound.len() < 3 {
let num_colours = self.vbox.bound
.iter()
.filter(|v| [Var::Red, Var::Green, Var::Blue].contains(v))
.count();
if self.vbox.bound.len() < 3 || num_colours < 2 {
if (needs_skills && self.vbox.bits < 4) || self.vbox.bits < 5 { if (needs_skills && self.vbox.bits < 4) || self.vbox.bits < 5 {
// println!("insufficient balance"); // println!("insufficient balance");
return self; return self;

View File

@ -526,7 +526,7 @@ impl Vbox {
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, index)| { .map(|(i, index)| {
self.bound.remove(*index - i) self.bound.remove(index.saturating_sub(i))
}) })
.collect::<Vec<Var>>(); .collect::<Vec<Var>>();