cant send skills
This commit is contained in:
parent
30b9909e22
commit
e5f027dc24
@ -1,5 +1,8 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const key = require('keymaster');
|
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'];
|
const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R'];
|
||||||
|
|
||||||
@ -9,7 +12,6 @@ function GamePanel(props) {
|
|||||||
activeSkill,
|
activeSkill,
|
||||||
activeIncoming,
|
activeIncoming,
|
||||||
setActiveSkill,
|
setActiveSkill,
|
||||||
setActiveIncoming,
|
|
||||||
selectSkillTarget,
|
selectSkillTarget,
|
||||||
selectIncomingTarget,
|
selectIncomingTarget,
|
||||||
account,
|
account,
|
||||||
@ -21,21 +23,40 @@ function GamePanel(props) {
|
|||||||
|
|
||||||
const playerTeam = game.teams.find(t => t.id === account.id);
|
const playerTeam = game.teams.find(t => t.id === account.id);
|
||||||
|
|
||||||
const incoming = game.stack.filter(s => s.target_team_id === playerTeam.id).map((inc) => {
|
function Cryp(cryp) {
|
||||||
key.unbind('1');
|
const skills = range(0, 4).map((i) => {
|
||||||
key('1', () => setActiveIncoming(inc.id));
|
const s = cryp.skills[i]
|
||||||
|
? cryp.skills[i].skill
|
||||||
|
: (<span> </span>);
|
||||||
|
|
||||||
|
return <button key={i} className="cryp-skill-btn" type ="submit" onClick={() => setActiveSkill(cryp.id, s)}>{s}</button>;
|
||||||
|
});
|
||||||
|
|
||||||
|
const stats = [
|
||||||
|
{ stat: 'hp', colour: '#1FF01F' },
|
||||||
|
{ stat: 'red_shield', colour: '#a52a2a' },
|
||||||
|
{ stat: 'blue_shield', colour: '#3498db' },
|
||||||
|
].map((s, i) => (
|
||||||
|
<figure key={i} alt={s.stat}>
|
||||||
|
{saw(s.colour)}
|
||||||
|
<figcaption>{cryp[s.stat].value} / {cryp[s.stat].max}</figcaption>
|
||||||
|
</figure>
|
||||||
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tile is-child" key={inc.id}>
|
<div className="cryp-box">
|
||||||
<div>{JSON.stringify(inc)}</div>
|
<figure className="img">
|
||||||
<button
|
{molecule}
|
||||||
className="button is-dark is-fullwidth"
|
</figure>
|
||||||
type="submit"
|
<div className="skills">
|
||||||
onClick={() => setActiveIncoming(inc.id)}>
|
{skills}
|
||||||
(1) Block skill: {inc.skill}
|
</div>
|
||||||
</button>
|
<div className="stats">
|
||||||
|
{stats}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
|
||||||
function PlayerCrypCard(cryp) {
|
function PlayerCrypCard(cryp) {
|
||||||
const skills = cryp.skills.map((skill, i) => {
|
const skills = cryp.skills.map((skill, i) => {
|
||||||
@ -65,24 +86,7 @@ function GamePanel(props) {
|
|||||||
style={ activeIncoming ? { cursor: 'pointer' } : {}}
|
style={ activeIncoming ? { cursor: 'pointer' } : {}}
|
||||||
onClick={() => selectIncomingTarget(cryp.id)}
|
onClick={() => selectIncomingTarget(cryp.id)}
|
||||||
className="tile is-vertical">
|
className="tile is-vertical">
|
||||||
<div className="tile is-child">
|
{Cryp(cryp, setActiveSkill)}
|
||||||
<div className="columns" >
|
|
||||||
<div className="column is-10">
|
|
||||||
<p className="title">{cryp.name}</p>
|
|
||||||
</div>
|
|
||||||
<div className="column">
|
|
||||||
<figure className="image">
|
|
||||||
<svg width="40" height="40" data-jdenticon-value={cryp.name} />
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div className="has-text-centered">{cryp.hp.value} / {cryp.hp.max} HP </div>
|
|
||||||
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.hp.max}></progress>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{effects}
|
|
||||||
{skills}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -150,6 +154,7 @@ function GamePanel(props) {
|
|||||||
<div className="six columns" align="center">
|
<div className="six columns" align="center">
|
||||||
Round X
|
Round X
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="three columns">
|
<div className="three columns">
|
||||||
{otherTeams.id}
|
{otherTeams.id}
|
||||||
{otherTeams.map(OpponentTeam)}
|
{otherTeams.map(OpponentTeam)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user