diff --git a/html-client/src/components/game.jsx b/html-client/src/components/game.jsx index 16e0e966..83a05744 100644 --- a/html-client/src/components/game.jsx +++ b/html-client/src/components/game.jsx @@ -1,5 +1,8 @@ const preact = require('preact'); const key = require('keymaster'); +const range = require('lodash/range'); +const molecule = require('./molecule'); +const saw = require('./saw.component'); const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R']; @@ -9,7 +12,6 @@ function GamePanel(props) { activeSkill, activeIncoming, setActiveSkill, - setActiveIncoming, selectSkillTarget, selectIncomingTarget, account, @@ -21,21 +23,40 @@ function GamePanel(props) { const playerTeam = game.teams.find(t => t.id === account.id); - const incoming = game.stack.filter(s => s.target_team_id === playerTeam.id).map((inc) => { - key.unbind('1'); - key('1', () => setActiveIncoming(inc.id)); + function Cryp(cryp) { + const skills = range(0, 4).map((i) => { + const s = cryp.skills[i] + ? cryp.skills[i].skill + : ( ); + + return ; + }); + + const stats = [ + { stat: 'hp', colour: '#1FF01F' }, + { stat: 'red_shield', colour: '#a52a2a' }, + { stat: 'blue_shield', colour: '#3498db' }, + ].map((s, i) => ( +
+ {saw(s.colour)} +
{cryp[s.stat].value} / {cryp[s.stat].max}
+
+ )); + return ( -
-
{JSON.stringify(inc)}
- +
+
+ {molecule} +
+
+ {skills} +
+
+ {stats} +
); - }); + } function PlayerCrypCard(cryp) { const skills = cryp.skills.map((skill, i) => { @@ -65,24 +86,7 @@ function GamePanel(props) { style={ activeIncoming ? { cursor: 'pointer' } : {}} onClick={() => selectIncomingTarget(cryp.id)} className="tile is-vertical"> -
-
-
-

{cryp.name}

-
-
-
- -
-
- -
-
{cryp.hp.value} / {cryp.hp.max} HP
- - -
- {effects} - {skills} + {Cryp(cryp, setActiveSkill)}
); } @@ -150,6 +154,7 @@ function GamePanel(props) {
Round X
+
{otherTeams.id} {otherTeams.map(OpponentTeam)}