Example #1
0
 public EffectAction(
     IProtoStatusEffect protoStatusEffect,
     double intensity,
     [CanBeNull] DelegeteEffectActionCondition condition = null,
     bool isHidden = false)
 {
     this.Condition         = condition;
     this.IsHidden          = isHidden;
     this.ProtoStatusEffect = protoStatusEffect;
     Api.Assert(intensity != 0, "Intensity cannot be 0");
     this.Intensity = MathHelper.Clamp(intensity, -1, 1);
 }
Example #2
0
        public EffectActionsList WillRemoveEffect <TProtoStatusEffect>(
            double intensityToRemove = 1.0,
            [CanBeNull] DelegeteEffectActionCondition condition = null,
            bool isHidden = false)
            where TProtoStatusEffect : IProtoStatusEffect, new()
        {
            if (intensityToRemove <= 0)
            {
                throw new ArgumentException("Intensity to remove must be > 0", nameof(intensityToRemove));
            }

            if (intensityToRemove > 1)
            {
                throw new ArgumentException("Intensity to remove must be <= 1", nameof(intensityToRemove));
            }

            this.list.Add(
                new EffectAction(
                    Api.GetProtoEntity <TProtoStatusEffect>(),
                    -intensityToRemove,
                    condition,
                    isHidden));
            return(this);
        }