internal void CreateCriticalEffect(bool tracked = true)
            {
                var scopedId = ScopedId();

                var effectData = GetEffectData(effectId);

                if (effectData == null)
                {
                    return;
                }
                if (effectData.targetingData.effectTriggerType != EffectTriggerType.Passive) // we only support passive for now
                {
                    return;
                }

                var actor = mechComponent.parent;

                LocationalEffectsFeature.ProcessLocationalEffectData(ref effectData, mechComponent);

                Control.mod.Logger.LogDebug($"Creating scopedId={scopedId} statName={effectData.statisticData.statName}");
                actor.Combat.EffectManager.CreateEffect(
                    effectData, scopedId, -1,
                    actor, actor,
                    default(WeaponHitInfo), 0, false);

                if (tracked)
                {
                    // make sure created effects are removed once component got destroyed
                    mechComponent.createdEffectIDs.Add(scopedId);
                }
            }
Example #2
0
 public static void Prefix(MechComponent __instance, ref EffectData effect)
 {
     try
     {
         LocationalEffectsFeature.ProcessLocationalEffectData(ref effect, __instance);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }