Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrote a test to ensure all shout keywords are used.
Browse files Browse the repository at this point in the history
This turned up both missing keywords and missing classifications.
It's good to write tests.
ceejbot committed Dec 25, 2023
1 parent b69669d commit 9669fd0
Showing 3 changed files with 115 additions and 27 deletions.
30 changes: 7 additions & 23 deletions installer/core/SoulsyHUD_KID.ini
Original file line number Diff line number Diff line change
@@ -129,25 +129,17 @@ Keyword = Soulsy_Shout_ElementalFury|Spell|DLC2VoiceElementalFury1|NONE|100
Keyword = Soulsy_Shout_ElementalFury|Spell|DLC2VoiceElementalFury2|NONE|100
Keyword = Soulsy_Shout_ElementalFury|Spell|DLC2VoiceElementalFury3|NONE|100


; Dawnguard.esm
Keyword = Soulsy_Shout_|Spell|DLC1SummonDragon|NONE|100
; Dawnguard.esm
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFire06|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFire07|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFireBall06|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFrost06|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFrost07|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDragonFrostBall06|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDrainVitality1|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDrainVitality2|NONE|100
Keyword = Soulsy_Shout_|Spell|DLC1VoiceDrainVitality3|NONE|100
Keyword = Soulsy_Shout_SummonDurnehviir|Spell|DLC1SummonDragon|NONE|100
Keyword = Soulsy_Shout_DrainVitality|Spell|DLC1VoiceDrainVitality1|NONE|100
Keyword = Soulsy_Shout_DrainVitality|Spell|DLC1VoiceDrainVitality2|NONE|100
Keyword = Soulsy_Shout_DrainVitality|Spell|DLC1VoiceDrainVitality3|NONE|100
Keyword = Soulsy_Shout_SoulTear|Spell|DLC1VoiceSoulTear1|NONE|100
Keyword = Soulsy_Shout_SoulTear|Spell|DLC1VoiceSoulTear2|NONE|100
Keyword = Soulsy_Shout_SoulTear|Spell|DLC1VoiceSoulTear3|NONE|100
Keyword = Soulsy_Shout_Uncategorized|Spell|DLC1VoiceUndeadSummon1|NONE|100
Keyword = Soulsy_Shout_Uncategorized|Spell|DLC1VoiceUndeadSummon2|NONE|100
Keyword = Soulsy_Shout_Uncategorized|Spell|DLC1VoiceUndeadSummon3|NONE|100
Keyword = Soulsy_Shout_SoulCairnSummon|Spell|DLC1VoiceUndeadSummon1|NONE|100
Keyword = Soulsy_Shout_SoulCairnSummon|Spell|DLC1VoiceUndeadSummon2|NONE|100
Keyword = Soulsy_Shout_SoulCairnSummon|Spell|DLC1VoiceUndeadSummon3|NONE|100

