X2CommunityCore / X2WOTCCommunityHighlander

https://steamcommunity.com/workshop/filedetails/?id=1134256495
MIT License
60 stars 68 forks source link

Start of initiative interruptions behave too much like genuine turn starts #1325

Open TacGit1 opened 6 months ago

TacGit1 commented 6 months ago

Initiative interruptions are special, occurring when it isn't the unit's turn. In X2TacticalGameRuleset, in the function: SetupUnitActionsForGroupTurnBegin, it calls SetupActionsForBeginTurn from XComGameState_Unit. In SetupActionsForBeginTurn, things like untouchable, bGotFreeFireAction, and, very critically, CleanupUnitValues(eCleanup_BeginTurn) is here. This means if a skirmisher interrupts a turn, but had untouchable, a hair trigger occurrence, or had some eCleanup_BeginTurn unit values on them, they all get cleared as if their real turn has started.

As another example, if a templar had Interrupt and Parry, their Parry gets cleared on interruption.

I have a fix set up that uses unit values, though this will be my first submission to the CHL, so gonna need some help/time doing this properly.