X2CommunityCore / X2WOTCCommunityHighlander

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

X2TargetingMethod_ArcWave doesn't validate its AdditionalTargets it gets as parameter #1408

Open furudee opened 1 week ago

furudee commented 1 week ago

The game assigns any additional targets an ability might hit, I believe in class X2AbilityMultiTargetStyle, native function GetMultiTargetOptions.

The issue is that it seems to incorrectly assign these additional targets when using an ability that uses class X2TargetingMethod_ArcWave as its Targeting Method. In a function GetAdditionalTargets, X2TargetingMethod_ArcWave only adds more targets and validates them, but doesn't validate the existing ones in the function parameter it's given. Other targeting methods that make use of the function seem to validate the targets.

I suggest adding a validation loop in ArcWave targeting method, that checks all targets being hit are also on the tiles being hit. I attempted to use an existing native function that other targeting methods use for validation, but it returned incorrect results.

I'm not aware of any other bug/ability that makes an ability hit more/less targets than intended, so I think just adding a validation is enough in this case

Untitled5 Example: ability has been assigned 2 additional targets instead of the intended amount of 1. This seems to be dependent on the position where the unit initiates the ability. Initiating from left or right and doing a 90 degree attack gives wrong amount of targets, but a straight on attack gives correct amount.