Battles are back on the menu
This commit is contained in:
parent
e9817f75e0
commit
383330ddad
@ -8,9 +8,9 @@ const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { ws, game, account, activeSkill, activeIncoming } = state;
|
||||
|
||||
function selectSkillTarget(targetTeamId) {
|
||||
function selectSkillTarget(targetCrypId) {
|
||||
if (activeSkill) {
|
||||
return ws.sendGameSkill(game.id, activeSkill.crypId, targetTeamId, activeSkill.skill.skill);
|
||||
return ws.sendGameSkill(game.id, activeSkill.crypId, targetCrypId, activeSkill.skill.skill);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -103,24 +103,28 @@ function GamePanel(props) {
|
||||
));
|
||||
|
||||
return (
|
||||
<div key={cryp.id} className="tile is-vertical">
|
||||
<div className="tile is-child">
|
||||
<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 className="tile"
|
||||
style={activeSkill ? { cursor: 'pointer' } : {}}
|
||||
onClick={() => selectSkillTarget(cryp.id)} >
|
||||
<div key={cryp.id} className="tile is-vertical">
|
||||
<div className="tile is-child">
|
||||
<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.value} HP </div>
|
||||
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.hp.max}></progress>
|
||||
|
||||
</div>
|
||||
<div className="has-text-centered">{cryp.hp.value} / {cryp.hp.value} HP </div>
|
||||
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.hp.max}></progress>
|
||||
|
||||
{effects}
|
||||
</div>
|
||||
{effects}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -128,10 +132,7 @@ function GamePanel(props) {
|
||||
function OpponentTeam(team) {
|
||||
const cryps = team.cryps.map(OpponentCrypCard);
|
||||
return (
|
||||
<div
|
||||
className="tile"
|
||||
style={activeSkill ? { cursor: 'pointer' } : {}}
|
||||
onClick={() => console.log(activeSkill)} >
|
||||
<div>
|
||||
{cryps}
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -17,6 +17,7 @@ const Body = require('./components/body.component');
|
||||
const store = createStore(
|
||||
combineReducers({
|
||||
account: reducers.accountReducer,
|
||||
activeSkill: reducers.activeSkillReducer,
|
||||
combiner: reducers.combinerReducer,
|
||||
game: reducers.gameReducer,
|
||||
cryps: reducers.crypsReducer,
|
||||
|
||||
@ -10,6 +10,16 @@ function accountReducer(state = defaultAccount, action) {
|
||||
}
|
||||
}
|
||||
|
||||
const defaultActiveSkill = null;
|
||||
function activeSkillReducer(state = defaultActiveSkill, action) {
|
||||
switch (action.type) {
|
||||
case actions.SET_ACTIVE_SKILL:
|
||||
return action.value;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
const defaultCryps = null;
|
||||
function crypsReducer(state = defaultCryps, action) {
|
||||
switch (action.type) {
|
||||
@ -72,6 +82,7 @@ function wsReducer(state = defaultWs, action) {
|
||||
|
||||
module.exports = {
|
||||
accountReducer,
|
||||
activeSkillReducer,
|
||||
combinerReducer,
|
||||
crypsReducer,
|
||||
gameReducer,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user