|
@@ -4,99 +4,54 @@
|
|
/* eslint-disable no-console */
|
|
/* eslint-disable no-console */
|
|
import Phaser from "phaser";
|
|
import Phaser from "phaser";
|
|
import logoImg from "./assets/twelveHeroes_cover.png";
|
|
import logoImg from "./assets/twelveHeroes_cover.png";
|
|
-import allHeroes from "./assets/all-heroes.json";
|
|
|
|
|
|
+
|
|
import '@babel/polyfill';
|
|
import '@babel/polyfill';
|
|
|
|
|
|
-const Faction = {
|
|
|
|
- HUMANS: 'Humans',
|
|
|
|
- ELVES: 'Elves',
|
|
|
|
- ORCS: 'Orcs',
|
|
|
|
- MECA: 'Meca',
|
|
|
|
- NONE: 'None',
|
|
|
|
-
|
|
|
|
-};
|
|
|
|
-Object.freeze(Faction);
|
|
|
|
-
|
|
|
|
-class Hero {
|
|
|
|
- constructor(name, cost, power, faction, ability, isDraftMode) {
|
|
|
|
- this.name = name;
|
|
|
|
- this.cost = cost;
|
|
|
|
- this.power = power;
|
|
|
|
- this.faction = faction;
|
|
|
|
- this.ability = ability;
|
|
|
|
- this.isDraftMode = isDraftMode;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-class Ability {
|
|
|
|
- constructor(abilityName, abilityHook, isActivationOptionnal, description) {
|
|
|
|
- this.abilityName = abilityName;
|
|
|
|
- this.abilityHook = abilityHook;
|
|
|
|
- this.isActivationOptionnal = isActivationOptionnal;
|
|
|
|
- this.description = description;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-let abilitiesMap = new Map();
|
|
|
|
-allHeroes.abilities.forEach(ability => {
|
|
|
|
- let abilityObj = new Ability(ability.abilityName,
|
|
|
|
- ability.abilityHook,
|
|
|
|
- ability.optionnal,
|
|
|
|
- ability['abilityDesc-FR']);
|
|
|
|
- abilitiesMap.set(ability.abilityName, abilityObj);
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-console.log('Hello Abilities : ', abilitiesMap);
|
|
|
|
-
|
|
|
|
-let heroesSet = new Set();
|
|
|
|
-allHeroes.heroes.forEach(hero => {
|
|
|
|
- let i = 0;
|
|
|
|
- while (i < hero.nbInDeck) {
|
|
|
|
- let heroObj = new Hero(
|
|
|
|
- hero.name,
|
|
|
|
- hero.cost,
|
|
|
|
- hero.power,
|
|
|
|
- hero.faction,
|
|
|
|
- abilitiesMap.get(hero.ability),
|
|
|
|
- hero.draftMode
|
|
|
|
- );
|
|
|
|
- heroesSet.add(heroObj);
|
|
|
|
- i++;
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-console.log('Hello Heroes : ', heroesSet);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-const config = {
|
|
|
|
- type: Phaser.AUTO,
|
|
|
|
- parent: "phaser-example",
|
|
|
|
- width: 800,
|
|
|
|
- height: 600,
|
|
|
|
- scene: {
|
|
|
|
- preload: preload,
|
|
|
|
- create: create
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-const game = new Phaser.Game(config);
|
|
|
|
-
|
|
|
|
-function preload() {
|
|
|
|
- this.load.image("logo", logoImg);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function create() {
|
|
|
|
- const logo = this.add.image(400, 150, "logo");
|
|
|
|
-
|
|
|
|
- this.tweens.add({
|
|
|
|
- targets: logo,
|
|
|
|
- y: 350,
|
|
|
|
- duration: 2000,
|
|
|
|
- ease: "Power2",
|
|
|
|
- yoyo: true,
|
|
|
|
- loop: -1
|
|
|
|
- });
|
|
|
|
-}
|
|
|
|
|
|
+import GameCreator from './GameCreator';
|
|
|
|
+
|
|
|
|
+// const Faction = {
|
|
|
|
+// HUMANS: 'Humans',
|
|
|
|
+// ELVES: 'Elves',
|
|
|
|
+// ORCS: 'Orcs',
|
|
|
|
+// MECA: 'Meca',
|
|
|
|
+// NONE: 'None',
|
|
|
|
+
|
|
|
|
+// };
|
|
|
|
+// Object.freeze(Faction);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+let gameCreator = new GameCreator();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// const config = {
|
|
|
|
+// type: Phaser.AUTO,
|
|
|
|
+// parent: "phaser-example",
|
|
|
|
+// width: 800,
|
|
|
|
+// height: 600,
|
|
|
|
+// scene: {
|
|
|
|
+// preload: preload,
|
|
|
|
+// create: create
|
|
|
|
+// }
|
|
|
|
+// };
|
|
|
|
+
|
|
|
|
+// const game = new Phaser.Game(config);
|
|
|
|
+
|
|
|
|
+// function preload() {
|
|
|
|
+// this.load.image("logo", logoImg);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// function create() {
|
|
|
|
+// const logo = this.add.image(400, 150, "logo");
|
|
|
|
+
|
|
|
|
+// this.tweens.add({
|
|
|
|
+// targets: logo,
|
|
|
|
+// y: 350,
|
|
|
|
+// duration: 2000,
|
|
|
|
+// ease: "Power2",
|
|
|
|
+// yoyo: true,
|
|
|
|
+// loop: -1
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|