serialize stages as strings
This commit is contained in:
parent
2026530370
commit
9f0c212643
@ -74,13 +74,14 @@ function getSequence(resolution) {
|
||||
if (resolution.event[0] === 'Ko') return ['POST_SKILL'];
|
||||
|
||||
switch (resolution.stages) {
|
||||
case 1: return ['START_SKILL', 'END_SKILL'];
|
||||
case 2: return ['START_SKILL', 'POST_SKILL'];
|
||||
case 3: return ['START_SKILL'];
|
||||
case 4: return ['END_SKILL', 'POST_SKILL'];
|
||||
case 5: return ['END_SKILL'];
|
||||
case 6: return ['POST_SKILL'];
|
||||
case 7: return [];
|
||||
case 'AllStages': return ['START_SKILL', 'END_SKILL', 'POST_SKILL'];
|
||||
case 'StartEnd': return ['START_SKILL', 'END_SKILL'];
|
||||
case 'StartPost': return ['START_SKILL', 'POST_SKILL'];
|
||||
case 'StartOnly': return ['START_SKILL'];
|
||||
case 'EndPost': return ['END_SKILL', 'POST_SKILL'];
|
||||
case 'EndOnly': return ['END_SKILL'];
|
||||
case 'PostOnly': return ['POST_SKILL'];
|
||||
case 'None': return [];
|
||||
default: return ['START_SKILL', 'END_SKILL', 'POST_SKILL'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,15 +405,15 @@ pub struct EventConstruct {
|
||||
}
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
pub enum LogStages {
|
||||
AllStages, // 0 Anim Anim Anim
|
||||
StartEnd, // 1 Anim Anim Skip
|
||||
StartPost, // 2 Anim Skip Anim
|
||||
StartOnly, // 3 Anim Skip Skip
|
||||
EndPost, // 4 Skip Anim Anim
|
||||
EndOnly, // 5 Skip Anim Skip
|
||||
PostOnly, // 6 Skip Skip Anim
|
||||
None, // 7 Skip Skip Skip
|
||||
pub enum EventStages {
|
||||
AllStages, // Anim Anim Anim
|
||||
StartEnd, // Anim Anim Skip
|
||||
StartPost, // Anim Skip Anim
|
||||
StartOnly, // Anim Skip Skip
|
||||
EndPost, // Skip Anim Anim
|
||||
EndOnly, // Skip Anim Skip
|
||||
PostOnly, // Skip Skip Anim
|
||||
None, // Skip Skip Skip
|
||||
}
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
@ -421,7 +421,7 @@ pub struct Resolution {
|
||||
pub source: EventConstruct,
|
||||
pub target: EventConstruct,
|
||||
pub event: Event,
|
||||
pub stages: u8,
|
||||
pub stages: EventStages,
|
||||
}
|
||||
|
||||
impl Resolution {
|
||||
@ -440,7 +440,7 @@ impl Resolution {
|
||||
blue: target.blue_life(),
|
||||
},
|
||||
event: Event::Incomplete,
|
||||
stages: LogStages::AllStages as u8,
|
||||
stages: EventStages::AllStages,
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,8 +449,8 @@ impl Resolution {
|
||||
self
|
||||
}
|
||||
|
||||
fn stages(mut self, s: LogStages) -> Resolution {
|
||||
self.stages = s as u8;
|
||||
fn stages(mut self, s: EventStages) -> Resolution {
|
||||
self.stages = s;
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -1268,7 +1268,7 @@ fn bash(source: &mut Construct, target: &mut Construct, mut results: Resolutions
|
||||
let amount = source.red_power().pct(skill.multiplier().pct(100 + 45u64.saturating_mul(cds)));
|
||||
target.deal_red_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
}
|
||||
|
||||
return results;
|
||||
@ -1282,7 +1282,7 @@ fn sleep(source: &mut Construct, target: &mut Construct, mut results: Resolution
|
||||
let amount = source.green_power().pct(skill.multiplier());
|
||||
target.deal_green_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1298,7 +1298,7 @@ fn intercept(source: &mut Construct, target: &mut Construct, mut results: Resolu
|
||||
results.push(Resolution::new(source, target).event(target.recharge(skill, red_amount, 0)));
|
||||
|
||||
let intercept = skill.effect()[0];
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, intercept)).stages(LogStages::PostOnly));
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, intercept)).stages(EventStages::PostOnly));
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -1306,7 +1306,7 @@ fn break_(source: &mut Construct, target: &mut Construct, mut results: Resolutio
|
||||
let stun = skill.effect()[0];
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, stun)));
|
||||
let vuln = skill.effect()[1];
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, vuln)).stages(LogStages::PostOnly));
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, vuln)).stages(EventStages::PostOnly));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1314,7 +1314,7 @@ fn break_(source: &mut Construct, target: &mut Construct, mut results: Resolutio
|
||||
fn block(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(skill, skill.effect()[0]))
|
||||
.stages(LogStages::StartEnd));
|
||||
.stages(EventStages::StartEnd));
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -1328,11 +1328,11 @@ fn counter(source: &mut Construct, target: &mut Construct, mut results: Resoluti
|
||||
let red_amount = source.red_power().pct(skill.multiplier());
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.recharge(skill, red_amount, 0))
|
||||
.stages(LogStages::StartEnd));
|
||||
.stages(EventStages::StartEnd));
|
||||
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(skill, skill.effect()[0]))
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1341,7 +1341,7 @@ fn riposte(source: &mut Construct, target: &mut Construct, mut results: Resoluti
|
||||
let amount = source.red_power().pct(skill.multiplier());
|
||||
target.deal_red_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::StartPost)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::StartPost)));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1360,7 +1360,7 @@ fn restrict(source: &mut Construct, target: &mut Construct, mut results: Resolut
|
||||
let amount = source.red_power().pct(skill.multiplier()).pct(s_multi);
|
||||
target.deal_red_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
|
||||
|
||||
return results;
|
||||
@ -1376,7 +1376,7 @@ fn slay(source: &mut Construct, target: &mut Construct, mut results: Resolutions
|
||||
results.push(Resolution::new(source, target).event(e));
|
||||
let heal = source.deal_green_damage(skill, amount);
|
||||
for h in heal {
|
||||
results.push(Resolution::new(source, source).event(h).stages(LogStages::PostOnly));
|
||||
results.push(Resolution::new(source, source).event(h).stages(EventStages::PostOnly));
|
||||
};
|
||||
},
|
||||
_ => results.push(Resolution::new(source, target).event(e)),
|
||||
@ -1409,7 +1409,7 @@ fn triage_tick(source: &mut Construct, target: &mut Construct, mut results: Reso
|
||||
let amount = source.green_power().pct(skill.multiplier());
|
||||
target.deal_green_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::EndPost)));
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -1424,7 +1424,7 @@ fn chaos(source: &mut Construct, target: &mut Construct, mut results: Resolution
|
||||
let amount = source.red_power().pct(skill.multiplier()).pct(r_rng);
|
||||
target.deal_red_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -1464,7 +1464,7 @@ fn decay(source: &mut Construct, target: &mut Construct, mut results: Resolution
|
||||
let decay = ConstructEffect::new(effect, duration).set_tick(Cast::new_tick(source, target, tick_skill));
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(skill, decay))
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
|
||||
return decay_tick(source, target, results, tick_skill);
|
||||
}
|
||||
@ -1473,7 +1473,7 @@ fn decay_tick(source: &mut Construct, target: &mut Construct, mut results: Resol
|
||||
let amount = source.blue_power().pct(skill.multiplier());
|
||||
target.deal_blue_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::EndPost)));
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -1495,7 +1495,7 @@ fn electrocute(source: &mut Construct, target: &mut Construct, mut results: Reso
|
||||
let electrocute = ConstructEffect::new(effect, duration).set_tick(Cast::new_tick(source, target, tick_skill));
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(skill, electrocute))
|
||||
.stages(LogStages::StartPost));
|
||||
.stages(EventStages::StartPost));
|
||||
return electrocute_tick(source, target, results, tick_skill);
|
||||
}
|
||||
|
||||
@ -1503,14 +1503,14 @@ fn electrocute_tick(source: &mut Construct, target: &mut Construct, mut results:
|
||||
let amount = source.blue_power().pct(skill.multiplier());
|
||||
target.deal_blue_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::EndPost)));
|
||||
return results;
|
||||
}
|
||||
|
||||
fn ruin(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(skill, skill.effect()[0]))
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
return results;;
|
||||
}
|
||||
|
||||
@ -1529,7 +1529,7 @@ fn absorption(source: &mut Construct, target: &mut Construct, mut results: Resol
|
||||
let absorb = skill.effect()[0].set_meta(EffectMeta::AddedDamage(amount));
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.add_effect(reflect_skill, absorb))
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
return results;;
|
||||
}
|
||||
|
||||
@ -1554,7 +1554,7 @@ fn reflect(source: &mut Construct, target: &mut Construct, mut results: Resoluti
|
||||
let blue_amount = source.blue_power().pct(skill.multiplier());
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(target.recharge(skill, 0, blue_amount))
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
|
||||
return results;;
|
||||
}
|
||||
@ -1586,13 +1586,13 @@ fn siphon_tick(source: &mut Construct, target: &mut Construct, mut results: Reso
|
||||
for e in siphon_events {
|
||||
match e {
|
||||
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => {
|
||||
results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost));
|
||||
results.push(Resolution::new(source, target).event(e).stages(EventStages::EndPost));
|
||||
let heal = source.deal_green_damage(skill, amount);
|
||||
for h in heal {
|
||||
results.push(Resolution::new(source, source).event(h).stages(LogStages::PostOnly));
|
||||
results.push(Resolution::new(source, source).event(h).stages(EventStages::PostOnly));
|
||||
};
|
||||
},
|
||||
_ => results.push(Resolution::new(source, target).event(e).stages(LogStages::EndPost)),
|
||||
_ => results.push(Resolution::new(source, target).event(e).stages(EventStages::EndPost)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1604,7 +1604,7 @@ fn link(source: &mut Construct, target: &mut Construct, mut results: Resolutions
|
||||
results.push(Resolution::new(source, target).event(target.recharge(skill, 0, blue_amount)));
|
||||
|
||||
let link = skill.effect()[0].set_meta(EffectMeta::LinkTarget(target.id));
|
||||
results.push(Resolution::new(source, target).event(source.add_effect(skill, link)).stages(LogStages::PostOnly));
|
||||
results.push(Resolution::new(source, target).event(source.add_effect(skill, link)).stages(EventStages::PostOnly));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1625,7 +1625,7 @@ fn link_hit(source: &Construct, target: &Construct, mut results: Resolutions, ga
|
||||
|
||||
results.push(Resolution::new(target, link_target).event(Event::Skill { skill: Skill::LinkI }));
|
||||
res.into_iter().for_each(|e| results.push(Resolution::new(&source, &link_target)
|
||||
.event(e).stages(LogStages::EndPost)));
|
||||
.event(e).stages(EventStages::EndPost)));
|
||||
} else {
|
||||
panic!("not a link target {:?}", link);
|
||||
}
|
||||
@ -1649,7 +1649,7 @@ fn silence(source: &mut Construct, target: &mut Construct, mut results: Resoluti
|
||||
let amount = source.blue_power().pct(skill.multiplier()).pct(s_multi);
|
||||
target.deal_blue_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
|
||||
return results;
|
||||
}
|
||||
@ -1700,10 +1700,10 @@ fn purify(source: &mut Construct, target: &mut Construct, mut results: Resolutio
|
||||
let ce = target.effects.remove(i);
|
||||
results.push(Resolution::new(source, target)
|
||||
.event(Event::Removal { effect: ce.effect, construct_effects: target.effects.clone() })
|
||||
.stages(LogStages::PostOnly));
|
||||
.stages(EventStages::PostOnly));
|
||||
target.deal_green_damage(skill, amount)
|
||||
.into_iter()
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(LogStages::PostOnly)));
|
||||
.for_each(|e| results.push(Resolution::new(source, target).event(e).stages(EventStages::PostOnly)));
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user