Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Burst Fire abilities that apply effects that can stack erroneouly multiply stacks by burst shots. #1380

Open
Mitzruti opened this issue Aug 31, 2024 · 1 comment · May be fixed by #1448
Open
Assignees

Comments

@Mitzruti
Copy link
Contributor

That is, if you have a three shot burst that's supposed to apply 1 stack of an effect per hit, it will instead apply 3 stacks per hit for a total of 9 stacks.

The good news is that this should be easily fixed: just remove the totally unnecessary code that does it from OnRefresh is XCGS_Effect.

@BlackDog86
Copy link
Contributor

BlackDog86 commented Jan 6, 2025

Yeah, so it looks like X2AbilityMultiTarget_BurstFire behaves a little differently from what XCGS_Effect is expecting. I think it's expecting to run the PostCreateInit / onRefresh only once for burst fire abilities, when in reality, because burst fire just fires three normal shots, the whole lot gets run n times instead, depending how many additional shots are taken.

Anyway, in essence, you have this code block, which is repeated in both PostCreateInit and the onRefresh of XCGS_Effect (the only difference between the two being that onInit, iStacks = 1 and onRefresh it's iStacks++, which is fine. So yeah I think we just need to take the special burst fire handling out of both functions.

if (EffectTemplate.bStackOnRefresh)
	{
		iStacks++;
		AbilityContext = XComGameStateContext_Ability(NewGameState.GetContext());
		if (AbilityContext != none && AbilityContext.InputContext.PrimaryTarget.ObjectID == ApplyEffectParameters.TargetStateObjectRef.ObjectID)
		{
			AbilityTemplate = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager().FindAbilityTemplate(AbilityContext.InputContext.AbilityTemplateName);
			if (AbilityTemplate != none)
			{
				BurstFire = X2AbilityMultiTarget_BurstFire(AbilityTemplate.AbilityMultiTargetStyle);
				if (BurstFire != none)
				{
					iStacks += BurstFire.NumExtraShots;
				}
			}
		}
	}

@BlackDog86 BlackDog86 linked a pull request Jan 6, 2025 that will close this issue
@BlackDog86 BlackDog86 self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants