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) { function renderBody(props) {
const { game, setGame, account } = props; const { game, setGame, account } = props;
console.log('grep');
if (game) { if (game) {
return ( return (
<div> <div>
@ -66,9 +67,7 @@ function renderBody(props) {
</div> </div>
</section> </section>
); );
} else { } return <div>not ready</div>;
return <div>not ready</div>;
}
} }
module.exports = addState(renderBody); 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 false;
} }
return { cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse }; return {
cryps, sendGamePve, sendGamePvp, activeItem, sendItemUse,
};
} }
); );

View File

@ -27,8 +27,8 @@ function CrypList({
</div> </div>
</div> </div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div> <div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress> <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> <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> <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> </div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div> <div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress> <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> <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> <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> </div>
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div> <div className="has-text-centered">{cryp.hp.value} / {cryp.stamina.value} HP </div>
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress> <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> <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> <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( const addState = connect(
function receiveState(state) { function receiveState(state) {
const { const {
game, activeSkill, activeIncoming, account, game, account,
} = state; } = state;
return { return {
game, activeSkill, activeIncoming, account, game, account,
}; };
} }
); );
@ -20,6 +20,24 @@ class PhaserInstance extends preact.Component {
this.props = props; 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() { componentDidMount() {
// now mounted, can freely modify the DOM: // now mounted, can freely modify the DOM:
this.PhaserPassives = new PhaserPassives(); 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) { for (let i = 0; i < this.scene.passiveNodes.length; i += 1) {
if (this.scene.passiveNodes[i].id === this.id) { if (this.scene.passiveNodes[i].id === this.id) {
this.scene.passiveNodes[i].alloc = this.alloc; this.scene.passiveNodes[i].alloc = this.alloc;
break;
} }
} }
this.scene.drawPassiveEdges(); this.scene.drawPassiveEdges();

View File

@ -5,6 +5,7 @@ const PhaserCombat = require('./phaser.combat');
const addState = connect( const addState = connect(
function receiveState(state) { function receiveState(state) {
console.log('grep');
const { const {
game, activeSkill, activeIncoming, account, game, activeSkill, activeIncoming, account,
} = state; } = state;
@ -25,8 +26,8 @@ class PhaserInstance extends preact.Component {
const otherTeams = nextProps.game.teams.filter(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) { 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.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].stam.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) { if (playerTeam.cryps[0].hp.value === 0) {
// this.PhaserCombat.skills('blast', 400, -150); // this.PhaserCombat.skills('blast', 400, -150);
@ -40,6 +41,7 @@ class PhaserInstance extends preact.Component {
componentDidMount() { componentDidMount() {
// now mounted, can freely modify the DOM: // now mounted, can freely modify the DOM:
console.log('grep');
this.PhaserCombat = new PhaserCombat(); this.PhaserCombat = new PhaserCombat();
const config = { const config = {
type: Phaser.DOM.FILL, type: Phaser.DOM.FILL,
@ -58,6 +60,7 @@ class PhaserInstance extends preact.Component {
} }
render() { render() {
console.log('grep');
return ( return (
<div id="phaser-example" style="overflow: hidden;"> <div id="phaser-example" style="overflow: hidden;">
</div> </div>