diff --git a/client/src/components/body.component.jsx b/client/src/components/body.component.jsx index 374e7f91..cc3dc3ac 100755 --- a/client/src/components/body.component.jsx +++ b/client/src/components/body.component.jsx @@ -28,6 +28,7 @@ const addState = connect( function renderBody(props) { const { game, setGame, account } = props; + console.log('grep'); if (game) { return (
@@ -66,9 +67,7 @@ function renderBody(props) {
); - } else { - return
not ready
; - } + } return
not ready
; } module.exports = addState(renderBody); diff --git a/client/src/components/cryp.list.container.js b/client/src/components/cryp.list.container.js old mode 100644 new mode 100755 index 78a4cf1a..e1f4a5cf --- a/client/src/components/cryp.list.container.js +++ b/client/src/components/cryp.list.container.js @@ -20,7 +20,9 @@ const addState = connect( return false; } - return { cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse }; + return { + cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse, + }; } ); diff --git a/client/src/components/cryp.list.jsx b/client/src/components/cryp.list.jsx index fb6e4588..a3f094ff 100755 --- a/client/src/components/cryp.list.jsx +++ b/client/src/components/cryp.list.jsx @@ -27,8 +27,8 @@ function CrypList({ -
{cryp.hp.value} / {cryp.stam.value} HP
- +
{cryp.hp.value} / {cryp.stamina.value} HP
+
{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP
diff --git a/client/src/components/game.jsx b/client/src/components/game.jsx index 5af4bf95..c1944f18 100755 --- a/client/src/components/game.jsx +++ b/client/src/components/game.jsx @@ -78,8 +78,8 @@ function GamePanel(props) { -
{cryp.hp.value} / {cryp.stam.value} HP
- +
{cryp.hp.value} / {cryp.stamina.value} HP
+
{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP
@@ -120,8 +120,8 @@ function GamePanel(props) { -
{cryp.hp.value} / {cryp.stam.value} HP
- +
{cryp.hp.value} / {cryp.stamina.value} HP
+
{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP
diff --git a/client/src/components/passive.container.jsx b/client/src/components/passive.container.jsx index 5fb0da7e..84d42e9a 100755 --- a/client/src/components/passive.container.jsx +++ b/client/src/components/passive.container.jsx @@ -6,10 +6,10 @@ const PhaserPassives = require('./phaser.passives'); const addState = connect( function receiveState(state) { const { - game, activeSkill, activeIncoming, account, + game, account, } = state; return { - game, activeSkill, activeIncoming, account, + game, account, }; } ); @@ -20,6 +20,24 @@ class PhaserInstance extends preact.Component { this.props = props; } + componentWillReceiveProps(nextProps) { + const playerTeam = nextProps.game.teams.find(t => t.id === nextProps.account.id); + const otherTeams = nextProps.game.teams.filter(t => t.id !== nextProps.account.id); + + if (playerTeam && otherTeams[0] && this.PhaserCombat.loaded) { + this.PhaserCombat.setPlayerOneHp(`${playerTeam.cryps[0].hp.value.toString()} / ${playerTeam.cryps[0].stamina.value.toString()} HP`); + this.PhaserCombat.setPlayerTwoHp(`${otherTeams[0].cryps[0].hp.value.toString()} / ${otherTeams[0].cryps[0].stamina.value.toString()} HP`); + + if (playerTeam.cryps[0].hp.value === 0) { + // this.PhaserCombat.skills('blast', 400, -150); + this.PhaserCombat.skills('chargeBall', 'green', 400, -250); + } else if (otherTeams[0].cryps[0].hp.value === 0) { + // this.PhaserCombat.skills('blast', 180, 150); + this.PhaserCombat.skills('chargeBall', 'green', 180, 250); + } + } + } + componentDidMount() { // now mounted, can freely modify the DOM: this.PhaserPassives = new PhaserPassives(); diff --git a/client/src/components/passive.node.js b/client/src/components/passive.node.js index 042375ef..65323ec0 100755 --- a/client/src/components/passive.node.js +++ b/client/src/components/passive.node.js @@ -27,6 +27,7 @@ class PassiveNode extends Phaser.GameObjects.Sprite { for (let i = 0; i < this.scene.passiveNodes.length; i += 1) { if (this.scene.passiveNodes[i].id === this.id) { this.scene.passiveNodes[i].alloc = this.alloc; + break; } } this.scene.drawPassiveEdges(); diff --git a/client/src/components/phaser.container.jsx b/client/src/components/phaser.container.jsx index e9142205..1bee8b39 100755 --- a/client/src/components/phaser.container.jsx +++ b/client/src/components/phaser.container.jsx @@ -5,6 +5,7 @@ const PhaserCombat = require('./phaser.combat'); const addState = connect( function receiveState(state) { + console.log('grep'); const { game, activeSkill, activeIncoming, account, } = state; @@ -25,8 +26,8 @@ class PhaserInstance extends preact.Component { const otherTeams = nextProps.game.teams.filter(t => t.id !== nextProps.account.id); if (playerTeam && otherTeams[0] && this.PhaserCombat.loaded) { - this.PhaserCombat.setPlayerOneHp(`${playerTeam.cryps[0].hp.value.toString()} / ${playerTeam.cryps[0].stam.value.toString()} HP`); - this.PhaserCombat.setPlayerTwoHp(`${otherTeams[0].cryps[0].hp.value.toString()} / ${otherTeams[0].cryps[0].stam.value.toString()} HP`); + this.PhaserCombat.setPlayerOneHp(`${playerTeam.cryps[0].hp.value.toString()} / ${playerTeam.cryps[0].stamina.value.toString()} HP`); + this.PhaserCombat.setPlayerTwoHp(`${otherTeams[0].cryps[0].hp.value.toString()} / ${otherTeams[0].cryps[0].stamina.value.toString()} HP`); if (playerTeam.cryps[0].hp.value === 0) { // this.PhaserCombat.skills('blast', 400, -150); @@ -40,6 +41,7 @@ class PhaserInstance extends preact.Component { componentDidMount() { // now mounted, can freely modify the DOM: + console.log('grep'); this.PhaserCombat = new PhaserCombat(); const config = { type: Phaser.DOM.FILL, @@ -58,6 +60,7 @@ class PhaserInstance extends preact.Component { } render() { + console.log('grep'); return (