rename skills -> animations

This commit is contained in:
ntr 2018-11-27 23:40:47 +11:00
parent bd7e56e8cc
commit fa4793f5eb
2 changed files with 10 additions and 10 deletions

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 = ['wall', 'spit', 'gravBlast', 'gravBomb', 'chargeBall']; const animations = ['wall', 'spit', 'gravBlast', 'gravBomb', 'chargeBall'];
return skills[Math.floor(Math.random() * 5)]; 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();
}); });
}); });