bigtime renaming

This commit is contained in:
ntr
2019-05-25 15:20:38 +10:00
parent 4800609df7
commit 760106e0e7
91 changed files with 1642 additions and 1615 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>cryps.gg - mnml pvp atbs</title>
<title>constructs.gg - mnml pvp atbs</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="./node_modules/izitoast/dist/css/iziToast.min.css"></script>
+1 -1
View File
@@ -1,4 +1,4 @@
require('./cryps.css');
require('./constructs.css');
// kick it off
require('./src/main');
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "cryps-client",
"name": "constructs-client",
"version": "1.0.0",
"description": "",
"main": "index.js",
+21 -21
View File
@@ -1,13 +1,13 @@
const toast = require('izitoast');
function registerEvents(registry, events, tutorial) {
function setCryps(cryps) {
registry.set('cryps', cryps);
function setConstructs(constructs) {
registry.set('constructs', constructs);
tutorial('homepage');
}
function setCrypList(cryps) {
registry.set('crypList', cryps);
function setConstructList(constructs) {
registry.set('constructList', constructs);
}
@@ -65,30 +65,30 @@ function registerEvents(registry, events, tutorial) {
registry.set('gameList', gameList);
}
function setCrypStatusUpdate(id, skill, target) {
registry.set('crypStatusUpdate', { id, skill, target });
function setConstructStatusUpdate(id, skill, target) {
registry.set('constructStatusUpdate', { id, skill, target });
}
events.on('SET_PLAYER', setPlayer);
events.on('SEND_SKILL', function skillActive(gameId, crypId, targetCrypId, skill) {
events.on('SEND_SKILL', function skillActive(gameId, constructId, targetConstructId, skill) {
const ws = registry.get('ws');
ws.sendGameSkill(gameId, crypId, targetCrypId, skill);
setCrypStatusUpdate(crypId, skill, targetCrypId);
ws.sendGameSkill(gameId, constructId, targetConstructId, skill);
setConstructStatusUpdate(constructId, skill, targetConstructId);
});
events.on('CRYP_ACTIVE', function crypActiveCb(cryp) {
const cryps = registry.get('cryps');
for (let i = 0; i < cryps.length; i += 1) {
if (cryps[i].id === cryp.id) cryps[i].active = !cryps[i].active;
events.on('CONSTRUCT_ACTIVE', function constructActiveCb(construct) {
const constructs = registry.get('constructs');
for (let i = 0; i < constructs.length; i += 1) {
if (constructs[i].id === construct.id) constructs[i].active = !constructs[i].active;
}
return setCryps(cryps);
return setConstructs(constructs);
});
const errMessages = {
select_cryps: 'Select your cryps before battle using the numbered buttons next to the cryp avatar',
select_constructs: 'Select your constructs before battle using the numbered buttons next to the construct avatar',
complete_nodes: 'You need to complete the previously connected nodes first',
max_skills: 'Your cryp can only learn a maximum of 4 skills',
max_skills: 'Your construct can only learn a maximum of 4 skills',
};
@@ -165,7 +165,7 @@ function registerEvents(registry, events, tutorial) {
});
}
events.on('CRYP_SPAWN', function spawnPrompt() {
events.on('CONSTRUCT_SPAWN', function spawnPrompt() {
const NAME_INPUT = '<input className="input" type="email" placeholder="name" />';
const SPAWN_BUTTON = '<button type="submit">SPAWN</button>';
@@ -173,7 +173,7 @@ function registerEvents(registry, events, tutorial) {
function submitSpawn(instance, thisToast, button, e, inputs) {
const NAME = inputs[0].value;
ws.sendCrypSpawn(NAME);
ws.sendConstructSpawn(NAME);
instance.hide({ transitionOut: 'fadeOut' }, thisToast, 'button');
}
@@ -184,7 +184,7 @@ function registerEvents(registry, events, tutorial) {
// overlay: true,
drag: false,
close: true,
title: 'SPAWN CRYP',
title: 'SPAWN CONSTRUCT',
position: 'center',
inputs: [
[NAME_INPUT, 'change', null, true], // true to focus
@@ -202,8 +202,8 @@ function registerEvents(registry, events, tutorial) {
loginPrompt,
setAccount,
setActiveSkill,
setCryps,
setCrypList,
setConstructs,
setConstructList,
setGame,
setMenu,
setPlayer,
+2 -2
View File
@@ -1,11 +1,11 @@
const renderCryps = require('./scenes/cryps');
const renderConstructs = require('./scenes/constructs');
const createSocket = require('./socket');
const registerEvents = require('./events');
const createTutorial = require('./tutorial');
document.fonts.load('10pt "Jura"').then(() => {
const game = renderCryps();
const game = renderConstructs();
const tutorial = createTutorial();
const events = registerEvents(game.registry, game.events, tutorial);
const ws = createSocket(events);
@@ -40,7 +40,7 @@ class CombatSkills extends Phaser.GameObjects.Group {
}
genericHeal(sourceAlly, castLocation) {
// const { sourceX, sourceY } = getCrypPosition(sourcePos, 0);
// const { sourceX, sourceY } = getConstructPosition(sourcePos, 0);
const lifespan = DELAYS.ANIMATION_DURATION;
const colour = randomColour();
const particles = this.scene.add.particles(colour);
+63 -63
View File
@@ -4,27 +4,27 @@ const StatBar = require('./elements/combat.statbar');
const { DELAYS, TEXT, POSITIONS: { COMBAT } } = require('./constants');
const CRYP_MARGIN = COMBAT.crypMargin();
const CONSTRUCT_MARGIN = COMBAT.constructMargin();
const TEXT_MARGIN = COMBAT.textMargin();
const crypAvatarText = (team, iter) => {
const constructAvatarText = (team, iter) => {
const nameX = COMBAT.width() * team;
const nameY = COMBAT.y() + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
const nameY = COMBAT.y() + CONSTRUCT_MARGIN * iter + COMBAT.height() * 0.07;
const statusX = COMBAT.width() * team;
const statusY = COMBAT.y() + TEXT_MARGIN * 6 + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
const statusY = COMBAT.y() + TEXT_MARGIN * 6 + CONSTRUCT_MARGIN * iter + COMBAT.height() * 0.07;
return { statusX, statusY, nameX, nameY };
};
const crypEffects = (team, iter) => {
const crypEffectsX = team ? COMBAT.width() - COMBAT.width() / 6.5 : COMBAT.width() / 6.5;
const crypEffectsY = TEXT_MARGIN * 2 + CRYP_MARGIN * iter;
return { crypEffectsX, crypEffectsY };
const constructEffects = (team, iter) => {
const constructEffectsX = team ? COMBAT.width() - COMBAT.width() / 6.5 : COMBAT.width() / 6.5;
const constructEffectsY = TEXT_MARGIN * 2 + CONSTRUCT_MARGIN * iter;
return { constructEffectsX, constructEffectsY };
};
const crypPosition = (team, iter) => {
const crypAvatarX = team ? COMBAT.width() - COMBAT.width() / 6 : COMBAT.width() / 6;
const crypAvatarY = TEXT_MARGIN * 5 + CRYP_MARGIN * iter;
return { crypAvatarX, crypAvatarY };
const constructPosition = (team, iter) => {
const constructAvatarX = team ? COMBAT.width() - COMBAT.width() / 6 : COMBAT.width() / 6;
const constructAvatarY = TEXT_MARGIN * 5 + CONSTRUCT_MARGIN * iter;
return { constructAvatarX, constructAvatarY };
};
@@ -32,8 +32,8 @@ class Effects extends Phaser.GameObjects.Group {
constructor(scene, team, iter) {
super(scene);
this.scene = scene;
const { crypEffectsX, crypEffectsY } = crypEffects(team, iter);
this.x = crypEffectsX; this.y = crypEffectsY;
const { constructEffectsX, constructEffectsY } = constructEffects(team, iter);
this.x = constructEffectsX; this.y = constructEffectsY;
this.effectCount = 0;
}
@@ -62,28 +62,28 @@ class Effects extends Phaser.GameObjects.Group {
}
}
class CrypImage extends Phaser.GameObjects.Image {
constructor(scene, team, iter, cryp) {
class ConstructImage extends Phaser.GameObjects.Image {
constructor(scene, team, iter, construct) {
// Get coords
const { crypAvatarX, crypAvatarY } = crypPosition(team, iter);
const { statusX, statusY, nameX, nameY } = crypAvatarText(team, iter);
const { constructAvatarX, constructAvatarY } = constructPosition(team, iter);
const { statusX, statusY, nameX, nameY } = constructAvatarText(team, iter);
// Cryp display
// Construct display
// const avatar = team ? 'magmar' : 'alk';
super(scene, crypAvatarX, crypAvatarY, 'aztec', genAvatar(cryp.name));
super(scene, constructAvatarX, constructAvatarY, 'aztec', genAvatar(construct.name));
this.setScale(0.5);
if (!team) this.flipX = true;
// Save position and cryp details
// Save position and construct details
this.scene = scene;
this.iter = iter;
this.team = team;
this.cryp = cryp;
this.construct = construct;
this.state = 'deselect';
// Add cryp name
scene.add.text(nameX, nameY, cryp.name, TEXT.NORMAL).setOrigin(team, 0);
// Add cryp stat bars
// Add construct name
scene.add.text(nameX, nameY, construct.name, TEXT.NORMAL).setOrigin(team, 0);
// Add construct stat bars
this.health = scene.add.existing(new StatBar(scene, this, 'HP'));
this.red_shield = scene.add.existing(new StatBar(scene, this, 'Red Shield'));
this.blue_shield = scene.add.existing(new StatBar(scene, this, 'Blue Shield'));
@@ -141,18 +141,18 @@ class CrypImage extends Phaser.GameObjects.Image {
}
}
class CombatCryps extends Phaser.Scene {
class CombatConstructs extends Phaser.Scene {
constructor() {
super({ key: 'CombatCryps' });
super({ key: 'CombatConstructs' });
}
create(game) {
this.cryps = this.add.group();
this.constructs = this.add.group();
this.phase = game.phase;
this.account = this.registry.get('account');
this.drawCryps(game);
this.drawConstructs(game);
this.registry.events.on('changedata', this.updateData, this);
this.registry.set('crypStatusUpdate', false);
this.registry.set('constructStatusUpdate', false);
this.teams = game.teams.length;
}
@@ -168,65 +168,65 @@ class CombatCryps extends Phaser.Scene {
const shouldUpdate = data !== this.phase;
this.phase = data;
if (shouldUpdate) {
this.cryps.children.entries.forEach(c => c.clearStatus());
this.drawCryps(this.game);
this.constructs.children.entries.forEach(c => c.clearStatus());
this.drawConstructs(this.game);
}
}
if (key === 'crypStatusUpdate' && data) {
this.updateCrypStatus(data);
if (key === 'constructStatusUpdate' && data) {
this.updateConstructStatus(data);
}
return true;
}
drawCryps(game) {
const renderCryp = (cryp, iter, team) => {
drawConstructs(game) {
const renderConstruct = (construct, iter, team) => {
// Add Image Avatar Class
const crypObj = new CrypImage(this, team, iter, cryp);
this.add.existing(crypObj);
this.cryps.add(crypObj);
return crypObj;
const constructObj = new ConstructImage(this, team, iter, construct);
this.add.existing(constructObj);
this.constructs.add(constructObj);
return constructObj;
};
const renderTeam = (cryp, iter, team) => {
const crypObj = this.cryps.children.entries
.find(c => c.cryp.id === cryp.id)
|| renderCryp(cryp, iter, team);
crypObj.health.val = cryp.hp.value;
crypObj.red_shield.val = cryp.red_shield.value;
crypObj.blue_shield.val = cryp.red_shield.value;
const renderTeam = (construct, iter, team) => {
const constructObj = this.constructs.children.entries
.find(c => c.construct.id === construct.id)
|| renderConstruct(construct, iter, team);
constructObj.health.val = construct.hp.value;
constructObj.red_shield.val = construct.red_shield.value;
constructObj.blue_shield.val = construct.red_shield.value;
crypObj.health.drawStatBar();
crypObj.red_shield.drawStatBar();
crypObj.blue_shield.drawStatBar();
crypObj.effects.update(cryp.effects);
constructObj.health.drawStatBar();
constructObj.red_shield.drawStatBar();
constructObj.blue_shield.drawStatBar();
constructObj.effects.update(construct.effects);
};
const allyTeam = game.teams.find(t => t.id === this.account.id);
// in future there will be more than one
const [enemyTeam] = game.teams.filter(t => t.id !== this.account.id);
allyTeam.cryps.forEach((cryp, i) => renderTeam(cryp, i, 0));
allyTeam.constructs.forEach((construct, i) => renderTeam(construct, i, 0));
if (!enemyTeam) return false;
enemyTeam.cryps.forEach((cryp, i) => renderTeam(cryp, i, 1));
enemyTeam.constructs.forEach((construct, i) => renderTeam(construct, i, 1));
return true;
}
selectCryp(crypId) {
this.cryps.children.entries.forEach(c => c.deselect());
if (crypId) this.cryps.children.entries.find(c => c.cryp.id === crypId).select();
selectConstruct(constructId) {
this.constructs.children.entries.forEach(c => c.deselect());
if (constructId) this.constructs.children.entries.find(c => c.construct.id === constructId).select();
}
updateCrypStatus(status) {
const sourceCryp = this.cryps.children.entries
.find(c => c.cryp.id === status.id);
updateConstructStatus(status) {
const sourceConstruct = this.constructs.children.entries
.find(c => c.construct.id === status.id);
const targetCryp = this.cryps.children.entries
.find(c => c.cryp.id === status.target);
const targetConstruct = this.constructs.children.entries
.find(c => c.construct.id === status.target);
if (this.phase === 'Skill') {
sourceCryp.statusText.text = `${status.skill} on ${targetCryp.cryp.name}`;
sourceConstruct.statusText.text = `${status.skill} on ${targetConstruct.construct.name}`;
}
}
@@ -236,4 +236,4 @@ class CombatCryps extends Phaser.Scene {
}
}
module.exports = CombatCryps;
module.exports = CombatConstructs;
+10 -10
View File
@@ -1,14 +1,14 @@
const Phaser = require('phaser');
const { POSITIONS: { COMBAT } } = require('./constants');
const CRYP_MARGIN = COMBAT.crypMargin();
const BOX_HEIGHT = CRYP_MARGIN * 0.8;
const CONSTRUCT_MARGIN = COMBAT.constructMargin();
const BOX_HEIGHT = CONSTRUCT_MARGIN * 0.8;
const BOX_WIDTH = COMBAT.width() * 0.2;
class CrypHitBox extends Phaser.GameObjects.Rectangle {
class ConstructHitBox extends Phaser.GameObjects.Rectangle {
constructor(scene, iter, team, cback) {
const y = COMBAT.y() + COMBAT.height() * 0.05 + CRYP_MARGIN * iter;
const y = COMBAT.y() + COMBAT.height() * 0.05 + CONSTRUCT_MARGIN * iter;
super(scene, (COMBAT.width() - BOX_WIDTH) * team, y, BOX_WIDTH, BOX_HEIGHT, 0x222222);
this.setOrigin(0);
this.clickHandler = () => cback();
@@ -59,22 +59,22 @@ class CombatHitBox extends Phaser.Scene {
skillHitBox(game) {
const account = this.registry.get('account');
const group = this.scene.get('CombatCryps').cryps;
const group = this.scene.get('CombatConstructs').constructs;
const skillScene = this.scene.get('CombatSkills');
game.teams.forEach((t) => {
t.cryps.forEach((c) => {
t.constructs.forEach((c) => {
const cback = () => {
const { activeSkill } = skillScene;
if (activeSkill) {
this.scene.get('CombatSkills').clearCrypActive(activeSkill.cryp.id);
this.scene.get('CombatSkills').clearConstructActive(activeSkill.construct.id);
activeSkill.activate();
skillScene.activeSkill = null;
this.game.events.emit('SEND_SKILL', game.id, activeSkill.cryp.id, c.id, activeSkill.skill.skill);
this.game.events.emit('SEND_SKILL', game.id, activeSkill.construct.id, c.id, activeSkill.skill.skill);
}
};
const crypSpawn = group.children.entries.find(s => s.cryp.id === c.id);
const constructSpawn = group.children.entries.find(s => s.construct.id === c.id);
const team = c.account === account.id ? 0 : 1;
if (crypSpawn) this.add.existing(new CrypHitBox(this, crypSpawn.iter, team, cback));
if (constructSpawn) this.add.existing(new ConstructHitBox(this, constructSpawn.iter, team, cback));
});
});
this.scene.moveBelow('Combat');
+4 -4
View File
@@ -3,7 +3,7 @@ const { throttle } = require('lodash');
const { TEXT, POSITIONS: { COMBAT } } = require('./constants');
const CombatLog = require('./combat.log');
const CombatCryps = require('./combat.cryps');
const CombatConstructs = require('./combat.constructs');
const CombatSkills = require('./combat.skills');
const CombatHitBox = require('./combat.hitbox');
@@ -47,7 +47,7 @@ class Combat extends Phaser.Scene {
}
startGame(game) {
this.scene.manager.add('CombatCryps', CombatCryps, true, game);
this.scene.manager.add('CombatConstructs', CombatConstructs, true, game);
this.scene.manager.add('CombatLog', CombatLog, true, game);
this.renderedResolves = game.resolved.length; // In case you rejoin mid way
this.scene.manager.add('CombatSkills', CombatSkills, true, game.phase);
@@ -79,7 +79,7 @@ class Combat extends Phaser.Scene {
}
checkAnimation(game) {
// Check cryps are loaded and whether game is animating
// Check constructs are loaded and whether game is animating
const cantAnimate = this.registry.get('gamePhase') === 'animating';
if (cantAnimate) return false;
if (game.resolved.length !== this.renderedResolves) {
@@ -125,7 +125,7 @@ class Combat extends Phaser.Scene {
this.registry.set('menu', true);
this.registry.set('game', null);
const ACTIVE_SCENES = ['CombatLog', 'CombatCryps', 'CombatSkills', 'CombatHitBox'];
const ACTIVE_SCENES = ['CombatLog', 'CombatConstructs', 'CombatSkills', 'CombatHitBox'];
ACTIVE_SCENES.forEach((sKey) => {
if (this.scene.get(sKey)) this.scene.get(sKey).cleanUp();
});
@@ -6,23 +6,23 @@ const {
POSITIONS: { COMBAT },
} = require('./constants');
function findResolutionCryps(scene, group, resolution, game) {
const sourceSpawn = group.children.entries.find(c => c.cryp.id === resolution.source.id);
function findResolutionConstructs(scene, group, resolution, game) {
const sourceSpawn = group.children.entries.find(c => c.construct.id === resolution.source.id);
/* const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id))
.cryps.find(c => c.id === resolution.source_cryp_id);
/* const sourceConstruct = game.teams.find(t => t.constructs.find(c => c.id === resolution.source_construct_id))
.constructs.find(c => c.id === resolution.source_construct_id);
const targetCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.target_cryp_id))
.cryps.find(c => c.id === resolution.target_cryp_id);
const targetConstruct = game.teams.find(t => t.constructs.find(c => c.id === resolution.target_construct_id))
.constructs.find(c => c.id === resolution.target_construct_id);
*/
const targetSpawn = group.children.entries.find(c => c.cryp.id === resolution.target.id);
const targetSpawn = group.children.entries.find(c => c.construct.id === resolution.target.id);
return { sourceSpawn, targetSpawn };
}
function calculateTweenParams(sourceSpawn, targetSpawn, account, skill) {
const tweenParams = (targets, centreSpot) => {
const enemy = targets.cryp.account !== account.id;
const enemy = targets.construct.account !== account.id;
let x = centreSpot ? COMBAT.width() * 0.3 : targets.x;
x = (enemy && centreSpot) ? x + COMBAT.width() * 0.4 : x;
const y = centreSpot ? COMBAT.height() * 13.25 / 35 : targets.y;
@@ -36,7 +36,7 @@ function calculateTweenParams(sourceSpawn, targetSpawn, account, skill) {
let moveSourceOrig = false;
const targetOnlySkill = ['DecayTick'];
if (!(targetOnlySkill.includes(skill))) {
if (sourceSpawn.cryp.account !== targetSpawn.cryp.account) {
if (sourceSpawn.construct.account !== targetSpawn.construct.account) {
moveSourceBattle = tweenParams(sourceSpawn, true);
moveSourceOrig = tweenParams(sourceSpawn, false);
}
@@ -57,12 +57,12 @@ function animatePhase(scene, game, resolution, cb) {
|| resolution.event[0] === 'TargetKo'
|| resolution.event === 'Ko') return cb();
const group = scene.scene.get('CombatCryps').cryps;
const group = scene.scene.get('CombatConstructs').constructs;
const animations = new CombatAnimations(scene);
const account = scene.registry.get('account');
// Find cryps, targets
const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game);
// Find constructs, targets
const { sourceSpawn, targetSpawn } = findResolutionConstructs(scene, group, resolution, game);
const {
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
} = calculateTweenParams(sourceSpawn, targetSpawn, account, resolution.event[1].skill);
@@ -74,16 +74,16 @@ function animatePhase(scene, game, resolution, cb) {
};
const castLocation = castParams();
// Move cryps into position
// Move constructs into position
if (moveSourceBattle) scene.tweens.add(moveSourceBattle);
scene.tweens.add(moveTargetBattle);
return scene.time.delayedCall(MOVE_CREEP, () => {
const sourceAlly = sourceSpawn.cryp.account === account.id;
const targetAlly = targetSpawn.cryp.account === account.id;
const sourceAlly = sourceSpawn.construct.account === account.id;
const targetAlly = targetSpawn.construct.account === account.id;
// animate animation
animations.getSkill(resolution.event[1].skill, sourceAlly, targetAlly, castLocation);
// Target cryp takes damage
// Target construct takes damage
scene.time.delayedCall(ANIMATION_DURATION, () => {
console.log(resolution);
if (resolution.event[0] === 'Damage') {
+34 -34
View File
@@ -2,18 +2,18 @@ const Phaser = require('phaser');
const { TEXT, POSITIONS: { COMBAT } } = require('./constants');
const CRYP_KEY_MAP = ['keydown_ONE', 'keydown_TWO', 'keydown_THREE'];
const CONSTRUCT_KEY_MAP = ['keydown_ONE', 'keydown_TWO', 'keydown_THREE'];
const SKILL_KEY_MAP = ['keydown_Q', 'keydown_W', 'keydown_E', 'keydown_R'];
const TARGET_KEY_MAP = ['keydown_SEVEN', 'keydown_EIGHT', 'keydown_NINE', 'keydown_ZERO'];
const CRYP_MARGIN = COMBAT.crypMargin();
const CONSTRUCT_MARGIN = COMBAT.constructMargin();
const TEXT_MARGIN = COMBAT.textMargin();
const SKILL_WIDTH = COMBAT.width() / 10;
const SKILL_HEIGHT = COMBAT.height() / 30;
const skillPosition = (crypIter, skillIter) => {
const skillPosition = (constructIter, skillIter) => {
const skillTextX = COMBAT.width() / 3.8;
const skillTextY = (TEXT_MARGIN * skillIter) * 1.5 + CRYP_MARGIN * crypIter + COMBAT.y() + COMBAT.height() * 0.07;
const skillTextY = (TEXT_MARGIN * skillIter) * 1.5 + CONSTRUCT_MARGIN * constructIter + COMBAT.y() + COMBAT.height() * 0.07;
return [skillTextX, skillTextY];
};
@@ -28,9 +28,9 @@ const skillCheckHitBox = (scenePlugin, pointer) => {
return false;
};
class CrypSkill extends Phaser.GameObjects.Container {
constructor(scene, x, y, skill, cryp) {
// Avatar will be a property of cryp
class ConstructSkill extends Phaser.GameObjects.Container {
constructor(scene, x, y, skill, construct) {
// Avatar will be a property of construct
super(scene, x, y);
const CD_TEXT = skill.cd ? `(${skill.cd}T)` : '';
const SKILL_TEXT = `${skill.skill} ${CD_TEXT}`;
@@ -42,7 +42,7 @@ class CrypSkill extends Phaser.GameObjects.Container {
this.add(this.skillText);
this.state = 'deselect';
this.cryp = cryp;
this.construct = construct;
this.skill = skill;
this.scene = scene;
@@ -117,7 +117,7 @@ class CombatSkills extends Phaser.Scene {
if (key === 'gamePhase' && data) {
const shouldUpdate = data !== this.phase;
if (shouldUpdate) {
this.scene.get('CombatCryps').selectCryp(null);
this.scene.get('CombatConstructs').selectConstruct(null);
return this.scene.restart(data);
}
return false;
@@ -135,9 +135,9 @@ class CombatSkills extends Phaser.Scene {
const { keyboard } = this.input;
const { events } = this.game;
const addSkill = (i, j, skill, cryp) => {
const addSkill = (i, j, skill, construct) => {
const skillTextPos = skillPosition(i, j);
const skillObj = new CrypSkill(this, skillTextPos[0], skillTextPos[1], skill, cryp);
const skillObj = new ConstructSkill(this, skillTextPos[0], skillTextPos[1], skill, construct);
if (skill.cd) {
skillObj.skillBox.setFillStyle(0x9d9ea0);
} else {
@@ -150,22 +150,22 @@ class CombatSkills extends Phaser.Scene {
const team = game.teams.find(t => t.id === account.id);
const enemyTeam = game.teams.find(t => t.id !== account.id);
team.cryps.forEach((cryp) => {
team.constructs.forEach((construct) => {
// return early if KOd
if (cryp.hp.value === 0) return true;
if (construct.hp.value === 0) return true;
// find the cryp position
const { iter } = this.scene.get('CombatCryps').cryps.children.entries.find(c => c.cryp.id === cryp.id);
// find the construct position
const { iter } = this.scene.get('CombatConstructs').constructs.children.entries.find(c => c.construct.id === construct.id);
// draw the skills
const skillButtons = cryp.skills.map((skill, j) => addSkill(iter, j, skill, cryp));
const skillButtons = construct.skills.map((skill, j) => addSkill(iter, j, skill, construct));
const bindCrypKeys = () => this.mapSkillKeys(skillButtons, game.id, cryp.id, team.id, enemyTeam.id, iter);
const bindConstructKeys = () => this.mapSkillKeys(skillButtons, game.id, construct.id, team.id, enemyTeam.id, iter);
// reset everything
keyboard.on('keydown_ESC', bindCrypKeys, this);
events.on('SEND_SKILL', bindCrypKeys, this);
bindCrypKeys();
keyboard.on('keydown_ESC', bindConstructKeys, this);
events.on('SEND_SKILL', bindConstructKeys, this);
bindConstructKeys();
return true;
});
@@ -174,16 +174,16 @@ class CombatSkills extends Phaser.Scene {
}
// FIXME
// needs to send crypId not team
mapSkillKeys(skillButtons, gameId, crypId, alliesId, enemyId, i) {
// needs to send constructId not team
mapSkillKeys(skillButtons, gameId, constructId, alliesId, enemyId, i) {
const { keyboard } = this.input;
keyboard.removeListener(CRYP_KEY_MAP[i]);
keyboard.removeListener(CONSTRUCT_KEY_MAP[i]);
keyboard.on(CRYP_KEY_MAP[i], () => {
keyboard.on(CONSTRUCT_KEY_MAP[i], () => {
SKILL_KEY_MAP.forEach(k => keyboard.removeListener(k));
this.scene.get('CombatCryps').selectCryp(crypId);
this.scene.get('CombatConstructs').selectConstruct(constructId);
skillButtons.forEach((button, j) => {
keyboard.on(SKILL_KEY_MAP[j], () => {
@@ -191,21 +191,21 @@ class CombatSkills extends Phaser.Scene {
button.select();
// clear existing keys
CRYP_KEY_MAP.forEach(k => keyboard.removeListener(k));
CONSTRUCT_KEY_MAP.forEach(k => keyboard.removeListener(k));
TARGET_KEY_MAP.forEach(k => keyboard.removeListener(k));
CRYP_KEY_MAP.forEach(k => keyboard.on(k, () => {
this.clearCrypActive(crypId);
CONSTRUCT_KEY_MAP.forEach(k => keyboard.on(k, () => {
this.clearConstructActive(constructId);
button.activate();
this.activeSkill = null;
this.game.events.emit('SEND_SKILL', gameId, crypId, alliesId, button.skill.skill);
this.game.events.emit('SEND_SKILL', gameId, constructId, alliesId, button.skill.skill);
}));
TARGET_KEY_MAP.forEach(k => keyboard.on(k, () => {
this.clearCrypActive(crypId);
this.clearConstructActive(constructId);
button.activate();
this.activeSkill = null;
this.game.events.emit('SEND_SKILL', gameId, crypId, enemyId, button.skill.skill);
this.game.events.emit('SEND_SKILL', gameId, constructId, enemyId, button.skill.skill);
}));
}, this);
});
@@ -214,15 +214,15 @@ class CombatSkills extends Phaser.Scene {
return true;
}
clearCrypActive(crypId) {
clearConstructActive(constructId) {
this.scene.scene.children.list.forEach((s) => {
if (s.cryp.id === crypId && s.state === 'activate') s.deselect();
if (s.construct.id === constructId && s.state === 'activate') s.deselect();
});
}
clearKeys() {
TARGET_KEY_MAP.forEach(tKey => this.input.keyboard.removeListener(tKey));
CRYP_KEY_MAP.forEach(tKey => this.input.keyboard.removeListener(tKey));
CONSTRUCT_KEY_MAP.forEach(tKey => this.input.keyboard.removeListener(tKey));
SKILL_KEY_MAP.forEach(tKey => this.input.keyboard.removeListener(tKey));
}
+35 -35
View File
@@ -7,10 +7,10 @@ const CANVAS_HEIGHT = () => Math.floor(window.innerHeight);
const headerWidth = () => CANVAS_WIDTH();
const headerHeight = () => Math.floor(CANVAS_HEIGHT() * 0.05);
const menuCrypListWidth = () => Math.floor(CANVAS_WIDTH() * 0.3);
const menuCrypListHeight = () => Math.floor(CANVAS_HEIGHT() - headerHeight());
const menuCrypListX = () => Math.floor(CANVAS_WIDTH() * 0.3);
const menuCrypListY = () => headerHeight();
const menuConstructListWidth = () => Math.floor(CANVAS_WIDTH() * 0.3);
const menuConstructListHeight = () => Math.floor(CANVAS_HEIGHT() - headerHeight());
const menuConstructListX = () => Math.floor(CANVAS_WIDTH() * 0.3);
const menuConstructListY = () => headerHeight();
const itemListWidth = () => Math.floor(CANVAS_WIDTH() * 0.5);
const itemListHeight = () => Math.floor(CANVAS_HEIGHT() * 0.95);
@@ -38,13 +38,13 @@ const combatWidth = () => CANVAS_WIDTH();
const combatHeight = () => CANVAS_HEIGHT() - headerHeight();
const combatY = () => headerHeight();
const combatX = () => 0;
const combatCrypMargin = () => Math.floor((CANVAS_HEIGHT() - headerHeight()) / 4.5);
const combatConstructMargin = () => Math.floor((CANVAS_HEIGHT() - headerHeight()) / 4.5);
const combatTextMargin = () => Math.floor((CANVAS_HEIGHT() - headerHeight()) / 35);
const statsWidth = () => Math.floor(CANVAS_WIDTH() - menuCrypListWidth());
const statsWidth = () => Math.floor(CANVAS_WIDTH() - menuConstructListWidth());
const statsHeight = () => CANVAS_HEIGHT() - headerHeight();
const statsY = () => headerHeight();
const statsX = () => menuCrypListWidth();
const statsX = () => menuConstructListWidth();
const statsKnownX = () => Math.floor(statsX() + statsWidth() / 4);
const statsLearnableX = () => Math.floor(statsX() + statsWidth() / 2);
const statsTextMargin = () => 24;
@@ -70,11 +70,11 @@ module.exports = {
height: headerHeight,
},
CRYP_LIST: {
x: menuCrypListX,
y: menuCrypListY,
width: menuCrypListWidth,
height: menuCrypListHeight,
CONSTRUCT_LIST: {
x: menuConstructListX,
y: menuConstructListY,
width: menuConstructListWidth,
height: menuConstructListHeight,
},
MENU_MAIN: {
@@ -127,7 +127,7 @@ module.exports = {
y: combatY,
width: combatWidth,
height: combatHeight,
crypMargin: combatCrypMargin,
constructMargin: combatConstructMargin,
textMargin: combatTextMargin,
@@ -172,7 +172,7 @@ module.exports = {
ITEMS: {
SKILLS: {
Amplify: {
description: 'increase the magic damage dealt by a cryp',
description: 'increase the magic damage dealt by a construct',
colours: '1 Green 1 Blue',
},
@@ -182,7 +182,7 @@ module.exports = {
},
Banish: {
description: 'target cryp is prevented from casting any skills and taking any damage',
description: 'target construct is prevented from casting any skills and taking any damage',
colours: '1 Red 1 Green',
},
@@ -198,7 +198,7 @@ module.exports = {
},
Buff: {
description: 'increase target cryp speed',
description: 'increase target construct speed',
upgrades: 'combine with 2 red / blue / green',
},
@@ -213,42 +213,42 @@ module.exports = {
},
Curse: {
description: 'target cryp takes increased magic damage',
description: 'target construct takes increased magic damage',
colours: '2 Blue',
},
Debuff: {
description: 'reduce target cryp speed',
description: 'reduce target construct speed',
upgrades: 'combine with 2 red / blue / green',
},
Decay: {
description: 'afflict a cryp with a blue damage based damage over time debuff',
description: 'afflict a construct with a blue damage based damage over time debuff',
colours: '1 Green 1 Blue',
},
Empower: {
description: 'increase the red damage dealt by a cryp',
description: 'increase the red damage dealt by a construct',
colours: '2 Red',
},
Haste: {
description: 'magical skill that increases speed of target cryp',
description: 'magical skill that increases speed of target construct',
colours: '1 Red 1 Blue',
},
Heal: {
description: 'heal a cryp with blue damage',
description: 'heal a construct with blue damage',
colours: '2 Green',
},
Hex: {
description: 'magical bsed skill that prevents target cryp from using any skills',
description: 'magical bsed skill that prevents target construct from using any skills',
colours: '1 Red 1 Blue',
},
Hostility: {
description: 'magical bsed skill that prevents target cryp from using any skills',
description: 'magical bsed skill that prevents target construct from using any skills',
colours: '2 Blue',
},
@@ -263,12 +263,12 @@ module.exports = {
},
Purge: {
description: 'remove magical buffs from target cryp',
description: 'remove magical buffs from target construct',
colours: '2 Green',
},
Purify: {
description: 'remove magical debuffs from target cryp',
description: 'remove magical debuffs from target construct',
colours: '1 Red 1 Green',
},
@@ -292,17 +292,17 @@ module.exports = {
},
Shield: {
description: 'grants immunity to magical skills to target cryp',
description: 'grants immunity to magical skills to target construct',
colours: '1 Green 1 Blue',
},
Silence: {
description: 'prevent target cryp from casting magical skills',
description: 'prevent target construct from casting magical skills',
colours: '1 Green 1 Blue',
},
Siphon: {
description: 'siphon hp from target cryp with a blue damage based debuff',
description: 'siphon hp from target construct with a blue damage based debuff',
colours: '1 Green 1 Blue',
},
@@ -311,7 +311,7 @@ module.exports = {
},
Slow: {
description: 'magical skill that reduces speed of target cryp',
description: 'magical skill that reduces speed of target construct',
colours: '1 Red 1 Green',
},
@@ -331,13 +331,13 @@ module.exports = {
},
Stun: {
description: 'red skill hat prevents target cryp from using any skills',
description: 'red skill hat prevents target construct from using any skills',
upgrades: 'combine with 2 red / blue / green',
},
Taunt: {
description: 'Enemy skills will prioritise cryps with this skill active',
description: 'Enemy skills will prioritise constructs with this skill active',
colours: '1 Red 1 Green',
},
@@ -354,19 +354,19 @@ module.exports = {
SPECS: {
Damage: {
description: 'Increase red / green / blue power stats cryp',
description: 'Increase red / green / blue power stats construct',
upgrades: 'combine with 2 red / blue / green',
},
Hp: {
description: 'Increases health of cryp',
description: 'Increases health of construct',
upgrades: 'combine with 2 red / blue / green',
},
Speed: {
description: 'Increases speed of cryp',
description: 'Increases speed of construct',
upgrades: 'combine with 2 red / blue / green',
},
},
+2 -2
View File
@@ -7,7 +7,7 @@ const Combat = require('./combat');
// const Background = require('./background');
function renderCryps() {
function renderConstructs() {
const config = {
type: Phaser.CANVAS,
// backgroundColor: '#181818',
@@ -74,4 +74,4 @@ function renderCryps() {
return game;
}
module.exports = renderCryps;
module.exports = renderConstructs;
@@ -1,49 +1,49 @@
const Phaser = require('phaser');
const { TEXT, POSITIONS: { COMBAT }, COLOURS } = require('.././constants');
const CRYP_MARGIN = COMBAT.crypMargin();
const CONSTRUCT_MARGIN = COMBAT.constructMargin();
const TEXT_MARGIN = COMBAT.textMargin();
const statBarDimensions = (team, iter, margin) => {
const statBarWidth = COMBAT.width() * 0.07;
const statBarHeight = TEXT_MARGIN / 1.5;
const statBarX = (COMBAT.width() - statBarWidth) * team;
const statBarY = COMBAT.y() + TEXT_MARGIN * (margin + 1) + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
const statBarY = COMBAT.y() + TEXT_MARGIN * (margin + 1) + CONSTRUCT_MARGIN * iter + COMBAT.height() * 0.07;
return { statBarX, statBarY, statBarWidth, statBarHeight };
};
const statTextCoord = (team, iter, margin) => {
const statTextX = team ? COMBAT.width() - COMBAT.width() * 0.075 : COMBAT.width() * 0.075;
const statTextY = COMBAT.y() + TEXT_MARGIN * (margin + 1) + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
const statTextY = COMBAT.y() + TEXT_MARGIN * (margin + 1) + CONSTRUCT_MARGIN * iter + COMBAT.height() * 0.07;
return { statTextX, statTextY };
};
class StatBar extends Phaser.GameObjects.Graphics {
constructor(scene, cryp, type) {
constructor(scene, construct, type) {
super(scene);
this.crypObj = cryp;
this.constructObj = construct;
this.type = type;
if (type === 'HP') {
this.val = this.crypObj.cryp.hp.value;
this.max = this.crypObj.cryp.hp.max;
this.val = this.constructObj.construct.hp.value;
this.max = this.constructObj.construct.hp.max;
this.margin = 0;
} else if (type === 'Red Shield') {
this.val = this.crypObj.cryp.red_shield.value;
this.max = this.crypObj.cryp.red_shield.max;
this.val = this.constructObj.construct.red_shield.value;
this.max = this.constructObj.construct.red_shield.max;
this.margin = 1;
} else if (type === 'Blue Shield') {
this.val = this.crypObj.cryp.blue_shield.value;
this.max = this.crypObj.cryp.blue_shield.max;
this.val = this.constructObj.construct.blue_shield.value;
this.max = this.constructObj.construct.blue_shield.max;
this.margin = 2;
} else if (type === 'Evasion') {
this.val = this.crypObj.cryp.evasion.value;
this.max = this.crypObj.cryp.evasion.max;
this.val = this.constructObj.construct.evasion.value;
this.max = this.constructObj.construct.evasion.max;
this.margin = 3;
}
const { statTextX, statTextY } = statTextCoord(cryp.team, cryp.iter, this.margin);
this.statText = scene.add.text(statTextX, statTextY, '', TEXT.NORMAL).setOrigin(cryp.team, 0);
const { statTextX, statTextY } = statTextCoord(construct.team, construct.iter, this.margin);
this.statText = scene.add.text(statTextX, statTextY, '', TEXT.NORMAL).setOrigin(construct.team, 0);
this.drawStatBar();
}
@@ -51,7 +51,7 @@ class StatBar extends Phaser.GameObjects.Graphics {
this.clear();
const {
statBarX, statBarY, statBarWidth, statBarHeight,
} = statBarDimensions(this.crypObj.team, this.crypObj.iter, this.margin);
} = statBarDimensions(this.constructObj.team, this.constructObj.iter, this.margin);
this.statText.text = `${this.val.toString()} / ${this.max.toString()} ${this.type}`;
// Draw Black Border
this.fillStyle(COLOURS.BLACK);
@@ -78,7 +78,7 @@ class StatBar extends Phaser.GameObjects.Graphics {
} else {
this.val = (this.val - value > this.max) ? this.max : this.val -= value;
}
if (this.val === 0 && this.type === 'HP') this.crypObj.setKo();
if (this.val === 0 && this.type === 'HP') this.constructObj.setKo();
this.drawStatBar();
}
}
+3 -3
View File
@@ -27,15 +27,15 @@ class GameList extends Phaser.Scene {
.setInteractive()
.setOrigin(0);
const TITLE = `${game.teams[0].cryps.map(c => c.name).join(', ')} - ${game.team_size}v${game.team_size}`;
const TITLE = `${game.teams[0].constructs.map(c => c.name).join(', ')} - ${game.team_size}v${game.team_size}`;
this.add
.text(gameBox.getCenter().x, gameBox.getCenter().y, TITLE, TEXT.NORMAL)
.setOrigin(0.5, 0.5);
gameBox.on('pointerdown', () => {
const cryps = this.registry.get('cryps');
const team = cryps.filter(c => c.active).map(c => c.id);
const constructs = this.registry.get('constructs');
const team = constructs.filter(c => c.active).map(c => c.id);
ws.sendGameJoin(game.id, team);
});
};
+1 -1
View File
@@ -20,7 +20,7 @@ class Header extends Phaser.Scene {
}
create() {
this.add.text(0, 0, 'cryps.gg', TEXT.HEADER);
this.add.text(0, 0, 'constructs.gg', TEXT.HEADER);
}
}
+32 -32
View File
@@ -1,14 +1,14 @@
const Phaser = require('phaser');
const { remove } = require('lodash');
const { TEXT, COLOURS, POSITIONS: { CRYP_LIST } } = require('./constants');
const { TEXT, COLOURS, POSITIONS: { CONSTRUCT_LIST } } = require('./constants');
const genAvatar = require('./avatar');
const { LineGroup, LineBox } = require('./elements/outline.rotate');
const ROW_HEIGHT = CRYP_LIST.height() * 0.1;
const ROW_WIDTH = CRYP_LIST.width();
const ROW_HEIGHT = CONSTRUCT_LIST.height() * 0.1;
const ROW_WIDTH = CONSTRUCT_LIST.width();
const menuY = CRYP_LIST.height() * 0.8;
const menuY = CONSTRUCT_LIST.height() * 0.8;
const KEY_MAP = [
'keydown-ONE',
@@ -18,41 +18,41 @@ const KEY_MAP = [
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
class HomeCrypList extends Phaser.Scene {
class HomeConstructList extends Phaser.Scene {
constructor() {
super({ key: 'HomeCryps' });
super({ key: 'HomeConstructs' });
}
updateData(parent, key, data) {
if (key === 'crypList') {
if (key === 'constructList') {
KEY_MAP.forEach(k => this.input.keyboard.removeListener(k));
this.scene.restart();
}
}
create() {
// this.cameras.main.setViewport(CRYP_LIST.x(), CRYP_LIST.y(), CRYP_LIST.width(), CRYP_LIST.height());
// this.cameras.main.setViewport(CONSTRUCT_LIST.x(), CONSTRUCT_LIST.y(), CONSTRUCT_LIST.width(), CONSTRUCT_LIST.height());
this.registry.events.on('changedata', this.updateData, this);
this.registry.events.on('setdata', this.updateData, this);
const cryps = this.registry.get('crypList');
const constructs = this.registry.get('constructList');
const lineGroup = this.add.existing(new LineGroup(this));
if (!cryps) return true;
if (!constructs) return true;
const ws = this.registry.get('ws');
this.activeCryps = [];
// We only display 3 cryps others can be viewed in cryp list (soon TM)
for (let i = 0; i < cryps.length; i += 1) {
const cryp = cryps[i];
this.activeConstructs = [];
// We only display 3 constructs others can be viewed in construct list (soon TM)
for (let i = 0; i < constructs.length; i += 1) {
const construct = constructs[i];
const BOX_WIDTH = Math.floor(ROW_WIDTH / 5);
const ROW_X = BOX_WIDTH * 2 * (i % 3);
const ROW_Y = CRYP_LIST.y() + (Math.floor(i / 3)) * ROW_HEIGHT * 1.5;
const ROW_Y = CONSTRUCT_LIST.y() + (Math.floor(i / 3)) * ROW_HEIGHT * 1.5;
const ACTIVE_FILL = 0.2;
const FILL = Object.values(COLOURS)[i];
// Selection of cryps
// Selection of constructs
// Cryp avatar and interaction box
// Construct avatar and interaction box
const cReady = this.add
.rectangle(ROW_X, ROW_Y + ROW_HEIGHT * 0.2, BOX_WIDTH * 2, ROW_HEIGHT, FILL)
.setInteractive()
@@ -60,11 +60,11 @@ class HomeCrypList extends Phaser.Scene {
cReady.setAlpha(0.2);
cReady.on('pointerdown', () => {
lineGroup.clear(true, true);
if (this.activeCryps.includes(cReady)) {
remove(this.activeCryps, n => n === cReady);
if (this.activeConstructs.includes(cReady)) {
remove(this.activeConstructs, n => n === cReady);
cReady.setAlpha(0.2);
} else {
this.activeCryps.push(cReady);
this.activeConstructs.push(cReady);
cReady.setAlpha(0.75);
lineGroup.add(this.add.existing(
new LineBox(this, cReady.x, cReady.y, cReady.width, cReady.height, cReady.fillColor, 3)
@@ -79,24 +79,24 @@ class HomeCrypList extends Phaser.Scene {
cReady.setFillStyle(FILL, ACTIVE_FILL);
};
cReady.cryp = cryp;
cReady.construct = construct;
this.add.image(
cReady.getCenter().x,
cReady.getCenter().y,
'aztec',
genAvatar(cryp.name)
genAvatar(construct.name)
);
this.add.text(ROW_X + BOX_WIDTH, ROW_Y, cryp.name, TEXT.HEADER)
this.add.text(ROW_X + BOX_WIDTH, ROW_Y, construct.name, TEXT.HEADER)
.setOrigin(0.5, 0.5);
}
// Add Spawn Cryp Option
// Add Spawn Construct Option
const spawn = this.add
.rectangle(ROW_WIDTH * 0.05, menuY, ROW_WIDTH * 0.2, ROW_HEIGHT * 0.5, 0x888888)
.setInteractive()
.setOrigin(0)
.on('pointerdown', () => {
this.game.events.emit('CRYP_SPAWN');
this.game.events.emit('CONSTRUCT_SPAWN');
});
this.add
.text(spawn.getCenter().x, spawn.getCenter().y, '+', TEXT.HEADER)
@@ -107,9 +107,9 @@ class HomeCrypList extends Phaser.Scene {
.setInteractive()
.setOrigin(0)
.on('pointerdown', () => {
const playerCryps = [];
this.activeCryps.forEach(obj => playerCryps.push(obj.cryp.id));
ws.sendPlayerCrypsSet(NULL_UUID, playerCryps);
const playerConstructs = [];
this.activeConstructs.forEach(obj => playerConstructs.push(obj.construct.id));
ws.sendPlayerConstructsSet(NULL_UUID, playerConstructs);
});
this.add
.text(joinNormal.getCenter().x, joinNormal.getCenter().y, 'Join Normal', TEXT.HEADER)
@@ -120,9 +120,9 @@ class HomeCrypList extends Phaser.Scene {
.setInteractive()
.setOrigin(0)
.on('pointerdown', () => {
const playerCryps = [];
this.activeCryps.forEach(obj => playerCryps.push(obj.cryp.id));
ws.sendInstanceJoin(playerCryps);
const playerConstructs = [];
this.activeConstructs.forEach(obj => playerConstructs.push(obj.construct.id));
ws.sendInstanceJoin(playerConstructs);
});
this.add
.text(joinInstance.getCenter().x, joinInstance.getCenter().y, 'New Instance', TEXT.HEADER)
@@ -139,4 +139,4 @@ class HomeCrypList extends Phaser.Scene {
}
}
module.exports = HomeCrypList;
module.exports = HomeConstructList;
+3 -3
View File
@@ -1,7 +1,7 @@
const Phaser = require('phaser');
const HomeCryps = require('./home.cryps');
const HomeConstructs = require('./home.constructs');
const HomeNavigation = require('./home.navigation');
const HomeRankings = require('./home.rankings');
@@ -10,7 +10,7 @@ const HomeShop = require('./home.shop');
const HomeInstances = require('./home.instances');
const FIXED_SCENES = [
'HomeCryps',
'HomeConstructs',
'HomeNavigation',
];
@@ -31,7 +31,7 @@ class Home extends Phaser.Scene {
this.registry.events.on('changedata', this.updateData, this);
this.registry.events.on('setdata', this.updateData, this);
this.scene.manager.add('HomeCryps', HomeCryps, true);
this.scene.manager.add('HomeConstructs', HomeConstructs, true);
this.scene.manager.add('HomeNavigation', HomeNavigation, true);
+5 -5
View File
@@ -16,7 +16,7 @@ class ItemInfo extends Phaser.Scene {
}
create(props) {
const { item, cryp } = props;
const { item, construct } = props;
if (!item) return false;
// Default item text
@@ -51,19 +51,19 @@ class ItemInfo extends Phaser.Scene {
.setWordWrapWidth(WIDTH * 0.75);
if (colours !== '') {
this.add
.text(X, Y + HEIGHT * 0.35, `Adds ${colours} to cryp`, TEXT.NORMAL)
.text(X, Y + HEIGHT * 0.35, `Adds ${colours} to construct`, TEXT.NORMAL)
.setWordWrapWidth(WIDTH * 0.75);
}
if (!cryp) return true;
if (!construct) return true;
const ws = this.registry.get('ws');
const { vbox } = this.registry.get('player');
const unEquip = this.add.rectangle(X, UNEQUIP_Y, UNEQUIP_WIDTH, UNEQUIP_HEIGHT, 0x222222)
.setOrigin(0, 0)
.setInteractive()
.on('pointerdown', () => {
ws.sendVboxUnequip(vbox.instance, cryp.id, item);
this.registry.set('crypStats', cryp);
ws.sendVboxUnequip(vbox.instance, construct.id, item);
this.registry.set('constructStats', construct);
});
this.add.text(unEquip.getCenter().x, unEquip.getCenter().y, 'unequip', TEXT.HEADER)
.setOrigin(0.5, 0.5);
+4 -4
View File
@@ -109,8 +109,8 @@ class DeleteHitBox extends Phaser.GameObjects.Rectangle {
const itemCheckHitbox = (scene, pointer) => {
const { list } = scene.scene.get('MenuCrypList').children;
const hitboxes = list.filter(c => c.cryp)
const { list } = scene.scene.get('MenuConstructList').children;
const hitboxes = list.filter(c => c.construct)
.concat(scene.children.list.filter(c => c instanceof CombinerHitBox || c instanceof DeleteHitBox));
let found;
@@ -283,7 +283,7 @@ class ItemList extends Phaser.Scene {
// Check first for hitbox interaction
const hitBox = itemCheckHitbox(this, pointer);
if (hitBox) {
// hitbox can only be the combinerhitbox, deletehitbox or cryp avatar
// hitbox can only be the combinerhitbox, deletehitbox or construct avatar
hitBox.itemDeselect();
if (hitBox instanceof CombinerHitBox) {
if (hitBox.item === item) deallocate(item);
@@ -291,7 +291,7 @@ class ItemList extends Phaser.Scene {
} else if (hitBox instanceof DeleteHitBox) {
ws.sendVboxReclaim(vbox.instance, item.index);
} else {
ws.sendVboxApply(vbox.instance, hitBox.cryp.id, item.index);
ws.sendVboxApply(vbox.instance, hitBox.construct.id, item.index);
deallocate(item);
} return true;
}
+51 -51
View File
@@ -1,11 +1,11 @@
const Phaser = require('phaser');
const { TEXT, COLOURS, POSITIONS: { CRYP_LIST } } = require('./constants');
const { TEXT, COLOURS, POSITIONS: { CONSTRUCT_LIST } } = require('./constants');
const genAvatar = require('./avatar');
const Item = require('./elements/item');
const BOX_WIDTH = Math.floor(CRYP_LIST.width());
const BOX_HEIGHT = Math.floor(CRYP_LIST.height() / 3.34);
const BOX_WIDTH = Math.floor(CONSTRUCT_LIST.width());
const BOX_HEIGHT = Math.floor(CONSTRUCT_LIST.height() / 3.34);
const TEXT_MARGIN = 24;
@@ -15,113 +15,113 @@ const KEY_MAP = [
'keydown-THREE',
];
class MenuCrypList extends Phaser.Scene {
class MenuConstructList extends Phaser.Scene {
constructor() {
super({ key: 'MenuCrypList' });
super({ key: 'MenuConstructList' });
}
create() {
this.registry.events.on('changedata', this.updateData, this);
this.registry.events.on('setdata', this.updateData, this);
const player = this.registry.get('player');
if (player) this.drawCryps(player.cryps);
if (player) this.drawConstructs(player.constructs);
}
updateData(parent, key, data) {
if (key === 'player') {
this.drawCryps(data.cryps);
this.drawConstructs(data.constructs);
}
}
drawCryps(cryps) {
if (!cryps) return true;
if (this.crypGroup) this.crypGroup.destroy(true);
this.crypGroup = this.add.group();
const addCryp = (cryp, i) => {
const ROW_X = CRYP_LIST.x();
const ROW_Y = CRYP_LIST.y() + BOX_HEIGHT * i * 1.1;
drawConstructs(constructs) {
if (!constructs) return true;
if (this.constructGroup) this.constructGroup.destroy(true);
this.constructGroup = this.add.group();
const addConstruct = (construct, i) => {
const ROW_X = CONSTRUCT_LIST.x();
const ROW_Y = CONSTRUCT_LIST.y() + BOX_HEIGHT * i * 1.1;
const ACTIVE_FILL = 0.2;
const FILL = Object.values(COLOURS)[i];
// Selection of cryps
// Selection of constructs
const selectFn = () => {
this.registry.set('crypStats', cryp);
this.registry.set('constructStats', construct);
};
// Cryp interaction box for adding items
const crypInteract = this.add
// Construct interaction box for adding items
const constructInteract = this.add
.rectangle(ROW_X, ROW_Y, BOX_WIDTH, BOX_HEIGHT, FILL, ACTIVE_FILL)
.setInteractive()
.setOrigin(0)
.on('pointerdown', selectFn);
crypInteract.itemSelect = () => {
crypInteract.setFillStyle(COLOURS.SELECT);
constructInteract.itemSelect = () => {
constructInteract.setFillStyle(COLOURS.SELECT);
};
crypInteract.itemDeselect = () => {
crypInteract.setFillStyle(FILL, ACTIVE_FILL);
constructInteract.itemDeselect = () => {
constructInteract.setFillStyle(FILL, ACTIVE_FILL);
};
crypInteract.cryp = cryp;
constructInteract.construct = construct;
// Cryp Avatar
const { name } = cryp;
const crypImage = this.add.image(
crypInteract.getCenter().x - crypInteract.width / 4,
crypInteract.getCenter().y,
// Construct Avatar
const { name } = construct;
const constructImage = this.add.image(
constructInteract.getCenter().x - constructInteract.width / 4,
constructInteract.getCenter().y,
'aztec',
genAvatar(name)
);
// Add text info
const yCrypTextAlgin = Math.floor(crypInteract.y + TEXT_MARGIN / 2);
const xCrypNameAlign = Math.floor(crypInteract.x + crypInteract.width * 1 / 10);
const crypInfoText = this.add.text(xCrypNameAlign, yCrypTextAlgin, name, TEXT.HEADER);
const yConstructTextAlgin = Math.floor(constructInteract.y + TEXT_MARGIN / 2);
const xConstructNameAlign = Math.floor(constructInteract.x + constructInteract.width * 1 / 10);
const constructInfoText = this.add.text(xConstructNameAlign, yConstructTextAlgin, name, TEXT.HEADER);
const colourText = (c, j) => {
// Placeholder for when gems are implemented
const gemText = this.add.text(crypInteract.x + crypInteract.width * (j + 3) / 6, yCrypTextAlgin, `${c[0]} - ${c[1]}`, TEXT.HEADER);
this.crypGroup.add(gemText);
const gemText = this.add.text(constructInteract.x + constructInteract.width * (j + 3) / 6, yConstructTextAlgin, `${c[0]} - ${c[1]}`, TEXT.HEADER);
this.constructGroup.add(gemText);
};
const { red, green, blue } = cryp.colours;
const CRYP_COLOURS = [
const { red, green, blue } = construct.colours;
const CONSTRUCT_COLOURS = [
['R', red],
['G', green],
['B', blue],
];
CRYP_COLOURS.forEach(colourText);
CONSTRUCT_COLOURS.forEach(colourText);
this.crypGroup.addMultiple([crypInteract, crypImage, crypInfoText]);
this.constructGroup.addMultiple([constructInteract, constructImage, constructInfoText]);
const crypSkill = (stat, j) => {
const constructSkill = (stat, j) => {
const SKILL_WIDTH = Math.floor(BOX_WIDTH / 2);
const SKILL_HEIGHT = Math.floor(BOX_HEIGHT / 8);
const SKILL_X = crypInteract.getCenter().x + crypInteract.width / 4;
const SKILL_Y = crypInteract.y + SKILL_HEIGHT * 1.15 * (j + 1.6);
const SKILL_X = constructInteract.getCenter().x + constructInteract.width / 4;
const SKILL_Y = constructInteract.y + SKILL_HEIGHT * 1.15 * (j + 1.6);
const itemObj = new Item(this, stat.skill, j, SKILL_X, SKILL_Y, SKILL_WIDTH, SKILL_HEIGHT);
this.add.existing(itemObj);
itemObj.setInteractive();
const itemInfo = { item: stat.skill, cryp };
const itemInfo = { item: stat.skill, construct };
itemObj.on('pointerdown', () => this.registry.set('itemInfo', itemInfo));
this.crypGroup.add(itemObj);
this.constructGroup.add(itemObj);
};
cryp.skills.forEach(crypSkill);
construct.skills.forEach(constructSkill);
const crypSpec = (spec, j) => {
const constructSpec = (spec, j) => {
const SKILL_WIDTH = Math.floor(BOX_WIDTH * 0.15);
const SKILL_HEIGHT = Math.floor(BOX_HEIGHT * 0.2);
const SKILL_X = Math.floor(crypInteract.x + BOX_WIDTH * (0.6 + j) * 0.175);
const SKILL_Y = Math.floor(crypInteract.y + BOX_HEIGHT * 0.875);
const SKILL_X = Math.floor(constructInteract.x + BOX_WIDTH * (0.6 + j) * 0.175);
const SKILL_Y = Math.floor(constructInteract.y + BOX_HEIGHT * 0.875);
const itemObj = new Item(this, spec, j, SKILL_X, SKILL_Y, SKILL_WIDTH, SKILL_HEIGHT);
itemObj.setInteractive();
const itemInfo = { item: spec, cryp };
const itemInfo = { item: spec, construct };
itemObj.on('pointerdown', () => this.registry.set('itemInfo', itemInfo));
this.add.existing(itemObj);
this.crypGroup.add(itemObj);
this.constructGroup.add(itemObj);
};
cryp.specs.forEach(crypSpec);
construct.specs.forEach(constructSpec);
};
cryps.forEach(addCryp);
constructs.forEach(addConstruct);
return true;
}
@@ -134,4 +134,4 @@ class MenuCrypList extends Phaser.Scene {
}
}
module.exports = MenuCrypList;
module.exports = MenuConstructList;
+4 -4
View File
@@ -1,7 +1,7 @@
const Phaser = require('phaser');
// Scenes constantly showing
const MenuCrypList = require('./menu.cryps.list');
const MenuConstructList = require('./menu.constructs.list');
const MenuNavigation = require('./menu.navigation');
const ItemList = require('./item.list');
// Scenes which change depending on menu context
@@ -11,7 +11,7 @@ const StatSheet = require('./statsheet');
const ItemInfo = require('./item.info');
const FIXED_MENU_SCENES = [
'MenuCrypList',
'MenuConstructList',
'MenuNavigation',
'ItemList',
];
@@ -37,7 +37,7 @@ class Menu extends Phaser.Scene {
this.registry.get('ws').sendPlayerState(player.instance);
// When we load the menu request the latest items
// Item list will restart when the data comes in
this.scene.manager.add('MenuCrypList', MenuCrypList, true);
this.scene.manager.add('MenuConstructList', MenuConstructList, true);
this.scene.manager.add('MenuNavigation', MenuNavigation, true);
this.scene.manager.add('ItemList', ItemList, true);
this.registry.set('inMenu', true);
@@ -53,7 +53,7 @@ class Menu extends Phaser.Scene {
case 'home': return this.cleanUp();
case 'zone': return this.newMainScene('Zones', Zones, data);
case 'gameList': return this.newMainScene('GameList', GameList, data);
case 'crypStats': return this.newMainScene('StatSheet', StatSheet, data);
case 'constructStats': return this.newMainScene('StatSheet', StatSheet, data);
case 'itemInfo': return this.newMainScene('ItemInfo', ItemInfo, data);
default: return false;
}
+20 -20
View File
@@ -21,8 +21,8 @@ class DeleteHitBox extends Phaser.GameObjects.Rectangle {
}
const itemCheckHitbox = (scene, pointer) => {
const { list } = scene.scene.get('MenuCrypList').children;
const hitboxes = list.filter(c => c.cryp)
const { list } = scene.scene.get('MenuConstructList').children;
const hitboxes = list.filter(c => c.construct)
.concat(scene.children.list.filter(c => c instanceof DeleteHitBox));
let found;
@@ -47,12 +47,12 @@ class StatSheet extends Phaser.Scene {
if (key === 'player') {
console.log('grep');
console.log(data);
const cryp = data.cryps.find(c => c.id === this.cryp.id);
this.scene.restart(cryp);
const construct = data.constructs.find(c => c.id === this.construct.id);
this.scene.restart(construct);
}
}
create(cryp) {
create(construct) {
this.registry.events.on('changedata', this.updateData, this);
// const ws = this.registry.get('ws');
@@ -60,7 +60,7 @@ class StatSheet extends Phaser.Scene {
if (!player) return false;
// const { vbox } = player;
this.cryp = cryp;
this.construct = construct;
/*
const del = this.add.existing(new DeleteHitBox(this, X + WIDTH * 0.7, Y + HEIGHT * 0.6));
@@ -68,25 +68,25 @@ class StatSheet extends Phaser.Scene {
.setOrigin(0.5, 0.5);
*/
this.add.text(X, Y, cryp.name, TEXT.HEADER);
this.add.text(X, Y, construct.name, TEXT.HEADER);
const crypStat = (stat, i) => {
const constructStat = (stat, i) => {
const STAT_X = X;
const STAT_Y = Y + (i + 2) * TEXT_MARGIN;
this.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base} -> ${stat.value}`, TEXT.NORMAL);
};
const CRYP_STATS = [
cryp.hp,
cryp.red_shield,
cryp.blue_shield,
cryp.evasion,
cryp.red_damage,
cryp.blue_damage,
cryp.speed,
const CONSTRUCT_STATS = [
construct.hp,
construct.red_shield,
construct.blue_shield,
construct.evasion,
construct.red_damage,
construct.blue_damage,
construct.speed,
];
CRYP_STATS.forEach(crypStat);
CONSTRUCT_STATS.forEach(constructStat);
/*
const knownSkill = (skill, i) => {
const SKILL_X = X + WIDTH * 0.4 + WIDTH * 0.125 * i;
@@ -96,7 +96,7 @@ class StatSheet extends Phaser.Scene {
this.input.setDraggable(itemObj);
this.add.existing(itemObj);
};
cryp.skills.forEach(knownSkill);
construct.skills.forEach(knownSkill);
this.add.text(X + WIDTH * 0.35, Y, 'Skills', TEXT.HEADER);
this.add.text(X + WIDTH * 0.35, Y + HEIGHT * 0.25, 'Specs', TEXT.HEADER);
@@ -108,7 +108,7 @@ class StatSheet extends Phaser.Scene {
this.input.setDraggable(itemObj);
this.add.existing(itemObj);
};
cryp.specs.forEach(knownSpec);
construct.specs.forEach(knownSpec);
this.input.on('drag', (pointer, item, dragX, dragY) => {
@@ -126,7 +126,7 @@ class StatSheet extends Phaser.Scene {
if (hitBox) {
hitBox.itemDeselect();
// add socket function for unlearn here
ws.sendVboxUnequip(vbox.instance, cryp.id, item.item);
ws.sendVboxUnequip(vbox.instance, construct.id, item.item);
}
return true;
});
+1 -1
View File
@@ -70,7 +70,7 @@ class Zones extends Phaser.Scene {
// Check cursor hasn't significantly moved during point allocation
// If panning and mouse release is on node it won't allocate
if (gameObjects[0] instanceof Node) {
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
const team = this.registry.get('constructs').filter(c => c.active).map(c => c.id);
if (gameObjects[0].success) return false;
this.registry.get('ws').sendZoneJoin(zoneId, gameObjects[0].id, team);
}
+47 -47
View File
@@ -2,7 +2,7 @@ const toast = require('izitoast');
const cbor = require('borc');
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://cryps.gg/ws' : 'ws://localhost:40000';
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://constructs.gg/ws' : 'ws://localhost:40000';
function errorToast(err) {
console.error(err);
@@ -41,8 +41,8 @@ function createSocket(events) {
send({ method: 'account_demo', params: {} });
}
function sendAccountCryps() {
send({ method: 'account_cryps', params: {} });
function sendAccountConstructs() {
send({ method: 'account_constructs', params: {} });
}
function sendAccountInstances() {
@@ -53,40 +53,40 @@ function createSocket(events) {
send({ method: 'account_zone', params: {} });
}
function sendCrypSpawn(name) {
send({ method: 'cryp_spawn', params: { name } });
function sendConstructSpawn(name) {
send({ method: 'construct_spawn', params: { name } });
}
function sendCrypLearn(id, skill) {
send({ method: 'cryp_learn', params: { id, skill } });
function sendConstructLearn(id, skill) {
send({ method: 'construct_learn', params: { id, skill } });
}
function sendCrypForget(id, skill) {
send({ method: 'cryp_forget', params: { id, skill } });
function sendConstructForget(id, skill) {
send({ method: 'construct_forget', params: { id, skill } });
}
function sendGameState(id) {
send({ method: 'game_state', params: { id } });
}
function sendGamePve(crypIds, mode) {
send({ method: 'game_pve', params: { cryp_ids: crypIds, mode } });
function sendGamePve(constructIds, mode) {
send({ method: 'game_pve', params: { construct_ids: constructIds, mode } });
}
function sendGamePvp(crypIds) {
send({ method: 'game_pvp', params: { cryp_ids: crypIds } });
function sendGamePvp(constructIds) {
send({ method: 'game_pvp', params: { construct_ids: constructIds } });
}
function sendGameJoin(gameId, crypIds) {
send({ method: 'game_join', params: { game_id: gameId, cryp_ids: crypIds } });
function sendGameJoin(gameId, constructIds) {
send({ method: 'game_join', params: { game_id: gameId, construct_ids: constructIds } });
}
function sendSpecForget(id, spec) {
send({ method: 'cryp_unspec', params: { id, spec } });
send({ method: 'construct_unspec', params: { id, spec } });
}
function sendPlayerCrypsSet(instanceId, crypIds) {
send({ method: 'player_cryps_set', params: { instance_id: instanceId, cryp_ids: crypIds } });
function sendPlayerConstructsSet(instanceId, constructIds) {
send({ method: 'player_constructs_set', params: { instance_id: instanceId, construct_ids: constructIds } });
}
function sendPlayerState(instanceId) {
@@ -97,12 +97,12 @@ function createSocket(events) {
send({ method: 'player_vbox_accept', params: { instance_id: instanceId, group, index } });
}
function sendVboxApply(instanceId, crypId, index) {
send({ method: 'player_vbox_apply', params: { instance_id: instanceId, cryp_id: crypId, index } });
function sendVboxApply(instanceId, constructId, index) {
send({ method: 'player_vbox_apply', params: { instance_id: instanceId, construct_id: constructId, index } });
}
function sendVboxUnequip(instanceId, crypId, target) {
send({ method: 'player_vbox_unequip', params: { instance_id: instanceId, cryp_id: crypId, target } });
function sendVboxUnequip(instanceId, constructId, target) {
send({ method: 'player_vbox_unequip', params: { instance_id: instanceId, construct_id: constructId, target } });
}
function sendVboxDiscard(instanceId) {
@@ -117,18 +117,18 @@ function createSocket(events) {
send({ method: 'player_vbox_reclaim', params: { instance_id: instanceId, index } });
}
function sendGameSkill(gameId, crypId, targetCrypId, skill) {
function sendGameSkill(gameId, constructId, targetConstructId, skill) {
send({
method: 'game_skill',
params: {
game_id: gameId, cryp_id: crypId, target_cryp_id: targetCrypId, skill,
game_id: gameId, construct_id: constructId, target_construct_id: targetConstructId, skill,
},
});
events.setActiveSkill(null);
}
function sendGameTarget(gameId, crypId, skillId) {
send({ method: 'game_target', params: { game_id: gameId, cryp_id: crypId, skill_id: skillId } });
function sendGameTarget(gameId, constructId, skillId) {
send({ method: 'game_target', params: { game_id: gameId, construct_id: constructId, skill_id: skillId } });
events.setActiveSkill(null);
}
@@ -136,16 +136,16 @@ function createSocket(events) {
send({ method: 'zone_create', params: {} });
}
function sendZoneJoin(zoneId, nodeId, crypIds) {
send({ method: 'zone_join', params: { zone_id: zoneId, node_id: nodeId, cryp_ids: crypIds } });
function sendZoneJoin(zoneId, nodeId, constructIds) {
send({ method: 'zone_join', params: { zone_id: zoneId, node_id: nodeId, construct_ids: constructIds } });
}
function sendZoneClose(zoneId) {
send({ method: 'zone_close', params: { zone_id: zoneId } });
}
function sendInstanceJoin(cryps) {
send({ method: 'instance_join', params: { cryp_ids: cryps, pve: true } });
function sendInstanceJoin(constructs) {
send({ method: 'instance_join', params: { construct_ids: constructs, pve: true } });
}
function sendInstanceReady(instanceId) {
@@ -165,7 +165,7 @@ function createSocket(events) {
account = login;
events.setAccount(login);
sendAccountCryps();
sendAccountConstructs();
}
function accountInstanceList(res) {
@@ -173,9 +173,9 @@ function createSocket(events) {
events.setInstanceList(instanceList);
}
function accountCryps(response) {
const [structName, cryps] = response;
events.setCrypList(cryps);
function accountConstructs(response) {
const [structName, constructs] = response;
events.setConstructList(constructs);
}
function gameState(response) {
@@ -183,8 +183,8 @@ function createSocket(events) {
events.setGame(game);
}
function crypSpawn(response) {
const [structName, cryp] = response;
function constructSpawn(response) {
const [structName, construct] = response;
}
function gamePve(response) {
@@ -213,14 +213,14 @@ function createSocket(events) {
// when the server sends a reply it will have one of these message types
// this object wraps the reply types to a function
const handlers = {
cryp_spawn: crypSpawn,
cryp_forget: () => true,
cryp_learn: () => true,
construct_spawn: constructSpawn,
construct_forget: () => true,
construct_learn: () => true,
game_pve: gamePve,
game_state: gameState,
account_login: accountLogin,
account_create: accountLogin,
account_cryps: accountCryps,
account_constructs: accountConstructs,
account_instances: accountInstanceList,
instance_scores: instanceScores,
zone_create: res => console.log(res),
@@ -232,9 +232,9 @@ function createSocket(events) {
function errHandler(error) {
switch (error) {
case 'no active zone': return sendZoneCreate();
case 'no cryps selected': return events.errorPrompt('select_cryps');
case 'no constructs selected': return events.errorPrompt('select_constructs');
case 'node requirements not met': return events.errorPrompt('complete_nodes');
case 'cryp at max skills (4)': return events.errorPrompt('max_skills');
case 'construct at max skills (4)': return events.errorPrompt('max_skills');
default: return errorToast(error);
@@ -301,7 +301,7 @@ function createSocket(events) {
sendAccountLogin,
sendAccountCreate,
sendAccountDemo,
sendAccountCryps,
sendAccountConstructs,
sendAccountInstances,
sendAccountZone,
sendGameState,
@@ -310,9 +310,9 @@ function createSocket(events) {
sendGameJoin,
sendGameSkill,
sendGameTarget,
sendCrypSpawn,
sendCrypLearn,
sendCrypForget,
sendConstructSpawn,
sendConstructLearn,
sendConstructForget,
sendSpecForget,
sendZoneCreate,
sendZoneJoin,
@@ -320,7 +320,7 @@ function createSocket(events) {
sendInstanceJoin,
sendInstanceReady,
sendInstanceScores,
sendPlayerCrypsSet,
sendPlayerConstructsSet,
sendPlayerState,
sendVboxAccept,
sendVboxApply,
+18 -18
View File
@@ -9,34 +9,34 @@ function noMore(instance, thisToast) {
}
const WELCOME_MESSAGE = `
Welcome to cryps.gg
Welcome to constructs.gg
Enter a username and password and press register to sign up,
or just press DEMO to quick start.
`;
const HOMEPAGE_MESSAGE = `
This homepage shows your cryps, joinable online games, PVE options and your items.\n
If you have no cryps yet, press SPAWN and give your cryp a name to create one.
Once you have made a cryp, click on them to visit their stat page and teach them some SKILLS.
This homepage shows your constructs, joinable online games, PVE options and your items.\n
If you have no constructs yet, press SPAWN and give your construct a name to create one.
Once you have made a construct, click on them to visit their stat page and teach them some SKILLS.
The stat page also has descriptions of each skill and their effects.
cryps have 3 basic stats: hp, red damage and magic damage.
Toggle whether a cryp is selected for your team by clicking the coloured stripes next to the cryp or press 1,2,3.
constructs have 3 basic stats: hp, red damage and magic damage.
Toggle whether a construct is selected for your team by clicking the coloured stripes next to the construct or press 1,2,3.
Once you have a team ready press the New PVE Game button to start playing.
`;
const SKILL_PHASE_MESSAGE = `
A cryps battle has two main phases. This first phase is called the SKILL PHASE.
Your cryps are positioned on the left, your opponent's are on the right.
In the centre are your cryps' SKILLS, grayed out SKILLS are currently ON COOLDOWN.
A skill's cooldown reduces on every turn that cryp does not use a skill with a cooldown.
For the moment, drag ATTACK onto the opponent team to have your cryps attack them with red damage.
A constructs battle has two main phases. This first phase is called the SKILL PHASE.
Your constructs are positioned on the left, your opponent's are on the right.
In the centre are your constructs' SKILLS, grayed out SKILLS are currently ON COOLDOWN.
A skill's cooldown reduces on every turn that construct does not use a skill with a cooldown.
For the moment, drag ATTACK onto the opponent team to have your constructs attack them with red damage.
`;
// const TARGET_PHASE_MESSAGE = `
// This phase is the TARGET PHASE.
// In cryps you do not directly attack your opponent's cryps, you attack the opponent as a team
// and you and your opponent choose which cryp is the TARGET of each ability.
// Drag the incoming ATTACKS from the right hand side onto your own cryps.
// In constructs you do not directly attack your opponent's constructs, you attack the opponent as a team
// and you and your opponent choose which construct is the TARGET of each ability.
// Drag the incoming ATTACKS from the right hand side onto your own constructs.
// It's wise to spread the damage around!
// `;
@@ -44,9 +44,9 @@ const RESOLUTION_PHASE_MESSAGE = `
The second phase is called the RESOLUTION PHASE.
This phase happens automatically, every skill is RESOLVED in order of its SPEED.
This is important because attacks only RESOLVE while their caster is still able to use the skill,
a fast skill that does a small amount of damage may KO an opponent cryp, causing any SKILLS
a fast skill that does a small amount of damage may KO an opponent construct, causing any SKILLS
they have used to no longer RESOLVE!
Another example of this is the skill STUN. STUN causes an opponent cryp to be unable to use any
Another example of this is the skill STUN. STUN causes an opponent construct to be unable to use any
abilities for TWO TURNS including the turn it resolves on. In other words it lasts for the rest of the turn it resolves on
and the whole next turn.
Try it now!
@@ -54,10 +54,10 @@ Try it now!
const FINISH_PHASE_MESSAGE = `
gg! The game has now concluded, if you were the winner you have been awarded with a STAT REROLL ITEM.
You can use this to reroll a stat on a cryp which may be lacking.
You can use this to reroll a stat on a construct which may be lacking.
A good metric is that if a stat is more than 1/2 of its STAMINA that's a good roll.
Now that you have learned the basics, press BACKSPACE to return to the main menu
and experiment with some combinations of SKILLS or replace the ones your cryps know in the STAT PAGE.
and experiment with some combinations of SKILLS or replace the ones your constructs know in the STAT PAGE.
glhf!
`;