Page 1 of 1

[1.7.4] Doomed Shadows focus_on_target bug

Posted: Wed Mar 09, 2022 7:33 am
by ScienceBall
I was looking at some of the code for Shadows.
There seems to be a bug where the code isn't consistent about where the focus_on_target variable should go.
It gets initialized in the shadow's ai_state, and the Shadow AI checks self.ai_state.focus_on_target.
But Focus Shadows sets it on the shadow's ai_target instead (e.ai_target.focus_on_target = true), and the shadow AI's clearTarget() sets it to false on the shadow directly (not ai_state or ai_target).
I presume that it should be all in one place, but I'm not sure which place it should be in.

Note that this is different from blindside_chance, which deliberately appears as both self.ai_target.blindside_chance and self.ai_state.blindside_chance.

This bug affects Doomed's Shadows. Lich's Shadows (from Doomed For Eternity) also have focus_on_target initialized on their ai_state, but Focus Shadows does not affect them because they have subtype = "lich shadow" instead of "shadow", so there is no practical consequence of this bug for them.