Team animations come from source, skill buttons
This commit is contained in:
parent
0d833f9b7d
commit
596e9968c0
@ -26,18 +26,35 @@ class CombatSkills extends Phaser.GameObjects.Group {
|
|||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSkill(type, isAlly) {
|
getSkill(type, isAlly, castLocation) {
|
||||||
if (type === 'attack') {
|
if (type === 'attack') {
|
||||||
this[randomAnimation()](isAlly);
|
this[randomAnimation()](isAlly);
|
||||||
} else {
|
} else {
|
||||||
this[type](isAlly);
|
this[type](isAlly, castLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Heal(isAlly) {
|
Heal(isAlly, castLocation) {
|
||||||
|
// const { sourceX, sourceY } = getCrypPosition(sourcePos, 0);
|
||||||
const lifespan = DELAYS.ANIMATION_DURATION;
|
const lifespan = DELAYS.ANIMATION_DURATION;
|
||||||
const particles = this.scene.add.particles(randomColour());
|
const colour = randomColour();
|
||||||
|
const particles = this.scene.add.particles(colour);
|
||||||
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
|
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
|
||||||
|
|
||||||
|
const emitter2 = particles.createEmitter({
|
||||||
|
x: castLocation.x,
|
||||||
|
y: castLocation.y,
|
||||||
|
moveToX: x,
|
||||||
|
moveToY: COMBAT.height() * 0.2,
|
||||||
|
speed: 500,
|
||||||
|
lifespan: lifespan / 3,
|
||||||
|
scale: { start: 0.5, end: 1 },
|
||||||
|
quantity: 3,
|
||||||
|
_frequency: 20,
|
||||||
|
blendMode: 'ADD',
|
||||||
|
emitZone: { source: new Phaser.Geom.Rectangle(-200, -100, 400, 200) },
|
||||||
|
});
|
||||||
|
|
||||||
const emitter = particles.createEmitter({
|
const emitter = particles.createEmitter({
|
||||||
x,
|
x,
|
||||||
y: COMBAT.height() * 0.2,
|
y: COMBAT.height() * 0.2,
|
||||||
@ -48,8 +65,14 @@ class CombatSkills extends Phaser.GameObjects.Group {
|
|||||||
scale: { start: 0.1, end: 1 },
|
scale: { start: 0.1, end: 1 },
|
||||||
blendMode: 'ADD',
|
blendMode: 'ADD',
|
||||||
lifespan,
|
lifespan,
|
||||||
|
active: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.add(particles);
|
this.add(particles);
|
||||||
|
this.scene.time.delayedCall(lifespan / 3, () => { emitter2.stop(); }, [], this);
|
||||||
|
this.scene.time.delayedCall(lifespan / 3, () => { emitter.active = true; }, [], this);
|
||||||
|
|
||||||
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
|
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ function calculateTweenParams(sourceSpawn, targetSpawn, account) {
|
|||||||
targets, x, y, ease, duration,
|
targets, x, y, ease, duration,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const moveSourceBattle = sourceSpawn.cryp.account !== targetSpawn.cryp.account
|
const moveSourceBattle = sourceSpawn.cryp.account !== targetSpawn.cryp.account
|
||||||
? tweenParams(sourceSpawn, true) : null;
|
? tweenParams(sourceSpawn, true) : null;
|
||||||
const moveSourceOrig = sourceSpawn.cryp.account !== targetSpawn.cryp.account
|
const moveSourceOrig = sourceSpawn.cryp.account !== targetSpawn.cryp.account
|
||||||
@ -59,7 +58,13 @@ function animatePhase(scene, game, resolution, cb) {
|
|||||||
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
|
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
|
||||||
} = calculateTweenParams(sourceSpawn, targetSpawn, account);
|
} = calculateTweenParams(sourceSpawn, targetSpawn, account);
|
||||||
|
|
||||||
// ew
|
const castParams = () => {
|
||||||
|
const x = (sourceSpawn === targetSpawn) ? moveTargetBattle.x : sourceSpawn.x;
|
||||||
|
const y = (sourceSpawn === targetSpawn) ? moveTargetBattle.y : sourceSpawn.y;
|
||||||
|
return { x, y };
|
||||||
|
};
|
||||||
|
const castLocation = castParams();
|
||||||
|
|
||||||
const { resolution: { results } } = resolution;
|
const { resolution: { results } } = resolution;
|
||||||
|
|
||||||
if (results.length === 0) return cb();
|
if (results.length === 0) return cb();
|
||||||
@ -72,7 +77,7 @@ function animatePhase(scene, game, resolution, cb) {
|
|||||||
const isAlly = resolution.target_team_id !== account.id;
|
const isAlly = resolution.target_team_id !== account.id;
|
||||||
// animate animation
|
// animate animation
|
||||||
const workingSkills = ['Heal', 'Block'];
|
const workingSkills = ['Heal', 'Block'];
|
||||||
if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly);
|
if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly, castLocation);
|
||||||
else animations.getSkill('attack', isAlly);
|
else animations.getSkill('attack', isAlly);
|
||||||
|
|
||||||
// Target cryp takes damage
|
// Target cryp takes damage
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class CrypSkill extends Phaser.GameObjects.Container {
|
|||||||
this.scene.children.list.forEach((skill) => {
|
this.scene.children.list.forEach((skill) => {
|
||||||
if (skill.state === 'select') skill.deselect();
|
if (skill.state === 'select') skill.deselect();
|
||||||
});
|
});
|
||||||
this.skillBox.setFillStyle(0x9d9ea0);
|
this.skillBox.setFillStyle(0x004bfe);
|
||||||
this.state = 'select';
|
this.state = 'select';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,11 @@ class CombatSkills extends Phaser.Scene {
|
|||||||
const addSkill = (i, j, skill, cryp) => {
|
const addSkill = (i, j, skill, cryp) => {
|
||||||
const skillTextPos = skillPosition(i, j);
|
const skillTextPos = skillPosition(i, j);
|
||||||
const skillObj = new CrypSkill(this, skillTextPos[0], skillTextPos[1], skill, cryp);
|
const skillObj = new CrypSkill(this, skillTextPos[0], skillTextPos[1], skill, cryp);
|
||||||
this.input.setDraggable(skillObj);
|
if (skill.cd) {
|
||||||
|
skillObj.skillBox.setFillStyle(0x9d9ea0);
|
||||||
|
} else {
|
||||||
|
this.input.setDraggable(skillObj);
|
||||||
|
}
|
||||||
this.add.existing(skillObj);
|
this.add.existing(skillObj);
|
||||||
return skillObj;
|
return skillObj;
|
||||||
};
|
};
|
||||||
@ -238,7 +242,7 @@ class CombatSkills extends Phaser.Scene {
|
|||||||
// Don't add interaction for self_target skills
|
// Don't add interaction for self_target skills
|
||||||
const crypSkill = cryp.skills.find(s => s.skill === skill.skill);
|
const crypSkill = cryp.skills.find(s => s.skill === skill.skill);
|
||||||
if (crypSkill.self_targeting) {
|
if (crypSkill.self_targeting) {
|
||||||
skillObj.skillBox.setFillStyle(0x9d9ea0);
|
skillObj.skillBox.setFillStyle(0xff0000);
|
||||||
} else {
|
} else {
|
||||||
this.input.setDraggable(skillObj);
|
this.input.setDraggable(skillObj);
|
||||||
keyboard.on(
|
keyboard.on(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user