pve enum
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
const SET_ACCOUNT = 'SET_ACCOUNT';
|
||||
const setAccount = value => ({ type: SET_ACCOUNT, value });
|
||||
|
||||
const SET_CRYPS = 'SET_CRYPS';
|
||||
const setCryps = value => ({ type: SET_CRYPS, value });
|
||||
|
||||
const SET_ITEMS = 'SET_ITEMS';
|
||||
const setItems = value => ({ type: SET_ITEMS, value });
|
||||
|
||||
const SET_GAME = 'SET_GAME';
|
||||
const setGame = value => ({ type: SET_GAME, value });
|
||||
|
||||
const SET_ACTIVE_ITEM = 'SET_ACTIVE_ITEM';
|
||||
const setActiveItem = value => ({ type: SET_ACTIVE_ITEM, value });
|
||||
|
||||
const SET_ACTIVE_INCOMING = 'SET_ACTIVE_INCOMING';
|
||||
const setActiveIncoming = value => ({ type: SET_ACTIVE_INCOMING, value });
|
||||
|
||||
const SET_ACTIVE_SKILL = 'SET_ACTIVE_SKILL';
|
||||
const setActiveSkill = (crypId, skill) => ({ type: SET_ACTIVE_SKILL, value: crypId ? { crypId, skill } : null });
|
||||
|
||||
const SET_WS = 'SET_WS';
|
||||
const setWs = value => ({ type: SET_WS, value });
|
||||
|
||||
module.exports = {
|
||||
SET_ACCOUNT,
|
||||
setAccount,
|
||||
SET_CRYPS,
|
||||
setCryps,
|
||||
SET_ITEMS,
|
||||
setItems,
|
||||
SET_GAME,
|
||||
setGame,
|
||||
SET_ACTIVE_ITEM,
|
||||
setActiveItem,
|
||||
SET_ACTIVE_INCOMING,
|
||||
setActiveIncoming,
|
||||
SET_ACTIVE_SKILL,
|
||||
setActiveSkill,
|
||||
SET_WS,
|
||||
setWs,
|
||||
};
|
||||
@@ -24,7 +24,7 @@ function registerEvents(registry, events) {
|
||||
}
|
||||
|
||||
function setItems(items) {
|
||||
registry.set('items', items);
|
||||
registry.set('itemList', items);
|
||||
}
|
||||
|
||||
function setGameList(gameList) {
|
||||
|
||||
@@ -3,6 +3,7 @@ const Phaser = require('phaser');
|
||||
const Combat = require('./combat');
|
||||
const CrypRows = require('./cryp.row');
|
||||
const GameList = require('./game.list');
|
||||
const ItemList = require('./item.list');
|
||||
const StatSheet = require('./statsheet');
|
||||
|
||||
class CrypList extends Phaser.Scene {
|
||||
@@ -29,6 +30,10 @@ class CrypList extends Phaser.Scene {
|
||||
this.renderGameList();
|
||||
}
|
||||
|
||||
if (key === 'itemList') {
|
||||
return this.renderItemList();
|
||||
}
|
||||
|
||||
if (key === 'game' && this.scene.isActive()) {
|
||||
this.scene.sleep();
|
||||
this.scene.add('Combat', Combat);
|
||||
@@ -62,6 +67,19 @@ class CrypList extends Phaser.Scene {
|
||||
this.gameList = new GameList({ list: this, ws, cryps, gameList, events: this.game.events });
|
||||
}
|
||||
|
||||
renderItemList() {
|
||||
const ws = this.registry.get('ws');
|
||||
const itemList = this.registry.get('itemList');
|
||||
|
||||
if (this.itemList) {
|
||||
this.itemList.cleanup();
|
||||
this.itemList.destroy(true);
|
||||
}
|
||||
|
||||
this.itemList = new ItemList({ list: this, ws, itemList, events: this.game.events });
|
||||
}
|
||||
|
||||
|
||||
displaySkills(cryp) {
|
||||
if (cryp) {
|
||||
this.scene.add('StatSheet', StatSheet);
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
const Phaser = require('phaser');
|
||||
|
||||
const { TEXT, SKILLS, POSITIONS: { STATS } } = require('./constants');
|
||||
|
||||
class CrypPage extends Phaser.GameObjects.Group {
|
||||
constructor(scene, cryp) {
|
||||
super(scene);
|
||||
this.id = cryp.id;
|
||||
this.scene = scene;
|
||||
this.ws = scene.registry.get('ws');
|
||||
|
||||
const TEXT_MARGIN = STATS.textMargin();
|
||||
|
||||
const crypStat = (stat, i) => {
|
||||
const STAT_X = STATS.x();
|
||||
const STAT_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||
|
||||
const text = scene.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL);
|
||||
this.add(text);
|
||||
};
|
||||
|
||||
const knownSkill = (skill, i) => {
|
||||
const SKILL_X = STATS.knownX();
|
||||
const SKILL_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||
|
||||
const text = scene.add.text(SKILL_X, SKILL_Y, skill.skill, TEXT.NORMAL)
|
||||
.setInteractive();
|
||||
|
||||
text.on('pointerdown', () => {
|
||||
this.ws.sendCrypForget(cryp.id, skill.skill);
|
||||
});
|
||||
this.add(text);
|
||||
};
|
||||
|
||||
const learnable = (skill, i) => {
|
||||
const SKILL_X = STATS.learnableX();
|
||||
const SKILL_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||
|
||||
const text = scene.add.text(SKILL_X, SKILL_Y, `${skill.name}\n${skill.description}`, TEXT.NORMAL)
|
||||
.setInteractive();
|
||||
|
||||
text.on('pointerdown', () => {
|
||||
this.ws.sendCrypLearn(cryp.id, skill);
|
||||
});
|
||||
this.add(text);
|
||||
text.cryp = cryp;
|
||||
};
|
||||
|
||||
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
|
||||
this.add(scene.add.text(STATS.x(), STATS.y(), cryp.name, TEXT.HEADER));
|
||||
CRYP_STATS.forEach(crypStat);
|
||||
|
||||
this.add(scene.add.text(STATS.knownX(), STATS.y(), 'Skills', TEXT.HEADER));
|
||||
cryp.skills.forEach(knownSkill);
|
||||
|
||||
this.add(scene.add.text(STATS.learnableX(), STATS.y(), 'Learnable', TEXT.HEADER));
|
||||
SKILLS.LEARNABLE.forEach(learnable);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CrypPage;
|
||||
@@ -8,7 +8,7 @@ const {
|
||||
|
||||
class GameList extends Phaser.GameObjects.Group {
|
||||
constructor(args) {
|
||||
super(list);
|
||||
super(args.list);
|
||||
|
||||
const { list, events, ws, cryps, gameList } = args;
|
||||
|
||||
@@ -98,13 +98,13 @@ class GameList extends Phaser.GameObjects.Group {
|
||||
pve.on('pointerdown', () => {
|
||||
const team = cryps.filter(c => c.active).map(c => c.id);
|
||||
if (team.length === 0) return false;
|
||||
return ws.sendGamePve(team, 'normal');
|
||||
return ws.sendGamePve(team, 'Normal');
|
||||
});
|
||||
|
||||
boss.on('pointerdown', () => {
|
||||
const team = cryps.filter(c => c.active).map(c => c.id);
|
||||
if (team.length === 0) return false;
|
||||
return ws.sendGamePve(team, 'boss');
|
||||
return ws.sendGamePve(team, 'Boss');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user