Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
Mashy 2018-12-04 20:29:18 +10:00
commit 6892a58341
4 changed files with 14 additions and 11 deletions

View File

@ -173,20 +173,21 @@ class CombatCryps extends Phaser.GameObjects.Group {
this.scene = scene; this.scene = scene;
} }
update(game, createCryps) { update(game) {
// Setting gamePhase will stop redraw unless phase changes again // Setting gamePhase will stop redraw unless phase changes again
if (!createCryps) this.clearSkills(); this.clearSkills();
// Destroy skills currently shown as the game state has changed // Destroy skills currently shown as the game state has changed
const account = this.scene.registry.get('account'); const account = this.scene.registry.get('account');
const allyTeam = game.teams.find(t => t.id === account.id); const allyTeam = game.teams.find(t => t.id === account.id);
// in future there will be more than one // in future there will be more than one
const [enemyTeam] = game.teams.filter(t => t.id !== account.id); const [enemyTeam] = game.teams.filter(t => t.id !== account.id);
const renderTeam = (cryp, iter, team) => { const renderTeam = (cryp, iter, team) => {
const crypObj = createCryps const crypObj =
? renderCryp(this.scene, this, cryp, game, team, iter) this.children.entries
: this.children.entries
.filter(obj => obj instanceof CrypImage) .filter(obj => obj instanceof CrypImage)
.find(c => c.cryp.id === cryp.id); .find(c => c.cryp.id === cryp.id)
|| renderCryp(this.scene, this, cryp, game, team, iter);
// Update to health bars wont be needed when dmg taken is done properly // Update to health bars wont be needed when dmg taken is done properly
crypObj.healthbar.hp = cryp.hp.base; crypObj.healthbar.hp = cryp.hp.base;
crypObj.healthbar.drawHealthBar(); crypObj.healthbar.drawHealthBar();

View File

@ -63,7 +63,7 @@ class Combat extends Phaser.Scene {
startGame(game) { startGame(game) {
this.renderedResolves = game.resolved.length; // In case you rejoin mid way this.renderedResolves = game.resolved.length; // In case you rejoin mid way
this.combatCryps = new CombatCryps(this); this.combatCryps = new CombatCryps(this);
this.combatCryps.update(game, true); this.combatCryps.update(game);
this.registry.set('gamePhase', game.phase); this.registry.set('gamePhase', game.phase);
return true; return true;
} }
@ -109,7 +109,7 @@ class Combat extends Phaser.Scene {
const phaseChange = (this.registry.get('gamePhase') === game.phase); const phaseChange = (this.registry.get('gamePhase') === game.phase);
if (phaseChange) return false; if (phaseChange) return false;
this.registry.set('gamePhase', game.phase); this.registry.set('gamePhase', game.phase);
this.combatCryps.update(game, false); this.combatCryps.update(game);
// Game over? // Game over?

View File

@ -185,9 +185,9 @@ function createSocket(events) {
}); });
if (!account) events.loginPrompt(); if (!account) events.loginPrompt();
if (process.env.NODE_ENV !== 'production') { // if (process.env.NODE_ENV !== 'production') {
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); // send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
} // }
return true; return true;
}); });

View File

@ -11,6 +11,8 @@
* notifications * notifications
* rejoin in progress games
* skills * skills
* check cryp status when resolving skills * check cryp status when resolving skills
* ko / stun / silence etc prevent effect * ko / stun / silence etc prevent effect