Merge branch 'combos'

This commit is contained in:
ntr
2019-02-21 15:03:21 +11:00
30 changed files with 1388 additions and 588 deletions
+3 -3
View File
@@ -28,8 +28,8 @@ function registerEvents(registry, events, tutorial) {
registry.set('activeSkill', skill);
}
function setItems(items) {
registry.set('itemList', items);
function setVbox(items) {
registry.set('vbox', items);
}
function setZone(zone) {
@@ -177,7 +177,7 @@ function registerEvents(registry, events, tutorial) {
setActiveSkill,
setCryps,
setGame,
setItems,
setVbox,
setWs,
setGameList,
setZone,
+5 -5
View File
@@ -85,9 +85,9 @@ class CrypImage extends Phaser.GameObjects.Image {
scene.add.text(nameX, nameY, cryp.name, TEXT.NORMAL).setOrigin(team, 0);
// Add cryp stat bars
this.health = scene.add.existing(new StatBar(scene, this, 'HP'));
this.armour = scene.add.existing(new StatBar(scene, this, 'Armour'));
this.red_shield = scene.add.existing(new StatBar(scene, this, 'Red Shield'));
this.blue_shield = scene.add.existing(new StatBar(scene, this, 'Blue Shield'));
this.evasion = scene.add.existing(new StatBar(scene, this, 'Evasion'));
this.spellShield = scene.add.existing(new StatBar(scene, this, 'Spell Shield'));
this.effects = scene.add.existing(new Effects(scene, team, iter));
this.statusText = scene.add.text(statusX, statusY, '', TEXT.NORMAL);
@@ -116,9 +116,9 @@ class CrypImage extends Phaser.GameObjects.Image {
reduceDefense(amount, type) {
if (type === 'PhysDmg') {
this.armour.takeDamage(amount);
} else if (type === 'SpellDmg') {
this.spellShield.takeDamage(amount);
this.red_shield.takeDamage(amount);
} else if (type === 'BlueDmg') {
this.blue_shield.takeDamage(amount);
}
}
+14 -14
View File
@@ -17,8 +17,8 @@ const itemListWidth = () => Math.floor(CANVAS_WIDTH * 0.5);
const itemListHeight = () => Math.floor(CANVAS_HEIGHT * 0.5);
const itemListX = () => 0;
const itemListY = () => Math.floor(CANVAS_HEIGHT * 0.5);
const itemBlockWidth = () => Math.floor(itemListWidth() * 0.1);
const itemBlockHeight = () => Math.floor(itemListHeight() * 0.16);
const itemBlockWidth = () => Math.floor(itemListWidth() * 0.075);
const itemBlockHeight = () => Math.floor(itemListHeight() * 0.12);
const menuNavigationWidth = () => Math.floor(CANVAS_WIDTH * 0.5);
const menuNavigationHeight = () => Math.floor(CANVAS_HEIGHT * 0.3);
@@ -162,31 +162,31 @@ module.exports = {
[ { name: 'Amplify',
description: 'increase the magic damage dealt by a cryp' },
{ name: 'Attack',
description: 'a fast physical attack with phys dmg' },
description: 'a fast attack with red damage' },
{ name: 'Banish',
description:
'target cryp is prevented from casting any skills and taking any damage' },
{ name: 'Blast',
description: 'blast the target with magic damage' },
{ name: 'Block',
description: 'decreases incoming physical damage for 1T' },
description: 'decreases incoming red damage for 1T' },
{ name: 'Curse',
description: 'target cryp takes increased magic damage' },
{ name: 'Decay',
description:
'afflict a cryp with a spell damage based damage over time debuff' },
{ name: 'Drain',
description: 'drain hp from target cryp with a spell damage based debuff' },
'afflict a cryp with a blue damage based damage over time debuff' },
{ name: 'Siphon',
description: 'siphon hp from target cryp with a blue damage based debuff' },
{ name: 'Empower',
description: 'increase the physical damage dealt by a cryp' },
description: 'increase the red damage dealt by a cryp' },
{ name: 'Haste',
description: 'magical skill that increases speed of target cryp' },
{ name: 'Heal', description: 'heal a cryp with spell dmg' },
{ name: 'Heal', description: 'heal a cryp with blue damage' },
{ name: 'Hex',
description:
'magical based skill that prevents target cryp from using any skills' },
{ name: 'Parry',
description: 'prevents all physical damage for 1T' },
description: 'prevents all red damage for 1T' },
{ name: 'Purge',
description: 'remove magical buffs from target cryp' },
{ name: 'Purify',
@@ -198,14 +198,14 @@ module.exports = {
{ name: 'Slow',
description: 'magical skill that reduces speed of target cryp' },
{ name: 'Snare',
description: 'prevents physical skills from being used for 2T' },
description: 'prevents red skills from being used for 2T' },
{ name: 'Stun',
description:
'physical skill that prevents target cryp from using any skills' },
'red skill that prevents target cryp from using any skills' },
{ name: 'Throw',
description: 'stuns and makes the target take increased physical damage' },
description: 'stuns and makes the target take increased red damage' },
{ name: 'Triage',
description: 'grants a spell dmg based healing over time buff' }
description: 'grants a blue damage based healing over time buff' }
]
},
};
+1 -1
View File
@@ -29,7 +29,7 @@ function renderCryps() {
},
},
scene: [
Background,
// Background,
Header,
],
};
+9 -8
View File
@@ -24,22 +24,23 @@ class StatBar extends Phaser.GameObjects.Graphics {
super(scene);
this.crypObj = cryp;
this.type = type;
console.log(type);
if (type === 'HP') {
this.val = this.crypObj.cryp.hp.base;
this.max = this.crypObj.cryp.stamina.base;
this.max = this.crypObj.cryp.hp.base;
this.margin = 0;
} else if (type === 'Armour') {
this.val = this.crypObj.cryp.armour.base;
this.max = this.crypObj.cryp.armour.base;
} else if (type === 'Red Shield') {
this.val = this.crypObj.cryp.red_shield.base;
this.max = this.crypObj.cryp.red_shield.base;
this.margin = 1;
} else if (type === 'Blue Shield') {
this.val = this.crypObj.cryp.blue_shield.base;
this.max = this.crypObj.cryp.blue_shield.base;
this.margin = 2;
} else if (type === 'Evasion') {
this.val = this.crypObj.cryp.evasion.base;
this.max = this.crypObj.cryp.evasion.base;
this.margin = 2;
} else if (type === 'Spell Shield') {
this.val = this.crypObj.cryp.spell_shield.base;
this.max = this.crypObj.cryp.spell_shield.base;
this.margin = 3;
}
const { statTextX, statTextY } = statTextCoord(cryp.team, cryp.iter, this.margin);
+27 -9
View File
@@ -5,23 +5,36 @@ const {
COLOURS,
} = require('../constants');
function FindColour(item) {
// Future add skills and use a constants lookup file ??
switch (item) {
case 'Green': return 0x61B329;
case 'Red': return 0xCC3333;
case 'Blue': return 0x6633FF;
default: return 0x222222;
}
}
class Item extends Phaser.GameObjects.Container {
constructor(scene, action, count, x, y, width, height) {
constructor(scene, item, index, x, y, width, height) {
super(scene, x, y);
this.state = 'deselect';
this.action = action;
this.scene = scene;
this.item = item;
this.index = index;
this.origX = x;
this.origY = y;
this.width = width;
this.height = height;
this.colour = FindColour(item);
this.box = scene.add
.rectangle(0, 0, width, height, 0x222222);
.rectangle(0, 0, width, height, this.colour);
this.text = scene.add
// .text(0, 0, `${action} x${count}`, TEXT.NORMAL)
.text(0, 0, `x${count}`, TEXT.NORMAL)
.text(0, 0, `${item}`, TEXT.NORMAL)
.setOrigin(0.5, 0.5);
this.add(this.box);
@@ -31,10 +44,15 @@ class Item extends Phaser.GameObjects.Container {
this.setInteractive();
}
changeOrigin(x, y) {
this.origX = x + this.width / 2;
this.origY = y + this.height / 2;
}
clickHandler() {
this.scene.activeItem = this;
// Set the main context to display the item info
this.scene.registry.set('itemInfo', this.action);
this.scene.registry.set('itemInfo', this.item);
this.select();
}
@@ -42,7 +60,7 @@ class Item extends Phaser.GameObjects.Container {
this.scene.children.list.forEach((item) => {
if (item.state === 'select') item.deselect();
});
this.box.setFillStyle(COLOURS.SELECT);
// this.box.setFillStyle(COLOURS.SELECT);
this.state = 'select';
}
@@ -50,12 +68,12 @@ class Item extends Phaser.GameObjects.Container {
this.scene.children.list.forEach((item) => {
if (item.state === 'select') item.deselect();
});
this.box.setFillStyle(0xff0000);
this.box.setFillStyle(0x222222);
this.state = 'activate';
}
deselect() {
this.box.setFillStyle(0x222222);
this.box.setFillStyle(this.colour);
this.state = 'deselect';
}
}
+171 -40
View File
@@ -16,15 +16,34 @@ const ITEM_WIDTH = ITEM_LIST.itemWidth();
const ITEM_HEIGHT = ITEM_LIST.itemHeight();
const INV_X = X + ITEM_WIDTH * 0.325;
const INV_Y = Y + ITEM_HEIGHT * 1.5;
const INV_Y = Y + ITEM_HEIGHT;
const INV_ROWS = 3;
const INV_COLUMNS = 5;
const INV_COLUMNS = 3;
const COMB_X = INV_X + ITEM_WIDTH * 6.75;
const COMB_X = INV_X + ITEM_WIDTH * 5.75;
const COMB_Y = INV_Y;
const COMB_ROWS = 2;
const COMB_COLUMNS = 2;
const BOX_X = X + ITEM_WIDTH * 2;
const BOX_Y = Y + ITEM_HEIGHT * 5;
const BOX_ROWS = 3;
const BOX_COLUMNS = 6;
const drawVbox = (graphics) => {
const boxDrawX = BOX_X - ITEM_WIDTH * 0.05;
const boxDrawY = BOX_Y - ITEM_HEIGHT * 0.05;
for (let i = 0; i <= BOX_COLUMNS; i += 1) {
const x = boxDrawX + i * ITEM_WIDTH * 1.1;
graphics.lineBetween(x, boxDrawY, x, boxDrawY + ITEM_HEIGHT * 1.1 * BOX_ROWS);
}
for (let i = 0; i <= BOX_ROWS; i += 1) {
const y = boxDrawY + i * ITEM_HEIGHT * 1.1;
graphics.lineBetween(boxDrawX, y, boxDrawX + ITEM_WIDTH * 1.1 * BOX_COLUMNS, y);
}
};
const drawInventory = (graphics) => {
const invDrawX = INV_X - ITEM_WIDTH * 0.05;
const invDrawY = INV_Y - ITEM_HEIGHT * 0.05;
@@ -55,16 +74,40 @@ class CombinerHitBox extends Phaser.GameObjects.Rectangle {
constructor(scene, x, y, i) {
super(scene, x, y, ITEM_WIDTH, ITEM_HEIGHT, 0x000000);
this.setOrigin(0);
this.x = x;
this.y = y;
this.slot = i;
this.item = false;
this.itemSelect = () => this.setFillStyle(0x222222);
this.itemDeselect = () => this.setFillStyle(0x000000);
}
allocate(item) {
if (this.item) this.deallocate();
item.setPosition(this.x + item.width / 2, this.y + item.height / 2);
this.item = item;
}
deallocate() {
if (this.item) this.item.setPosition(this.item.origX, this.item.origY);
this.item = false;
}
}
class DeleteHitBox extends Phaser.GameObjects.Rectangle {
constructor(scene, x, y) {
super(scene, x, y, ITEM_WIDTH * 1.25, ITEM_HEIGHT * 1.25, 0x222222);
this.setOrigin(0);
this.itemSelect = () => this.setFillStyle(0xff0000);
this.itemDeselect = () => this.setFillStyle(0x222222);
}
}
const itemCheckHitbox = (scene, pointer) => {
const { list } = scene.scene.get('MenuCrypList').children;
const hitboxes = list.filter(c => c.cryp)
.concat(scene.children.list.filter(c => c instanceof CombinerHitBox));
.concat(scene.children.list.filter(c => c instanceof CombinerHitBox || c instanceof DeleteHitBox));
let found;
for (let i = 0; i < hitboxes.length; i += 1) {
@@ -84,77 +127,165 @@ class ItemList extends Phaser.Scene {
}
updateData(parent, key, data) {
if (key === 'itemList') {
if (key === 'vbox') {
this.registry.events.off('changedata', this.updateData, this);
this.registry.events.off('setdata', this.updateData, this);
this.scene.restart(data);
}
}
create(itemList) {
if (!itemList) return false;
create(vbox) {
this.registry.events.on('changedata', this.updateData, this);
this.registry.events.on('setdata', this.updateData, this);
this.addStatic();
this.addItems(itemList);
this.addClickHandlers(itemList);
return this;
}
if (!vbox.bound) return false;
this.combinerItems = this.registry.get('combinerItems');
if (!this.combinerItems || vbox.bound.length < this.registry.get('boundLength')) {
this.combinerItems = [-1, -1, -1];
}
this.registry.set('boundLength', vbox.bound.length);
const ws = this.registry.get('ws');
addStatic() {
// Static Elements
const graphics = this.add.graphics();
graphics.lineStyle(5, 0x808080, 1.0);
drawCombiner(graphics);
drawInventory(graphics);
this.add.text(X + WIDTH / 4, Y + HEIGHT / 8, 'Inventory', TEXT.HEADER);
this.add.text(X + WIDTH * 3 / 4, Y + HEIGHT / 8, 'Combiner', TEXT.HEADER);
}
drawVbox(graphics);
addItems(itemList) {
const actions = countBy(itemList, i => i.action);
this.add.text(X + WIDTH * 0.1, Y, 'Inventory', TEXT.HEADER);
this.add.text(X + WIDTH * 0.47, Y, 'Combiner', TEXT.HEADER);
this.add.text(X + WIDTH * 0.35, Y + HEIGHT / 2, 'Varibox', TEXT.HEADER);
for (let i = 0; i < (COMB_COLUMNS * COMB_ROWS); i += 1) {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % COMB_COLUMNS) + INV_X + ITEM_WIDTH * 6.75;
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / COMB_COLUMNS) + INV_Y;
const reroll = this.add
.rectangle(WIDTH * 0.01, Y + HEIGHT * 0.775, ITEM_WIDTH * 1.25, ITEM_HEIGHT * 1.25, 0x222222)
.setInteractive()
.setOrigin(0)
.on('pointerdown', () => this.registry.get('ws').sendVboxDiscard(vbox.game));
this.add.text(reroll.getCenter().x, reroll.getCenter().y, 'Reroll', TEXT.HEADER)
.setOrigin(0.5, 0.5);
const combine = this.add
.rectangle(ITEM_WIDTH * 1.1 + COMB_X, ITEM_HEIGHT * 1.1 + COMB_Y, ITEM_WIDTH, ITEM_HEIGHT, 0x222222)
.setInteractive()
.setOrigin(0)
.on('pointerdown', () => {
ws.sendVboxCombine(vbox.game, this.combinerItems);
this.combinerItems = [-1, -1, -1];
this.children.list.filter(obj => obj instanceof CombinerHitBox).forEach(cBox => cBox.deallocate());
});
this.add.text(combine.getCenter().x, combine.getCenter().y, 'C', TEXT.HEADER)
.setOrigin(0.5, 0.5);
for (let i = 0; i < 3; i += 1) {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % COMB_COLUMNS) + COMB_X;
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / COMB_COLUMNS) + COMB_Y;
this.add.existing(new CombinerHitBox(this, ITEM_X, ITEM_Y, i));
}
const del = this.add.existing(new DeleteHitBox(this, WIDTH * 0.01, Y + HEIGHT * 0.6));
this.add.text(del.getCenter().x, del.getCenter().y, 'Del', TEXT.HEADER)
.setOrigin(0.5, 0.5);
Object.keys(actions).forEach((action, i) => {
// Generate Items
vbox.bound.forEach((action, i) => {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % INV_COLUMNS) + INV_X + ITEM_WIDTH * 0.5;
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / INV_COLUMNS) + INV_Y + ITEM_HEIGHT * 0.5;
const itemBox = new Item(this, action, actions[action], ITEM_X, ITEM_Y, ITEM_WIDTH, ITEM_HEIGHT);
const itemBox = new Item(this, action, i, ITEM_X, ITEM_Y, ITEM_WIDTH, ITEM_HEIGHT);
this.input.setDraggable(itemBox);
this.add.existing(itemBox);
});
}
addClickHandlers(itemList) {
const ws = this.registry.get('ws');
this.input.on('dragstart', (pointer, box) => {
if (!(box instanceof Item)) return false;
box.clickHandler();
vbox.free.forEach((action, i) => {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % BOX_COLUMNS) + BOX_X + ITEM_WIDTH * 0.5;
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / BOX_COLUMNS) + BOX_Y + ITEM_HEIGHT * 0.5;
const itemBox = new Item(this, action, i, ITEM_X, ITEM_Y, ITEM_WIDTH, ITEM_HEIGHT);
itemBox
.setInteractive()
.on('pointerdown', () => {
ws.sendVboxAccept(vbox.game, i);
});
this.add.existing(itemBox);
});
// Restore previous combiner item slots
this.combinerItems.forEach((index, i) => {
if (index === -1) return false;
const item = this.children.list.filter(obj => obj instanceof Item).find(it => it.index === index);
const hitBox = this.children.list.filter(obj => obj instanceof CombinerHitBox).find(hb => hb.slot === i);
hitBox.allocate(item);
return true;
});
this.input.on('drag', (pointer, box, dragX, dragY) => {
if (!(box instanceof Item)) return false;
box.setPosition(dragX, dragY);
// allocation functions
const allocate = (item, hitBox) => {
hitBox.allocate(item);
this.combinerItems[hitBox.slot] = item.index;
this.registry.set('combinerItems', this.combinerItems);
};
const deallocate = (item) => {
const clearIndex = this.combinerItems.indexOf(item.index);
if (clearIndex !== -1) {
this.children.list.filter(obj => obj instanceof CombinerHitBox)
.forEach((cBox) => {
if (cBox.item === item) cBox.deallocate();
});
this.combinerItems[clearIndex] = -1;
}
item.setPosition(item.origX, item.origY);
};
const findUnallocated = () => {
for (let i = 0; i <= 2; i += 1) {
if (this.combinerItems[i] === -1) {
return this.children.list.filter(obj => obj instanceof CombinerHitBox).find(hb => hb.slot === i);
}
} return false;
};
// Add Handlers
this.input.on('dragstart', (pointer, item) => {
if (!(item instanceof Item)) return false;
item.clickHandler();
return true;
});
this.input.on('drag', (pointer, item, dragX, dragY) => {
if (!(item instanceof Item)) return false;
item.setPosition(dragX, dragY);
const hitBox = itemCheckHitbox(this, pointer);
if (hitBox) hitBox.itemSelect();
return true;
});
this.input.on('dragend', (pointer, box) => {
if (!(box instanceof Item)) return false;
box.deselect();
this.input.on('dragend', (pointer, item) => {
if (!(item instanceof Item)) return false;
item.deselect();
// Allocate to combiner if clicked without movement form inventory (return 0)
if (!Math.hypot(item.x - item.origX, item.y - item.origY)) {
const cBox = findUnallocated();
if (cBox) allocate(item, cBox);
return true;
}
// Check for hitboxes
const hitBox = itemCheckHitbox(this, pointer);
box.setPosition(box.origX, box.origY);
if (!hitBox) return false;
if (hitBox instanceof CombinerHitBox) console.log(`Moved item into slot ${hitBox.slot}`);
else ws.sendItemUse(itemList.find(li => li.action === box.action).id, hitBox.cryp.id);
hitBox.itemDeselect();
if (hitBox) {
hitBox.itemDeselect();
// Allocate to specific combiner slot
if (hitBox instanceof CombinerHitBox) {
allocate(item, hitBox);
return true;
}
// Allocate to cryp hitbox
if (hitBox instanceof DeleteHitBox) ws.sendVboxDrop(vbox.game, item.index);
else ws.sendVboxApply(vbox.game, hitBox.cryp.id, item.index);
}
// If the item hasn't been allocated deallocate the item
// Scene will restart if there is vbox change
deallocate(item);
return true;
});
return this;
}
cleanUp() {
+4 -4
View File
@@ -113,10 +113,10 @@ class MenuCrypList extends Phaser.Scene {
.setOrigin(0.5, 0.5));
const CRYP_STATS = [
cryp.stamina,
cryp.armour,
cryp.spell_shield,
cryp.phys_dmg,
cryp.spell_dmg,
cryp.red_shield,
cryp.blue_shield,
cryp.red_damage,
cryp.blue_damage,
cryp.speed,
];
CRYP_STATS.forEach((stat, j) => crypStat(stat, j, crypInfo));
+2 -1
View File
@@ -25,6 +25,7 @@ const MAIN_MENU_SCENES = [
'ItemInfo',
];
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
class Menu extends Phaser.Scene {
constructor() {
@@ -37,7 +38,7 @@ class Menu extends Phaser.Scene {
// When we load the menu request the latest items
// Item list will restart when the data comes in
this.registry.get('ws').sendAccountItems();
this.registry.get('ws').sendVboxState(NULL_UUID);
this.scene.manager.add('MenuCrypList', MenuCrypList, true);
this.scene.manager.add('MenuNavigation', MenuNavigation, true);
+31 -31
View File
@@ -2,79 +2,79 @@ const passiveNodes = [
{ x: 860, y: 1011, id: 'CMED1', alloc: false, text: '5% Increased Speed for Chaos Slow skills, 5% Increased Slow Effect'},
{ x: 905, y: 970, id: 'CSTAT7', alloc: false, text: '+2 Chaos Stat'},
{ x: 940, y: 917.5, id: 'CSTAT8', alloc: false, text: '+2 Chaos Stat'},
{ x: 950, y: 1172.5, id: 'CMED2', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Healing Skills'},
{ x: 955, y: 1120, id: 'CSDMG1', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 965, y: 1082.5, id: 'CSDMG2', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 950, y: 1172.5, id: 'CMED2', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Healing Skills'},
{ x: 955, y: 1120, id: 'CSDMG1', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 965, y: 1082.5, id: 'CSDMG2', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 970, y: 872.5, id: 'CSTAT9', alloc: false, text: '+2 Chaos Stat'},
{ x: 975, y: 1012.5, id: 'CSTAT6', alloc: false, text: '+2 Chaos Stat'},
{ x: 995, y: 1062.5, id: 'CSDMG3', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 995, y: 1062.5, id: 'CSDMG3', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1000, y: 1150, id: 'CHEAL1', alloc: false, text: '+5% Increased Healing'},
{ x: 1005, y: 812.5, id: 'CMED20', alloc: false, text: '5% Increased Speed for Healing skills, 5% Increased Stamina'},
{ x: 1024.5, y: 1122.5, id: 'CHEAL2', alloc: false, text: '+5% Increased Healing'},
{ x: 1036.5, y: 896.5, id: 'CMED19', alloc: false, text: '5% Increased Speed for Healing skills, 5% Increased Stamina'},
{ x: 1036.5, y: 1042.5, id: 'CMED18', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Healing Skills'},
{ x: 1036.5, y: 1042.5, id: 'CMED18', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Healing Skills'},
{ x: 1036.5, y: 1082.5, id: 'CHEAL3', alloc: false, text: '+5% Increased Healing'},
{ x: 1041.5, y: 772.5, id: 'CSTAT10', alloc: false, text: '+2 Chaos Stat'},
{ x: 1055, y: 1327.5, id: 'CMED3', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Banish Skills'},
{ x: 1055, y: 1327.5, id: 'CMED3', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Banish Skills'},
{ x: 1066.5, y: 939.5, id: 'CHEAL5', alloc: false, text: '+5% Increased Healing'},
{ x: 1067.5, y: 995, id: 'CHEAL4', alloc: false, text: '+5% Increased Healing'},
{ x: 1070, y: 1250, id: 'CSTAT4', alloc: false, text: '+2 Chaos Stat'},
{ x: 1072.5, y: 840.5, id: 'CHEAL8', alloc: false, text: '+5% Increased Healing'},
{ x: 1087.5, y: 700, id: 'CSTAT11', alloc: false, text: '+2 Chaos Stat'},
{ x: 1097.5, y: 1052.5, id: 'CSDMG4', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1097.5, y: 1052.5, id: 'CSDMG4', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1102.5, y: 1140, id: 'CSTAT5', alloc: false, text: '+2 Chaos Stat'},
{ x: 1102.5, y: 917.5, id: 'CHEAL6', alloc: false, text: '+5% Increased Healing'},
{ x: 1115, y: 1332.5, id: 'CSTAT1', alloc: false, text: '+2 Chaos Stat'},
{ x: 1115, y: 875, id: 'CHEAL7', alloc: false, text: '+5% Increased Healing'},
{ x: 1130, y: 640, id: 'CSTAT12', alloc: false, text: '+2 Chaos Stat'},
{ x: 1145, y: 1287.5, id: 'CSTAT3', alloc: false, text: '+2 Chaos Stat'},
{ x: 1145, y: 1057.5, id: 'CSDMG5', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1145, y: 1057.5, id: 'CSDMG5', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1175, y: 1332.5, id: 'CSTAT2', alloc: false, text: '+2 Chaos Stat'},
{ x: 1180, y: 1247.5, id: 'CMED10', alloc: false, text: '5% Increased Speed for Banish Spells, 5% Increased Stamina'},
{ x: 1180, y: 1247.5, id: 'CMED10', alloc: false, text: '5% Increased Speed for Banish Blues, 5% Increased Stamina'},
{ x: 1180, y: 950, id: 'CMED14', alloc: false, text: '5% Increased Speed for Chaos Slow skills, 5% Increased Speed for Banish Skills'},
{ x: 1195, y: 875, id: 'CHEAL9', alloc: false, text: '+5% Increased Healing'},
{ x: 1196.5, y: 635, id: 'CMED21', alloc: false, text: '5% Increased Effect of Slow, 5% Increased Stamina'},
{ x: 1205, y: 1062.5, id: 'CSDMG6', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1205, y: 1062.5, id: 'CSDMG6', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1212.5, y: 1200, id: 'CHEAL14', alloc: false, text: '+5% Increased Healing'},
{ x: 1231.5, y: 590, id: 'CSTAT14', alloc: false, text: '+2 Chaos Stat'},
{ x: 1235, y: 772.5, id: 'CHEAL12', alloc: false, text: '+5% Increased Healing'},
{ x: 1240, y: 1225, id: 'CPHYS1', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1240, y: 1322.5, id: 'CMED4', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Stamina'},
{ x: 1240, y: 1322.5, id: 'CMED4', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Stamina'},
{ x: 1258.5, y: 1107.5, id: 'CHEAL15', alloc: false, text: '+5% Increased Healing'},
{ x: 1260, y: 917.5, id: 'CHEAL10', alloc: false, text: '+5% Increased Healing'},
{ x: 1263, y: 520, id: 'CLRG4', alloc: false, text: 'Damaging spells have a 20% chance to inflict slow'},
{ x: 1273.5, y: 1057.5, id: 'CMED13', alloc: false, text: '5% Increased Speed for Banish Spells, 5% Increased Speed for Damaging Spells'},
{ x: 1275, y: 1167.5, id: 'CMED11', alloc: false, text: '5% Increased Speed for Banish Spells, 5% Increased Stamina'},
{ x: 1275, y: 947.5, id: 'CMED15', alloc: false, text: '5% Increased Speed for Chaos Slow skills, 5% Increased Speed for Damaging Spells'},
{ x: 1277.5, y: 872.5, id: 'CMED16', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Healing Skills'},
{ x: 1263, y: 520, id: 'CLRG4', alloc: false, text: 'Damaging blues have a 20% chance to inflict slow'},
{ x: 1273.5, y: 1057.5, id: 'CMED13', alloc: false, text: '5% Increased Speed for Banish Blues, 5% Increased Speed for Damaging Blues'},
{ x: 1275, y: 1167.5, id: 'CMED11', alloc: false, text: '5% Increased Speed for Banish Blues, 5% Increased Stamina'},
{ x: 1275, y: 947.5, id: 'CMED15', alloc: false, text: '5% Increased Speed for Chaos Slow skills, 5% Increased Speed for Damaging Blues'},
{ x: 1277.5, y: 872.5, id: 'CMED16', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Healing Skills'},
{ x: 1278.5, y: 812.5, id: 'CHEAL11', alloc: false, text: '+5% Increased Healing'},
{ x: 1280, y: 732.5, id: 'CHEAL13', alloc: false, text: '+5% Increased Healing'},
{ x: 1281.5, y: 1002.5, id: 'CSDMG7', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1281.5, y: 1002.5, id: 'CSDMG7', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1284, y: 640, id: 'CSTAT15', alloc: false, text: '+2 Chaos Stat'},
{ x: 1298.5, y: 1107.5, id: 'CPHYS4', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1302.5, y: 917.5, id: 'CSDMG8', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1302.5, y: 917.5, id: 'CSDMG8', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1305, y: 1307.5, id: 'CPHYS2', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1306, y: 1347.5, id: 'CSDMG10', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1306, y: 1347.5, id: 'CSDMG10', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1315, y: 762.5, id: 'CMED17', alloc: false, text: '5% Increased Speed for Healing skills, 5% Increased Stamina'},
{ x: 1326.5, y: 590, id: 'CSTAT16', alloc: false, text: '+2 Chaos Stat'},
{ x: 1346.5, y: 635, id: 'CMED22', alloc: false, text: '5% Increased Effect of Slow, 5% Increased Stamina'},
{ x: 1348.5, y: 535, id: 'CSTAT13', alloc: false, text: '+2 Chaos Stat'},
{ x: 1355, y: 1322.5, id: 'CMED5', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Stamina'},
{ x: 1360, y: 1002.5, id: 'CSDMG9', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1355, y: 1322.5, id: 'CMED5', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Stamina'},
{ x: 1360, y: 1002.5, id: 'CSDMG9', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1399.5, y: 1107.5, id: 'CPHYS5', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1400, y: 807.5, id: 'CMED24', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Healing Skills'},
{ x: 1400, y: 807.5, id: 'CMED24', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Healing Skills'},
{ x: 1409.5, y: 1312.5, id: 'CPHYS3', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1410, y: 1347.5, id: 'CSDMG11', alloc: false, text: '+5% Increased Spell Damage'},
{ x: 1410, y: 532.5, id: 'CMED23', alloc: false, text: '5% Increased Speed for Banish Spells, 5% Increased Effect of Slow'},
{ x: 1410, y: 1347.5, id: 'CSDMG11', alloc: false, text: '+5% Increased Blue Damage'},
{ x: 1410, y: 532.5, id: 'CMED23', alloc: false, text: '5% Increased Speed for Banish Blues, 5% Increased Effect of Slow'},
{ x: 1420, y: 732.5, id: 'CSTAT19', alloc: false, text: '+2 Chaos Stat'},
{ x: 1430, y: 1205, id: 'CPHYS7', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1447.5, y: 765, id: 'CMED25', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Speed for Healing Skills'},
{ x: 1452.5, y: 1322.5, id: 'CMED6', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Stamina'},
{ x: 1447.5, y: 765, id: 'CMED25', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Speed for Healing Skills'},
{ x: 1452.5, y: 1322.5, id: 'CMED6', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Stamina'},
{ x: 1455, y: 1267.5, id: 'CSTAT33', alloc: false, text: '+2 Chaos Stat'},
{ x: 1455, y: 1147.5, id: 'CMED12', alloc: false, text: '5% Increased Speed for Banish Spells, 5% Increased Stamina'},
{ x: 1455, y: 1147.5, id: 'CMED12', alloc: false, text: '5% Increased Speed for Banish Blues, 5% Increased Stamina'},
{ x: 1455, y: 1042.5, id: 'CSTAT35', alloc: false, text: '+2 Chaos Stat'},
{ x: 1457.5, y: 975, id: 'CSTAT37', alloc: false, text: '+2 Chaos Stat'},
{ x: 1462.5, y: 825, id: 'CLRG3', alloc: false, text: '20% critical strike chance for spells'},
{ x: 1462.5, y: 825, id: 'CLRG3', alloc: false, text: '20% critical strike chance for blues'},
{ x: 1485, y: 640, id: 'CSTAT17', alloc: false, text: '+2 Chaos Stat'},
{ x: 1500, y: 1110, id: 'CPHYS6', alloc: false, text: '+2% Reduced Physical Damage Taken'},
{ x: 1505, y: 1242.5, id: 'CSTAT32', alloc: false, text: '+2 Chaos Stat'},
@@ -85,8 +85,8 @@ const passiveNodes = [
{ x: 1555, y: 732.5, id: 'CSTAT18', alloc: false, text: '+2 Chaos Stat'},
{ x: 1597.5, y: 827.5, id: 'CSTAT21', alloc: false, text: '+2 Chaos Stat'},
{ x: 1607.5, y: 1277.5, id: 'CSTAT30', alloc: false, text: '+2 Chaos Stat'},
{ x: 1612.5, y: 1137.5, id: 'CLRG1', alloc: false, text: 'When you take physical damage there is a 20% chance to heal for 150% of physical damage taken'},
{ x: 1612.5, y: 955, id: 'CLRG2', alloc: false, text: 'Your healing spells have a 20% chance to increase ally speed by 100%'},
{ x: 1612.5, y: 1137.5, id: 'CLRG1', alloc: false, text: 'When you take red damage there is a 20% chance to heal for 150% of red damage taken'},
{ x: 1612.5, y: 955, id: 'CLRG2', alloc: false, text: 'Your healing blues have a 20% chance to increase ally speed by 100%'},
{ x: 1657.5, y: 822.5, id: 'CSTAT22', alloc: false, text: '+2 Chaos Stat'},
{ x: 1657.5, y: 1312.5, id: 'CSTAT29', alloc: false, text: '+2 Chaos Stat'},
{ x: 1685, y: 1187.5, id: 'CSTAT27', alloc: false, text: '+2 Chaos Stat'},
@@ -94,7 +94,7 @@ const passiveNodes = [
{ x: 1690, y: 1117.5, id: 'CSTAT26', alloc: false, text: '+2 Chaos Stat'},
{ x: 1705, y: 960, id: 'CSTAT24', alloc: false, text: '+2 Chaos Stat'},
{ x: 1712.5, y: 850, id: 'CMED9', alloc: false, text: '5% Increased Speed for Healing skills, 5% Increased Stamina'},
{ x: 1717.5, y: 1267.5, id: 'CMED7', alloc: false, text: '5% Increased Speed for Damaging Spells, 5% Increased Stamina'},
{ x: 1717.5, y: 1267.5, id: 'CMED7', alloc: false, text: '5% Increased Speed for Damaging Blues, 5% Increased Stamina'},
{ x: 1725, y: 1222.5, id: 'CSTAT28', alloc: false, text: '+2 Chaos Stat'},
{ x: 1727.5, y: 1062.5, id: 'CMED8', alloc: false, text: '5% Increased Speed for Chaos Slow skills, 5% Increased Speed for Banish Skills'},
{ x: 1737.5, y: 917.5, id: 'CSTAT23', alloc: false, text: '+2 Chaos Stat'},
+4 -4
View File
@@ -66,11 +66,11 @@ class StatSheet extends Phaser.Scene {
const CRYP_STATS = [
cryp.stamina,
cryp.armour,
cryp.spell_shield,
cryp.red_shield,
cryp.blue_shield,
cryp.evasion,
cryp.phys_dmg,
cryp.spell_dmg,
cryp.red_damage,
cryp.blue_damage,
cryp.speed,
];
+40 -18
View File
@@ -1,6 +1,7 @@
const toast = require('izitoast');
const cbor = require('borc');
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://cryps.gg/ws' : 'ws://localhost:40000';
function errorToast(err) {
@@ -44,10 +45,6 @@ function createSocket(events) {
send({ method: 'account_cryps', params: {} });
}
function sendAccountItems() {
send({ method: 'account_items', params: {} });
}
function sendAccountZone() {
send({ method: 'account_zone', params: {} });
}
@@ -88,6 +85,31 @@ function createSocket(events) {
send({ method: 'cryp_unspec', params: { id, spec } });
}
function sendVboxState(gameId) {
send({ method: 'vbox_state', params: { game_id: gameId } });
}
function sendVboxAccept(gameId, i) {
send({ method: 'vbox_accept', params: { game_id: gameId, index: i } });
}
function sendVboxApply(gameId, crypId, index) {
send({ method: 'vbox_apply', params: { game_id: gameId, cryp_id: crypId, index } });
}
function sendVboxDiscard(gameId) {
send({ method: 'vbox_discard', params: { game_id: gameId } });
}
function sendVboxCombine(gameId, indices) {
send({ method: 'vbox_combine', params: { game_id: gameId, indices } });
}
function sendVboxDrop(gameId, index) {
send({ method: 'vbox_drop', params: { game_id: gameId, index } });
}
function sendPressR() {
send({ method: 'press_r', params: { } });
@@ -110,10 +132,6 @@ function createSocket(events) {
events.setActiveSkill(null);
}
function sendItemUse(item, target) {
send({ method: 'item_use', params: { item, target } });
}
function sendZoneCreate() {
send({ method: 'zone_create', params: {} });
}
@@ -136,7 +154,7 @@ function createSocket(events) {
account = login;
events.setAccount(login);
sendAccountCryps();
sendGameJoinableList();
// sendGameJoinableList();
}
function accountCryps(response) {
@@ -162,16 +180,17 @@ function createSocket(events) {
const [structName, game] = response;
}
function accountItems(response) {
const [structName, items] = response;
events.setItems(items);
}
function zoneState(response) {
const [structName, zone] = response;
events.setZone(zone);
}
function vboxState(response) {
const [structName, vbox] = response;
console.log(vbox);
events.setVbox(vbox);
}
// -------------
// Setup
// -------------
@@ -188,11 +207,10 @@ function createSocket(events) {
account_login: accountLogin,
account_create: accountLogin,
account_cryps: accountCryps,
account_items: accountItems,
zone_create: res => console.log(res),
zone_state: zoneState,
zone_close: res => console.log(res),
vbox_state: vboxState,
};
function errHandler(error) {
@@ -268,7 +286,6 @@ function createSocket(events) {
sendAccountCreate,
sendAccountDemo,
sendAccountCryps,
sendAccountItems,
sendAccountZone,
sendGameState,
sendGamePve,
@@ -280,11 +297,16 @@ function createSocket(events) {
sendCrypSpawn,
sendCrypLearn,
sendCrypForget,
sendItemUse,
sendSpecForget,
sendZoneCreate,
sendZoneJoin,
sendZoneClose,
sendVboxState,
sendVboxAccept,
sendVboxApply,
sendVboxDrop,
sendVboxCombine,
sendVboxDiscard,
connect,
};
}
+2 -2
View File
@@ -19,7 +19,7 @@ This homepage shows your cryps, joinable online games, PVE options and your item
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.
The stat page also has descriptions of each skill and their effects.
cryps have 3 basic stats: stamina, physical damage and magic damage.
cryps have 3 basic stats: stamina, 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.
Once you have a team ready press the New PVE Game button to start playing.
`;
@@ -29,7 +29,7 @@ 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 physical damage.
For the moment, drag ATTACK onto the opponent team to have your cryps attack them with red damage.
`;
// const TARGET_PHASE_MESSAGE = `