Class CompositeBuffTemplate
Composite buff template that combines attribute modifiers, state flags, and resource ticks into a single buff. Follows the Composite pattern to avoid requiring multiple separate buffs for complex effects (e.g., a frost spell that slows movement speed AND freezes AND deals DoT).
[CreateAssetMenu(fileName = "New Composite Buff Template", menuName = "FishMMO/Character/Buff/Composite Buff", order = 5)]
public class CompositeBuffTemplate : BaseBuffTemplate, ICachedObject, ITooltip
- Inheritance
-
ObjectScriptableObjectCompositeBuffTemplate
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
BonusAttributes
[Header("Attribute Modifiers (Applied on Apply/Remove)")]
[Tooltip("Attribute modifiers applied while the buff is active.")]
public List<BuffAttributeTemplate> BonusAttributes
Field Value
DamageAttribute
Damage type used to resolve resistance when a tick reduces health.
[Tooltip("Damage type used for resistance when a tick reduces health. Leave empty for true damage.")]
public DamageAttributeTemplate DamageAttribute
Field Value
Remarks
Leave empty for true damage — a null damage type bypasses resistance entirely, which is the right default for environmental and pure-magic effects. Set it to make a poison respect nature resistance, a burn respect fire resistance, and so on.
Ignored by ticks that heal or that target a resource other than health.
Flags
[Header("State Flags")]
[Tooltip("Character flags to enable while the buff is active.")]
public List<CharacterFlags> Flags
Field Value
TickAttributes
[Header("Resource Tick Effects")]
[Tooltip("Resource modifications per tick. Positive = heal, negative = damage. Scales with stacks.")]
public List<BuffAttributeTemplate> TickAttributes
Field Value
Methods
OnApply(Buff, ICharacter)
Applies attribute modifiers and enables state flags.
public override void OnApply(Buff buff, ICharacter target)
Parameters
buffBuffThe buff instance being applied.
targetICharacterThe character receiving the buff.
OnApplyStack(Buff, ICharacter)
A stack applies only the attribute half of the composite, never the state flags.
public override void OnApplyStack(Buff buff, ICharacter target)
Parameters
buffBuffThe buff instance gaining a stack.
targetICharacterThe character receiving the buff.
Remarks
Without these two overrides the base class routes stacking to OnApply(Buff, ICharacter) and
OnRemove(Buff, ICharacter), so removing ONE stack of a multi-stack composite ran
DisableStateFlags and cleared the crowd-control flag while the buff was still
active with stacks remaining. StateBuffTemplate carries the same pair for
the same reason. Attribute modifiers do stack, and symmetrically, so they stay.
OnRemove(Buff, ICharacter)
Removes attribute modifiers and disables state flags.
public override void OnRemove(Buff buff, ICharacter target)
Parameters
buffBuffThe buff instance being removed.
targetICharacterThe character losing the buff.
OnRemoveStack(Buff, ICharacter)
Removes one stack's attribute modifiers, leaving the state flags to OnRemove(Buff, ICharacter).
public override void OnRemoveStack(Buff buff, ICharacter target)
Parameters
buffBuffThe buff instance losing a stack.
targetICharacterThe character losing the stack.
OnTick(Buff, ICharacter)
Applies resource tick effects scaled by (1 + Stacks).
public override void OnTick(Buff buff, ICharacter target)
Parameters
buffBuffThe buff instance.
targetICharacterThe character affected.
SecondaryTooltip(TooltipBuilder)
Appends a secondary tooltip describing all combined effects.
public override void SecondaryTooltip(TooltipBuilder builder)
Parameters
builderTooltipBuilderThe tooltip builder to populate.