public override void OnFactActivate()
 {
     try
     {
         var context = Buff.Context.SourceAbilityContext;
         foreach (var spell in Spells)
         {
             // Ensure the wish spells use the appropriate spell params and level.
             // This lets a spell-like Wish propagate its params:
             //
             //   Wish spell -> Wish buff -> Wish activatable abilities -> wished-for spell
             //
             // (This is similar to how UnitPartTouch.Init implements sticky touch spells.)
             var ability = Owner.AddFact <Ability>(spell);
             ability.OverrideParams          = context.Params;
             ability.Data.OverrideSpellLevel = context.Params.SpellLevel;
             ability.Data.SpellSource        = context.Params.SpellSource;
             abilities.Add(ability);
         }
     }
     catch (Exception e)
     {
         Log.Error(e);
     }
 }
        public override void OnTurnOff()
        {
            int ranks = GetRanks();

            Log.Write($"Adding permanent inherent bonus +{ranks} to {Stat}");
            var fact = Owner.AddFact <Feature>(PermanentBonus);

            for (int i = 1; i < ranks; i++)
            {
                fact.AddRank();
            }
            Context[AbilitySharedValue.StatBonus] = 0;
        }
Example #3
0
        private Fact Apply()
        {
            Log.Write($"AddFactOnLevelUpCondtion::Apply(), name: {Fact.Blueprint.name}");
            var level = CalcLevel();

            if (IsFeatureShouldBeApplied(level))
            {
                if (appliedFact == null)
                {
                    appliedFact = Owner.AddFact(Feature, null, (Fact as Feature)?.Param);
                    OnAddLevelUpFeature(level);
                }
            }
            else if (appliedFact != null)
            {
                Owner.RemoveFact(appliedFact);
                appliedFact = null;
            }
            return(appliedFact);
        }