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

This commit is contained in:
Mashy 2018-11-28 11:47:12 +10:00
commit 342394ddfa
4 changed files with 573 additions and 575 deletions

View File

@ -7,8 +7,6 @@ const renderResolutions = require('./combat.render.resolutions');
const CRYP_KEY_MAP = ['keydown_ONE', 'keydown_TWO', 'keydown_THREE']; const CRYP_KEY_MAP = ['keydown_ONE', 'keydown_TWO', 'keydown_THREE'];
const SKILL_KEY_MAP = ['keydown_Q', 'keydown_W', 'keydown_E', 'keydown_R']; const SKILL_KEY_MAP = ['keydown_Q', 'keydown_W', 'keydown_E', 'keydown_R'];
const CombatSkills = require('./combat.skills');
class Combat extends Phaser.Scene { class Combat extends Phaser.Scene {
constructor() { constructor() {

View File

@ -1,15 +1,15 @@
const { eachSeries } = require('async'); const { eachSeries } = require('async');
const CombatSkills = require('./combat.skills'); const CombatAnimations = require('./combat.animations');
const { CrypImage } = require('./combat.cryps'); const { CrypImage } = require('./combat.cryps');
const { const {
DELAYS: { ANIMATION_DURATION, MOVE_CREEP, DAMAGE_TICK }, DELAYS: { ANIMATION_DURATION, MOVE_CREEP, DAMAGE_TICK },
POSITIONS: { COMBAT }, POSITIONS: { COMBAT },
} = require('./constants'); } = require('./constants');
const randomSkill = () => { const randomAnimation = () => {
const skills = ['chargeBall']; const animations = ['wall', 'spit', 'gravBlast', 'gravBomb', 'chargeBall'];
return skills[Math.floor(Math.random() * 1)]; return animations[Math.floor(Math.random() * 5)];
}; };
function findResolutionCryps(scene, group, resolution, allyTeam, enemyTeam) { function findResolutionCryps(scene, group, resolution, allyTeam, enemyTeam) {
@ -32,7 +32,7 @@ function findResolutionCryps(scene, group, resolution, allyTeam, enemyTeam) {
} }
function animatePhase(scene, group, game, resolution, cb) { function animatePhase(scene, group, game, resolution, cb) {
scene.skills = new CombatSkills(scene); const animations = new CombatAnimations(scene);
// Find cryps and targets // Find cryps and targets
const tweenParams = (targets, centreSpot, enemy) => { const tweenParams = (targets, centreSpot, enemy) => {
@ -60,11 +60,11 @@ function animatePhase(scene, group, game, resolution, cb) {
scene.tweens.add(moveAllyBattle); scene.tweens.add(moveAllyBattle);
scene.tweens.add(moveEnemyBattle); scene.tweens.add(moveEnemyBattle);
// animate skill // animate animation
const skill = randomSkill(); const animation = randomAnimation();
scene.time.delayedCall(MOVE_CREEP, () => { scene.time.delayedCall(MOVE_CREEP, () => {
const isAlly = resolution.target_team_id === account.id; const isAlly = resolution.target_team_id === account.id;
scene.skills[skill](isAlly); animations[animation](isAlly);
// Target cryp takes damage // Target cryp takes damage
scene.time.delayedCall(ANIMATION_DURATION, () => { scene.time.delayedCall(ANIMATION_DURATION, () => {
@ -77,8 +77,8 @@ function animatePhase(scene, group, game, resolution, cb) {
// all done // all done
scene.time.delayedCall(MOVE_CREEP, () => { scene.time.delayedCall(MOVE_CREEP, () => {
scene.skills.cleanup(); animations.cleanup();
scene.skills.destroy(); animations.destroy();
return cb(); return cb();
}); });
}); });