Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
57780416c8
@ -71,8 +71,6 @@ class Combat extends Phaser.Scene {
|
||||
if (game.log[this.logIter] === '<Resolve Phase>') {
|
||||
this.registry.set('resolve', true);
|
||||
this.logIter += 1;
|
||||
this.crypTeamRender.destroy(true);
|
||||
this.crypTeamRender = new DrawCrypTeams(this, game);
|
||||
combatRender(this, game, this.crypTeamRender);
|
||||
return true;
|
||||
} this.logIter += 1;
|
||||
|
||||
@ -6,8 +6,7 @@ const randomSkill = () => {
|
||||
return skills[Math.floor(Math.random() * 5)];
|
||||
};
|
||||
|
||||
function animatePhase(scene, group, game, account, delay) {
|
||||
// Find cryps and targets
|
||||
function findResolveCryps(scene, group, game) {
|
||||
const resolved = game.resolved[scene.resolvedIter];
|
||||
const allyCryp = scene.allyTeam.cryps.find(
|
||||
c => c.id === resolved.source_cryp_id || c.id === resolved.target_cryp_id
|
||||
@ -23,45 +22,35 @@ function animatePhase(scene, group, game, account, delay) {
|
||||
.find(c => c.cryp.id === enemyCryp.id);
|
||||
|
||||
const target = allyCryp.id === resolved.target_cryp_id ? allySpawn : enemySpawn;
|
||||
const allyCrypX = allySpawn.x; const allyCrypY = allySpawn.y;
|
||||
const enemyCrypX = enemySpawn.x; const enemyCrypY = enemySpawn.y;
|
||||
// Move cryps into posistion
|
||||
scene.tweens.add({
|
||||
targets: allySpawn,
|
||||
x: COMBAT.x() + COMBAT.width() * 0.3,
|
||||
y: COMBAT.height() * 13.25 / 35,
|
||||
ease: 'Power1',
|
||||
duration: DELAYS.MOVE_CREEP,
|
||||
});
|
||||
return {allySpawn, enemySpawn, target };
|
||||
}
|
||||
|
||||
scene.tweens.add({
|
||||
targets: enemySpawn,
|
||||
x: COMBAT.x() + COMBAT.width() * 0.7,
|
||||
y: COMBAT.height() * 13.25 / 35,
|
||||
ease: 'Power1',
|
||||
duration: DELAYS.MOVE_CREEP,
|
||||
});
|
||||
function animatePhase(scene, group, game, delay) {
|
||||
// Find cryps and targets
|
||||
const tweenParams = (targets, centreSpot, enemy) => {
|
||||
let x = centreSpot ? COMBAT.width() * 0.3 : targets.x;
|
||||
x = (enemy && centreSpot) ? x + COMBAT.width() * 0.4 : x;
|
||||
const y = centreSpot ? COMBAT.height() * 13.25 / 35 : targets.y;
|
||||
const ease = 'Power1';
|
||||
const duration = DELAYS.MOVE_CREEP;
|
||||
return { targets, x, y, ease, duration };
|
||||
};
|
||||
const { allySpawn, enemySpawn, target } = findResolveCryps(scene, group, game);
|
||||
const moveAllyBattle = tweenParams(allySpawn, true, false);
|
||||
const moveAllyOrig = tweenParams(allySpawn, false, false);
|
||||
const moveEnemyBattle = tweenParams(enemySpawn, true, true);
|
||||
const moveEnemyOrig = tweenParams(enemySpawn, false, true);
|
||||
// Move cryps into posistion
|
||||
scene.tweens.add(moveAllyBattle);
|
||||
scene.tweens.add(moveEnemyBattle);
|
||||
// Target cryp takes damage into posistion
|
||||
scene.time.delayedCall(delay + DELAYS.MOVE_CREEP, () => {
|
||||
target.takeDamage(100);
|
||||
});
|
||||
// Move cryps back
|
||||
scene.time.delayedCall(delay + DELAYS.MOVE_CREEP + DELAYS.DAMAGE_TICK, () => {
|
||||
scene.tweens.add({
|
||||
targets: allySpawn,
|
||||
x: allyCrypX,
|
||||
y: allyCrypY,
|
||||
ease: 'Power1',
|
||||
duration: DELAYS.MOVE_CREEP,
|
||||
});
|
||||
|
||||
scene.tweens.add({
|
||||
targets: enemySpawn,
|
||||
x: enemyCrypX,
|
||||
y: enemyCrypY,
|
||||
ease: 'Power1',
|
||||
duration: DELAYS.MOVE_CREEP,
|
||||
});
|
||||
scene.tweens.add(moveAllyOrig);
|
||||
scene.tweens.add(moveEnemyOrig);
|
||||
});
|
||||
}
|
||||
|
||||
@ -75,7 +64,7 @@ function combatRender(scene, game, group) {
|
||||
scene.time.delayedCall(DELAYS.MOVE_CREEP, () => {
|
||||
scene.skills[skill](target);
|
||||
});
|
||||
animatePhase(scene, group, game, account, delay[0]);
|
||||
animatePhase(scene, group, game, delay[0]);
|
||||
|
||||
if (scene.iterateLog(game)) {
|
||||
scene.time.delayedCall(delay[1] + DELAYS.MOVE_CREEP * 2, () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user