stam -> stamina

This commit is contained in:
Mashy 2018-11-13 17:47:32 +10:00
parent 4e0f2d90b0
commit bcc3079f73
7 changed files with 37 additions and 14 deletions

View File

@ -28,6 +28,7 @@ const addState = connect(
function renderBody(props) {
const { game, setGame, account } = props;
console.log('grep');
if (game) {
return (
<div>
@ -66,9 +67,7 @@ function renderBody(props) {
</div>
</section>
);
} else {
return <div>not ready</div>;
}
} return <div>not ready</div>;
}
module.exports = addState(renderBody);

4
client/src/components/cryp.list.container.js Normal file → Executable file
View File

@ -20,7 +20,9 @@ const addState = connect(
return false;
}
return { cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse };
return {
cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse,
};
}
);

View File

@ -27,8 +27,8 @@ function CrypList({
</div>
</div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stamina.value}></progress>
<div className="has-text-centered">{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP </div>
<progress className="progress is-dark" value={cryp.xp} max={Math.pow(2, cryp.lvl + 1)}></progress>

View File

@ -78,8 +78,8 @@ function GamePanel(props) {
</div>
</div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stamina.value}></progress>
<div className="has-text-centered">{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP </div>
<progress className="progress is-dark" value={cryp.xp} max={Math.pow(2, cryp.lvl + 1)}></progress>
@ -120,8 +120,8 @@ function GamePanel(props) {
</div>
</div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stamina.value}></progress>
<div className="has-text-centered">{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP </div>
<progress className="progress is-dark" value={cryp.xp} max={Math.pow(2, cryp.lvl + 1)}></progress>

View File

@ -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();

View File

@ -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();

View File

@ -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 (
<div id="phaser-example" style="overflow: hidden;">
</div>