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

This commit is contained in:
ntr 2018-12-15 11:00:23 +11:00
commit 9746712992
3 changed files with 51 additions and 11 deletions

View File

@ -30,15 +30,16 @@ class CombatSkills extends Phaser.GameObjects.Group {
if (type === 'attack') {
this[randomAnimation()](isAlly);
} else {
this.heal();
this[type](isAlly);
}
}
heal() {
Heal(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const particles = this.scene.add.particles(randomColour());
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
const emitter = particles.createEmitter({
x: COMBAT.width() * 0.3,
x,
y: COMBAT.height() * 0.2,
angle: { min: 250, max: 290 },
speed: 250,
@ -50,7 +51,41 @@ class CombatSkills extends Phaser.GameObjects.Group {
});
this.add(particles);
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
}
Block(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const colour = randomColour();
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
const emitter1 = this.scene.add.particles(colour).createEmitter({
x,
y: COMBAT.height() * 0.4,
scale: { start: 0.75, end: 0.25 },
blendMode: 'ADD',
emitZone: {
source: new Phaser.Geom.Rectangle(-100, -100, 200, 200),
type: 'edge',
quantity: 24,
yoyo: true,
},
});
const emitter2 = this.scene.add.particles(colour).createEmitter({
x,
y: COMBAT.height() * 0.4,
blendMode: 'SCREEN',
scale: { start: 0.2, end: 0 },
speed: { min: -100, max: 100 },
quantity: 50,
active: false,
emitZone: {
source: new Phaser.Geom.Rectangle(-100, -100, 200, 200),
type: 'edge',
quantity: 50,
},
});
this.scene.time.delayedCall(lifespan / 2, () => { emitter1.stop(); }, [], this);
this.scene.time.delayedCall(lifespan / 2, () => { emitter2.active = true; }, [], this);
this.scene.time.delayedCall(lifespan, () => { emitter2.stop(); }, [], this);
}
wall(isAlly) {

View File

@ -69,7 +69,8 @@ function animatePhase(scene, game, resolution, cb) {
scene.time.delayedCall(MOVE_CREEP, () => {
const isAlly = resolution.target_team_id !== account.id;
// animate animation
if (resolution.skill === 'Heal') animations.getSkill(resolution.skill, isAlly);
const workingSkills = ['Heal', 'Block'];
if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly);
else animations.getSkill('attack', isAlly);
// Target cryp takes damage

View File

@ -234,13 +234,17 @@ class CombatSkills extends Phaser.Scene {
const skillPos = targetTextPosition(iter, team);
const skillObj = new CrypSkill(this, skillPos[0], skillPos[1], skill, cryp);
this.add.existing(skillObj);
// Don't add interaction for self_target skills
if (skill.self_targeting) {
skillObj.skillBox.setFillStyle(0x9d9ea0);
} else {
this.input.setDraggable(skillObj);
keyboard.on(
TARGET_KEY_MAP[iter],
() => this.mapTargetKeys(skillObj, game.id, friendlyCryps, iter),
this
);
}
});
return true;