Dispel
Closed this issue · 1 comments
Chillu1 commented
Before implementing dispel mechanic, it's probably best to implement tags #26 first.
Dispel mechanic is a pretty common in games with buff/debuff mechanics.
It would be nice to have helper/QoL logic inside ModiBuff.Core for dispelling certain modifier types, this is where tags can help a lot with tagging what kind of modifiers to dispel (remove and revert).
Possible dispel tags: Offensive, Defensive, Movement, Basic/Hard Dispel, Undispellable.
Possible API
ModifierController.Dispel(int tagFlags)
/ModifierController.Dispel<TTag>(TTag tagFlags)
Chillu1 commented
Mostly implemented, but with game logic instead of ModiBuff.Core
.
Either through: CallbackEffect
with multi-tag, CallbackEffect
with single event, or CallbackUnit
.
//Most control-oriented dispel solution
add => add("InitStatusEffectSleep_RemoveOnDispel")
.Tag(TagType.BasicDispel)
.Effect(new StatusEffectEffect(StatusEffectType.Sleep, 5f, true), EffectOn.Init)
.Remove(RemoveEffectOn.CallbackEffect)
.CallbackEffect(CallbackType.Dispel, removeEffect =>
new DispelEvent((target, source, eventTag) =>
{
if ((TagType.BasicDispel & eventTag) != 0)
removeEffect.Effect(target, source);
})),
add => add("InitStatusEffectSleep_RemoveOnDispel")
.Tag(TagType.StrongDispel)
.Effect(new StatusEffectEffect(StatusEffectType.Sleep, 5f, true), EffectOn.Init)
.Remove(RemoveEffectOn.CallbackEffect)
.CallbackEffect(CallbackType.StrongDispel, removeEffect => new StrongDispelEvent(removeEffect.Effect)),
//Easiest dispel solution, note that we can't control for what else can happen in the dispel event
add => add("InitStatusEffectSleep_RemoveOnDispel")
.Tag(TagType.StrongDispel)
.Effect(new StatusEffectEffect(StatusEffectType.Sleep, 5f, true), EffectOn.Init)
.Remove(RemoveEffectOn.CallbackUnit)
.CallbackUnit(CallbackUnitType.StrongDispel)
Taken from: