added stages back in
This commit is contained in:
parent
c7120d795f
commit
0e19156f3a
@ -28,16 +28,26 @@ function createSocket(store) {
|
|||||||
return eachSeries(newRes, (r, cb) => {
|
return eachSeries(newRes, (r, cb) => {
|
||||||
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
|
if (['Disable', 'TargetKo'].includes(r.event[0])) return cb();
|
||||||
// Create sub events for combat animations
|
// Create sub events for combat animations
|
||||||
store.dispatch(actions.setResolution(r));
|
const sequence = getCombatSequence(r);
|
||||||
// const sequence = getCombatSequence(r);
|
console.log(sequence);
|
||||||
|
return eachSeries(sequence, (stages, sCb) => {
|
||||||
|
const stagedR = Object.create(r);
|
||||||
|
stagedR.stages = stages;
|
||||||
|
let timeout = 0;
|
||||||
|
if (stages.includes('START_SKILL') && stages.includes('END_SKILL')) {
|
||||||
|
timeout = (TIMES.SOURCE_DURATION_MS + TIMES.TARGET_DURATION_MS - TIMES.TARGET_DELAY_MS);
|
||||||
|
} else if (stages.includes('START_SKILL')) timeout = TIMES.SOURCE_DURATION_MS;
|
||||||
|
else if (stages.includes('END_SKILL')) timeout = TIMES.TARGET_DURATION_MS;
|
||||||
|
else if (stages.includes('POST_SKILL')) timeout = TIMES.POST_SKILL_DURATION_MS;
|
||||||
|
|
||||||
// sequence.forEach(stage => {
|
store.dispatch(actions.setResolution(stagedR));
|
||||||
// const stagedR = Object.create(r);
|
|
||||||
// stagedR.stage = stage;
|
|
||||||
// store.dispatch(actions.setResolution(stagedR));
|
|
||||||
// });
|
|
||||||
|
|
||||||
setTimeout(cb, TIMES.RESOLUTION_TOTAL_MS);
|
return setTimeout(sCb, timeout);
|
||||||
|
}, err => {
|
||||||
|
if (err) console.error(err);
|
||||||
|
// Finished this resolution
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
}, err => {
|
}, err => {
|
||||||
if (err) return console.error(err);
|
if (err) return console.error(err);
|
||||||
store.dispatch(actions.setResolution(null));
|
store.dispatch(actions.setResolution(null));
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const SiphonTick = require('./anims/siphon.tick');
|
|||||||
|
|
||||||
// const Test = require('./anims/test');
|
// const Test = require('./anims/test');
|
||||||
|
|
||||||
const { removeTier } = require('../utils');
|
const { removeTier, getCombatText } = require('../utils');
|
||||||
|
|
||||||
const colours = {
|
const colours = {
|
||||||
red: '#a52a2a',
|
red: '#a52a2a',
|
||||||
@ -36,23 +36,20 @@ const colours = {
|
|||||||
white: '#FFFFFF',
|
white: '#FFFFFF',
|
||||||
};
|
};
|
||||||
|
|
||||||
const SOURCE_ANIM_MS = 1000;
|
const SOURCE_ANIM_MS = 850;
|
||||||
|
|
||||||
const TARGET_ANIM_DELAY_MS = 500;
|
|
||||||
const TARGET_ANIM_MS = 1000;
|
|
||||||
|
|
||||||
function animations(props) {
|
function animations(props) {
|
||||||
const { resolution, stage, player, construct, game, account } = props;
|
const { game, account, resolution, player, construct } = props;
|
||||||
|
console.log(resolution);
|
||||||
if (!resolution) return false;
|
if (!resolution) return false;
|
||||||
const [type, event] = resolution.event;
|
const [, event] = resolution.event;
|
||||||
if (!event.skill) return false;
|
if (!event.skill) return false;
|
||||||
if (!resolution.target) return false;
|
if (!resolution.target) return false;
|
||||||
|
const { stages } = resolution;
|
||||||
console.log(resolution);
|
console.log(stages);
|
||||||
|
|
||||||
// source animation
|
// source animation
|
||||||
if (resolution.source.id === construct.id) {
|
if (resolution.source.id === construct.id && stages.includes('START_SKILL')) {
|
||||||
const playerTeam = game.players.find(t => t.id === account.id);
|
const playerTeam = game.players.find(t => t.id === account.id);
|
||||||
const playerTeamIds = playerTeam.constructs.map(c => c.id);
|
const playerTeamIds = playerTeam.constructs.map(c => c.id);
|
||||||
const otherTeam = game.players.find(t => t.id !== account.id);
|
const otherTeam = game.players.find(t => t.id !== account.id);
|
||||||
@ -92,46 +89,58 @@ function animations(props) {
|
|||||||
if (resolution.target.id !== construct.id) return false;
|
if (resolution.target.id !== construct.id) return false;
|
||||||
|
|
||||||
// target animation
|
// target animation
|
||||||
|
console.log(stages);
|
||||||
const anim = text => {
|
const anim = text => {
|
||||||
console.log(text);
|
console.log(text);
|
||||||
if (!text) return false;
|
if (!text || !stages.includes('END_SKILL')) return false;
|
||||||
const skill = removeTier(text);
|
const skill = removeTier(text);
|
||||||
|
|
||||||
if (skill === 'Bash' && type === 'Damage') return false;
|
// if (skill === 'Bash' && type === 'Damage') return false;
|
||||||
switch (skill) {
|
switch (skill) {
|
||||||
case 'Attack': return <Strike id={construct.id} stage={stage} team={player} colour={colours.white}/>;
|
case 'Attack': return <Strike id={construct.id} team={player} colour={colours.white}/>;
|
||||||
case 'Amplify': return <Amplify/>;
|
case 'Amplify': return <Amplify/>;
|
||||||
case 'Banish': return banish(construct.id);
|
case 'Banish': return banish(construct.id);
|
||||||
case 'Bash': return <Bash />;
|
case 'Bash': return <Bash />;
|
||||||
case 'Block': return <Block />;
|
case 'Block': return <Block />;
|
||||||
case 'Buff': return <Buff />;
|
case 'Buff': return <Buff />;
|
||||||
case 'Curse': return <Curse />;
|
case 'Curse': return <Curse />;
|
||||||
case 'Blast': return <Blast id={construct.id} stage={stage} team={player}/>;
|
case 'Blast': return <Blast id={construct.id} team={player}/>;
|
||||||
case 'Debuff': return <Debuff />;
|
case 'Debuff': return <Debuff />;
|
||||||
case 'Decay': return <Decay />;
|
case 'Decay': return <Decay />;
|
||||||
case 'Strike': return <Strike id={construct.id} stage={stage} team={player} colour={colours.red}/>;
|
case 'Strike': return <Strike id={construct.id} team={player} colour={colours.red}/>;
|
||||||
case 'Chaos': return <Chaos id={construct.id} team={player} colour={colours.purple}/>;
|
case 'Chaos': return <Chaos id={construct.id} team={player}/>;
|
||||||
case 'Slay': return <Slay id={construct.id} team={player} colour={colours.yellow}/>;
|
case 'Slay': return <Slay id={construct.id} team={player} />;
|
||||||
case 'Heal': return <Heal id={construct.id} stage={stage} team={player} colour={colours.red}/>;
|
case 'Heal': return <Heal id={construct.id} team={player} />;
|
||||||
case 'Hex': return <Hex />;
|
case 'Hex': return <Hex />;
|
||||||
case 'Haste': return <Haste />;
|
case 'Haste': return <Haste />;
|
||||||
case 'Siphon': return <Siphon id={construct.id} stage={stage} team={player} colour={colours.red}/>;
|
case 'Siphon': return <Siphon id={construct.id} team={player} />;
|
||||||
case 'SiphonTick': return <SiphonTick id={construct.id} stage={stage} team={player} colour={colours.red}/>;
|
case 'SiphonTick': return <SiphonTick id={construct.id} team={player} />;
|
||||||
case 'Stun': return <Stun />;
|
case 'Stun': return <Stun />;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const combatAnim = anim(event.skill);
|
const combatAnim = anim(event.skill);
|
||||||
|
|
||||||
if (combatAnim) {
|
if (combatAnim) {
|
||||||
return (
|
return (
|
||||||
<div class={`combat-anim`}>
|
<div class={'combat-anim'}>
|
||||||
{combatAnim}
|
{combatAnim}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (<div></div>);
|
if (stages.includes('POST_SKILL')) {
|
||||||
|
const combatText = getCombatText(resolution);
|
||||||
|
return (
|
||||||
|
<div class={'combat-text'}>
|
||||||
|
{combatText}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div></div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = animations;
|
module.exports = animations;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const anime = require('animejs').default;
|
|||||||
const dagger = require('../svgs/dagger');
|
const dagger = require('../svgs/dagger');
|
||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
class Attack extends Component {
|
class Attack extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ function banish(id) {
|
|||||||
scaleY: 0,
|
scaleY: 0,
|
||||||
fill: '#fff',
|
fill: '#fff',
|
||||||
easing: 'easeInOutElastic',
|
easing: 'easeInOutElastic',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const anime = require('animejs').default;
|
|||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
const { randomPoints } = require('../../utils');
|
const { randomPoints } = require('../../utils');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
|
|
||||||
function projectile(x, y, radius, colour) {
|
function projectile(x, y, radius, colour) {
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class Block extends Component {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -38,28 +38,28 @@ class Buff extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#buff .buff-one'],
|
targets: ['#buff .buff-one'],
|
||||||
points: '0,190 100,10 190,190',
|
points: '0,190 100,10 190,190',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#buff .buff-two'],
|
targets: ['#buff .buff-two'],
|
||||||
points: '40,170 100,50 160,170',
|
points: '40,170 100,50 160,170',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#buff .buff-three'],
|
targets: ['#buff .buff-three'],
|
||||||
points: '70,150 100,90 130,150',
|
points: '70,150 100,90 130,150',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const anime = require('animejs').default;
|
|||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
const { randomPoints } = require('../../utils');
|
const { randomPoints } = require('../../utils');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
function projectile(x, y, radius, colour) {
|
function projectile(x, y, radius, colour) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class Curse extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -39,28 +39,28 @@ class Debuff extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#debuff .debuff-one'],
|
targets: ['#debuff .debuff-one'],
|
||||||
points: '0,190 100,10 190,190',
|
points: '0,190 100,10 190,190',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#debuff .debuff-two'],
|
targets: ['#debuff .debuff-two'],
|
||||||
points: '40,170 100,50 160,170',
|
points: '40,170 100,50 160,170',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
targets: ['#debuff .debuff-three'],
|
targets: ['#debuff .debuff-three'],
|
||||||
points: '70,150 100,90 130,150',
|
points: '70,150 100,90 130,150',
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class Decay extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
@ -50,7 +50,7 @@ class Decay extends Component {
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class Haste extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const anime = require('animejs').default;
|
|||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
const { randomPoints } = require('../../utils');
|
const { randomPoints } = require('../../utils');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
|
|
||||||
function projectile(x, y, radius, colour) {
|
function projectile(x, y, radius, colour) {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class Hex extends Component {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const anime = require('animejs').default;
|
|||||||
|
|
||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
class AttackCharge extends Component {
|
class AttackCharge extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const anime = require('animejs').default;
|
|||||||
|
|
||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
|
|
||||||
function projectile(x, y, radius, colour) {
|
function projectile(x, y, radius, colour) {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const anime = require('animejs').default;
|
|||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
const { randomPoints } = require('../../utils');
|
const { randomPoints } = require('../../utils');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
|
|
||||||
function projectile(x, y, radius, colour) {
|
function projectile(x, y, radius, colour) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const anime = require('animejs').default;
|
|||||||
|
|
||||||
const { TIMES } = require('../../constants');
|
const { TIMES } = require('../../constants');
|
||||||
|
|
||||||
const duration = TIMES.START_SKILL;
|
const duration = TIMES.TARGET_DURATION_MS;
|
||||||
|
|
||||||
|
|
||||||
function laser(dimensions, colour) {
|
function laser(dimensions, colour) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class Stun extends Component {
|
|||||||
|
|
||||||
easing: 'easeOutExpo',
|
easing: 'easeOutExpo',
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
duration: TIMES.TARGET_DELAY_MS,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
@ -57,8 +57,8 @@ class Stun extends Component {
|
|||||||
rotate: 180,
|
rotate: 180,
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
|
|
||||||
duration: TIMES.TARGET_DURATION_MS,
|
|
||||||
delay: TIMES.TARGET_DELAY_MS,
|
delay: TIMES.TARGET_DELAY_MS,
|
||||||
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.animations.push(anime({
|
this.animations.push(anime({
|
||||||
@ -67,7 +67,7 @@ class Stun extends Component {
|
|||||||
strokeWidth: 0,
|
strokeWidth: 0,
|
||||||
easing: 'easeInOutSine',
|
easing: 'easeInOutSine',
|
||||||
direction: 'alternate',
|
direction: 'alternate',
|
||||||
duration: TIMES.START_SKILL,
|
duration: TIMES.TARGET_DURATION_MS,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,19 +75,11 @@ function GameConstruct(props) {
|
|||||||
let crypSkills = <div> </div>;
|
let crypSkills = <div> </div>;
|
||||||
if (player) crypSkills = (<div class="skills"> {skills} </div>);
|
if (player) crypSkills = (<div class="skills"> {skills} </div>);
|
||||||
|
|
||||||
const [combatText, combatClass] = getCombatText(construct, resolution);
|
|
||||||
const combatTextClass = `combat-text ${combatClass}`;
|
|
||||||
|
|
||||||
const playerTeam = game.players.find(t => t.id === account.id);
|
|
||||||
const playerTeamIds = playerTeam.constructs.map(c => c.id);
|
|
||||||
|
|
||||||
const stage = resolution ? resolution.stage : false;
|
|
||||||
const combatInfo = animations({ game, account, resolution, stage, player, construct });
|
|
||||||
|
|
||||||
const effects = construct.effects.length
|
const effects = construct.effects.length
|
||||||
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
|
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
|
||||||
: <div> </div>;
|
: <div> </div>;
|
||||||
|
|
||||||
|
const combatInfo = animations({ game, account, resolution, player, construct });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -1,16 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
TIMES: {
|
TIMES: {
|
||||||
RESOLUTION_TOTAL_MS: 2000,
|
|
||||||
// RESOLUTION_TOTAL_MS: 20000,
|
|
||||||
|
|
||||||
SOURCE_DURATION_MS: 1000,
|
SOURCE_DURATION_MS: 1000,
|
||||||
TARGET_DELAY_MS: 500,
|
TARGET_DELAY_MS: 500,
|
||||||
TARGET_DURATION_MS: 1500,
|
TARGET_DURATION_MS: 1000,
|
||||||
|
POST_SKILL_DURATION_MS: 750,
|
||||||
START_SKILL: 2000,
|
|
||||||
END_SKILL: 2000,
|
|
||||||
POST_SKILL: 2000,
|
|
||||||
DELAY: 150,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
COLOURS: {
|
COLOURS: {
|
||||||
|
|||||||
@ -75,9 +75,7 @@ const STATS = {
|
|||||||
|
|
||||||
function eventClasses(resolution, construct) {
|
function eventClasses(resolution, construct) {
|
||||||
if (!resolution) return '';
|
if (!resolution) return '';
|
||||||
const startSkill = resolution.stage === 'START_SKILL';
|
const postSkill = resolution.stages.includes('POST_SKILL');
|
||||||
const endSkill = resolution.stage === 'END_SKILL';
|
|
||||||
const postSkill = resolution.stage === 'POST_SKILL';
|
|
||||||
const source = construct.id === resolution.source.id;
|
const source = construct.id === resolution.source.id;
|
||||||
const target = construct.id === resolution.target.id;
|
const target = construct.id === resolution.target.id;
|
||||||
// not involved at all. blur them
|
// not involved at all. blur them
|
||||||
@ -107,9 +105,6 @@ function eventClasses(resolution, construct) {
|
|||||||
if (type === 'Damage') {
|
if (type === 'Damage') {
|
||||||
const { skill, amount, mitigation, colour } = event;
|
const { skill, amount, mitigation, colour } = event;
|
||||||
// Highlight the flow of damage from source -> target
|
// Highlight the flow of damage from source -> target
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
|
|
||||||
// Deal damage to construct and return effect
|
// Deal damage to construct and return effect
|
||||||
if (target && postSkill) {
|
if (target && postSkill) {
|
||||||
construct.green_life.value = resolution.target.green;
|
construct.green_life.value = resolution.target.green;
|
||||||
@ -131,8 +126,6 @@ function eventClasses(resolution, construct) {
|
|||||||
|
|
||||||
if (type === 'Healing') {
|
if (type === 'Healing') {
|
||||||
const { skill, amount, overhealing } = event;
|
const { skill, amount, overhealing } = event;
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
if (target && postSkill) {
|
if (target && postSkill) {
|
||||||
construct.green_life.value = resolution.target.green;
|
construct.green_life.value = resolution.target.green;
|
||||||
return 'green-damage';
|
return 'green-damage';
|
||||||
@ -150,29 +143,21 @@ function eventClasses(resolution, construct) {
|
|||||||
|
|
||||||
if (type === 'Effect') {
|
if (type === 'Effect') {
|
||||||
const { skill, effect, duration, construct_effects: constructEffects } = event;
|
const { skill, effect, duration, construct_effects: constructEffects } = event;
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
if (target && postSkill) construct.effects = constructEffects;
|
if (target && postSkill) construct.effects = constructEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Skill') {
|
if (type === 'Skill') {
|
||||||
const { skill } = event;
|
const { skill } = event;
|
||||||
// Highlight the flow of damage from source -> target
|
// Highlight the flow of damage from source -> target
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Removal') {
|
if (type === 'Removal') {
|
||||||
const { effect, construct_effects: constructEffects } = event;
|
const { effect, construct_effects: constructEffects } = event;
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
if (target && postSkill) construct.effects = constructEffects;
|
if (target && postSkill) construct.effects = constructEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Recharge') {
|
if (type === 'Recharge') {
|
||||||
const { skill, red, blue } = event;
|
const { skill, red, blue } = event;
|
||||||
if (source && startSkill) return 'active-skill';
|
|
||||||
if (target && endSkill) return 'active-skill';
|
|
||||||
if (target && postSkill) {
|
if (target && postSkill) {
|
||||||
if (red > 0 && blue > 0) {
|
if (red > 0 && blue > 0) {
|
||||||
construct.red_life.value = resolution.target.red;
|
construct.red_life.value = resolution.target.red;
|
||||||
@ -200,116 +185,77 @@ function eventClasses(resolution, construct) {
|
|||||||
function getCombatSequence(resolution) {
|
function getCombatSequence(resolution) {
|
||||||
if (!resolution.event) return false;
|
if (!resolution.event) return false;
|
||||||
if (resolution.event[0] === 'Inversion') return false;
|
if (resolution.event[0] === 'Inversion') return false;
|
||||||
if (resolution.event[0] === 'Skill') return ['START_SKILL', 'END_SKILL'];
|
if (resolution.event[0] === 'Skill') return [['START_SKILL', 'END_SKILL']];
|
||||||
if (resolution.event[0] === 'Ko') return ['POST_SKILL'];
|
if (resolution.event[0] === 'Ko') return [['POST_SKILL']];
|
||||||
|
|
||||||
switch (resolution.stages) {
|
switch (resolution.stages) {
|
||||||
case 1: return ['START_SKILL', 'DELAY', 'END_SKILL'];
|
case 1: return [['START_SKILL', 'END_SKILL']];
|
||||||
case 2: return ['START_SKILL', 'POST_SKILL'];
|
case 2: return [['START_SKILL'], ['POST_SKILL']];
|
||||||
case 3: return ['START_SKILL'];
|
case 3: return [['START_SKILL']];
|
||||||
case 4: return ['END_SKILL', 'POST_SKILL'];
|
case 4: return [['END_SKILL'], ['POST_SKILL']];
|
||||||
case 5: return ['END_SKILL'];
|
case 5: return [['END_SKILL']];
|
||||||
case 6: return ['POST_SKILL'];
|
case 6: return [['POST_SKILL']];
|
||||||
case 7: return false;
|
case 7: return false;
|
||||||
default: return ['START_SKILL', 'DELAY', 'END_SKILL', 'POST_SKILL'];
|
default: return [['START_SKILL', 'END_SKILL'], ['POST_SKILL']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCombatText(construct, resolution) {
|
function getCombatText(resolution) {
|
||||||
if (!resolution) return ['', ''];
|
if (!resolution) return false;
|
||||||
|
|
||||||
|
|
||||||
const [type, event] = resolution.event;
|
const [type, event] = resolution.event;
|
||||||
const source = construct.id === resolution.source.id;
|
|
||||||
const target = construct.id === resolution.target.id;
|
|
||||||
const startSkill = resolution.stage === 'START_SKILL';
|
|
||||||
const endSkill = resolution.stage === 'END_SKILL';
|
|
||||||
const postSkill = resolution.stage === 'POST_SKILL';
|
|
||||||
|
|
||||||
if (type === 'Ko') {
|
if (type === 'Ko') {
|
||||||
if (postSkill && target) return ['KO!', ''];
|
return 'KO!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Disable') {
|
if (type === 'Disable') {
|
||||||
const { skill, disable } = event;
|
const { disable } = event;
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
return `${disable}`;
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return [`${disable}`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Immunity') {
|
if (type === 'Immunity') {
|
||||||
const { skill, immunity } = event;
|
return 'IMMUNE';
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return ['IMMUNE', ''];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type === 'TargetKo') {
|
|
||||||
const { skill } = event;
|
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Damage') {
|
if (type === 'Damage') {
|
||||||
const { skill, mitigation, colour } = event;
|
const { mitigation, colour } = event;
|
||||||
let { amount } = event;
|
let { amount } = event;
|
||||||
if (colour === 'Green') amount *= -1;
|
if (colour === 'Green') amount *= -1;
|
||||||
const mitigationText = mitigation
|
const mitigationText = mitigation
|
||||||
? `(${mitigation})`
|
? `(${mitigation})`
|
||||||
: '';
|
: '';
|
||||||
if (startSkill && source) return [`${skill}`, `${skill.toLowerCase()}-cast`];
|
return `${amount} ${mitigationText}`;
|
||||||
if (endSkill && target) return [`${skill}`, `${skill.toLowerCase()}-hit`];
|
|
||||||
if (postSkill && target) return [`${amount} ${mitigationText}`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Healing') {
|
if (type === 'Healing') {
|
||||||
const { skill, amount, overhealing } = event;
|
const { amount, overhealing } = event;
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
return `${amount} (${overhealing} OH)`;
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return [`${amount} (${overhealing} OH)`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Inversion') {
|
if (type === 'Inversion') {
|
||||||
const { skill } = event;
|
return 'INVERT';
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return ['INVERT', ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Reflection') {
|
if (type === 'Reflection') {
|
||||||
const { skill } = event;
|
return 'REFLECT';
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return ['REFLECT', ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Effect') {
|
if (type === 'Effect') {
|
||||||
const { skill, effect, duration } = event;
|
const { effect, duration } = event;
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
return `+ ${effect} ${duration}T`;
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return [`+ ${effect} ${duration}T`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Recharge') {
|
if (type === 'Recharge') {
|
||||||
const { skill, red, blue } = event;
|
const { red, blue } = event;
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
return [`+${red}R ${blue}B`, ''];
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
if (postSkill && target) return [`+${red}R ${blue}B`, ''];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type === 'Skill' || type === 'AoeSkill') {
|
|
||||||
const { skill } = event;
|
|
||||||
if (startSkill && source) return [`${skill}`, ''];
|
|
||||||
if (endSkill && target) return [`${skill}`, ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Removal') {
|
if (type === 'Removal') {
|
||||||
const { effect } = event;
|
const { effect } = event;
|
||||||
if (postSkill && target) return [`-${effect}`, ''];
|
return `-${effect}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertItem(v) {
|
function convertItem(v) {
|
||||||
|
|||||||
@ -36,4 +36,4 @@ stripe-rust = { version = "0.10.4", features = ["webhooks"] }
|
|||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }
|
# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }
|
||||||
|
|
||||||
stripe-rust = { path = "/home/ntr/code/stripe-rs" }
|
stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user