; ForcefulTongue.esp
Keyword = Soulsy_Shout_SummonDurnehviir|Spell|FT_DLC1SummonDurnehviir|NONE|100
@@ -452,14 +444,6 @@ Keyword = Soulsy_Shout_PhantomDecoy|Spell|TC_PhantomDecoy_Spell2_Ab|NONE|100
Keyword = Soulsy_Shout_PhantomDecoy|Spell|TC_PhantomDecoy_Spell3|NONE|100
Keyword = Soulsy_Shout_PhantomDecoy|Spell|TC_PhantomDecoy_Spell3_Blast1|NONE|100
Keyword = Soulsy_Shout_PhantomDecoy|Spell|TC_PhantomDecoy_Spell3_Blast2|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion0_BringingHomeKyne|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion0_BringingHomeKyne_Ability|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion1_LeapOfFaith|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion2_CloserToKyne|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion3_Pilgrimage|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion4_KynesSacrifice|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion4_KynesSacrifice_Marked|NONE|100
Keyword = Soulsy_Shout_|Spell|TC_Questline_Spell_Champion5_ShoutToTheSky|NONE|100
Keyword = Soulsy_Shout_Riftwalk|Spell|TC_Riftwalk_Spell1|NONE|100
Keyword = Soulsy_Shout_Riftwalk|Spell|TC_Riftwalk_Spell1_Ability|NONE|100
Keyword = Soulsy_Shout_Riftwalk|Spell|TC_Riftwalk_Spell1_VoiceBlast|NONE|100
3 changes: 3 additions & 0 deletions src/data/keywords.rs
Original file line number Diff line number Diff line change
@@ -132,6 +132,9 @@ pub enum SpellKeywords {
Shout_UnrelentingForce,
Shout_WhirlwindSprint,
Shout_PhantomForm,
Shout_SoulCairnSummon,
Shout_LightningBreath,
Shout_PoisonBreath,
Shout_AlessiasLove,
Shout_Annihilate,
Shout_ArcaneHelix,
109 changes: 105 additions & 4 deletions src/data/shout.rs
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ impl ShoutType {
ShoutVariant::ThrowVoice => "Zul-mey-gut!",
ShoutVariant::UnrelentingForce => "Fus-ro-dah!",
ShoutVariant::WhirlwindSprint => "Wuld-nah-kest!",
ShoutVariant::SummonUndead => "Diil-qoth-zaam!",
ShoutVariant::SoulCairnSummon => "Diil-qoth-zaam!",
// stormcrown
ShoutVariant::LightningBreath => "Strun-gaar-kest",
ShoutVariant::PoisonBreath => "Laas-slen-aus",
@@ -173,10 +173,8 @@ pub enum ShoutVariant {
FrostBreath,
IceForm,
KynesPeace,
LightningBreath,
MarkedForDeath,
PhantomForm,
PoisonBreath,
Slowtime,
SoulTear,
Stormcall,
@@ -185,7 +183,10 @@ pub enum ShoutVariant {
UnrelentingForce,
WhirlwindSprint,
// unused dawnguard shout
SummonUndead,
SoulCairnSummon,
// Stormcrown
LightningBreath,
PoisonBreath,
// Thunderchild shouts
AlessiasLove,
Annihilate,
@@ -454,5 +455,105 @@ static SHOUT_MAPPING: Lazy<HashMap<SpellKeywords, (ShoutVariant, Icon)>> = Lazy:
SpellKeywords::Shout_Wanderlust,
(ShoutVariant::Wanderlust, Icon::ShoutWanderlust),
),
(
SpellKeywords::Shout_LightningBreath,
(ShoutVariant::LightningBreath, Icon::ShoutLightningBreath),
),
(
SpellKeywords::Shout_PoisonBreath,
(ShoutVariant::PoisonBreath, Icon::ShoutPoisonBreath),
),
(
SpellKeywords::Shout_SoulCairnSummon,
(ShoutVariant::SoulCairnSummon, Icon::ShoutSoulCairnSummon),
),
])
});

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn all_keywords_used() {
let shoutwords: Vec<SpellKeywords> = vec![
SpellKeywords::Shout_AnimalAllegiance,
SpellKeywords::Shout_AuraWhisper,
SpellKeywords::Shout_BattleFury,
SpellKeywords::Shout_BecomeEthereal,
SpellKeywords::Shout_BendWill,
SpellKeywords::Shout_CallDragon,
SpellKeywords::Shout_CallOfValor,
SpellKeywords::Shout_ClearSkies,
SpellKeywords::Shout_Disarm,
SpellKeywords::Shout_Dismay,
SpellKeywords::Shout_DragonAspect,
SpellKeywords::Shout_Dragonrend,
SpellKeywords::Shout_DrainVitality,
SpellKeywords::Shout_ElementalFury,
SpellKeywords::Shout_FireBreath,
SpellKeywords::Shout_FrostBreath,
SpellKeywords::Shout_IceForm,
SpellKeywords::Shout_KynesPeace,
SpellKeywords::Shout_MarkedForDeath,
SpellKeywords::Shout_Slowtime,
SpellKeywords::Shout_SoulTear,
SpellKeywords::Shout_Stormcall,
SpellKeywords::Shout_SummonDurnehviir,
SpellKeywords::Shout_ThrowVoice,
SpellKeywords::Shout_UnrelentingForce,
SpellKeywords::Shout_WhirlwindSprint,
// Dawnguard unused spell
SpellKeywords::Shout_SoulCairnSummon,
// ForcefulTongue
SpellKeywords::Shout_PhantomForm,
// Stormcrown
SpellKeywords::Shout_LightningBreath,
SpellKeywords::Shout_PoisonBreath,
// Thunderchild
SpellKeywords::Shout_AlessiasLove,
SpellKeywords::Shout_Annihilate,
SpellKeywords::Shout_ArcaneHelix,
SpellKeywords::Shout_Armageddon,
SpellKeywords::Shout_Curse,
SpellKeywords::Shout_DanceOfTheDead,
SpellKeywords::Shout_Earthquake,
SpellKeywords::Shout_EssenceRip,
SpellKeywords::Shout_Evocation,
SpellKeywords::Shout_Geomagnetism,
SpellKeywords::Shout_Iceborn,
SpellKeywords::Shout_JonesShadow,
SpellKeywords::Shout_Kingsbane,
SpellKeywords::Shout_Lifestream,
SpellKeywords::Shout_LightningShield,
SpellKeywords::Shout_Oblivion,
SpellKeywords::Shout_PhantomDecoy,
SpellKeywords::Shout_Riftwalk,
SpellKeywords::Shout_Shattersphere,
SpellKeywords::Shout_ShorsWrath,
SpellKeywords::Shout_ShroudOfSnowfall,
SpellKeywords::Shout_SpeakUntoTheStars,
SpellKeywords::Shout_SplinterTwins,
SpellKeywords::Shout_Stormblast,
SpellKeywords::Shout_TheConqueror,
SpellKeywords::Shout_Trueshot,
SpellKeywords::Shout_WailOfTheBanshee,
SpellKeywords::Shout_Wanderlust,
SpellKeywords::Shout_Warcry,
];

let unused: Vec<&SpellKeywords> = shoutwords
.iter()
.filter(|xs| {
let shout = ShoutType::new(vec![xs.to_string()]);
if matches!(shout.variant, ShoutVariant::Unclassified) {
eprintln!("{xs} turned into unclassified shout");
true
} else {
false
}
})
.collect();
assert!(unused.is_empty());
}
}

0 comments on commit 9669fd0

Please sign in to comment.