Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
27c7023f61
@ -87,7 +87,7 @@ class CrypImage extends Phaser.GameObjects.Image {
|
||||
this.health = scene.add.existing(new StatBar(scene, this, 'HP'));
|
||||
this.red_shield = scene.add.existing(new StatBar(scene, this, 'Red Shield'));
|
||||
this.blue_shield = scene.add.existing(new StatBar(scene, this, 'Blue Shield'));
|
||||
this.evasion = scene.add.existing(new StatBar(scene, this, 'Evasion'));
|
||||
// this.evasion = scene.add.existing(new StatBar(scene, this, 'Evasion'));
|
||||
|
||||
this.effects = scene.add.existing(new Effects(scene, team, iter));
|
||||
this.statusText = scene.add.text(statusX, statusY, '', TEXT.NORMAL);
|
||||
|
||||
@ -7,15 +7,15 @@ const {
|
||||
} = require('./constants');
|
||||
|
||||
function findResolutionCryps(scene, group, resolution, game) {
|
||||
const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id))
|
||||
.cryps.find(c => c.id === resolution.source_cryp_id);
|
||||
const sourceSpawn = group.children.entries.find(c => c.cryp.id === resolution.source.id);
|
||||
|
||||
const sourceSpawn = group.children.entries.find(c => c.cryp.id === sourceCryp.id);
|
||||
/* const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id))
|
||||
.cryps.find(c => c.id === resolution.source_cryp_id);
|
||||
|
||||
const targetCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.target_cryp_id))
|
||||
.cryps.find(c => c.id === resolution.target_cryp_id);
|
||||
|
||||
const targetSpawn = group.children.entries.find(c => c.cryp.id === targetCryp.id);
|
||||
*/
|
||||
const targetSpawn = group.children.entries.find(c => c.cryp.id === resolution.target.id);
|
||||
|
||||
return { sourceSpawn, targetSpawn };
|
||||
}
|
||||
@ -46,9 +46,8 @@ function calculateTweenParams(sourceSpawn, targetSpawn, account) {
|
||||
|
||||
function animatePhase(scene, game, resolution, cb) {
|
||||
// return early for disabled skills
|
||||
const { resolution: { results } } = resolution;
|
||||
if (results.length === 0) return cb();
|
||||
if (results[0][0] === 'Disable') return cb();
|
||||
if (resolution.length === 0) return cb();
|
||||
if (resolution.event[0] === 'Disable') return cb();
|
||||
|
||||
const group = scene.scene.get('CombatCryps').cryps;
|
||||
const animations = new CombatAnimations(scene);
|
||||
@ -56,7 +55,6 @@ function animatePhase(scene, game, resolution, cb) {
|
||||
|
||||
// Find cryps, targets
|
||||
const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game);
|
||||
|
||||
const {
|
||||
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
|
||||
} = calculateTweenParams(sourceSpawn, targetSpawn, account);
|
||||
@ -74,54 +72,35 @@ function animatePhase(scene, game, resolution, cb) {
|
||||
|
||||
return scene.time.delayedCall(MOVE_CREEP, () => {
|
||||
const isAlly = sourceSpawn.cryp.account === account.id;
|
||||
|
||||
// animate animation
|
||||
animations.getSkill(resolution.skill, isAlly, castLocation);
|
||||
|
||||
// Target cryp takes damage
|
||||
scene.time.delayedCall(ANIMATION_DURATION, () => {
|
||||
eachSeries(results,
|
||||
(result, tickCb) => {
|
||||
// touch
|
||||
if (!results.length) return tickCb();
|
||||
if (resolution.event[0] === 'Damage') {
|
||||
targetSpawn.takeDamage(resolution.event[1]);
|
||||
scene.registry.set('gameLog', scene.registry.get('gameLog') + 1);
|
||||
}
|
||||
if (resolution.event[0] === 'Healing') {
|
||||
targetSpawn.takeHealing(resolution.event[1]);
|
||||
scene.registry.set('gameLog', scene.registry.get('gameLog') + 1);
|
||||
}
|
||||
if (resolution.event[0] === 'Effect') {
|
||||
targetSpawn.effects.addEffect(resolution.event[1]);
|
||||
console.log('target has new effect', resolution.event[1].effect);
|
||||
}
|
||||
|
||||
const [resultType, values] = result;
|
||||
if (resultType === 'Damage') {
|
||||
targetSpawn.takeDamage(values);
|
||||
scene.registry.set('gameLog', scene.registry.get('gameLog') + 1);
|
||||
return setTimeout(tickCb, DAMAGE_TICK);
|
||||
}
|
||||
if (resultType === 'Healing') {
|
||||
targetSpawn.takeHealing(values.amount);
|
||||
scene.registry.set('gameLog', scene.registry.get('gameLog') + 1);
|
||||
return setTimeout(tickCb, DAMAGE_TICK);
|
||||
}
|
||||
if (resultType === 'Effect') {
|
||||
targetSpawn.effects.addEffect(values);
|
||||
console.log('target has new effect', values.effect);
|
||||
return setTimeout(tickCb, DAMAGE_TICK);
|
||||
}
|
||||
if (resolution.event[0] === 'Removal') {
|
||||
targetSpawn.effects.removeEffect(resolution.event[1].effect);
|
||||
console.log('target effect removed', resolution.event[1].effect);
|
||||
}
|
||||
if (moveSourceOrig) scene.tweens.add(moveSourceOrig);
|
||||
scene.tweens.add(moveTargetOrig);
|
||||
|
||||
if (resultType === 'Removal') {
|
||||
targetSpawn.effects.removeEffect(values.effect);
|
||||
console.log('target effect removed', values.effect);
|
||||
return setTimeout(tickCb, DAMAGE_TICK);
|
||||
}
|
||||
|
||||
// unhandled result type
|
||||
return tickCb();
|
||||
},
|
||||
(err) => {
|
||||
// Move cryps back
|
||||
if (moveSourceOrig) scene.tweens.add(moveSourceOrig);
|
||||
scene.tweens.add(moveTargetOrig);
|
||||
|
||||
// all done
|
||||
scene.time.delayedCall(MOVE_CREEP, () => {
|
||||
animations.destroy(true);
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
// all done
|
||||
scene.time.delayedCall(MOVE_CREEP, () => {
|
||||
animations.destroy(true);
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -24,23 +24,22 @@ class StatBar extends Phaser.GameObjects.Graphics {
|
||||
super(scene);
|
||||
this.crypObj = cryp;
|
||||
this.type = type;
|
||||
console.log(type);
|
||||
|
||||
if (type === 'HP') {
|
||||
this.val = this.crypObj.cryp.hp.value;
|
||||
this.max = this.crypObj.cryp.hp.value;
|
||||
this.max = this.crypObj.cryp.hp.max;
|
||||
this.margin = 0;
|
||||
} else if (type === 'Red Shield') {
|
||||
this.val = this.crypObj.cryp.red_shield.value;
|
||||
this.max = this.crypObj.cryp.red_shield.value;
|
||||
this.max = this.crypObj.cryp.red_shield.max;
|
||||
this.margin = 1;
|
||||
} else if (type === 'Blue Shield') {
|
||||
this.val = this.crypObj.cryp.blue_shield.value;
|
||||
this.max = this.crypObj.cryp.blue_shield.value;
|
||||
this.max = this.crypObj.cryp.blue_shield.max;
|
||||
this.margin = 2;
|
||||
} else if (type === 'Evasion') {
|
||||
this.val = this.crypObj.cryp.evasion.value;
|
||||
this.max = this.crypObj.cryp.evasion.value;
|
||||
this.max = this.crypObj.cryp.evasion.max;
|
||||
this.margin = 3;
|
||||
}
|
||||
const { statTextX, statTextY } = statTextCoord(cryp.team, cryp.iter, this.margin);
|
||||
|
||||
0
server/COMBOS.md
Executable file → Normal file
0
server/COMBOS.md
Executable file → Normal file
@ -31,6 +31,7 @@ constants
|
||||
change to ownership pattern
|
||||
|
||||
## SOON
|
||||
* Remove debuffs on KO
|
||||
* Descriptions
|
||||
* Stats - How they work
|
||||
* Items - What they give
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user