Bug Defeat of Island War soldier after war is done talks about war progress.

Veracity

Developer
Staff member
I just did my first (likely only) Avant Guard run. Shiny account. Three day HC - including Liver of Steel and the AT Nemesis quest.

(I was not expecting to like it, but it was interesting enough to do once. I was not expecting all sorts of activities to progress twice as fast because the bodyguard and the main opponent both counted as fights in the zone. The Arid, Extra-Dry Desert, flyer-ing, and even The 8-bit Realm allowed both fights to progress status - although the latter was a mixed bag, since I really wanted 5 fights per zone, not 6. Still, it surprised me.)

The issue: I frequently encountered a "War Hippy" or a "Frat Warrior" as the bodyguard. Sometimes as the bodyguard of somebody of the same army - which progresses the zone twice. Sometimes of a random other monster in a zone I was visiting.

Now, if the war has not yet started - or is in-progress - KoL will give you a recognizable message from which we deduce how the war has progressed against that soldier's side. If I have wished for a War Frat Mobile Grill Unit and yellow rayed it for the uniform (and all the other good stuff), KoL progresses the fight against the fratboys by one - and KoLmafia accounts for that.

After the war, IslandManager.handleBattleFieldMonster doesn't bother doing anything, and doesn't bother logging "frat boys defeated".

But IslandDecorator.decorateBattleFieldFight doesn't check for that and will tell you a "victory message" and an "area message" and a "hero message".

So, when I was given a "War Hippy" monster as the bodyguard after the war, I was told that "1000 hippies defeated, 0 down, 0 left" and to "Keep your eyes open for Neil".

I can see that the fix is for IslandDecorator.decorateBattleFieldFight to not print anything if the war is over.

Seems like a trivial fix - and I have saved HTML of a War Frat monster as the bodyguard, so I could write tests.

Except there's a bigger issue which make tests a lot more problematic, since IslandManager has a whole bunch of static local variables to track war progress.
If it depended on Preferences, I could set the variables exactly as desired, and test IslandManager and Island Decorator.

As is, a couple hours of experimentation left me with no joy.

(I wish I had accepted DoctorRotelle's idea to get rid of the static variables - at least 15 years ago.)

So, this is a bug - I saw it with my own eyes - but writing a test is way more difficult than it should be.

I could submit a fix - with no test - or we could refactor IslandManager to no longer use static variables, first, and make IslandManager and IslandDecorator way more testable.
 
Back
Top