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

This commit is contained in:
ntr 2019-03-25 17:29:51 +11:00
commit 27c7023f61
5 changed files with 36 additions and 57 deletions

View File

@ -87,7 +87,7 @@ class CrypImage extends Phaser.GameObjects.Image {
this.health = scene.add.existing(new StatBar(scene, this, 'HP')); this.health = scene.add.existing(new StatBar(scene, this, 'HP'));
this.red_shield = scene.add.existing(new StatBar(scene, this, 'Red Shield')); 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.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.effects = scene.add.existing(new Effects(scene, team, iter));
this.statusText = scene.add.text(statusX, statusY, '', TEXT.NORMAL); this.statusText = scene.add.text(statusX, statusY, '', TEXT.NORMAL);

View File

@ -7,15 +7,15 @@ const {
} = require('./constants'); } = require('./constants');
function findResolutionCryps(scene, group, resolution, game) { function findResolutionCryps(scene, group, resolution, game) {
const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id)) const sourceSpawn = group.children.entries.find(c => c.cryp.id === resolution.source.id);
.cryps.find(c => c.id === resolution.source_cryp_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)) 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); .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 }; return { sourceSpawn, targetSpawn };
} }
@ -46,9 +46,8 @@ function calculateTweenParams(sourceSpawn, targetSpawn, account) {
function animatePhase(scene, game, resolution, cb) { function animatePhase(scene, game, resolution, cb) {
// return early for disabled skills // return early for disabled skills
const { resolution: { results } } = resolution; if (resolution.length === 0) return cb();
if (results.length === 0) return cb(); if (resolution.event[0] === 'Disable') return cb();
if (results[0][0] === 'Disable') return cb();
const group = scene.scene.get('CombatCryps').cryps; const group = scene.scene.get('CombatCryps').cryps;
const animations = new CombatAnimations(scene); const animations = new CombatAnimations(scene);
@ -56,7 +55,6 @@ function animatePhase(scene, game, resolution, cb) {
// Find cryps, targets // Find cryps, targets
const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game); const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game);
const { const {
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig, moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
} = calculateTweenParams(sourceSpawn, targetSpawn, account); } = calculateTweenParams(sourceSpawn, targetSpawn, account);
@ -74,54 +72,35 @@ function animatePhase(scene, game, resolution, cb) {
return scene.time.delayedCall(MOVE_CREEP, () => { return scene.time.delayedCall(MOVE_CREEP, () => {
const isAlly = sourceSpawn.cryp.account === account.id; const isAlly = sourceSpawn.cryp.account === account.id;
// animate animation // animate animation
animations.getSkill(resolution.skill, isAlly, castLocation); animations.getSkill(resolution.skill, isAlly, castLocation);
// Target cryp takes damage // Target cryp takes damage
scene.time.delayedCall(ANIMATION_DURATION, () => { scene.time.delayedCall(ANIMATION_DURATION, () => {
eachSeries(results, if (resolution.event[0] === 'Damage') {
(result, tickCb) => { targetSpawn.takeDamage(resolution.event[1]);
// touch scene.registry.set('gameLog', scene.registry.get('gameLog') + 1);
if (!results.length) return tickCb(); }
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 (resolution.event[0] === 'Removal') {
if (resultType === 'Damage') { targetSpawn.effects.removeEffect(resolution.event[1].effect);
targetSpawn.takeDamage(values); console.log('target effect removed', resolution.event[1].effect);
scene.registry.set('gameLog', scene.registry.get('gameLog') + 1); }
return setTimeout(tickCb, DAMAGE_TICK); if (moveSourceOrig) scene.tweens.add(moveSourceOrig);
} scene.tweens.add(moveTargetOrig);
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 (resultType === 'Removal') { // all done
targetSpawn.effects.removeEffect(values.effect); scene.time.delayedCall(MOVE_CREEP, () => {
console.log('target effect removed', values.effect); animations.destroy(true);
return setTimeout(tickCb, DAMAGE_TICK); return cb();
} });
// 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();
});
});
}); });
}); });
} }

View File

@ -24,23 +24,22 @@ class StatBar extends Phaser.GameObjects.Graphics {
super(scene); super(scene);
this.crypObj = cryp; this.crypObj = cryp;
this.type = type; this.type = type;
console.log(type);
if (type === 'HP') { if (type === 'HP') {
this.val = this.crypObj.cryp.hp.value; this.val = this.crypObj.cryp.hp.value;
this.max = this.crypObj.cryp.hp.value; this.max = this.crypObj.cryp.hp.max;
this.margin = 0; this.margin = 0;
} else if (type === 'Red Shield') { } else if (type === 'Red Shield') {
this.val = this.crypObj.cryp.red_shield.value; 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; this.margin = 1;
} else if (type === 'Blue Shield') { } else if (type === 'Blue Shield') {
this.val = this.crypObj.cryp.blue_shield.value; 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; this.margin = 2;
} else if (type === 'Evasion') { } else if (type === 'Evasion') {
this.val = this.crypObj.cryp.evasion.value; this.val = this.crypObj.cryp.evasion.value;
this.max = this.crypObj.cryp.evasion.value; this.max = this.crypObj.cryp.evasion.max;
this.margin = 3; this.margin = 3;
} }
const { statTextX, statTextY } = statTextCoord(cryp.team, cryp.iter, this.margin); const { statTextX, statTextY } = statTextCoord(cryp.team, cryp.iter, this.margin);

0
server/COMBOS.md Executable file → Normal file
View File

View File

@ -31,6 +31,7 @@ constants
change to ownership pattern change to ownership pattern
## SOON ## SOON
* Remove debuffs on KO
* Descriptions * Descriptions
* Stats - How they work * Stats - How they work
* Items - What they give * Items - What they give