diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-04-20 20:45:09 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-04-20 20:45:09 +0200 |
commit | 9275cfc93869c47bfa5c99776f18e68a00789bd5 (patch) | |
tree | ba47eecadfdf4f7fd12f25c39f5e23bf5c7acd77 | |
parent | 2f225ba3d27351812307e0a426096738384b7b0d (diff) | |
download | evtclib-9275cfc93869c47bfa5c99776f18e68a00789bd5.tar.gz evtclib-9275cfc93869c47bfa5c99776f18e68a00789bd5.tar.bz2 evtclib-9275cfc93869c47bfa5c99776f18e68a00789bd5.zip |
fix mai trin success detection for early failures
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | src/analyzers/strikes.rs | 7 | ||||
-rw-r--r-- | tests/analyzers.rs | 16 | ||||
-rw-r--r-- | tests/logs/analyzers/mai-failed-pre-echo-20220420.zevtc | bin | 0 -> 26262 bytes |
4 files changed, 25 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9aed6..8532b95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. - Success detection for CM logs - CM detection +### Fixed +- Success detection for Mai Trin logs that ended before the Echo of Scarlet + Briar spawned. + ## 0.7.1 - 2022-04-01 ### Added - Various analyzers for the End of Dragons strike missions: diff --git a/src/analyzers/strikes.rs b/src/analyzers/strikes.rs index 420a674..bc994e4 100644 --- a/src/analyzers/strikes.rs +++ b/src/analyzers/strikes.rs @@ -86,7 +86,12 @@ impl<'log> Analyzer for CaptainMaiTrin<'log> { let scarlet = self.log.characters().find(|npc| { npc.id() == Self::ECHO_OF_SCARLET_BRIAR || npc.id() == Self::ECHO_OF_SCARLET_BRIAR_CM - })?; + }); + // If the log ends before Scarlet even spawns, then it for sure is a failure. + let scarlet = match scarlet { + Some(s) => s, + None => return Some(Outcome::Failure), + }; let mai = self .log .characters() diff --git a/tests/analyzers.rs b/tests/analyzers.rs index dc876d6..9779e27 100644 --- a/tests/analyzers.rs +++ b/tests/analyzers.rs @@ -63,7 +63,21 @@ fn test_mai_cm_succeeded() { #[test] fn test_mai_cm_failed() { - let log = evtclib::process_file("tests/logs/cms/mai-trin-failed.zevtc", Compression::Zip).unwrap(); + let log = + evtclib::process_file("tests/logs/cms/mai-trin-failed.zevtc", Compression::Zip).unwrap(); + + let analyzer = log.analyzer().expect("No analyzer for Mai Trin"); + + assert_eq!(analyzer.outcome(), Some(Outcome::Failure)); +} + +#[test] +fn test_mai_failed_pre_echo() { + let log = evtclib::process_file( + "tests/logs/analyzers/mai-failed-pre-echo-20220420.zevtc", + Compression::Zip, + ) + .unwrap(); let analyzer = log.analyzer().expect("No analyzer for Mai Trin"); diff --git a/tests/logs/analyzers/mai-failed-pre-echo-20220420.zevtc b/tests/logs/analyzers/mai-failed-pre-echo-20220420.zevtc Binary files differnew file mode 100644 index 0000000..94443a0 --- /dev/null +++ b/tests/logs/analyzers/mai-failed-pre-echo-20220420.zevtc |