using Cysharp.Threading.Tasks; using UnityEngine; using YachtDice.Modifiers.Core; using YachtDice.Modifiers.Definition; using YachtDice.Modifiers.Runtime; namespace YachtDice.Modifiers.Effects { [CreateAssetMenu(fileName = "PostMultiplyEffect", menuName = "YachtDice/Modifiers/Effects/Post Multiply")] public class PostMultiplyEffect : EffectSO { [SerializeField] private float postMultiplier = 1f; public override UniTask Apply(ModifierContext context, ModifierInstance instance) { context.PostMultiplier *= Mathf.Pow(postMultiplier, instance.Stacks); return UniTask.CompletedTask; } #if UNITY_EDITOR public static PostMultiplyEffect CreateForTest(float postMultiplier, ModifierPhase phase = ModifierPhase.PostMultiplicative, int priority = 0) { var so = CreateInstance(); so.postMultiplier = postMultiplier; so.SetPhaseForTest(phase); so.SetPriorityForTest(priority); return so; } #endif } }