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

Add an OnEffectRefreshed function to Persistent effects #1381

Open
Mitzruti opened this issue Aug 31, 2024 · 1 comment
Open

Add an OnEffectRefreshed function to Persistent effects #1381

Mitzruti opened this issue Aug 31, 2024 · 1 comment

Comments

@Mitzruti
Copy link
Contributor

Ideally, this would be called immediately after OnRefresh in HandleApplyEffect and also pass the incoming effect as an argument.

Currently, because HandleApplyEffect is Final, there's no way for a mod to have information about the incoming effect to act on.
if you want to apply multiple stacks of an effect, it's currently only possible when first applying the effect. (or applying the same effect multiple times, but that method can get ugly fast if you want to get fancy)
even if tampering with OnRefresh in the XCGS, you can't currently act on any information from the incoming effect.

It may also be useful to pass the existing effect's pre-refresh duration so that you could have it stack duration instead of just using whichever duration is higher.

It'd also be good if there could be an accompanying vis function, so you could trigger a flyover for the new stacks, duration, or whatever else you're doing like triggering a small heal on refreshing a regen. but I'm not sure where that would be hooked up.

@Iridar
Copy link
Contributor

Iridar commented Sep 12, 2024

Could you not achieve the desired result with a custom persistent effect that would do whatever you want in its OnEffectAdded()? You should be able to make an effect with eDupe_Allowed with OnEffectAdded() that first checks if there's already an instance of this effect on the unit, and then modify duration (or anything else) of the existing effect, and then just not apply itself by calling RemoveEffect() on itself. A bit hacky, but I'm pretty sure that would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants