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 SKILL_KEY_MAP = ['keydown_Q', 'keydown_W', 'keydown_E', 'keydown_R'];
const CombatSkills = require('./combat.skills');
class Combat extends Phaser.Scene {
constructor() {

View File

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