core anims
This commit is contained in:
parent
e66a4233e8
commit
09d95a7cf7
@ -9,25 +9,22 @@ function none() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getObjects(resolution, game, account) {
|
function getObjects(resolution, game, account) {
|
||||||
if (!resolution) return none();
|
const [type, event] = resolution.variant;
|
||||||
if (!resolution.target) return none();
|
|
||||||
|
|
||||||
const [type, event] = resolution.event;
|
|
||||||
if (!event || !event.skill) return none();
|
if (!event || !event.skill) return none();
|
||||||
|
|
||||||
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);
|
||||||
const otherTeamIds = otherTeam.constructs.map(c => c.id);
|
const otherTeamIds = otherTeam.constructs.map(c => c.id);
|
||||||
const sourceIsPlayer = playerTeamIds.includes(resolution.source.id);
|
const sourceIsPlayer = playerTeamIds.includes(event.source);
|
||||||
const targetIsPlayer = playerTeamIds.includes(resolution.target.id);
|
const targetIsPlayer = playerTeamIds.includes(resolution.target);
|
||||||
|
|
||||||
const targetting = () => {
|
const targetting = () => {
|
||||||
if (type === 'AoeSkill') {
|
if (type === 'AoeSkill') {
|
||||||
if (targetIsPlayer) return playerTeamIds;
|
if (targetIsPlayer) return playerTeamIds;
|
||||||
return otherTeamIds;
|
return otherTeamIds;
|
||||||
}
|
}
|
||||||
return [resolution.target.id];
|
return [resolution.target];
|
||||||
};
|
};
|
||||||
|
|
||||||
const sameTeam = (sourceIsPlayer && targetIsPlayer) || (!sourceIsPlayer && !targetIsPlayer);
|
const sameTeam = (sourceIsPlayer && targetIsPlayer) || (!sourceIsPlayer && !targetIsPlayer);
|
||||||
@ -35,41 +32,32 @@ function getObjects(resolution, game, account) {
|
|||||||
if (!sameTeam) y = targetIsPlayer ? 1 : -1;
|
if (!sameTeam) y = targetIsPlayer ? 1 : -1;
|
||||||
|
|
||||||
const i = sourceIsPlayer
|
const i = sourceIsPlayer
|
||||||
? playerTeamIds.findIndex(c => c === resolution.source.id)
|
? playerTeamIds.findIndex(c => c === event.source)
|
||||||
: otherTeamIds.findIndex(c => c === resolution.source.id);
|
: otherTeamIds.findIndex(c => c === event.source);
|
||||||
|
|
||||||
const j = targetIsPlayer
|
const j = targetIsPlayer
|
||||||
? playerTeamIds.findIndex(c => c === resolution.target.id)
|
? playerTeamIds.findIndex(c => c === resolution.target)
|
||||||
: otherTeamIds.findIndex(c => c === resolution.target.id);
|
: otherTeamIds.findIndex(c => c === resolution.target);
|
||||||
const x = j - i;
|
const x = j - i;
|
||||||
const direction = { x, y };
|
const direction = { x, y };
|
||||||
// const targetTeam = targetIsPlayer ? playerTeamIds : otherTeamIds;
|
// const targetTeam = targetIsPlayer ? playerTeamIds : otherTeamIds;
|
||||||
|
|
||||||
const createSourceAnim = () => {
|
const animSource = {
|
||||||
return {
|
animation: 'sourceCast',
|
||||||
animation: 'sourceCast',
|
constructId: event.source,
|
||||||
constructId: resolution.source.id,
|
direction,
|
||||||
direction,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const skipSource = !resolution.stages.includes('START_SKILL')
|
|
||||||
|| resolution.source.id === resolution.target.id;
|
|
||||||
|
|
||||||
const animSource = skipSource
|
|
||||||
? null
|
|
||||||
: createSourceAnim();
|
|
||||||
|
|
||||||
const animTarget = {
|
const animTarget = {
|
||||||
skill: event.skill,
|
skill: event.skill,
|
||||||
constructId: targetting(),
|
constructId: targetting(),
|
||||||
player: playerTeamIds.includes(resolution.target.id),
|
player: playerTeamIds.includes(resolution.target),
|
||||||
direction,
|
direction,
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
animSource,
|
animSource,
|
||||||
animTarget,
|
animTarget,
|
||||||
animSkill: event.skill,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,30 +74,21 @@ function getTime(stages) {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFocusTargets(resolution, game) {
|
function getFocusTargets(resolution) {
|
||||||
if (!resolution) return [];
|
const [type, event] = resolution.variant;
|
||||||
if (!resolution.event) return [];
|
if (type === 'HitCast') {
|
||||||
const [type] = resolution.event;
|
const { source } = event;
|
||||||
const source = resolution.source.id;
|
const { target } = resolution;
|
||||||
const target = resolution.target.id;
|
if (source !== target) return [source, target];
|
||||||
|
return [target];
|
||||||
if (type === 'AoeSkill') {
|
|
||||||
const targetTeam = game.players.find(t => t.constructs.find(c => c.id === target));
|
|
||||||
const targetTeamIds = targetTeam.constructs.map(c => c.id);
|
|
||||||
if (source !== target) targetTeamIds.push(source);
|
|
||||||
return targetTeamIds;
|
|
||||||
}
|
}
|
||||||
if (source !== target) return [source, target];
|
return [resolution.target];
|
||||||
return [target];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getText(resolution) {
|
function getText(resolution) {
|
||||||
const nullText = { text: null, constructId: null, life: null };
|
const nullText = { text: null, constructId: null, life: null };
|
||||||
if (!resolution) return nullText;
|
const [type, event] = resolution.variant;
|
||||||
if (!resolution.stages.includes('POST_SKILL')) return nullText;
|
|
||||||
|
|
||||||
function generatePostSkill() {
|
function generatePostSkill() {
|
||||||
const [type, event] = resolution.event;
|
|
||||||
if (type === 'Ko') {
|
if (type === 'Ko') {
|
||||||
return { text: 'KO!', css: 'ko-transition' };
|
return { text: 'KO!', css: 'ko-transition' };
|
||||||
}
|
}
|
||||||
@ -176,16 +155,14 @@ function getText(resolution) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { green, red, blue } = resolution.target;
|
const { green, red, blue } = event.display;
|
||||||
const { text, css, effects } = generatePostSkill();
|
const { text, css, effects } = generatePostSkill();
|
||||||
const skill = resolution.event[1] ? resolution.event[1].skill : null;
|
|
||||||
return {
|
return {
|
||||||
css,
|
css,
|
||||||
text,
|
text,
|
||||||
effects,
|
effects,
|
||||||
life: { green, red, blue },
|
life: { green, red, blue },
|
||||||
constructId: resolution.target.id,
|
constructId: event.display.id,
|
||||||
skill,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ const shapes = require('./shapes');
|
|||||||
const { removeTier } = require('../utils');
|
const { removeTier } = require('../utils');
|
||||||
const { TIMES } = require('./../constants');
|
const { TIMES } = require('./../constants');
|
||||||
|
|
||||||
const addState = connect(({ animText, itemInfo }) => ({ animText, itemInfo }));
|
const addState = connect(({ animText, animSkill, itemInfo }) => ({ animText, animSkill, itemInfo }));
|
||||||
|
|
||||||
class AnimText extends preact.Component {
|
class AnimText extends preact.Component {
|
||||||
shouldComponentUpdate(newProps) {
|
shouldComponentUpdate(newProps) {
|
||||||
@ -27,11 +27,11 @@ class AnimText extends preact.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render(props) {
|
render() {
|
||||||
const { construct, animText, itemInfo } = props;
|
const { construct, animText, animSkill, itemInfo } = this.props;
|
||||||
if (animText && animText.constructId === construct.id) {
|
if (animText && animText.constructId === construct.id) {
|
||||||
const itemSourceDescription = () => {
|
const itemSourceDescription = () => {
|
||||||
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill));
|
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animSkill));
|
||||||
const itemSourceInfo = itemSource.length
|
const itemSourceInfo = itemSource.length
|
||||||
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
||||||
: false;
|
: false;
|
||||||
@ -60,7 +60,7 @@ class AnimText extends preact.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="combat-text">
|
<div class="combat-text">
|
||||||
<h2><span>{animText.skill}</span></h2>
|
<h2><span>{animSkill}</span></h2>
|
||||||
<span>{itemSourceDescription()}</span>
|
<span>{itemSourceDescription()}</span>
|
||||||
{animationTextHtml()}
|
{animationTextHtml()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,11 +6,11 @@ const reactStringReplace = require('react-string-replace');
|
|||||||
const throttle = require('lodash/throttle');
|
const throttle = require('lodash/throttle');
|
||||||
|
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
const { effectInfo, removeTier } = require('../utils');
|
const { effectInfo } = require('../utils');
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
({ game, account, animSkill, animating, itemInfo, gameEffectInfo, tutorialGame }) =>
|
({ game, account, animating, itemInfo, gameEffectInfo, tutorialGame }) =>
|
||||||
({ game, account, animSkill, animating, itemInfo, gameEffectInfo, tutorialGame })
|
({ game, account, animating, itemInfo, gameEffectInfo, tutorialGame })
|
||||||
);
|
);
|
||||||
|
|
||||||
class TargetSvg extends Component {
|
class TargetSvg extends Component {
|
||||||
|
|||||||
@ -87,48 +87,33 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setAnimating(true));
|
store.dispatch(actions.setAnimating(true));
|
||||||
store.dispatch(actions.setGameSkillInfo(null));
|
store.dispatch(actions.setGameSkillInfo(null));
|
||||||
// stop fetching the game state til animations are done
|
// stop fetching the game state til animations are done
|
||||||
const newRes = game.events[currentGame.events.length];
|
const newRes = game.events[currentGame.events.length - 1];
|
||||||
return eachSeries(newRes, (r, cb) => {
|
return eachSeries(newRes, (r, cb) => {
|
||||||
if (!r.event) return cb();
|
// if (!r.event) return cb();
|
||||||
let timeout = animations.getTime(r.stages);
|
const timeout = r.delay;
|
||||||
const anims = animations.getObjects(r, game, account);
|
const anims = animations.getObjects(r, game, account);
|
||||||
const text = animations.getText(r);
|
|
||||||
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
|
||||||
if (anims.animSkill) store.dispatch(actions.setAnimSkill(anims.animSkill));
|
|
||||||
|
|
||||||
if (r.stages.includes('START_SKILL') && anims.animSource) {
|
|
||||||
store.dispatch(actions.setAnimSource(anims.animSource));
|
|
||||||
store.dispatch(actions.setAnimText(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r.stages.includes('END_SKILL') && anims.animTarget) {
|
if (r.variant[0].includes('Hit')) {
|
||||||
|
if (r.variant[0] === 'HitCast') {
|
||||||
|
store.dispatch(actions.setAnimSource(anims.animSource));
|
||||||
|
}
|
||||||
|
const { skill } = r.variant[1];
|
||||||
|
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
||||||
|
store.dispatch(actions.setAnimSkill(skill));
|
||||||
store.dispatch(actions.setAnimTarget(anims.animTarget));
|
store.dispatch(actions.setAnimTarget(anims.animTarget));
|
||||||
store.dispatch(actions.setAnimText(null));
|
store.dispatch(actions.setAnimText(null));
|
||||||
if (animations.isCbAnim(anims.animSkill)) store.dispatch(actions.setAnimCb(cb));
|
if (animations.isCbAnim(skill)) store.dispatch(actions.setAnimCb(cb));
|
||||||
|
return setTimeout(() => {
|
||||||
|
store.dispatch(actions.setAnimSource(null));
|
||||||
|
store.dispatch(actions.setAnimTarget(null));
|
||||||
|
if (r.variant[0].includes('Hit') && animations.isCbAnim(r.variant[1].skill)) return true;
|
||||||
|
return cb();
|
||||||
|
}, timeout);
|
||||||
}
|
}
|
||||||
|
const text = animations.getText(r);
|
||||||
if (r.stages.includes('POST_SKILL') && text) {
|
store.dispatch(actions.setAnimText(text));
|
||||||
// timeout to prevent text classes from being added too soon
|
return setTimeout(cb, timeout);
|
||||||
if (timeout === TIMES.POST_SKILL_DURATION_MS) {
|
|
||||||
store.dispatch(actions.setAnimText(text));
|
|
||||||
} else {
|
|
||||||
setTimeout(
|
|
||||||
() => store.dispatch(actions.setAnimText(text)),
|
|
||||||
timeout - TIMES.POST_SKILL_DURATION_MS - 700
|
|
||||||
);
|
|
||||||
timeout -= 700;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return setTimeout(() => {
|
|
||||||
store.dispatch(actions.setAnimSkill(null));
|
|
||||||
store.dispatch(actions.setAnimSource(null));
|
|
||||||
store.dispatch(actions.setAnimTarget(null));
|
|
||||||
// store.dispatch(actions.setAnimText(null));
|
|
||||||
store.dispatch(actions.setAnimFocus([]));
|
|
||||||
if (r.stages.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true;
|
|
||||||
return cb();
|
|
||||||
}, timeout);
|
|
||||||
}, err => {
|
}, err => {
|
||||||
if (err) return console.error(err);
|
if (err) return console.error(err);
|
||||||
// clear animation state
|
// clear animation state
|
||||||
|
|||||||
@ -41,6 +41,7 @@ pub enum Colour {
|
|||||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
Hit { construct: Uuid, skill: Skill },
|
Hit { construct: Uuid, skill: Skill },
|
||||||
|
HitCast { construct: Uuid, skill: Skill, source: Uuid },
|
||||||
Damage { construct: Uuid, values: Vec<Value>, colour: Colour },
|
Damage { construct: Uuid, values: Vec<Value>, colour: Colour },
|
||||||
Effect { construct: Uuid, effect: ConstructEffect },
|
Effect { construct: Uuid, effect: ConstructEffect },
|
||||||
IncreaseCooldowns { construct: Uuid, turns: usize },
|
IncreaseCooldowns { construct: Uuid, turns: usize },
|
||||||
@ -501,6 +502,7 @@ impl Game {
|
|||||||
for action in actions {
|
for action in actions {
|
||||||
match action {
|
match action {
|
||||||
Action::Hit { construct, skill } => self.hit(construct, skill),
|
Action::Hit { construct, skill } => self.hit(construct, skill),
|
||||||
|
Action::HitCast { construct, skill, source } => self.hit_cast(construct, skill, source),
|
||||||
Action::Damage { construct, values, colour } => self.damage(construct, values, colour),
|
Action::Damage { construct, values, colour } => self.damage(construct, values, colour),
|
||||||
Action::Effect { construct, effect } => self.effect(construct, effect),
|
Action::Effect { construct, effect } => self.effect(construct, effect),
|
||||||
Action::IncreaseCooldowns { construct, turns } => self.increase_cooldowns(construct, turns),
|
Action::IncreaseCooldowns { construct, turns } => self.increase_cooldowns(construct, turns),
|
||||||
@ -510,6 +512,11 @@ impl Game {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn hit_cast(&mut self, construct: Uuid, skill: Skill, source: Uuid) -> &mut Game {
|
||||||
|
self.event_add(vec![Event::new(EventVariant::HitCast { skill: skill, source: source }, construct)]);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
fn hit(&mut self, construct: Uuid, skill: Skill) -> &mut Game {
|
fn hit(&mut self, construct: Uuid, skill: Skill) -> &mut Game {
|
||||||
self.event_add(vec![Event::new(EventVariant::Hit { skill: skill }, construct)]);
|
self.event_add(vec![Event::new(EventVariant::Hit { skill: skill }, construct)]);
|
||||||
self
|
self
|
||||||
|
|||||||
@ -105,7 +105,7 @@ impl Cast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn actions(&self) -> Vec<Action> {
|
pub fn actions(&self) -> Vec<Action> {
|
||||||
let mut actions = vec![Action::Hit { construct: self.target, skill: self.skill }];
|
let mut actions = vec![Action::HitCast { construct: self.target, skill: self.skill, source: self.source }];
|
||||||
|
|
||||||
let mut rest = match self.skill {
|
let mut rest = match self.skill {
|
||||||
Skill::Amplify => vec![
|
Skill::Amplify => vec![
|
||||||
@ -186,15 +186,7 @@ impl Cast {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
Skill::Strike |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Skill::Strike |
|
|
||||||
Skill::StrikePlus |
|
Skill::StrikePlus |
|
||||||
Skill::StrikePlusPlus => vec![
|
Skill::StrikePlusPlus => vec![
|
||||||
Action::Damage {
|
Action::Damage {
|
||||||
@ -218,19 +210,16 @@ pub type Disable = Vec<Effect>;
|
|||||||
pub struct Event {
|
pub struct Event {
|
||||||
pub target: Uuid,
|
pub target: Uuid,
|
||||||
pub variant: EventVariant,
|
pub variant: EventVariant,
|
||||||
pub stages: EventStages,
|
|
||||||
pub delay: i64,
|
pub delay: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
pub fn new(variant: EventVariant, target: Uuid) -> Event {
|
pub fn new(variant: EventVariant, target: Uuid) -> Event {
|
||||||
let stages = variant.stages();
|
let delay = variant.delay();
|
||||||
|
|
||||||
Event {
|
Event {
|
||||||
target,
|
target,
|
||||||
variant,
|
variant,
|
||||||
delay: stages.delay(),
|
delay,
|
||||||
stages: stages,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,6 +227,7 @@ impl Event {
|
|||||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||||
pub enum EventVariant {
|
pub enum EventVariant {
|
||||||
Hit { skill: Skill },
|
Hit { skill: Skill },
|
||||||
|
HitCast { skill: Skill, source: Uuid },
|
||||||
|
|
||||||
Damage { amount: usize, mitigation: usize, colour: Colour, display: EventConstruct },
|
Damage { amount: usize, mitigation: usize, colour: Colour, display: EventConstruct },
|
||||||
Effect { effect: Effect, duration: u8, display: EventConstruct },
|
Effect { effect: Effect, duration: u8, display: EventConstruct },
|
||||||
@ -263,46 +253,17 @@ pub enum EventVariant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EventVariant {
|
impl EventVariant {
|
||||||
fn stages(&self) -> EventStages {
|
fn delay(&self) -> i64 {
|
||||||
match self {
|
// let source_duration = 1000; // Time for SOURCE ONLY
|
||||||
EventVariant::Disable { disable: _}
|
let target_delay = 500; // Used for Source + Target
|
||||||
=> EventStages::PostOnly,
|
let target_duration = 1500; // Time for TARGET ONLY
|
||||||
EventVariant::Damage { amount: _, mitigation: _, colour: _, display: _ }
|
let post_skill = 1000; // Time for all POST
|
||||||
=> EventStages::PostOnly,
|
let source_and_target_total = target_delay + target_duration; // SOURCE + TARGET time
|
||||||
EventVariant::Healing { amount: _, overhealing: _}
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Recharge { red: _, blue: _}
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Inversion { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Reflection { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::AoeSkill { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Skill { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Effect { effect: _, duration: _, display: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Removal { effect: _, display: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::TargetKo { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Ko ()
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Forfeit ()
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Incomplete ()
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
EventVariant::Evasion { skill: _, evasion_rating: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
|
|
||||||
EventVariant::CooldownDecrease { skill: _, turns: _ }
|
match self {
|
||||||
=> EventStages::PostOnly,
|
EventVariant::Hit { skill: _ } => target_duration,
|
||||||
EventVariant::CooldownIncrease { skill: _, turns: _ }
|
EventVariant::HitCast { skill: _, source: _ } => source_and_target_total,
|
||||||
=> EventStages::PostOnly,
|
_ => post_skill,
|
||||||
|
|
||||||
EventVariant::Hit { skill: _ }
|
|
||||||
=> EventStages::PostOnly,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,44 +289,6 @@ impl EventConstruct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
|
||||||
pub enum EventStages {
|
|
||||||
#[serde(rename = "START_SKILL END_SKILL POST_SKILL")]
|
|
||||||
AllStages, // Anim Anim Anim
|
|
||||||
#[serde(rename = "START_SKILL END_SKILL")]
|
|
||||||
StartEnd, // Anim Anim Skip
|
|
||||||
#[serde(rename = "START_SKILL POST_SKILL")]
|
|
||||||
StartPost, // Anim Skip Anim
|
|
||||||
#[serde(rename = "START_SKILL")]
|
|
||||||
StartOnly, // Anim Skip Skip
|
|
||||||
#[serde(rename = "END_SKILL POST_SKILL")]
|
|
||||||
EndPost, // Skip Anim Anim
|
|
||||||
#[serde(rename = "END_SKILL")]
|
|
||||||
EndOnly, // Skip Anim Skip
|
|
||||||
#[serde(rename = "POST_SKILL")]
|
|
||||||
PostOnly, // Skip Skip Anim
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EventStages {
|
|
||||||
fn delay(self) -> i64 {
|
|
||||||
let source_duration = 1000; // Time for SOURCE ONLY
|
|
||||||
let target_delay = 500; // Used for Source + Target
|
|
||||||
let target_duration = 1500; // Time for TARGET ONLY
|
|
||||||
let post_skill = 1000; // Time for all POST
|
|
||||||
let source_and_target_total = target_delay + target_duration; // SOURCE + TARGET time
|
|
||||||
|
|
||||||
match self {
|
|
||||||
EventStages::AllStages => source_and_target_total + post_skill, // Anim Anim Anim
|
|
||||||
EventStages::StartEnd => source_and_target_total, // Anim Anim Skip
|
|
||||||
EventStages::StartPost => source_duration + post_skill, // Anim Skip Anim
|
|
||||||
EventStages::StartOnly => source_duration, // Anim Skip Skip
|
|
||||||
EventStages::EndPost => target_duration + post_skill, // Skip Anim Anim
|
|
||||||
EventStages::EndOnly => target_duration, // Skip Anim Skip
|
|
||||||
EventStages::PostOnly => post_skill, // Skip Skip Anim
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||||
pub enum Skill {
|
pub enum Skill {
|
||||||
Attack,
|
Attack,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user