Calculation (GEC)

GameplayEffectCalculations (GEC) are way to execute any custom code when an GameplayEffect is applied. They can be attached to any GameplayEffect. They usually involve doing some sort of "calculation" (e.g. Damage formula involving multiple Attributes like MinDmg, MaxDmg, CritChance, CritBonus) and returning a list of Modifiers to be applied. Calculations are only applied when used with Instant or Periodic Effects (GE)

Creating your own GECs

  1. Inherit from GameplayEffectCalculation

  2. Override the Execute method and implement whatever you want (e.g. DamageCalculation)

  3. Create an ScriptableObject container (e.g. GameplayEffectCalculationSO_DamageCalculation)

    namespace GAS {
        [CreateAssetMenu(menuName = "GAS/GameplayEffectCalculationSO_DamageCalculation", fileName = "GameplayEffectCalculationSO_DamageCalculation")]
        [Serializable]
        public class GameplayEffectCalculationSO_DamageCalculation : GameplayEffectCalculationSO {
            public GameplayEffectCalculationSO_DamageCalculation() {
                calc = new DamageCalculation();
            }
        }
    }

Last updated