Advertisement
coffeetable

nothing of importance

Sep 21st, 2014
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 134.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [AddComponentMenu("Toolbox/Status Effect")]
  5. public class StatusEffect
  6. {
  7.     public enum ModifiedStat
  8.     {
  9.         MaxHealth,
  10.         MaxStamina,
  11.         Health,
  12.         Stamina,
  13.         MeleeAccuracy,
  14.         RangedAccuracy,
  15.         Deflection,
  16.         Fortitude,
  17.         Reflex,
  18.         Will,
  19.         StaminaRechargeRate,
  20.         AttackSpeed,
  21.         Stealth,
  22.         BonusDamage,
  23.         DamageThreshhold,
  24.         DamageMinimum,
  25.         MovementRate,
  26.         NonTargetable,
  27.         NonMobile,
  28.         KnockedDown,
  29.         EngagedEnemyCount,
  30.         EngagementRadius,
  31.         EngagementAccuracy,
  32.         EngagementDamage,
  33.         Engageable,
  34.         Damage,
  35.         Stunned,
  36.         BonusUnarmedDamage,
  37.         MeleeAttackDistanceMult,
  38.         RangedAttackDistanceMult,
  39.         MeleeAttackAllOnPath,
  40.         BonusMeleeDamageFromWounds,
  41.         BonusDTFromArmor,
  42.         MeleeMissThresholdDelta_DO_NOT_USE,
  43.         MeleeDamageRangePctIncreaseToMin,
  44.         CanStun,
  45.         SneakAttackOnNearDead,
  46.         MeleeCritThresholdDelta_DO_NOT_USE,
  47.         RangedCritThresholdDelta_DO_NOT_USE,
  48.         CanCripple,
  49.         MarkedPrey,
  50.         SuspendHostileEffects,
  51.         BonusMeleeDamage,
  52.         ImmuneToEngageStop,
  53.         HealthLossPctMult,
  54.         BonusDamageMult,
  55.         FocusWhenHits,
  56.         BeamDamageMult,
  57.         DrainResolveForDeflection,
  58.         ReapplyDamage,
  59.         ReapplyDamageToNearbyEnemies,
  60.         ReloadSpeed,
  61.         DropTrap,
  62.         StasisShield,
  63.         SuspendBeneficialEffects,
  64.         DamageBasedOnInverseHealth,
  65.         Resolve,
  66.         Might,
  67.         Dexterity,
  68.         Intellect,
  69.         SummonWeapon,
  70.         TransferStamina,
  71.         StaminaRechargeRateMult,
  72.         VesselAccuracy,
  73.         BeastAccuracy,
  74.         WilderAccuracy,
  75.         StunDefense,
  76.         KnockdownDefense,
  77.         PoisonDefense,
  78.         DiseaseDefense,
  79.         DistantEnemyBonus,
  80.         BonusDamageMultOnLowStaminaTarget,
  81.         BonusCritChanceOnSameEnemy,
  82.         BonusAccuracyForNearestAllyOnSameEnemy,
  83.         EnemyCritToHitPercent,
  84.         HostileEffectDurationMult,
  85.         DeflectReflexGrazeToMissPercent,
  86.         FortitudeWillGrazeToMissPercent,
  87.         ExtraStraightBounces,
  88.         DamageToDOT,
  89.         BonusDamageMultIfTargetHasDOT,
  90.         RedirectMeleeAttacks,
  91.         HostileAOEDamageMultiplier,
  92.         ImprovedFlanking,
  93.         DTBypass,
  94.         StealSpell,
  95.         SwapFaction,
  96.         AttackOnMeleeHit,
  97.         MinorSpellReflection,
  98.         Athletics,
  99.         Lore,
  100.         Mechanics,
  101.         Survival,
  102.         Crafting,
  103.         PushDefense,
  104.         WhileStunnedDefense,
  105.         WhileKnockeddownDefense,
  106.         BonusAccuracyOnSameEnemy,
  107.         BonusDamageMultOnSameEnemy,
  108.         Constitution,
  109.         Perception,
  110.         CritHitMultiplierBonus,
  111.         BonusGrazeToHitPercent,
  112.         CanStunOnCrit,
  113.         BonusGrazeToMissPercent,
  114.         BonusCritToHitPercent,
  115.         BonusMissToGrazePercent,
  116.         BonusHitToCritPercent,
  117.         BonusHitToGrazePercent,
  118.         BonusDamageProc,
  119.         Confused,
  120.         BonusMeleeWeaponDamage,
  121.         BonusRangedWeaponDamage,
  122.         RateOfFireMult,
  123.         ApplyAttackEffects,
  124.         EnemyReflexGrazeToMissPercent,
  125.         StaminaPercent,
  126.         EnemiesNeededToFlankAdj,
  127.         ConcentrationBonus,
  128.         DOTOnHit,
  129.         SpellReflection,
  130.         DisableSpellcasting,
  131.         ResistAffliction,
  132.         PreventDeath,
  133.         AdjustDurationBeneficialEffects,
  134.         DOTTickMult,
  135.         AdjustDurationHostileEffects,
  136.         ResistKeyword,
  137.         TransferDT,
  138.         TransferRandomAttribute,
  139.         Disintegrate,
  140.         BonusAccuracyOnSameEnemyAsExtraObject,
  141.         Duplicate,
  142.         GainStaminaWhenHits,
  143.         CanKnockDownOnCrit,
  144.         BonusAccuracyAtLowStamina,
  145.         BonusDamageMultAtLowStamina,
  146.         BonusDamageMultOnKDSFTarget,
  147.         DamagePlusDOT,
  148.         RangedGrazeReflection,
  149.         EnemyHitToGrazePercent,
  150.         StunDurationMult,
  151.         KnockDownDurationMult,
  152.         BonusArmorDTMultAtLowHealth,
  153.         AccuracyByRace,
  154.         DamageMultByRace,
  155.         Fatigue,
  156.         DUMMY_EFFECT_IncreasedWeaponReach,
  157.         PrimordialAccuracy,
  158.         StopAnimation,
  159.         AddAfflictionImmunity,
  160.         Invisible,
  161.         WoundDelay,
  162.         SpellDamageMult,
  163.         FinishingBlowDamageMult,
  164.         ZealousAuraAoEMult,
  165.         DelayUnconsciousness,
  166.         NegMoveTickMult,
  167.         BonusDamageMultOnFlankedTarget,
  168.         FocusGainMult,
  169.         DisengagementDefense,
  170.         SpellDefense,
  171.         RangedDeflection,
  172.         BonusUsesPerRestPastThree,
  173.         PoisonTickMult,
  174.         DiseaseTickMult,
  175.         StalkersLinkDamageMult,
  176.         DamageToStamina,
  177.         ChanterPhraseAoEMult,
  178.         BonusHealMult,
  179.         IncomingCritDamageMult,
  180.         SpellCastBonus,
  181.         AoEMult,
  182.         FrenzyDurationMult,
  183.         ProneDurationMult,
  184.         WildstrikeDamageMult,
  185.         ReviveAndAddStamina,
  186.         DamageToStaminaRegen,
  187.         LaunchAttack,
  188.         HidesHealthStamina,
  189.         AllDefense,
  190.         MaxStaminaMult,
  191.         CallbackOnDamaged,
  192.         ApplyFinishingBlowDamage,
  193.         NoEffect,
  194.         Accuracy,
  195.         TransferDamageToStamina,
  196.         CallbackAfterAttack,
  197.         Count
  198.     }
  199.     public struct HitTypeModifier
  200.     {
  201.         public StatusEffect.ModifiedStat ModifiedStat;
  202.         public HitType From;
  203.         public HitType To;
  204.         public HitTypeModifier(StatusEffect.ModifiedStat stat, HitType from, HitType to)
  205.         {
  206.             this.ModifiedStat = stat;
  207.             this.From = from;
  208.             this.To = to;
  209.         }
  210.     }
  211.     public enum ApplyType
  212.     {
  213.         ApplyOnTick,
  214.         ApplyOverTime,
  215.         ApplyAtEnd
  216.     }
  217.     public static StatusEffect.HitTypeModifier[] HitTypeStats = new StatusEffect.HitTypeModifier[]
  218.     {
  219.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyCritToHitPercent, HitType.CRIT, HitType.HIT),
  220.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyHitToGrazePercent, HitType.HIT, HitType.GRAZE),
  221.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
  222.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
  223.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
  224.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusGrazeToHitPercent, HitType.GRAZE, HitType.HIT),
  225.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusCritToHitPercent, HitType.CRIT, HitType.HIT),
  226.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusMissToGrazePercent, HitType.MISS, HitType.GRAZE),
  227.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusHitToCritPercent, HitType.HIT, HitType.CRIT),
  228.         new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusHitToGrazePercent, HitType.HIT, HitType.GRAZE)
  229.     };
  230.     protected StatusEffectParams m_params;
  231.     protected GameObject m_source;
  232.     protected GameObject m_owner;
  233.     [Persistent]
  234.     protected uint m_id;
  235.     [Persistent]
  236.     protected Equippable.EquipmentSlot m_slot = Equippable.EquipmentSlot.None;
  237.     [Persistent]
  238.     protected bool m_applied;
  239.     [Persistent]
  240.     protected float m_duration;
  241.     [Persistent]
  242.     protected float m_durationOverride;
  243.     [Persistent]
  244.     protected bool m_needsDurationCalculated = true;
  245.     [Persistent]
  246.     protected float m_timeActive;
  247.     [Persistent]
  248.     protected float m_intervalTimer;
  249.     [Persistent]
  250.     protected uint m_intervalCount;
  251.     [Persistent(Persistent.ConversionType.GUIDLink)]
  252.     protected GameObject m_target;
  253.     protected CharacterStats m_targetStats;
  254.     [Persistent]
  255.     protected bool m_deleteOnClear;
  256.     [Persistent]
  257.     protected bool m_effect_is_on_main_target;
  258.     [Persistent]
  259.     protected uint m_generalCounter = (uint)UnityEngine.Random.Range(0, 6);
  260.     [Persistent]
  261.     protected int m_bundleId = -1;
  262.     protected List<GameObject> m_appliedFX = new List<GameObject>();
  263.     protected Dictionary<GameObject, GameObject> m_auraTargetsApplied = new Dictionary<GameObject, GameObject>();
  264.     protected List<GameObject> m_auraTargetsUnapplied = new List<GameObject>();
  265.     protected List<GameObject> m_forcedAuraTargets = new List<GameObject>();
  266.     [Persistent]
  267.     protected float m_scale = 1f;
  268.     [Persistent]
  269.     protected float m_religiousScale = 1f;
  270.     private bool m_is_checking_melee_path;
  271.     [Persistent]
  272.     private uint m_suspensionCount;
  273.     [Persistent]
  274.     private bool m_suppressed;
  275.     [Persistent]
  276.     private float m_timeApplied;
  277.     [Persistent]
  278.     private int m_numRestCycles;
  279.     [Persistent]
  280.     private GenericSpell m_spell;
  281.     [Persistent]
  282.     private Team m_cachedTeam;
  283.     [Persistent(Persistent.ConversionType.GUIDLink)]
  284.     private GameObject m_extraObject;
  285.     [Persistent]
  286.     private GenericAbility.AbilityType m_stackingType;
  287.     private GenericAbility m_abilityOrigin;
  288.     private Equippable m_equipmentOrigin;
  289.     [Persistent]
  290.     private Phrase m_phraseOrigin;
  291.     [Persistent]
  292.     private Affliction m_afflictionOrigin;
  293.     [Persistent]
  294.     private string m_afflictionKeyword;
  295.     [Persistent]
  296.     private float m_damageToReapply;
  297.     [Persistent]
  298.     private float m_damageToAbsorb;
  299.     [Persistent]
  300.     private int m_triggerCount;
  301.     [Persistent]
  302.     private bool m_triggerCallbackSet;
  303.     [Persistent]
  304.     private float m_durationAfterBreak;
  305.     [Persistent]
  306.     private bool m_ticksAfterBreak;
  307.     [Persistent]
  308.     private float m_increasePerTick;
  309.     [Persistent(Persistent.ConversionType.GUIDLink)]
  310.     public GameObject Source
  311.     {
  312.         get
  313.         {
  314.             return this.m_source;
  315.         }
  316.         set
  317.         {
  318.             this.m_source = value;
  319.         }
  320.     }
  321.     public int BundleId
  322.     {
  323.         get
  324.         {
  325.             return this.m_bundleId;
  326.         }
  327.         set
  328.         {
  329.             this.m_bundleId = value;
  330.         }
  331.     }
  332.     public GameObject ExtraObject
  333.     {
  334.         get
  335.         {
  336.             return this.m_extraObject;
  337.         }
  338.         set
  339.         {
  340.             this.m_extraObject = value;
  341.         }
  342.     }
  343.     public GenericAbility.AbilityType AbilityType
  344.     {
  345.         get
  346.         {
  347.             return this.m_stackingType;
  348.         }
  349.         set
  350.         {
  351.             this.m_stackingType = value;
  352.         }
  353.     }
  354.     [Persistent(Persistent.ConversionType.GUIDLink)]
  355.     public GenericAbility AbilityOrigin
  356.     {
  357.         get
  358.         {
  359.             return this.m_abilityOrigin;
  360.         }
  361.         set
  362.         {
  363.             this.m_abilityOrigin = value;
  364.         }
  365.     }
  366.     [Persistent(Persistent.ConversionType.GUIDLink)]
  367.     public Equippable EquipmentOrigin
  368.     {
  369.         get
  370.         {
  371.             return this.m_equipmentOrigin;
  372.         }
  373.         set
  374.         {
  375.             this.m_equipmentOrigin = value;
  376.         }
  377.     }
  378.     public Phrase PhraseOrigin
  379.     {
  380.         get
  381.         {
  382.             return this.m_phraseOrigin;
  383.         }
  384.         set
  385.         {
  386.             this.m_phraseOrigin = value;
  387.         }
  388.     }
  389.     public Affliction AfflictionOrigin
  390.     {
  391.         get
  392.         {
  393.             return this.m_afflictionOrigin;
  394.         }
  395.         set
  396.         {
  397.             this.m_afflictionOrigin = value;
  398.             if (this.m_afflictionOrigin == AfflictionData.Prone)
  399.             {
  400.                 CharacterStats component = this.m_owner.GetComponent<CharacterStats>();
  401.                 if (component != null)
  402.                 {
  403.                     this.Duration *= component.ProneDurationMult;
  404.                 }
  405.             }
  406.         }
  407.     }
  408.     public string AfflictionKeyword
  409.     {
  410.         get
  411.         {
  412.             return this.m_afflictionKeyword;
  413.         }
  414.         set
  415.         {
  416.             this.m_afflictionKeyword = value.Trim().ToLowerInvariant();
  417.         }
  418.     }
  419.     public float DurationAfterBreak
  420.     {
  421.         get
  422.         {
  423.             return this.m_durationAfterBreak;
  424.         }
  425.         set
  426.         {
  427.             this.m_durationAfterBreak = value;
  428.         }
  429.     }
  430.     public bool TicksAfterBreak
  431.     {
  432.         get
  433.         {
  434.             return this.m_ticksAfterBreak;
  435.         }
  436.         set
  437.         {
  438.             this.m_ticksAfterBreak = value;
  439.         }
  440.     }
  441.     public float IncreasePerTick
  442.     {
  443.         get
  444.         {
  445.             return this.m_increasePerTick;
  446.         }
  447.         set
  448.         {
  449.             this.m_increasePerTick = value;
  450.         }
  451.     }
  452.     public float FriendlyRadius
  453.     {
  454.         get
  455.         {
  456.             float num = this.m_params.FriendlyRadius;
  457.             if (this.Owner != null)
  458.             {
  459.                 CharacterStats component = this.Owner.GetComponent<CharacterStats>();
  460.                 if (component != null)
  461.                 {
  462.                     num *= component.StatEffectAreaMultiplier;
  463.                 }
  464.             }
  465.             if (this.m_abilityOrigin != null)
  466.             {
  467.                 num *= this.m_abilityOrigin.RadiusMultiplier;
  468.             }
  469.             if (num > 0f && this.m_triggerCallbackSet && this.m_triggerCount > 0)
  470.             {
  471.                 num += this.m_params.TriggerAdjustment.RadiusAdjustment * (float)this.m_triggerCount;
  472.             }
  473.             return num;
  474.         }
  475.         set
  476.         {
  477.             this.m_params.FriendlyRadius = value;
  478.         }
  479.     }
  480.     public float HostileRadius
  481.     {
  482.         get
  483.         {
  484.             float num = this.m_params.HostileRadius;
  485.             if (this.Owner != null)
  486.             {
  487.                 CharacterStats component = this.Owner.GetComponent<CharacterStats>();
  488.                 if (component != null)
  489.                 {
  490.                     num *= component.StatEffectAreaMultiplier;
  491.                 }
  492.             }
  493.             if (num > 0f && this.m_triggerCallbackSet && this.m_triggerCount > 0)
  494.             {
  495.                 num += this.m_params.TriggerAdjustment.RadiusAdjustment * (float)this.m_triggerCount;
  496.             }
  497.             return num;
  498.         }
  499.         set
  500.         {
  501.             this.m_params.HostileRadius = value;
  502.         }
  503.     }
  504.     public bool IsHostileAura
  505.     {
  506.         get
  507.         {
  508.             return this.HostileRadius > 0f && this.FriendlyRadius == 0f;
  509.         }
  510.     }
  511.     public bool IsAura
  512.     {
  513.         get
  514.         {
  515.             return this.HostileRadius > 0f || this.FriendlyRadius > 0f;
  516.         }
  517.     }
  518.     [Persistent(Persistent.ConversionType.GUIDLink)]
  519.     public GameObject Owner
  520.     {
  521.         get
  522.         {
  523.             return this.m_owner;
  524.         }
  525.         set
  526.         {
  527.             this.m_owner = value;
  528.         }
  529.     }
  530.     public bool Stackable
  531.     {
  532.         get
  533.         {
  534.             if (this.Params.Value < 0f)
  535.             {
  536.                 return true;
  537.             }
  538.             switch (this.AbilityType)
  539.             {
  540.             case GenericAbility.AbilityType.Equipment:
  541.                 return false;
  542.             case GenericAbility.AbilityType.Ring:
  543.                 return false;
  544.             case GenericAbility.AbilityType.Spell:
  545.                 return false;
  546.             case GenericAbility.AbilityType.Attribute:
  547.                 return true;
  548.             case GenericAbility.AbilityType.Ability:
  549.                 return true;
  550.             case GenericAbility.AbilityType.Talent:
  551.                 return true;
  552.             default:
  553.                 return true;
  554.             }
  555.         }
  556.     }
  557.     public bool IsSuppressed
  558.     {
  559.         get
  560.         {
  561.             return this.m_suppressed;
  562.         }
  563.     }
  564.     public bool Applied
  565.     {
  566.         get
  567.         {
  568.             return this.m_applied;
  569.         }
  570.     }
  571.     public bool HasBeenApplied
  572.     {
  573.         get
  574.         {
  575.             return this.m_timeActive > 0f || (this.m_applied && this.Duration == 0f);
  576.         }
  577.     }
  578.     public bool Expired
  579.     {
  580.         get
  581.         {
  582.             return this.Duration != 0f && this.TimeLeft <= 0f && this.DurationAfterBreak <= 0f;
  583.         }
  584.     }
  585.     public float TimeApplied
  586.     {
  587.         get
  588.         {
  589.             return this.m_timeApplied;
  590.         }
  591.     }
  592.     public Equippable.EquipmentSlot Slot
  593.     {
  594.         get
  595.         {
  596.             return this.m_slot;
  597.         }
  598.         set
  599.         {
  600.             this.m_slot = value;
  601.         }
  602.     }
  603.     [Persistent]
  604.     public StatusEffectParams Params
  605.     {
  606.         get
  607.         {
  608.             return this.m_params;
  609.         }
  610.         set
  611.         {
  612.             this.m_params = value;
  613.             if (this.m_params != null && this.m_params.OnAppliedVisualEffect != null && this.m_target != null)
  614.             {
  615.                 Transform transform = AttackBase.GetTransform(this.m_target, this.Params.VisualEffectAttach);
  616.                 GameObject gameObject = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
  617.                 if (gameObject != null)
  618.                 {
  619.                     this.m_appliedFX.Add(gameObject);
  620.                 }
  621.             }
  622.         }
  623.     }
  624.     public float CurrentAppliedValue
  625.     {
  626.         get
  627.         {
  628.             float num = this.Scale * this.m_religiousScale;
  629.             float num2 = 0f;
  630.             if (this.Params.TriggerAdjustment != null)
  631.             {
  632.                 num2 = this.Params.TriggerAdjustment.ValueAdjustment * (float)this.m_triggerCount;
  633.             }
  634.             float num3 = this.Params.Value + num2;
  635.             if (this.AfflictionOrigin == null)
  636.             {
  637.                 if (this.IsScaledMultiplier)
  638.                 {
  639.                     num3 -= 1f;
  640.                     num3 *= num;
  641.                     num3 += 1f;
  642.                 }
  643.                 else
  644.                 {
  645.                     if (!this.IsDOT)
  646.                     {
  647.                         num3 *= num;
  648.                     }
  649.                 }
  650.             }
  651.             return num3;
  652.         }
  653.     }
  654.     public float Duration
  655.     {
  656.         get
  657.         {
  658.             return this.m_duration;
  659.         }
  660.         set
  661.         {
  662.             this.m_duration = value;
  663.         }
  664.     }
  665.     public bool LastsUntilCombatEnds
  666.     {
  667.         get
  668.         {
  669.             return this.Params.LastsUntilCombatEnds;
  670.         }
  671.     }
  672.     public bool LastsUntilRest
  673.     {
  674.         get
  675.         {
  676.             return this.Params.LastsUntilRest;
  677.         }
  678.     }
  679.     public float TimeLeft
  680.     {
  681.         get
  682.         {
  683.             if (this.Duration == 0f)
  684.             {
  685.                 return 0f;
  686.             }
  687.             return this.Duration - this.m_timeActive;
  688.         }
  689.     }
  690.     public float Scale
  691.     {
  692.         get
  693.         {
  694.             return this.m_scale;
  695.         }
  696.         set
  697.         {
  698.             this.m_scale = value;
  699.         }
  700.     }
  701.     public string HitStrength
  702.     {
  703.         get
  704.         {
  705.             if (this.Scale < 1f)
  706.             {
  707.                 return GUIUtils.GetText(55);
  708.             }
  709.             if (this.Scale > 1f)
  710.             {
  711.                 return GUIUtils.GetText(56);
  712.             }
  713.             return string.Empty;
  714.         }
  715.     }
  716.     public bool IsDOT
  717.     {
  718.         get
  719.         {
  720.             if (this.Params.Interval > 0f && ((this.FriendlyRadius == 0f && this.HostileRadius == 0f) || this.Params.ContinuousApplicationAura) && (this.Params.Apply == StatusEffect.ApplyType.ApplyOnTick || this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime))
  721.             {
  722.                 if (this.Params.Value < 0f && (this.Params.AffectsStat == StatusEffect.ModifiedStat.Health || this.Params.AffectsStat == StatusEffect.ModifiedStat.Stamina || this.Params.AffectsStat == StatusEffect.ModifiedStat.StaminaPercent))
  723.                 {
  724.                     return true;
  725.                 }
  726.                 if (this.Params.Value > 0f && this.Params.AffectsStat == StatusEffect.ModifiedStat.Damage)
  727.                 {
  728.                     return true;
  729.                 }
  730.                 if (this.Params.AffectsStat == StatusEffect.ModifiedStat.TransferStamina)
  731.                 {
  732.                     return true;
  733.                 }
  734.                 if (this.Params.AffectsStat == StatusEffect.ModifiedStat.TransferDamageToStamina)
  735.                 {
  736.                     return true;
  737.                 }
  738.             }
  739.             return false;
  740.         }
  741.     }
  742.     public bool IsScaledMultiplier
  743.     {
  744.         get
  745.         {
  746.             return this.Params.AffectsStat == StatusEffect.ModifiedStat.AttackSpeed || this.Params.AffectsStat == StatusEffect.ModifiedStat.HealthLossPctMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.StaminaRechargeRateMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.HostileEffectDurationMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.HostileAOEDamageMultiplier || this.Params.AffectsStat == StatusEffect.ModifiedStat.RateOfFireMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.DOTTickMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.KnockDownDurationMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.BonusArmorDTMultAtLowHealth || this.Params.AffectsStat == StatusEffect.ModifiedStat.FinishingBlowDamageMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.ZealousAuraAoEMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.NegMoveTickMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.FocusGainMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.PoisonTickMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.DiseaseTickMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.StalkersLinkDamageMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.ChanterPhraseAoEMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.BonusHealMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.AoEMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.FrenzyDurationMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.ProneDurationMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.WildstrikeDamageMult || this.Params.AffectsStat == StatusEffect.ModifiedStat.MaxStaminaMult;
  747.         }
  748.     }
  749.     public bool IsNegativeMovementEffect
  750.     {
  751.         get
  752.         {
  753.             return (this.Params.Value < 0f && this.Params.AffectsStat == StatusEffect.ModifiedStat.MovementRate) || (this.Params.AffectsStat == StatusEffect.ModifiedStat.NonMobile || this.Params.AffectsStat == StatusEffect.ModifiedStat.StopAnimation);
  754.         }
  755.     }
  756.     public bool IsPoisonEffect
  757.     {
  758.         get
  759.         {
  760.             return (this.m_abilityOrigin != null && this.m_abilityOrigin.Attack != null && this.m_abilityOrigin.Attack.HasKeyword("poison")) || (this.m_afflictionOrigin != null && this.m_afflictionKeyword != null && this.m_afflictionKeyword.Equals("poison", StringComparison.Ordinal));
  761.         }
  762.     }
  763.     public bool IsDiseaseEffect
  764.     {
  765.         get
  766.         {
  767.             return (this.m_abilityOrigin != null && this.m_abilityOrigin.Attack != null && this.m_abilityOrigin.Attack.HasKeyword("disease")) || (this.m_afflictionOrigin != null && this.m_afflictionKeyword != null && this.m_afflictionKeyword.Equals("disease", StringComparison.Ordinal));
  768.         }
  769.     }
  770.     public List<GameObject> ForcedAuraTargets
  771.     {
  772.         get
  773.         {
  774.             return this.m_forcedAuraTargets;
  775.         }
  776.     }
  777.     public bool DeleteOnClear
  778.     {
  779.         get
  780.         {
  781.             return this.m_deleteOnClear;
  782.         }
  783.         set
  784.         {
  785.             this.m_deleteOnClear = value;
  786.         }
  787.     }
  788.     public uint EffectID
  789.     {
  790.         get
  791.         {
  792.             return this.m_id;
  793.         }
  794.         set
  795.         {
  796.             this.m_id = value;
  797.         }
  798.     }
  799.     public string BundleName
  800.     {
  801.         get
  802.         {
  803.             if (this.AfflictionOrigin != null)
  804.             {
  805.                 return this.AfflictionOrigin.DisplayName.ToString();
  806.             }
  807.             if (this.AbilityOrigin != null)
  808.             {
  809.                 return GenericAbility.Name(this.AbilityOrigin);
  810.             }
  811.             if (this.EquipmentOrigin != null)
  812.             {
  813.                 return this.EquipmentOrigin.Name;
  814.             }
  815.             if (this.PhraseOrigin != null)
  816.             {
  817.                 return this.PhraseOrigin.DisplayName.ToString();
  818.             }
  819.             return null;
  820.         }
  821.     }
  822.     public static bool StatModifiesRatio(StatusEffect.ModifiedStat stat)
  823.     {
  824.         return stat == StatusEffect.ModifiedStat.DamageToStamina || stat == StatusEffect.ModifiedStat.BonusDamageProc || stat == StatusEffect.ModifiedStat.CanStun || stat == StatusEffect.ModifiedStat.SneakAttackOnNearDead || stat == StatusEffect.ModifiedStat.CanCripple || stat == StatusEffect.ModifiedStat.HealthLossPctMult || stat == StatusEffect.ModifiedStat.GainStaminaWhenHits || stat == StatusEffect.ModifiedStat.DamageToStaminaRegen || stat == StatusEffect.ModifiedStat.ReapplyDamage || stat == StatusEffect.ModifiedStat.ReapplyDamageToNearbyEnemies || stat == StatusEffect.ModifiedStat.AttackSpeed;
  825.     }
  826.     public static StatusEffect.ModifiedStat AttributeTypeToModifiedStat(CharacterStats.AttributeScoreType type)
  827.     {
  828.         switch (type)
  829.         {
  830.         case CharacterStats.AttributeScoreType.Resolve:
  831.             return StatusEffect.ModifiedStat.Resolve;
  832.         case CharacterStats.AttributeScoreType.Might:
  833.             return StatusEffect.ModifiedStat.Might;
  834.         case CharacterStats.AttributeScoreType.Dexterity:
  835.             return StatusEffect.ModifiedStat.Dexterity;
  836.         case CharacterStats.AttributeScoreType.Intellect:
  837.             return StatusEffect.ModifiedStat.Intellect;
  838.         case CharacterStats.AttributeScoreType.Constitution:
  839.             return StatusEffect.ModifiedStat.Constitution;
  840.         case CharacterStats.AttributeScoreType.Perception:
  841.             return StatusEffect.ModifiedStat.Perception;
  842.         default:
  843.             return StatusEffect.ModifiedStat.Count;
  844.         }
  845.     }
  846.     public static StatusEffect.ModifiedStat SkillTypeToModifiedStat(CharacterStats.SkillType skill)
  847.     {
  848.         switch (skill)
  849.         {
  850.         case CharacterStats.SkillType.Stealth:
  851.             return StatusEffect.ModifiedStat.Stealth;
  852.         case CharacterStats.SkillType.Athletics:
  853.             return StatusEffect.ModifiedStat.Athletics;
  854.         case CharacterStats.SkillType.Lore:
  855.             return StatusEffect.ModifiedStat.Lore;
  856.         case CharacterStats.SkillType.Mechanics:
  857.             return StatusEffect.ModifiedStat.Mechanics;
  858.         case CharacterStats.SkillType.Survival:
  859.             return StatusEffect.ModifiedStat.Survival;
  860.         case CharacterStats.SkillType.Crafting:
  861.             return StatusEffect.ModifiedStat.Crafting;
  862.         default:
  863.             return StatusEffect.ModifiedStat.Count;
  864.         }
  865.     }
  866.     public float DotExpectedDamage(GameObject target)
  867.     {
  868.         Health component = target.GetComponent<Health>();
  869.         if (this.Params.AffectsStat != StatusEffect.ModifiedStat.Damage && this.Params.AffectsStat != StatusEffect.ModifiedStat.DamageBasedOnInverseHealth)
  870.         {
  871.             return 0f;
  872.         }
  873.         float num = 1f;
  874.         if (this.Params.AffectsStat == StatusEffect.ModifiedStat.DamageBasedOnInverseHealth)
  875.         {
  876.             num = 1f - component.CurrentHealth / component.MaxHealth;
  877.         }
  878.         long num2 = (long)Mathf.FloorToInt(this.Params.Duration / this.Params.Interval) - (long)((ulong)this.m_intervalCount);
  879.         if (this.IncreasePerTick > 0f)
  880.         {
  881.             return this.Params.Value * num * (float)(num2 * (num2 + 1L) / 2L) * this.IncreasePerTick;
  882.         }
  883.         return this.Params.Value * num * (float)num2;
  884.     }
  885.     public static List<List<StatusEffect>> FilterAfflictions(ref List<StatusEffect> effectList)
  886.     {
  887.         List<List<StatusEffect>> list = new List<List<StatusEffect>>();
  888.         for (int i = effectList.Count - 1; i >= 0; i--)
  889.         {
  890.             StatusEffect statusEffect = effectList[i];
  891.             if (statusEffect.AfflictionOrigin)
  892.             {
  893.                 List<StatusEffect> list2 = null;
  894.                 bool flag = false;
  895.                 for (int j = 0; j < list.Count; j++)
  896.                 {
  897.                     if (list[j][0].AfflictionOrigin == statusEffect.AfflictionOrigin)
  898.                     {
  899.                         list2 = list[j];
  900.                         flag = true;
  901.                         break;
  902.                     }
  903.                 }
  904.                 if (!flag)
  905.                 {
  906.                     list2 = new List<StatusEffect>();
  907.                     list.Add(list2);
  908.                 }
  909.                 list2.Add(statusEffect);
  910.                 effectList.Remove(statusEffect);
  911.             }
  912.         }
  913.         return list;
  914.     }
  915.     public static List<StatusEffect> BundleEffects(ref List<StatusEffect> effectList, out float longestDuration)
  916.     {
  917.         longestDuration = 0f;
  918.         if (effectList.Count == 0)
  919.         {
  920.             return null;
  921.         }
  922.         List<StatusEffect> list = new List<StatusEffect>();
  923.         list.Add(effectList[0]);
  924.         effectList.RemoveAt(0);
  925.         longestDuration = list[0].TimeLeft;
  926.         for (int i = effectList.Count - 1; i >= 0; i--)
  927.         {
  928.             StatusEffect statusEffect = effectList[i];
  929.             if (statusEffect.BundlesWith(list[0]))
  930.             {
  931.                 list.Add(statusEffect);
  932.                 effectList.Remove(statusEffect);
  933.                 if (statusEffect.TimeLeft > longestDuration)
  934.                 {
  935.                     longestDuration = statusEffect.TimeLeft;
  936.                 }
  937.             }
  938.         }
  939.         return list;
  940.     }
  941.     public static StatusEffect Create(GameObject owner, StatusEffectParams param, GenericAbility.AbilityType abType, DamageInfo hitInfo, bool deleteOnClear)
  942.     {
  943.         return StatusEffect.Create(owner, param, abType, hitInfo, deleteOnClear, 0f);
  944.     }
  945.     public static StatusEffect Create(GameObject owner, StatusEffectParams param, GenericAbility.AbilityType abType, DamageInfo hitInfo, bool deleteOnClear, float durationOverride)
  946.     {
  947.         StatusEffect statusEffect = new StatusEffect();
  948.         GameObject gameObject = GameUtilities.FindParentCharacter(owner);
  949.         statusEffect.m_owner = gameObject;
  950.         statusEffect.Params = param;
  951.         statusEffect.AbilityType = abType;
  952.         statusEffect.m_abilityOrigin = owner.GetComponent<GenericAbility>();
  953.         if (hitInfo != null)
  954.         {
  955.             if (hitInfo.IsCriticalHit)
  956.             {
  957.                 statusEffect.Scale = CharacterStats.CritMultiplier;
  958.             }
  959.             if (hitInfo.IsGraze)
  960.             {
  961.                 statusEffect.Scale = CharacterStats.GrazeMultiplier;
  962.             }
  963.         }
  964.         statusEffect.m_needsDurationCalculated = true;
  965.         statusEffect.m_durationOverride = durationOverride;
  966.         statusEffect.CalculateDuration();
  967.         statusEffect.DeleteOnClear = deleteOnClear;
  968.         statusEffect.m_timeApplied = Time.time;
  969.         if (param.ChecksReligion)
  970.         {
  971.             statusEffect.m_religiousScale = Religion.Instance.GetCurrentBonusMultiplier(gameObject, statusEffect.m_abilityOrigin);
  972.         }
  973.         GenericCipherAbility component = owner.GetComponent<GenericCipherAbility>();
  974.         if (component != null)
  975.         {
  976.             statusEffect.DurationAfterBreak = component.DurationAfterBreak;
  977.             statusEffect.TicksAfterBreak = component.TicksAfterBreak;
  978.             statusEffect.IncreasePerTick = component.IncreasePerTick;
  979.         }
  980.         return statusEffect;
  981.     }
  982.     public void Restored()
  983.     {
  984.         if (this.m_target)
  985.         {
  986.             this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
  987.         }
  988.     }
  989.     public void Update()
  990.     {
  991.         this.UpdateHelper(Time.deltaTime);
  992.     }
  993.     public void TimeJumpUpdate(float seconds)
  994.     {
  995.         if (seconds <= 0f)
  996.         {
  997.             return;
  998.         }
  999.         this.UpdateHelper(seconds);
  1000.     }
  1001.     private void UpdateHelper(float seconds)
  1002.     {
  1003.         if (this.m_target == null)
  1004.         {
  1005.             return;
  1006.         }
  1007.         if (this.m_suspensionCount > 0u)
  1008.         {
  1009.             return;
  1010.         }
  1011.         if (this.m_intervalTimer > 0f)
  1012.         {
  1013.             float num = seconds;
  1014.             if (this.m_targetStats != null)
  1015.             {
  1016.                 if (this.IsDOT)
  1017.                 {
  1018.                     num *= this.m_targetStats.DOTTickMult;
  1019.                 }
  1020.                 if (this.IsNegativeMovementEffect)
  1021.                 {
  1022.                     num *= this.m_targetStats.NegMoveTickMult;
  1023.                 }
  1024.                 if (this.IsPoisonEffect)
  1025.                 {
  1026.                     num *= this.m_targetStats.PoisonTickMult;
  1027.                 }
  1028.                 if (this.IsDiseaseEffect)
  1029.                 {
  1030.                     num *= this.m_targetStats.DiseaseTickMult;
  1031.                 }
  1032.             }
  1033.             this.m_intervalTimer -= num;
  1034.         }
  1035.         this.m_timeActive += seconds;
  1036.         if (!this.m_suppressed && this.m_applied)
  1037.         {
  1038.             this.UpdateActiveEffect(seconds);
  1039.         }
  1040.         if (this.Duration > 0f && this.m_timeActive > this.Duration && this.DurationAfterBreak <= 0f)
  1041.         {
  1042.             this.ClearEffect(this.m_target);
  1043.         }
  1044.     }
  1045.     private void UpdateActiveEffect(float seconds)
  1046.     {
  1047.         if (this.m_triggerCallbackSet && this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.Timer && this.m_triggerCount < this.Params.TriggerAdjustment.MaxTriggerCount && this.m_timeActive >= this.Params.TriggerAdjustment.TriggerValue * (float)(this.m_triggerCount + 1))
  1048.         {
  1049.             this.OnTrigger();
  1050.         }
  1051.         if ((this.Duration > 0f || this.Params.Interval > 0f) && this.m_target != null && this.m_intervalTimer <= 0f)
  1052.         {
  1053.             float num = (this.Duration <= 0f) ? 1f : this.Duration;
  1054.             float friendlyRadius = this.FriendlyRadius;
  1055.             float hostileRadius = this.HostileRadius;
  1056.             bool flag = friendlyRadius > 0f || hostileRadius > 0f;
  1057.             if (this.Duration > 0f && this.m_timeActive >= this.Duration)
  1058.             {
  1059.                 if (this.DurationAfterBreak <= 0f)
  1060.                 {
  1061.                     if (this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd)
  1062.                     {
  1063.                         this.ApplyEffect(this.m_target, this.Params.Value);
  1064.                         if (flag || this.m_forcedAuraTargets.Count > 0)
  1065.                         {
  1066.                             this.ApplyAura(this.Params.Value);
  1067.                         }
  1068.                     }
  1069.                     this.ClearEffect(this.m_target);
  1070.                 }
  1071.             }
  1072.             else
  1073.             {
  1074.                 if (this.m_intervalTimer <= 0f)
  1075.                 {
  1076.                     this.m_intervalTimer = this.Params.Interval;
  1077.                     if (this.Params.Apply != StatusEffect.ApplyType.ApplyAtEnd)
  1078.                     {
  1079.                         if (flag || this.m_forcedAuraTargets.Count > 0)
  1080.                         {
  1081.                             Vector3 b = (!(this.m_target != null)) ? this.Owner.transform.position : this.m_target.transform.position;
  1082.                             List<GameObject> list = new List<GameObject>(this.m_auraTargetsApplied.Keys);
  1083.                             list.AddRange(this.m_auraTargetsUnapplied);
  1084.                             foreach (GameObject current in list)
  1085.                             {
  1086.                                 if (!(current == null))
  1087.                                 {
  1088.                                     float sqrMagnitude = (current.transform.position - b).sqrMagnitude;
  1089.                                     if (sqrMagnitude > friendlyRadius * friendlyRadius && sqrMagnitude > hostileRadius * hostileRadius)
  1090.                                     {
  1091.                                         this.RemoveAura(current);
  1092.                                     }
  1093.                                 }
  1094.                             }
  1095.                         }
  1096.                         if (this.Params.Interval > 0f && this.Params.Apply != StatusEffect.ApplyType.ApplyOverTime)
  1097.                         {
  1098.                             if (!flag || this.m_params.ContinuousApplicationAura || !this.m_effect_is_on_main_target)
  1099.                             {
  1100.                                 this.ApplyEffect(this.m_target, this.Params.Value);
  1101.                             }
  1102.                             if (flag || this.m_forcedAuraTargets.Count > 0)
  1103.                             {
  1104.                                 this.ApplyAura(this.Params.Value);
  1105.                             }
  1106.                         }
  1107.                         else
  1108.                         {
  1109.                             float num2 = seconds;
  1110.                             if (this.Params.Interval > 0f)
  1111.                             {
  1112.                                 num2 = this.Params.Interval;
  1113.                             }
  1114.                             float num3 = this.Params.Value * (1f / num) * num2;
  1115.                             this.ApplyEffect(this.m_target, num3);
  1116.                             if (flag || this.m_forcedAuraTargets.Count > 0)
  1117.                             {
  1118.                                 this.ApplyAura(num3);
  1119.                             }
  1120.                         }
  1121.                     }
  1122.                     this.m_intervalCount += 1u;
  1123.                 }
  1124.             }
  1125.         }
  1126.     }
  1127.     private void ApplyAura(float amount)
  1128.     {
  1129.         if (this.m_target == null)
  1130.         {
  1131.             return;
  1132.         }
  1133.         foreach (Faction current in Faction.ActiveFactionComponents)
  1134.         {
  1135.             if (!(current == null) && !(current.gameObject == null) && !(current.gameObject == this.m_target))
  1136.             {
  1137.                 Faction.Relationship relationship = current.GetRelationship(this.m_target);
  1138.                 CharacterStats component = current.gameObject.GetComponent<CharacterStats>();
  1139.                 if (!(component == null))
  1140.                 {
  1141.                     Health component2 = current.gameObject.GetComponent<Health>();
  1142.                     if (!(component2 != null) || component2.Targetable)
  1143.                     {
  1144.                         float sqrMagnitude = (current.transform.position - this.m_target.transform.position).sqrMagnitude;
  1145.                         if (this.m_forcedAuraTargets.Contains(current.gameObject) || (relationship == Faction.Relationship.Hostile && sqrMagnitude < this.HostileRadius * this.HostileRadius) || (relationship == Faction.Relationship.Friendly && sqrMagnitude < this.FriendlyRadius * this.FriendlyRadius))
  1146.                         {
  1147.                             bool flag = this.m_auraTargetsApplied.ContainsKey(current.gameObject) || this.m_auraTargetsUnapplied.Contains(current.gameObject);
  1148.                             bool applied = false;
  1149.                             bool flag2 = true;
  1150.                             if (!flag && this.m_owner != null && this.m_abilityOrigin != null && this.m_abilityOrigin.AuraDefense != CharacterStats.DefenseType.None)
  1151.                             {
  1152.                                 if (this.m_abilityOrigin.AuraTargetsWhoDefended.ContainsKey(current.gameObject))
  1153.                                 {
  1154.                                     if (this.m_abilityOrigin.AuraTargetsWhoDefended[current.gameObject] == HitType.MISS)
  1155.                                     {
  1156.                                         flag2 = false;
  1157.                                     }
  1158.                                 }
  1159.                                 else
  1160.                                 {
  1161.                                     CharacterStats component3 = this.m_owner.GetComponent<CharacterStats>();
  1162.                                     if (component3 != null)
  1163.                                     {
  1164.                                         DamageInfo damageInfo = component3.ComputeSecondaryAttack(null, current.gameObject, this.m_abilityOrigin.AuraDefense);
  1165.                                         this.m_abilityOrigin.AuraTargetsWhoDefended.Add(current.gameObject, damageInfo.HitType);
  1166.                                         if (damageInfo.HitType == HitType.MISS)
  1167.                                         {
  1168.                                             flag2 = false;
  1169.                                         }
  1170.                                         List<StatusEffect> list = new List<StatusEffect>();
  1171.                                         list.Add(this);
  1172.                                         AttackBase.PostAttackMessages(current.gameObject, this.Owner, damageInfo, list, true);
  1173.                                     }
  1174.                                 }
  1175.                             }
  1176.                             if ((!flag || this.m_params.ContinuousApplicationAura) && flag2 && !this.m_auraTargetsUnapplied.Contains(current.gameObject))
  1177.                             {
  1178.                                 applied = this.ApplyEffect(current.gameObject, amount);
  1179.                             }
  1180.                             if (!flag)
  1181.                             {
  1182.                                 this.AddAura(current.gameObject, applied);
  1183.                             }
  1184.                         }
  1185.                     }
  1186.                 }
  1187.             }
  1188.         }
  1189.     }
  1190.     public void AddAura(GameObject obj, bool applied)
  1191.     {
  1192.         if (this == null)
  1193.         {
  1194.             return;
  1195.         }
  1196.         if (obj == null)
  1197.         {
  1198.             return;
  1199.         }
  1200.         if (applied)
  1201.         {
  1202.             CharacterStats component = obj.GetComponent<CharacterStats>();
  1203.             if (component != null)
  1204.             {
  1205.                 component.AurasAffectingMeReadOnly.Add(this);
  1206.                 if (component.OnAddStatusEffect != null)
  1207.                 {
  1208.                     component.OnAddStatusEffect(this, true);
  1209.                 }
  1210.             }
  1211.             Transform transform = AttackBase.GetTransform(obj, this.Params.VisualEffectAttach);
  1212.             GameObject value = GameUtilities.LaunchLoopingEffect(this.m_params.OnAuraVisualEffect, transform.position, transform.rotation, 1f, transform);
  1213.             this.m_auraTargetsApplied.Add(obj, value);
  1214.         }
  1215.         else
  1216.         {
  1217.             this.m_auraTargetsUnapplied.Add(obj);
  1218.         }
  1219.         Health component2 = obj.GetComponent<Health>();
  1220.         if (component2 != null)
  1221.         {
  1222.             component2.OnDeath += new GameInputEventHandle(this.HandleAuraOnDeathAndDestroy);
  1223.         }
  1224.     }
  1225.     public void RemoveAura(GameObject obj)
  1226.     {
  1227.         if (obj == null)
  1228.         {
  1229.             return;
  1230.         }
  1231.         if (this.m_auraTargetsUnapplied.Contains(obj))
  1232.         {
  1233.             this.m_auraTargetsUnapplied.Remove(obj);
  1234.             if (this.m_abilityOrigin != null && this.m_abilityOrigin.AuraTargetsWhoDefended.ContainsKey(obj))
  1235.             {
  1236.                 this.m_abilityOrigin.AuraTargetsWhoDefended.Remove(obj);
  1237.             }
  1238.         }
  1239.         else
  1240.         {
  1241.             CharacterStats component = obj.GetComponent<CharacterStats>();
  1242.             if (component)
  1243.             {
  1244.                 component.AurasAffectingMeReadOnly.Remove(this);
  1245.                 if (component.OnClearStatusEffect != null)
  1246.                 {
  1247.                     component.OnClearStatusEffect(this);
  1248.                 }
  1249.             }
  1250.             this.ClearEffect(obj);
  1251.             UnityEngine.Object.DestroyObject(this.m_auraTargetsApplied[obj]);
  1252.             this.m_auraTargetsApplied.Remove(obj);
  1253.         }
  1254.         Health component2 = obj.GetComponent<Health>();
  1255.         if (component2 != null)
  1256.         {
  1257.             component2.OnDeath -= new GameInputEventHandle(this.HandleAuraOnDeathAndDestroy);
  1258.         }
  1259.     }
  1260.     private void HandleAuraOnDeathAndDestroy(GameObject obj, GameEventArgs args)
  1261.     {
  1262.         if (this.m_auraTargetsApplied.ContainsKey(obj) || this.m_auraTargetsUnapplied.Contains(obj))
  1263.         {
  1264.             this.RemoveAura(obj);
  1265.         }
  1266.     }
  1267.     private void CalculateDuration()
  1268.     {
  1269.         float num = this.Params.Duration;
  1270.         if (this.m_durationOverride > 0f)
  1271.         {
  1272.             num = this.m_durationOverride;
  1273.         }
  1274.         num *= this.Scale;
  1275.         if (this.m_owner != null)
  1276.         {
  1277.             CharacterStats component = this.m_owner.GetComponent<CharacterStats>();
  1278.             if (component != null)
  1279.             {
  1280.                 num *= component.StatEffectDurationMultiplier;
  1281.                 if (this.Params.IsHostile)
  1282.                 {
  1283.                     num *= component.HostileEffectDurationMultiplier;
  1284.                 }
  1285.                 if (this.m_abilityOrigin != null && this.m_abilityOrigin is Frenzy)
  1286.                 {
  1287.                     num *= component.FrenzyDurationMult;
  1288.                 }
  1289.             }
  1290.         }
  1291.         this.Duration = num;
  1292.         if (this.Params.ChecksReligion)
  1293.         {
  1294.             this.m_religiousScale = Religion.Instance.GetCurrentBonusMultiplier(this.m_owner, this.m_abilityOrigin);
  1295.         }
  1296.     }
  1297.     public virtual void ApplyEffect(GameObject target)
  1298.     {
  1299.         if (this.m_needsDurationCalculated)
  1300.         {
  1301.             this.CalculateDuration();
  1302.             this.m_needsDurationCalculated = false;
  1303.         }
  1304.         this.m_target = target;
  1305.         if (this.m_target != null)
  1306.         {
  1307.             this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
  1308.         }
  1309.         bool applied = this.m_applied;
  1310.         if (this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd)
  1311.         {
  1312.             if (this.Duration <= 0f || this.Params.Interval <= 0f)
  1313.             {
  1314.                 Debug.Log("Apply-at-end status effect has no duration or interval!", target);
  1315.             }
  1316.             this.m_applied = true;
  1317.         }
  1318.         else
  1319.         {
  1320.             bool flag = this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime || this.Params.Interval > 0f;
  1321.             if (flag && !this.HasBeenApplied)
  1322.             {
  1323.                 this.m_applied = true;
  1324.             }
  1325.             else
  1326.             {
  1327.                 this.ApplyEffect(target, this.Params.Value);
  1328.                 if (this.HostileRadius > 0f || this.FriendlyRadius > 0f)
  1329.                 {
  1330.                     this.ApplyAura(this.Params.Value);
  1331.                 }
  1332.             }
  1333.         }
  1334.         if (this.m_applied && !applied && target != null)
  1335.         {
  1336.             Transform transform = AttackBase.GetTransform(target, this.Params.VisualEffectAttach);
  1337.             GameUtilities.LaunchEffect(this.m_params.OnStartVisualEffect, transform.position, transform.rotation, 1f, transform);
  1338.             if (this.Params.VisualEffectAttach >= AttackBase.EffectAttachType.Fx_Bone_01 && this.Params.VisualEffectAttach <= AttackBase.EffectAttachType.Fx_Bone_10)
  1339.             {
  1340.                 Equipment component = target.GetComponent<Equipment>();
  1341.                 if (component != null)
  1342.                 {
  1343.                     EquipmentSet currentItems = component.CurrentItems;
  1344.                     if (currentItems != null && currentItems.PrimaryWeapon != null)
  1345.                     {
  1346.                         AnimationBoneMapper component2 = target.GetComponent<AnimationBoneMapper>();
  1347.                         if (component2 != null)
  1348.                         {
  1349.                             for (AttackBase.EffectAttachType effectAttachType = AttackBase.EffectAttachType.Fx_Bone_01; effectAttachType <= AttackBase.EffectAttachType.Fx_Bone_10; effectAttachType++)
  1350.                             {
  1351.                                 transform = null;
  1352.                                 if (component2.HasBone(currentItems.PrimaryWeapon.gameObject, effectAttachType))
  1353.                                 {
  1354.                                     transform = component2[currentItems.PrimaryWeapon.gameObject, effectAttachType];
  1355.                                 }
  1356.                                 if (transform != null)
  1357.                                 {
  1358.                                     GameObject gameObject = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
  1359.                                     if (gameObject != null)
  1360.                                     {
  1361.                                         this.m_appliedFX.Add(gameObject);
  1362.                                     }
  1363.                                 }
  1364.                             }
  1365.                         }
  1366.                     }
  1367.                 }
  1368.             }
  1369.             else
  1370.             {
  1371.                 GameObject gameObject2 = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
  1372.                 if (gameObject2 != null)
  1373.                 {
  1374.                     this.m_appliedFX.Add(gameObject2);
  1375.                 }
  1376.             }
  1377.             this.AddTriggerCallback();
  1378.         }
  1379.     }
  1380.     public virtual bool ApplyEffect(GameObject target, float appliedValue)
  1381.     {
  1382.         if (this.m_target == null)
  1383.         {
  1384.             this.m_target = target;
  1385.             if (this.m_target != null)
  1386.             {
  1387.                 this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
  1388.             }
  1389.         }
  1390.         if (!this.Params.CanApply((!(this.AbilityOrigin != null)) ? this.Owner : this.AbilityOrigin.gameObject, target, this.m_target))
  1391.         {
  1392.             return false;
  1393.         }
  1394.         bool flag = this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime || this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd || this.Params.Interval > 0f;
  1395.         if (this.m_applied && !flag && target == this.m_target)
  1396.         {
  1397.             return false;
  1398.         }
  1399.         if (this.HostileRadius > 0f && this.FriendlyRadius <= 0f && this.m_target == target)
  1400.         {
  1401.             this.m_applied = true;
  1402.             return false;
  1403.         }
  1404.         if (!this.ApplyEffectHelper(target, appliedValue))
  1405.         {
  1406.             return false;
  1407.         }
  1408.         this.m_applied = true;
  1409.         if (this.m_target == target)
  1410.         {
  1411.             this.m_effect_is_on_main_target = true;
  1412.         }
  1413.         return true;
  1414.     }
  1415.     private bool ApplyEffectHelper(GameObject target, float appliedValue)
  1416.     {
  1417.         if (target == null)
  1418.         {
  1419.             return false;
  1420.         }
  1421.         CharacterStats characterStats = this.m_targetStats;
  1422.         if (characterStats == null || target != this.m_target)
  1423.         {
  1424.             characterStats = target.GetComponent<CharacterStats>();
  1425.         }
  1426.         Health component = target.GetComponent<Health>();
  1427.         Mover component2 = target.GetComponent<Mover>();
  1428.         Equipment component3 = target.GetComponent<Equipment>();
  1429.         if (characterStats == null || component == null)
  1430.         {
  1431.             Debug.LogError(target.name + " doesn't have a health and/or CharacterStats component. Unable to apply status effect!");
  1432.             return false;
  1433.         }
  1434.         if (this.AfflictionOrigin == null)
  1435.         {
  1436.             if (this.IsScaledMultiplier)
  1437.             {
  1438.                 appliedValue -= 1f;
  1439.                 appliedValue *= this.Scale * this.m_religiousScale;
  1440.                 appliedValue += 1f;
  1441.             }
  1442.             else
  1443.             {
  1444.                 if (!this.IsDOT)
  1445.                 {
  1446.                     appliedValue *= this.Scale * this.m_religiousScale;
  1447.                 }
  1448.             }
  1449.         }
  1450.         switch (this.Params.AffectsStat)
  1451.         {
  1452.         case StatusEffect.ModifiedStat.MaxHealth:
  1453.             if (!component.Dead)
  1454.             {
  1455.                 if (appliedValue > 0f)
  1456.                 {
  1457.                     characterStats.MaxHealth += appliedValue;
  1458.                     component.CurrentHealth += appliedValue;
  1459.                 }
  1460.                 else
  1461.                 {
  1462.                     component.ApplyHealthChangeDirectly(appliedValue, this.m_owner);
  1463.                 }
  1464.             }
  1465.             break;
  1466.         case StatusEffect.ModifiedStat.MaxStamina:
  1467.             if (!component.Unconscious)
  1468.             {
  1469.                 characterStats.StaminaBonus += appliedValue;
  1470.                 component.CurrentStamina += appliedValue;
  1471.             }
  1472.             break;
  1473.         case StatusEffect.ModifiedStat.Health:
  1474.             if (!component.Dead)
  1475.             {
  1476.                 component.ApplyHealthChangeDirectly(appliedValue, this.m_owner);
  1477.             }
  1478.             break;
  1479.         case StatusEffect.ModifiedStat.Stamina:
  1480.             if (!component.Dead)
  1481.             {
  1482.                 component.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
  1483.             }
  1484.             break;
  1485.         case StatusEffect.ModifiedStat.MeleeAccuracy:
  1486.             characterStats.MeleeAccuracyBonus += (int)appliedValue;
  1487.             break;
  1488.         case StatusEffect.ModifiedStat.RangedAccuracy:
  1489.             characterStats.RangedAccuracyBonus += (int)appliedValue;
  1490.             break;
  1491.         case StatusEffect.ModifiedStat.Deflection:
  1492.             characterStats.DeflectionBonus += (int)appliedValue;
  1493.             break;
  1494.         case StatusEffect.ModifiedStat.Fortitude:
  1495.             characterStats.FortitudeBonus += (int)appliedValue;
  1496.             break;
  1497.         case StatusEffect.ModifiedStat.Reflex:
  1498.             characterStats.ReflexBonus += (int)appliedValue;
  1499.             break;
  1500.         case StatusEffect.ModifiedStat.Will:
  1501.             characterStats.WillBonus += (int)appliedValue;
  1502.             break;
  1503.         case StatusEffect.ModifiedStat.StaminaRechargeRate:
  1504.             characterStats.StaminaRechargeBonus += appliedValue;
  1505.             break;
  1506.         case StatusEffect.ModifiedStat.AttackSpeed:
  1507.             characterStats.AttackSpeedMultiplier *= appliedValue;
  1508.             break;
  1509.         case StatusEffect.ModifiedStat.Stealth:
  1510.             characterStats.StealthBonus += (int)appliedValue;
  1511.             break;
  1512.         case StatusEffect.ModifiedStat.BonusDamage:
  1513.             if (this.Params.DmgType < DamagePacket.DamageType.Count)
  1514.             {
  1515.                 characterStats.BonusDamage[(int)this.Params.DmgType] += appliedValue;
  1516.             }
  1517.             else
  1518.             {
  1519.                 if (this.Params.DmgType == DamagePacket.DamageType.All)
  1520.                 {
  1521.                     for (int i = 0; i < 7; i++)
  1522.                     {
  1523.                         characterStats.BonusDamage[i] += appliedValue;
  1524.                     }
  1525.                 }
  1526.             }
  1527.             break;
  1528.         case StatusEffect.ModifiedStat.DamageThreshhold:
  1529.             characterStats.DamageThreshhold[(int)this.Params.DmgType] += appliedValue;
  1530.             if (this.Params.DmgType == DamagePacket.DamageType.All)
  1531.             {
  1532.                 for (int j = 0; j < 7; j++)
  1533.                 {
  1534.                     characterStats.DamageThreshhold[j] += appliedValue;
  1535.                 }
  1536.             }
  1537.             break;
  1538.         case StatusEffect.ModifiedStat.DamageMinimum:
  1539.             characterStats.DamageMinBonus += appliedValue;
  1540.             break;
  1541.         case StatusEffect.ModifiedStat.MovementRate:
  1542.             if (component2)
  1543.             {
  1544.                 component2.SetRunSpeed(component2.RunSpeed + appliedValue);
  1545.                 component2.SetWalkSpeed(component2.WalkSpeed + appliedValue);
  1546.             }
  1547.             break;
  1548.         case StatusEffect.ModifiedStat.NonTargetable:
  1549.             component.Targetable = false;
  1550.             break;
  1551.         case StatusEffect.ModifiedStat.NonMobile:
  1552.             if (component2)
  1553.             {
  1554.                 component2.Frozen = true;
  1555.             }
  1556.             break;
  1557.         case StatusEffect.ModifiedStat.KnockedDown:
  1558.         {
  1559.             AIController component4 = target.GetComponent<AIController>();
  1560.             if (component4 != null)
  1561.             {
  1562.                 GameEventArgs gameEventArgs = new GameEventArgs();
  1563.                 gameEventArgs.Type = GameEventType.KnockedDown;
  1564.                 gameEventArgs.FloatData = new float[1];
  1565.                 float num = this.Duration * characterStats.KnockDownDurationMult;
  1566.                 num -= 1.7f;
  1567.                 if (num <= 0.1f)
  1568.                 {
  1569.                     num = 0.1f;
  1570.                 }
  1571.                 gameEventArgs.FloatData[0] = num;
  1572.                 gameEventArgs.IntData = new int[1];
  1573.                 gameEventArgs.IntData[0] = 1;
  1574.                 component4.OnEvent(gameEventArgs);
  1575.             }
  1576.             break;
  1577.         }
  1578.         case StatusEffect.ModifiedStat.EngagedEnemyCount:
  1579.             characterStats.EngageableEnemyCount += (int)appliedValue;
  1580.             if (characterStats.EngageableEnemyCount < 0)
  1581.             {
  1582.                 characterStats.EngageableEnemyCount = 0;
  1583.             }
  1584.             break;
  1585.         case StatusEffect.ModifiedStat.EngagementRadius:
  1586.             characterStats.EngagementDistanceBonus += appliedValue;
  1587.             break;
  1588.         case StatusEffect.ModifiedStat.EngagementAccuracy:
  1589.             characterStats.DisengagementAccuracyBonus += (int)appliedValue;
  1590.             break;
  1591.         case StatusEffect.ModifiedStat.EngagementDamage:
  1592.             characterStats.DisengagementDamageBonus += appliedValue;
  1593.             break;
  1594.         case StatusEffect.ModifiedStat.Engageable:
  1595.             characterStats.ImmuneToEngagement = true;
  1596.             break;
  1597.         case StatusEffect.ModifiedStat.Damage:
  1598.             if (!component.Unconscious && !component.Dead)
  1599.             {
  1600.                 if (this.IncreasePerTick > 0f)
  1601.                 {
  1602.                     component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
  1603.                 }
  1604.                 else
  1605.                 {
  1606.                     component.ApplyDamageDirectly(appliedValue, this.Params.DmgType, this.Owner, this);
  1607.                 }
  1608.             }
  1609.             break;
  1610.         case StatusEffect.ModifiedStat.Stunned:
  1611.             if (this.m_timeActive < 1.401298E-45f)
  1612.             {
  1613.                 AIController component5 = target.GetComponent<AIController>();
  1614.                 if (component5 != null)
  1615.                 {
  1616.                     GameEventArgs gameEventArgs2 = new GameEventArgs();
  1617.                     gameEventArgs2.Type = GameEventType.Stunned;
  1618.                     gameEventArgs2.FloatData = new float[1];
  1619.                     gameEventArgs2.FloatData[0] = this.Duration * characterStats.StunDurationMult;
  1620.                     gameEventArgs2.IntData = new int[1];
  1621.                     gameEventArgs2.IntData[0] = 1;
  1622.                     component5.OnEvent(gameEventArgs2);
  1623.                 }
  1624.             }
  1625.             break;
  1626.         case StatusEffect.ModifiedStat.BonusUnarmedDamage:
  1627.             characterStats.BonusUnarmedDamage += appliedValue;
  1628.             break;
  1629.         case StatusEffect.ModifiedStat.MeleeAttackDistanceMult:
  1630.             characterStats.MeleeAttackDistanceMultiplier = appliedValue;
  1631.             break;
  1632.         case StatusEffect.ModifiedStat.RangedAttackDistanceMult:
  1633.             characterStats.RangedAttackDistanceMultiplier = appliedValue;
  1634.             break;
  1635.         case StatusEffect.ModifiedStat.BonusDTFromArmor:
  1636.             characterStats.BonusDTFromArmor += appliedValue;
  1637.             break;
  1638.         case StatusEffect.ModifiedStat.MeleeMissThresholdDelta_DO_NOT_USE:
  1639.         case StatusEffect.ModifiedStat.MeleeCritThresholdDelta_DO_NOT_USE:
  1640.         case StatusEffect.ModifiedStat.RangedCritThresholdDelta_DO_NOT_USE:
  1641.             Debug.LogError(this.Params.AffectsStat.ToString() + " is DEPRECATED! Do not use!");
  1642.             break;
  1643.         case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
  1644.             characterStats.MeleeDamageRangePctIncreaseToMin += appliedValue;
  1645.             break;
  1646.         case StatusEffect.ModifiedStat.SuspendHostileEffects:
  1647.             characterStats.SuspendEffects(CharacterStats.EffectType.Hostile);
  1648.             break;
  1649.         case StatusEffect.ModifiedStat.BonusMeleeDamage:
  1650.             characterStats.BonusMeleeDamage += appliedValue;
  1651.             break;
  1652.         case StatusEffect.ModifiedStat.ImmuneToEngageStop:
  1653.             characterStats.ImmuneToEngageStop = true;
  1654.             break;
  1655.         case StatusEffect.ModifiedStat.HealthLossPctMult:
  1656.             characterStats.HealthLossPercentMult *= appliedValue;
  1657.             break;
  1658.         case StatusEffect.ModifiedStat.DrainResolveForDeflection:
  1659.             characterStats.ResolveBonus += (int)appliedValue;
  1660.             if (this.m_owner != null)
  1661.             {
  1662.                 CharacterStats component6 = this.m_owner.GetComponent<CharacterStats>();
  1663.                 if (component6)
  1664.                 {
  1665.                     StatusEffectParams statusEffectParams = new StatusEffectParams();
  1666.                     statusEffectParams.AffectsStat = StatusEffect.ModifiedStat.Deflection;
  1667.                     statusEffectParams.Value = this.Params.ExtraValue;
  1668.                     statusEffectParams.Duration = this.Duration;
  1669.                     statusEffectParams.IsHostile = false;
  1670.                     StatusEffect statusEffect = StatusEffect.Create(this.m_owner, statusEffectParams, this.AbilityType, null, true);
  1671.                     statusEffect.DurationAfterBreak = this.DurationAfterBreak;
  1672.                     characterStats.ApplyStatusEffectImmediate(statusEffect);
  1673.                 }
  1674.             }
  1675.             break;
  1676.         case StatusEffect.ModifiedStat.ReapplyDamage:
  1677.             if (this.m_intervalCount > 0u)
  1678.             {
  1679.                 component.ApplyDamageDirectly(this.m_damageToReapply * (this.Params.Value + this.IncreasePerTick * (this.m_intervalCount - 1u)), DamagePacket.DamageType.Raw, this.Owner, this);
  1680.                 this.m_damageToReapply = 0f;
  1681.             }
  1682.             else
  1683.             {
  1684.                 component.OnDamaged += new GameInputEventHandle(this.HandleOnDamagedForReapply);
  1685.                 this.m_damageToReapply = 0f;
  1686.             }
  1687.             break;
  1688.         case StatusEffect.ModifiedStat.ReapplyDamageToNearbyEnemies:
  1689.             if (this.m_intervalCount > 0u)
  1690.             {
  1691.                 GameObject[] array = GameUtilities.CreaturesInRange(target.transform.position, 3f, target, true);
  1692.                 if (array != null)
  1693.                 {
  1694.                     GameObject[] array2 = array;
  1695.                     for (int k = 0; k < array2.Length; k++)
  1696.                     {
  1697.                         GameObject gameObject = array2[k];
  1698.                         Health component7 = gameObject.GetComponent<Health>();
  1699.                         if (component7 != null)
  1700.                         {
  1701.                             component7.ApplyDamageDirectly(this.m_damageToReapply * (this.Params.Value + this.IncreasePerTick * (this.m_intervalCount - 1u)), DamagePacket.DamageType.Raw, this.Owner, this);
  1702.                         }
  1703.                     }
  1704.                 }
  1705.                 this.m_damageToReapply = 0f;
  1706.             }
  1707.             else
  1708.             {
  1709.                 component.OnDamaged += new GameInputEventHandle(this.HandleOnDamagedForReapply);
  1710.                 this.m_damageToReapply = 0f;
  1711.             }
  1712.             break;
  1713.         case StatusEffect.ModifiedStat.ReloadSpeed:
  1714.             characterStats.ReloadSpeedMultiplier = appliedValue;
  1715.             break;
  1716.         case StatusEffect.ModifiedStat.DropTrap:
  1717.             if (component2 != null)
  1718.             {
  1719.                 Vector3 lastPosition = component2.LastPosition;
  1720.                 if (lastPosition != target.transform.position)
  1721.                 {
  1722.                     HazardAttack.PlaceTrap(this.Params.TrapPrefab, lastPosition, target);
  1723.                 }
  1724.             }
  1725.             break;
  1726.         case StatusEffect.ModifiedStat.StasisShield:
  1727.             if (this.m_damageToAbsorb == 0f)
  1728.             {
  1729.                 characterStats.OnPreDamageApplied += new CombatEventHandler(this.HandleStatsOnPreDamageAppliedForAbsorb);
  1730.                 this.m_damageToAbsorb = appliedValue;
  1731.                 AIController component8 = target.GetComponent<AIController>();
  1732.                 if (component8 != null)
  1733.                 {
  1734.                     GameEventArgs gameEventArgs3 = new GameEventArgs();
  1735.                     gameEventArgs3.Type = GameEventType.Stunned;
  1736.                     gameEventArgs3.FloatData = new float[1];
  1737.                     gameEventArgs3.FloatData[0] = this.Duration;
  1738.                     gameEventArgs3.IntData = new int[1];
  1739.                     gameEventArgs3.IntData[0] = 1;
  1740.                     component8.OnEvent(gameEventArgs3);
  1741.                 }
  1742.             }
  1743.             break;
  1744.         case StatusEffect.ModifiedStat.SuspendBeneficialEffects:
  1745.             characterStats.SuspendEffects(CharacterStats.EffectType.Beneficial);
  1746.             break;
  1747.         case StatusEffect.ModifiedStat.DamageBasedOnInverseHealth:
  1748.             if (!component.Dead)
  1749.             {
  1750.                 float num2 = 1f - component.CurrentHealth / component.MaxHealth;
  1751.                 if (this.IncreasePerTick > 0f)
  1752.                 {
  1753.                     component.ApplyDamageDirectly(appliedValue * num2 * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
  1754.                 }
  1755.                 else
  1756.                 {
  1757.                     component.ApplyDamageDirectly(appliedValue * num2, this.Params.DmgType, this.Owner, this);
  1758.                 }
  1759.             }
  1760.             break;
  1761.         case StatusEffect.ModifiedStat.Resolve:
  1762.             characterStats.ResolveBonus += (int)appliedValue;
  1763.             break;
  1764.         case StatusEffect.ModifiedStat.Might:
  1765.             characterStats.MightBonus += (int)appliedValue;
  1766.             break;
  1767.         case StatusEffect.ModifiedStat.Dexterity:
  1768.             characterStats.DexterityBonus += (int)appliedValue;
  1769.             break;
  1770.         case StatusEffect.ModifiedStat.Intellect:
  1771.             characterStats.IntellectBonus += (int)appliedValue;
  1772.             break;
  1773.         case StatusEffect.ModifiedStat.SummonWeapon:
  1774.             if (component3 != null)
  1775.             {
  1776.                 component3.PushSummonedWeapon(this.Params.EquippablePrefab);
  1777.             }
  1778.             break;
  1779.         case StatusEffect.ModifiedStat.TransferStamina:
  1780.             if (this.m_owner != null)
  1781.             {
  1782.                 Health component9 = this.m_owner.GetComponent<Health>();
  1783.                 if (component9 != null)
  1784.                 {
  1785.                     component9.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
  1786.                 }
  1787.             }
  1788.             component.ApplyStaminaChangeDirectly(-appliedValue, this.m_owner, this, false);
  1789.             break;
  1790.         case StatusEffect.ModifiedStat.StaminaRechargeRateMult:
  1791.             characterStats.StaminaRechargeMult *= appliedValue;
  1792.             break;
  1793.         case StatusEffect.ModifiedStat.VesselAccuracy:
  1794.             characterStats.VesselAccuracyBonus += (int)appliedValue;
  1795.             break;
  1796.         case StatusEffect.ModifiedStat.BeastAccuracy:
  1797.             characterStats.BeastAccuracyBonus += (int)appliedValue;
  1798.             break;
  1799.         case StatusEffect.ModifiedStat.WilderAccuracy:
  1800.             characterStats.WilderAccuracyBonus += (int)appliedValue;
  1801.             break;
  1802.         case StatusEffect.ModifiedStat.StunDefense:
  1803.             characterStats.StunDefenseBonus += (int)appliedValue;
  1804.             break;
  1805.         case StatusEffect.ModifiedStat.KnockdownDefense:
  1806.             characterStats.KnockdownDefenseBonus += (int)appliedValue;
  1807.             break;
  1808.         case StatusEffect.ModifiedStat.PoisonDefense:
  1809.             characterStats.PoisonDefenseBonus += (int)appliedValue;
  1810.             break;
  1811.         case StatusEffect.ModifiedStat.DiseaseDefense:
  1812.             characterStats.DiseaseDefenseBonus += (int)appliedValue;
  1813.             break;
  1814.         case StatusEffect.ModifiedStat.DistantEnemyBonus:
  1815.             characterStats.DistantEnemyBonus += (int)appliedValue;
  1816.             break;
  1817.         case StatusEffect.ModifiedStat.BonusAccuracyForNearestAllyOnSameEnemy:
  1818.             characterStats.NearestAllyWithSharedTargetAccuracyBonus += (int)appliedValue;
  1819.             break;
  1820.         case StatusEffect.ModifiedStat.EnemyCritToHitPercent:
  1821.             characterStats.EnemyCritToHitPercent += appliedValue;
  1822.             break;
  1823.         case StatusEffect.ModifiedStat.HostileEffectDurationMult:
  1824.             characterStats.AdjustEffectDurations(CharacterStats.EffectType.Hostile, appliedValue);
  1825.             characterStats.HostileEffectDurationMultiplier *= appliedValue;
  1826.             break;
  1827.         case StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent:
  1828.             characterStats.DeflectReflexGrazeToMissPercent += appliedValue;
  1829.             break;
  1830.         case StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent:
  1831.             characterStats.FortitudeWillGrazeToMissPercent += appliedValue;
  1832.             break;
  1833.         case StatusEffect.ModifiedStat.ExtraStraightBounces:
  1834.             characterStats.ExtraStraightBounces += (int)appliedValue;
  1835.             break;
  1836.         case StatusEffect.ModifiedStat.RedirectMeleeAttacks:
  1837.             characterStats.RedirectMeleeAttacks = true;
  1838.             break;
  1839.         case StatusEffect.ModifiedStat.HostileAOEDamageMultiplier:
  1840.             characterStats.HostileAOEDamageMultiplier *= appliedValue;
  1841.             break;
  1842.         case StatusEffect.ModifiedStat.ImprovedFlanking:
  1843.             characterStats.ImprovedFlanking++;
  1844.             break;
  1845.         case StatusEffect.ModifiedStat.DTBypass:
  1846.             characterStats.DTBypass += (float)((int)appliedValue);
  1847.             break;
  1848.         case StatusEffect.ModifiedStat.StealSpell:
  1849.             if (this.m_owner != null)
  1850.             {
  1851.                 CharacterStats component10 = this.m_owner.GetComponent<CharacterStats>();
  1852.                 if (component10 != null)
  1853.                 {
  1854.                     if (this.m_spell != null)
  1855.                     {
  1856.                         component10.ActiveAbilities.Remove(this.m_spell);
  1857.                     }
  1858.                     if (component3 != null && component3.CurrentItems != null && component3.CurrentItems.Grimoire != null)
  1859.                     {
  1860.                         Grimoire component11 = component3.CurrentItems.Grimoire.GetComponent<Grimoire>();
  1861.                         if (component11 != null)
  1862.                         {
  1863.                             GenericSpell genericSpell = component11.FindNewSpell(this.m_owner, (int)this.Params.Value);
  1864.                             if (genericSpell != null)
  1865.                             {
  1866.                                 this.m_spell = (GenericSpell)component10.InstantiateAbility(genericSpell, GenericAbility.AbilityType.Spell);
  1867.                                 this.m_spell.IsFree = true;
  1868.                                 this.m_spell.NeedsGrimoire = false;
  1869.                                 this.m_spell.ProhibitFromGrimoire = true;
  1870.                             }
  1871.                         }
  1872.                     }
  1873.                 }
  1874.             }
  1875.             break;
  1876.         case StatusEffect.ModifiedStat.SwapFaction:
  1877.         {
  1878.             PartyMemberAI component12 = target.GetComponent<PartyMemberAI>();
  1879.             AIController aIController;
  1880.             if (component12)
  1881.             {
  1882.                 component12.enabled = false;
  1883.                 target.AddComponent<AIPackageController>();
  1884.                 aIController = component12;
  1885.             }
  1886.             else
  1887.             {
  1888.                 aIController = target.GetComponent<AIController>();
  1889.             }
  1890.             if (aIController != null)
  1891.             {
  1892.                 AIState currentState = aIController.AI.CurrentState;
  1893.                 if (currentState.Priority < 2)
  1894.                 {
  1895.                     aIController.AI.PopAllStates();
  1896.                 }
  1897.                 else
  1898.                 {
  1899.                     aIController.AI.ClearQueuedStates();
  1900.                 }
  1901.             }
  1902.             Faction component13 = target.GetComponent<Faction>();
  1903.             Faction component14 = this.m_owner.GetComponent<Faction>();
  1904.             if (component13 != null && component14 != null)
  1905.             {
  1906.                 this.m_cachedTeam = component13.CurrentTeamInstance;
  1907.                 component13.ModifyToMatch(component14);
  1908.             }
  1909.             break;
  1910.         }
  1911.         case StatusEffect.ModifiedStat.Athletics:
  1912.             characterStats.AthleticsBonus += (int)appliedValue;
  1913.             break;
  1914.         case StatusEffect.ModifiedStat.Lore:
  1915.             characterStats.LoreBonus += (int)appliedValue;
  1916.             break;
  1917.         case StatusEffect.ModifiedStat.Mechanics:
  1918.             characterStats.MechanicsBonus += (int)appliedValue;
  1919.             break;
  1920.         case StatusEffect.ModifiedStat.Survival:
  1921.             characterStats.SurvivalBonus += (int)appliedValue;
  1922.             break;
  1923.         case StatusEffect.ModifiedStat.Crafting:
  1924.             characterStats.CraftingBonus += (int)appliedValue;
  1925.             break;
  1926.         case StatusEffect.ModifiedStat.PushDefense:
  1927.             characterStats.PushDefenseBonus += (int)appliedValue;
  1928.             break;
  1929.         case StatusEffect.ModifiedStat.WhileStunnedDefense:
  1930.             characterStats.WhileStunnedDefenseBonus += (int)appliedValue;
  1931.             break;
  1932.         case StatusEffect.ModifiedStat.WhileKnockeddownDefense:
  1933.             characterStats.WhileKnockeddownDefenseBonus += (int)appliedValue;
  1934.             break;
  1935.         case StatusEffect.ModifiedStat.Constitution:
  1936.             characterStats.ConstitutionBonus += (int)appliedValue;
  1937.             break;
  1938.         case StatusEffect.ModifiedStat.Perception:
  1939.             characterStats.PerceptionBonus += (int)appliedValue;
  1940.             break;
  1941.         case StatusEffect.ModifiedStat.CritHitMultiplierBonus:
  1942.             characterStats.CritHitDamageMultiplierBonus += appliedValue;
  1943.             break;
  1944.         case StatusEffect.ModifiedStat.BonusGrazeToHitPercent:
  1945.             characterStats.BonusGrazeToHitPercent += appliedValue;
  1946.             break;
  1947.         case StatusEffect.ModifiedStat.BonusGrazeToMissPercent:
  1948.             characterStats.BonusGrazeToMissPercent += appliedValue;
  1949.             break;
  1950.         case StatusEffect.ModifiedStat.BonusCritToHitPercent:
  1951.             characterStats.BonusCritToHitPercent += appliedValue;
  1952.             break;
  1953.         case StatusEffect.ModifiedStat.BonusMissToGrazePercent:
  1954.             characterStats.BonusMissToGrazePercent += appliedValue;
  1955.             break;
  1956.         case StatusEffect.ModifiedStat.BonusHitToCritPercent:
  1957.             characterStats.BonusHitToCritPercent += appliedValue;
  1958.             break;
  1959.         case StatusEffect.ModifiedStat.BonusHitToGrazePercent:
  1960.             characterStats.BonusHitToGrazePercent += appliedValue;
  1961.             break;
  1962.         case StatusEffect.ModifiedStat.Confused:
  1963.         {
  1964.             AIController component15 = target.GetComponent<AIController>();
  1965.             if (component15 != null)
  1966.             {
  1967.                 component15.AI.PopAllStates();
  1968.             }
  1969.             break;
  1970.         }
  1971.         case StatusEffect.ModifiedStat.BonusMeleeWeaponDamage:
  1972.             characterStats.BonusMeleeWeaponDamage += appliedValue;
  1973.             break;
  1974.         case StatusEffect.ModifiedStat.BonusRangedWeaponDamage:
  1975.             characterStats.BonusRangedWeaponDamage += appliedValue;
  1976.             break;
  1977.         case StatusEffect.ModifiedStat.RateOfFireMult:
  1978.             characterStats.RateOfFireMultiplier *= appliedValue;
  1979.             break;
  1980.         case StatusEffect.ModifiedStat.ApplyAttackEffects:
  1981.             if (this.Params.AttackPrefab != null && this.Params.AttackPrefab.AbilityOrigin != null && !this.Params.AttackPrefab.AbilityOrigin.ActivateBeforeAttack)
  1982.             {
  1983.                 this.Params.AttackPrefab.AbilityOrigin.Activate();
  1984.             }
  1985.             break;
  1986.         case StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent:
  1987.             characterStats.EnemyReflexGrazeToMissPercent += appliedValue;
  1988.             break;
  1989.         case StatusEffect.ModifiedStat.StaminaPercent:
  1990.             component.ApplyStaminaChangeDirectly(appliedValue * component.MaxStamina, this.m_owner, this, false);
  1991.             break;
  1992.         case StatusEffect.ModifiedStat.EnemiesNeededToFlankAdj:
  1993.             characterStats.EnemiesNeededToFlank += (int)appliedValue;
  1994.             break;
  1995.         case StatusEffect.ModifiedStat.ConcentrationBonus:
  1996.             characterStats.ConcentrationBonus += appliedValue;
  1997.             break;
  1998.         case StatusEffect.ModifiedStat.DisableSpellcasting:
  1999.             characterStats.SpellCastingDisabled++;
  2000.             break;
  2001.         case StatusEffect.ModifiedStat.ResistAffliction:
  2002.         {
  2003.             CharacterStats expr_12DD = characterStats;
  2004.             expr_12DD.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Combine(expr_12DD.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseAffliction));
  2005.             characterStats.AdjustStatusEffectDurationsFromAffliction(this.Params.AfflictionPrefab, this.Params.ExtraValue);
  2006.             break;
  2007.         }
  2008.         case StatusEffect.ModifiedStat.PreventDeath:
  2009.             characterStats.DeathPrevented++;
  2010.             break;
  2011.         case StatusEffect.ModifiedStat.AdjustDurationBeneficialEffects:
  2012.             characterStats.AdjustStatusEffectDurations(CharacterStats.EffectType.Beneficial, this.Params.Value, this);
  2013.             break;
  2014.         case StatusEffect.ModifiedStat.DOTTickMult:
  2015.             characterStats.DOTTickMult *= appliedValue;
  2016.             break;
  2017.         case StatusEffect.ModifiedStat.AdjustDurationHostileEffects:
  2018.             characterStats.AdjustStatusEffectDurations(CharacterStats.EffectType.Hostile, this.Params.Value, this);
  2019.             break;
  2020.         case StatusEffect.ModifiedStat.ResistKeyword:
  2021.         {
  2022.             CharacterStats expr_1376 = characterStats;
  2023.             expr_1376.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Combine(expr_1376.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseKeyword));
  2024.             characterStats.AdjustStatusEffectDurationsFromKeyword(this.Params.Keyword, this.Params.ExtraValue);
  2025.             break;
  2026.         }
  2027.         case StatusEffect.ModifiedStat.TransferDT:
  2028.             if (this.m_owner != null)
  2029.             {
  2030.                 CharacterStats component16 = this.m_owner.GetComponent<CharacterStats>();
  2031.                 if (component16 != null)
  2032.                 {
  2033.                     component16.DamageThreshhold[(int)this.Params.DmgType] += appliedValue;
  2034.                     characterStats.DamageThreshhold[(int)this.Params.DmgType] -= appliedValue;
  2035.                     if (this.Params.DmgType == DamagePacket.DamageType.All)
  2036.                     {
  2037.                         for (int l = 0; l < 7; l++)
  2038.                         {
  2039.                             component16.DamageThreshhold[l] += appliedValue;
  2040.                             characterStats.DamageThreshhold[l] -= appliedValue;
  2041.                         }
  2042.                     }
  2043.                 }
  2044.             }
  2045.             break;
  2046.         case StatusEffect.ModifiedStat.TransferRandomAttribute:
  2047.             if (this.m_owner != null)
  2048.             {
  2049.                 CharacterStats component17 = this.m_owner.GetComponent<CharacterStats>();
  2050.                 if (component17 != null)
  2051.                 {
  2052.                     switch (this.m_generalCounter)
  2053.                     {
  2054.                     case 0u:
  2055.                         component17.MightBonus += (int)appliedValue;
  2056.                         characterStats.MightBonus -= (int)appliedValue;
  2057.                         break;
  2058.                     case 1u:
  2059.                         component17.ConstitutionBonus += (int)appliedValue;
  2060.                         characterStats.ConstitutionBonus -= (int)appliedValue;
  2061.                         break;
  2062.                     case 2u:
  2063.                         component17.DexterityBonus += (int)appliedValue;
  2064.                         characterStats.DexterityBonus -= (int)appliedValue;
  2065.                         break;
  2066.                     case 3u:
  2067.                         component17.PerceptionBonus += (int)appliedValue;
  2068.                         characterStats.PerceptionBonus -= (int)appliedValue;
  2069.                         break;
  2070.                     case 4u:
  2071.                         component17.IntellectBonus += (int)appliedValue;
  2072.                         characterStats.IntellectBonus -= (int)appliedValue;
  2073.                         break;
  2074.                     case 5u:
  2075.                         component17.ResolveBonus += (int)appliedValue;
  2076.                         characterStats.ResolveBonus -= (int)appliedValue;
  2077.                         break;
  2078.                     }
  2079.                 }
  2080.             }
  2081.             break;
  2082.         case StatusEffect.ModifiedStat.Disintegrate:
  2083.             if (!component.Dead)
  2084.             {
  2085.                 if (this.IncreasePerTick > 0f)
  2086.                 {
  2087.                     component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, DamagePacket.DamageType.Raw, this.Owner, this);
  2088.                 }
  2089.                 else
  2090.                 {
  2091.                     component.ApplyDamageDirectly(appliedValue, DamagePacket.DamageType.Raw, this.Owner, this);
  2092.                 }
  2093.                 if (component.Dead)
  2094.                 {
  2095.                     UnityEngine.Object.DestroyObject(this.Owner, 0.1f);
  2096.                 }
  2097.             }
  2098.             break;
  2099.         case StatusEffect.ModifiedStat.Duplicate:
  2100.         {
  2101.             this.ExtraObject = MirrorCharacterUtils.MirrorCharacter(target, MirrorCharacterUtils.MirrorType.NewCharacter);
  2102.             this.ExtraObject.transform.parent = target.transform;
  2103.             this.ExtraObject.transform.localPosition = new Vector3(1f, 0f, 0f);
  2104.             if (this.Params.EquippablePrefab != null)
  2105.             {
  2106.                 Equipment component18 = this.ExtraObject.GetComponent<Equipment>();
  2107.                 if (component18 != null)
  2108.                 {
  2109.                     component18.PushSummonedWeapon(this.Params.EquippablePrefab);
  2110.                 }
  2111.             }
  2112.             Health component19 = this.ExtraObject.GetComponent<Health>();
  2113.             if (component19 != null)
  2114.             {
  2115.                 component19.OnDeath += new GameInputEventHandle(this.HandleDestroyOnDeath);
  2116.             }
  2117.             CharacterStats component20 = this.ExtraObject.GetComponent<CharacterStats>();
  2118.             if (component20 != null)
  2119.             {
  2120.                 component20.OverrideName = string.Format(GUIUtils.GetText(1373), characterStats.Name());
  2121.             }
  2122.             break;
  2123.         }
  2124.         case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
  2125.             if (component.StaminaPercentage <= this.Params.ExtraValue)
  2126.             {
  2127.                 characterStats.MeleeAccuracyBonus += (int)appliedValue;
  2128.                 characterStats.RangedAccuracyBonus += (int)appliedValue;
  2129.                 this.m_generalCounter = 1u;
  2130.             }
  2131.             break;
  2132.         case StatusEffect.ModifiedStat.EnemyHitToGrazePercent:
  2133.             characterStats.EnemyHitToGrazePercent += appliedValue;
  2134.             break;
  2135.         case StatusEffect.ModifiedStat.StunDurationMult:
  2136.             characterStats.StunDurationMult *= appliedValue;
  2137.             break;
  2138.         case StatusEffect.ModifiedStat.KnockDownDurationMult:
  2139.             characterStats.KnockDownDurationMult *= appliedValue;
  2140.             break;
  2141.         case StatusEffect.ModifiedStat.BonusArmorDTMultAtLowHealth:
  2142.             characterStats.BonusArmorDTMultAtLowHealth *= appliedValue;
  2143.             break;
  2144.         case StatusEffect.ModifiedStat.Fatigue:
  2145.             characterStats.Fatigue += appliedValue;
  2146.             break;
  2147.         case StatusEffect.ModifiedStat.PrimordialAccuracy:
  2148.             characterStats.PrimordialAccuracyBonus += (int)appliedValue;
  2149.             break;
  2150.         case StatusEffect.ModifiedStat.StopAnimation:
  2151.         {
  2152.             AnimationController component21 = target.GetComponent<AnimationController>();
  2153.             if (component21 != null && component2 != null)
  2154.             {
  2155.                 component21.TimeScaleOverride++;
  2156.                 component2.Frozen = true;
  2157.             }
  2158.             break;
  2159.         }
  2160.         case StatusEffect.ModifiedStat.AddAfflictionImmunity:
  2161.             if (this.Params.AfflictionPrefab != null)
  2162.             {
  2163.                 characterStats.AfflictionImmunities.Add(this.Params.AfflictionPrefab);
  2164.                 characterStats.ClearEffectFromAffliction(this.Params.AfflictionPrefab);
  2165.             }
  2166.             break;
  2167.         case StatusEffect.ModifiedStat.Invisible:
  2168.             if (appliedValue > 0f)
  2169.             {
  2170.                 characterStats.InvisibilityState++;
  2171.             }
  2172.             break;
  2173.         case StatusEffect.ModifiedStat.WoundDelay:
  2174.             characterStats.WoundDelay += appliedValue;
  2175.             break;
  2176.         case StatusEffect.ModifiedStat.FinishingBlowDamageMult:
  2177.             characterStats.FinishingBlowDamageMult *= appliedValue;
  2178.             break;
  2179.         case StatusEffect.ModifiedStat.ZealousAuraAoEMult:
  2180.             characterStats.ZealousAuraRadiusMult *= Mathf.Sqrt(appliedValue);
  2181.             break;
  2182.         case StatusEffect.ModifiedStat.DelayUnconsciousness:
  2183.             characterStats.UnconsciousnessDelayed++;
  2184.             break;
  2185.         case StatusEffect.ModifiedStat.NegMoveTickMult:
  2186.             characterStats.NegMoveTickMult *= appliedValue;
  2187.             break;
  2188.         case StatusEffect.ModifiedStat.FocusGainMult:
  2189.             characterStats.FocusGainMult *= appliedValue;
  2190.             break;
  2191.         case StatusEffect.ModifiedStat.DisengagementDefense:
  2192.             characterStats.DisengagementDefenseBonus += (int)appliedValue;
  2193.             break;
  2194.         case StatusEffect.ModifiedStat.SpellDefense:
  2195.             characterStats.SpellDefenseBonus += (int)appliedValue;
  2196.             break;
  2197.         case StatusEffect.ModifiedStat.RangedDeflection:
  2198.             characterStats.RangedDeflectionBonus += (int)appliedValue;
  2199.             break;
  2200.         case StatusEffect.ModifiedStat.BonusUsesPerRestPastThree:
  2201.             characterStats.BonusUsesPerRestPastThree += (int)appliedValue;
  2202.             break;
  2203.         case StatusEffect.ModifiedStat.PoisonTickMult:
  2204.             characterStats.PoisonTickMult *= appliedValue;
  2205.             break;
  2206.         case StatusEffect.ModifiedStat.DiseaseTickMult:
  2207.             characterStats.DiseaseTickMult *= appliedValue;
  2208.             break;
  2209.         case StatusEffect.ModifiedStat.StalkersLinkDamageMult:
  2210.             characterStats.StalkersLinkDamageMult *= appliedValue;
  2211.             break;
  2212.         case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
  2213.             characterStats.ChanterPhraseRadiusMult *= Mathf.Sqrt(appliedValue);
  2214.             break;
  2215.         case StatusEffect.ModifiedStat.BonusHealMult:
  2216.             characterStats.BonusHealMult *= appliedValue;
  2217.             break;
  2218.         case StatusEffect.ModifiedStat.SpellCastBonus:
  2219.         {
  2220.             int num3 = (int)this.Params.ExtraValue - 1;
  2221.             if (num3 >= 0 && num3 < 6)
  2222.             {
  2223.                 characterStats.SpellCastBonus[num3] += (int)appliedValue;
  2224.             }
  2225.             break;
  2226.         }
  2227.         case StatusEffect.ModifiedStat.AoEMult:
  2228.             characterStats.AoERadiusMult *= Mathf.Sqrt(appliedValue);
  2229.             break;
  2230.         case StatusEffect.ModifiedStat.FrenzyDurationMult:
  2231.             characterStats.FrenzyDurationMult *= appliedValue;
  2232.             break;
  2233.         case StatusEffect.ModifiedStat.ProneDurationMult:
  2234.             characterStats.ProneDurationMult *= appliedValue;
  2235.             break;
  2236.         case StatusEffect.ModifiedStat.WildstrikeDamageMult:
  2237.             characterStats.WildstrikeDamageMult *= appliedValue;
  2238.             break;
  2239.         case StatusEffect.ModifiedStat.ReviveAndAddStamina:
  2240.             if (!component.Dead)
  2241.             {
  2242.                 if (component.Unconscious)
  2243.                 {
  2244.                     component.OnRevive();
  2245.                 }
  2246.                 component.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
  2247.             }
  2248.             break;
  2249.         case StatusEffect.ModifiedStat.LaunchAttack:
  2250.             if (this.m_owner != null && this.Params.AttackPrefab != null)
  2251.             {
  2252.                 AttackBase attackBase = UnityEngine.Object.Instantiate(this.Params.AttackPrefab) as AttackBase;
  2253.                 attackBase.Owner = this.m_owner;
  2254.                 attackBase.transform.parent = this.m_owner.transform;
  2255.                 attackBase.SkipAnimation = true;
  2256.                 attackBase.Launch(target);
  2257.             }
  2258.             break;
  2259.         case StatusEffect.ModifiedStat.HidesHealthStamina:
  2260.             component.EnableHealthDisplay(false);
  2261.             break;
  2262.         case StatusEffect.ModifiedStat.AllDefense:
  2263.             characterStats.DeflectionBonus += (int)appliedValue;
  2264.             characterStats.ReflexBonus += (int)appliedValue;
  2265.             characterStats.WillBonus += (int)appliedValue;
  2266.             characterStats.FortitudeBonus += (int)appliedValue;
  2267.             break;
  2268.         case StatusEffect.ModifiedStat.MaxStaminaMult:
  2269.             characterStats.MaxStaminaMultiplier *= appliedValue;
  2270.             break;
  2271.         case StatusEffect.ModifiedStat.CallbackOnDamaged:
  2272.             if (this.Params.OnDamagedCallbackAbility != null)
  2273.             {
  2274.                 component.OnDamaged += new GameInputEventHandle(this.Params.OnDamagedCallbackAbility.HandleOnDamaged);
  2275.             }
  2276.             break;
  2277.         case StatusEffect.ModifiedStat.Accuracy:
  2278.             characterStats.MeleeAccuracyBonus += (int)appliedValue;
  2279.             characterStats.RangedAccuracyBonus += (int)appliedValue;
  2280.             break;
  2281.         case StatusEffect.ModifiedStat.TransferDamageToStamina:
  2282.             if (this.m_owner != null)
  2283.             {
  2284.                 Health component22 = this.m_owner.GetComponent<Health>();
  2285.                 if (component22 != null)
  2286.                 {
  2287.                     if (this.IncreasePerTick > 0f)
  2288.                     {
  2289.                         component22.ApplyStaminaChangeDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.m_owner, this, false);
  2290.                     }
  2291.                     else
  2292.                     {
  2293.                         component22.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
  2294.                     }
  2295.                 }
  2296.             }
  2297.             if (this.Params.DmgType < DamagePacket.DamageType.Count)
  2298.             {
  2299.                 if (this.IncreasePerTick > 0f)
  2300.                 {
  2301.                     component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
  2302.                 }
  2303.                 else
  2304.                 {
  2305.                     component.ApplyDamageDirectly(appliedValue, this.Params.DmgType, this.Owner, this);
  2306.                 }
  2307.             }
  2308.             else
  2309.             {
  2310.                 if (this.Params.DmgType == DamagePacket.DamageType.All)
  2311.                 {
  2312.                     Debug.LogError(this.Params.AffectsStat.ToString() + " is using DamageType of All, which is not supported!");
  2313.                 }
  2314.             }
  2315.             break;
  2316.         case StatusEffect.ModifiedStat.CallbackAfterAttack:
  2317.             if (this.m_abilityOrigin != null)
  2318.             {
  2319.                 characterStats.OnPostDamageDealt += new CombatEventHandler(this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallback);
  2320.             }
  2321.             break;
  2322.         }
  2323.         return true;
  2324.     }
  2325.     public virtual void ClearEffect(GameObject target)
  2326.     {
  2327.         if (!this.m_applied)
  2328.         {
  2329.             return;
  2330.         }
  2331.         if (this.m_target == target && this.m_triggerCount == 1 && this.Params.TriggerAdjustment.ResetTriggerOnEffectEnd)
  2332.         {
  2333.             this.OffTrigger();
  2334.             return;
  2335.         }
  2336.         if (this.m_appliedFX.Count > 0)
  2337.         {
  2338.             foreach (GameObject current in this.m_appliedFX)
  2339.             {
  2340.                 GameUtilities.ShutDownLoopingEffect(current);
  2341.                 UnityEngine.Object.DestroyObject(current, 5f);
  2342.             }
  2343.             this.m_appliedFX.Clear();
  2344.         }
  2345.         if (target == null)
  2346.         {
  2347.             return;
  2348.         }
  2349.         Transform transform = AttackBase.GetTransform(target, this.Params.VisualEffectAttach);
  2350.         GameUtilities.LaunchEffect(this.m_params.OnStopVisualEffect, transform.position, transform.rotation, 1f, transform);
  2351.         CharacterStats characterStats = this.m_targetStats;
  2352.         if (target != this.m_target || characterStats == null)
  2353.         {
  2354.             characterStats = target.GetComponent<CharacterStats>();
  2355.         }
  2356.         Health component = target.GetComponent<Health>();
  2357.         Mover component2 = target.GetComponent<Mover>();
  2358.         if (characterStats == null || component == null)
  2359.         {
  2360.             Debug.LogError(target.name + " doesn't have a health and/or CharacterStats component. Unable to remove status effect!");
  2361.             return;
  2362.         }
  2363.         float currentAppliedValue = this.CurrentAppliedValue;
  2364.         if (this.m_target != target || this.m_effect_is_on_main_target)
  2365.         {
  2366.             switch (this.Params.AffectsStat)
  2367.             {
  2368.             case StatusEffect.ModifiedStat.MaxHealth:
  2369.                 characterStats.MaxHealth -= currentAppliedValue;
  2370.                 component.CurrentHealth -= currentAppliedValue;
  2371.                 if (component.CurrentHealth <= 0f)
  2372.                 {
  2373.                     component.CurrentHealth = 1f;
  2374.                 }
  2375.                 break;
  2376.             case StatusEffect.ModifiedStat.MaxStamina:
  2377.                 characterStats.StaminaBonus -= currentAppliedValue;
  2378.                 component.CurrentStamina -= currentAppliedValue;
  2379.                 break;
  2380.             case StatusEffect.ModifiedStat.MeleeAccuracy:
  2381.                 characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
  2382.                 break;
  2383.             case StatusEffect.ModifiedStat.RangedAccuracy:
  2384.                 characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
  2385.                 break;
  2386.             case StatusEffect.ModifiedStat.Deflection:
  2387.                 characterStats.DeflectionBonus -= (int)currentAppliedValue;
  2388.                 break;
  2389.             case StatusEffect.ModifiedStat.Fortitude:
  2390.                 characterStats.FortitudeBonus -= (int)currentAppliedValue;
  2391.                 break;
  2392.             case StatusEffect.ModifiedStat.Reflex:
  2393.                 characterStats.ReflexBonus -= (int)currentAppliedValue;
  2394.                 break;
  2395.             case StatusEffect.ModifiedStat.Will:
  2396.                 characterStats.WillBonus -= (int)currentAppliedValue;
  2397.                 break;
  2398.             case StatusEffect.ModifiedStat.StaminaRechargeRate:
  2399.                 characterStats.StaminaRechargeBonus -= currentAppliedValue;
  2400.                 break;
  2401.             case StatusEffect.ModifiedStat.AttackSpeed:
  2402.                 characterStats.AttackSpeedMultiplier /= currentAppliedValue;
  2403.                 if (characterStats.AttackSpeedMultiplier >= 1f & characterStats.AttackSpeedMultiplier <= 1f)
  2404.                 {
  2405.                     characterStats.AttackSpeedMultiplier = 1f;
  2406.                 }
  2407.                 break;
  2408.             case StatusEffect.ModifiedStat.Stealth:
  2409.                 characterStats.StealthBonus -= (int)currentAppliedValue;
  2410.                 break;
  2411.             case StatusEffect.ModifiedStat.BonusDamage:
  2412.                 if (this.Params.DmgType < DamagePacket.DamageType.Count)
  2413.                 {
  2414.                     characterStats.BonusDamage[(int)this.Params.DmgType] -= currentAppliedValue;
  2415.                 }
  2416.                 else
  2417.                 {
  2418.                     if (this.Params.DmgType == DamagePacket.DamageType.All)
  2419.                     {
  2420.                         for (int i = 0; i < 7; i++)
  2421.                         {
  2422.                             characterStats.BonusDamage[i] -= currentAppliedValue;
  2423.                         }
  2424.                     }
  2425.                 }
  2426.                 break;
  2427.             case StatusEffect.ModifiedStat.DamageThreshhold:
  2428.                 characterStats.DamageThreshhold[(int)this.Params.DmgType] -= currentAppliedValue;
  2429.                 if (this.Params.DmgType == DamagePacket.DamageType.All)
  2430.                 {
  2431.                     for (int j = 0; j < 7; j++)
  2432.                     {
  2433.                         characterStats.DamageThreshhold[j] -= currentAppliedValue;
  2434.                     }
  2435.                 }
  2436.                 break;
  2437.             case StatusEffect.ModifiedStat.DamageMinimum:
  2438.                 characterStats.DamageMinBonus -= currentAppliedValue;
  2439.                 break;
  2440.             case StatusEffect.ModifiedStat.MovementRate:
  2441.                 if (component2)
  2442.                 {
  2443.                     component2.SetRunSpeed(component2.RunSpeed - currentAppliedValue);
  2444.                     component2.SetWalkSpeed(component2.WalkSpeed - currentAppliedValue);
  2445.                 }
  2446.                 break;
  2447.             case StatusEffect.ModifiedStat.NonTargetable:
  2448.                 component.Targetable = true;
  2449.                 break;
  2450.             case StatusEffect.ModifiedStat.NonMobile:
  2451.                 if (component2)
  2452.                 {
  2453.                     component2.Frozen = false;
  2454.                 }
  2455.                 break;
  2456.             case StatusEffect.ModifiedStat.KnockedDown:
  2457.             {
  2458.                 AIController component3 = target.GetComponent<AIController>();
  2459.                 if (component3 != null)
  2460.                 {
  2461.                     GameEventArgs gameEventArgs = new GameEventArgs();
  2462.                     gameEventArgs.Type = GameEventType.KnockedDown;
  2463.                     gameEventArgs.IntData = new int[1];
  2464.                     gameEventArgs.IntData[0] = 0;
  2465.                     component3.OnEvent(gameEventArgs);
  2466.                 }
  2467.                 break;
  2468.             }
  2469.             case StatusEffect.ModifiedStat.EngagedEnemyCount:
  2470.                 characterStats.EngageableEnemyCount -= (int)currentAppliedValue;
  2471.                 if (characterStats.EngageableEnemyCount < 0)
  2472.                 {
  2473.                     characterStats.EngageableEnemyCount = 0;
  2474.                 }
  2475.                 break;
  2476.             case StatusEffect.ModifiedStat.EngagementRadius:
  2477.                 characterStats.EngagementDistanceBonus -= currentAppliedValue;
  2478.                 break;
  2479.             case StatusEffect.ModifiedStat.EngagementAccuracy:
  2480.                 characterStats.DisengagementAccuracyBonus -= (int)currentAppliedValue;
  2481.                 break;
  2482.             case StatusEffect.ModifiedStat.EngagementDamage:
  2483.                 characterStats.DisengagementDamageBonus -= currentAppliedValue;
  2484.                 break;
  2485.             case StatusEffect.ModifiedStat.Engageable:
  2486.                 characterStats.ImmuneToEngagement = false;
  2487.                 break;
  2488.             case StatusEffect.ModifiedStat.Stunned:
  2489.             {
  2490.                 AIController component4 = target.GetComponent<AIController>();
  2491.                 if (component4 != null)
  2492.                 {
  2493.                     GameEventArgs gameEventArgs2 = new GameEventArgs();
  2494.                     gameEventArgs2.Type = GameEventType.Stunned;
  2495.                     gameEventArgs2.IntData = new int[1];
  2496.                     gameEventArgs2.IntData[0] = 0;
  2497.                     component4.OnEvent(gameEventArgs2);
  2498.                 }
  2499.                 break;
  2500.             }
  2501.             case StatusEffect.ModifiedStat.BonusUnarmedDamage:
  2502.                 characterStats.BonusUnarmedDamage -= currentAppliedValue;
  2503.                 break;
  2504.             case StatusEffect.ModifiedStat.MeleeAttackDistanceMult:
  2505.                 characterStats.MeleeAttackDistanceMultiplier = 1f;
  2506.                 break;
  2507.             case StatusEffect.ModifiedStat.RangedAttackDistanceMult:
  2508.                 characterStats.RangedAttackDistanceMultiplier = 1f;
  2509.                 break;
  2510.             case StatusEffect.ModifiedStat.BonusDTFromArmor:
  2511.                 characterStats.BonusDTFromArmor -= currentAppliedValue;
  2512.                 break;
  2513.             case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
  2514.                 characterStats.MeleeDamageRangePctIncreaseToMin -= currentAppliedValue;
  2515.                 break;
  2516.             case StatusEffect.ModifiedStat.SuspendHostileEffects:
  2517.                 characterStats.UnsuspendEffects(CharacterStats.EffectType.Hostile, this.m_timeApplied);
  2518.                 break;
  2519.             case StatusEffect.ModifiedStat.BonusMeleeDamage:
  2520.                 characterStats.BonusMeleeDamage -= currentAppliedValue;
  2521.                 break;
  2522.             case StatusEffect.ModifiedStat.ImmuneToEngageStop:
  2523.                 characterStats.ImmuneToEngageStop = false;
  2524.                 break;
  2525.             case StatusEffect.ModifiedStat.HealthLossPctMult:
  2526.                 characterStats.HealthLossPercentMult /= currentAppliedValue;
  2527.                 break;
  2528.             case StatusEffect.ModifiedStat.DrainResolveForDeflection:
  2529.                 characterStats.ResolveBonus -= (int)currentAppliedValue;
  2530.                 break;
  2531.             case StatusEffect.ModifiedStat.ReapplyDamage:
  2532.             case StatusEffect.ModifiedStat.ReapplyDamageToNearbyEnemies:
  2533.                 component.OnDamaged -= new GameInputEventHandle(this.HandleOnDamagedForReapply);
  2534.                 break;
  2535.             case StatusEffect.ModifiedStat.ReloadSpeed:
  2536.                 characterStats.ReloadSpeedMultiplier /= currentAppliedValue;
  2537.                 if (characterStats.ReloadSpeedMultiplier >= 1f & characterStats.ReloadSpeedMultiplier <= 1f)
  2538.                 {
  2539.                     characterStats.ReloadSpeedMultiplier = 1f;
  2540.                 }
  2541.                 break;
  2542.             case StatusEffect.ModifiedStat.StasisShield:
  2543.             {
  2544.                 characterStats.OnPreDamageApplied -= new CombatEventHandler(this.HandleStatsOnPreDamageAppliedForAbsorb);
  2545.                 AIController component5 = target.GetComponent<AIController>();
  2546.                 if (component5 != null)
  2547.                 {
  2548.                     GameEventArgs gameEventArgs3 = new GameEventArgs();
  2549.                     gameEventArgs3.Type = GameEventType.Stunned;
  2550.                     gameEventArgs3.IntData = new int[1];
  2551.                     gameEventArgs3.IntData[0] = 0;
  2552.                     component5.OnEvent(gameEventArgs3);
  2553.                 }
  2554.                 break;
  2555.             }
  2556.             case StatusEffect.ModifiedStat.SuspendBeneficialEffects:
  2557.                 characterStats.UnsuspendEffects(CharacterStats.EffectType.Beneficial, this.m_timeApplied);
  2558.                 break;
  2559.             case StatusEffect.ModifiedStat.Resolve:
  2560.                 characterStats.ResolveBonus -= (int)currentAppliedValue;
  2561.                 break;
  2562.             case StatusEffect.ModifiedStat.Might:
  2563.                 characterStats.MightBonus -= (int)currentAppliedValue;
  2564.                 break;
  2565.             case StatusEffect.ModifiedStat.Dexterity:
  2566.                 characterStats.DexterityBonus -= (int)currentAppliedValue;
  2567.                 break;
  2568.             case StatusEffect.ModifiedStat.Intellect:
  2569.                 characterStats.IntellectBonus -= (int)currentAppliedValue;
  2570.                 break;
  2571.             case StatusEffect.ModifiedStat.SummonWeapon:
  2572.             {
  2573.                 Equipment component6 = target.GetComponent<Equipment>();
  2574.                 if (component6 != null)
  2575.                 {
  2576.                     component6.PopSummonedWeapon();
  2577.                 }
  2578.                 break;
  2579.             }
  2580.             case StatusEffect.ModifiedStat.StaminaRechargeRateMult:
  2581.                 if (currentAppliedValue != 0f)
  2582.                 {
  2583.                     characterStats.StaminaRechargeMult /= currentAppliedValue;
  2584.                 }
  2585.                 break;
  2586.             case StatusEffect.ModifiedStat.VesselAccuracy:
  2587.                 characterStats.VesselAccuracyBonus -= (int)currentAppliedValue;
  2588.                 break;
  2589.             case StatusEffect.ModifiedStat.BeastAccuracy:
  2590.                 characterStats.BeastAccuracyBonus -= (int)currentAppliedValue;
  2591.                 break;
  2592.             case StatusEffect.ModifiedStat.WilderAccuracy:
  2593.                 characterStats.WilderAccuracyBonus -= (int)currentAppliedValue;
  2594.                 break;
  2595.             case StatusEffect.ModifiedStat.StunDefense:
  2596.                 characterStats.StunDefenseBonus -= (int)currentAppliedValue;
  2597.                 break;
  2598.             case StatusEffect.ModifiedStat.KnockdownDefense:
  2599.                 characterStats.KnockdownDefenseBonus -= (int)currentAppliedValue;
  2600.                 break;
  2601.             case StatusEffect.ModifiedStat.PoisonDefense:
  2602.                 characterStats.PoisonDefenseBonus -= (int)currentAppliedValue;
  2603.                 break;
  2604.             case StatusEffect.ModifiedStat.DiseaseDefense:
  2605.                 characterStats.DiseaseDefenseBonus -= (int)currentAppliedValue;
  2606.                 break;
  2607.             case StatusEffect.ModifiedStat.DistantEnemyBonus:
  2608.                 characterStats.DistantEnemyBonus -= (int)currentAppliedValue;
  2609.                 break;
  2610.             case StatusEffect.ModifiedStat.BonusAccuracyForNearestAllyOnSameEnemy:
  2611.                 characterStats.NearestAllyWithSharedTargetAccuracyBonus -= (int)currentAppliedValue;
  2612.                 break;
  2613.             case StatusEffect.ModifiedStat.EnemyCritToHitPercent:
  2614.                 characterStats.EnemyCritToHitPercent -= currentAppliedValue;
  2615.                 break;
  2616.             case StatusEffect.ModifiedStat.HostileEffectDurationMult:
  2617.                 characterStats.HostileEffectDurationMultiplier /= currentAppliedValue;
  2618.                 break;
  2619.             case StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent:
  2620.                 characterStats.DeflectReflexGrazeToMissPercent -= currentAppliedValue;
  2621.                 break;
  2622.             case StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent:
  2623.                 characterStats.FortitudeWillGrazeToMissPercent -= currentAppliedValue;
  2624.                 break;
  2625.             case StatusEffect.ModifiedStat.ExtraStraightBounces:
  2626.                 characterStats.ExtraStraightBounces -= (int)currentAppliedValue;
  2627.                 break;
  2628.             case StatusEffect.ModifiedStat.RedirectMeleeAttacks:
  2629.                 characterStats.RedirectMeleeAttacks = false;
  2630.                 break;
  2631.             case StatusEffect.ModifiedStat.HostileAOEDamageMultiplier:
  2632.                 characterStats.HostileAOEDamageMultiplier /= currentAppliedValue;
  2633.                 break;
  2634.             case StatusEffect.ModifiedStat.ImprovedFlanking:
  2635.                 characterStats.ImprovedFlanking--;
  2636.                 break;
  2637.             case StatusEffect.ModifiedStat.DTBypass:
  2638.                 characterStats.DTBypass -= (float)((int)currentAppliedValue);
  2639.                 break;
  2640.             case StatusEffect.ModifiedStat.StealSpell:
  2641.                 if (this.m_owner != null && this.m_spell != null)
  2642.                 {
  2643.                     CharacterStats component7 = this.m_owner.GetComponent<CharacterStats>();
  2644.                     if (component7 != null)
  2645.                     {
  2646.                         component7.ActiveAbilities.Remove(this.m_spell);
  2647.                     }
  2648.                 }
  2649.                 break;
  2650.             case StatusEffect.ModifiedStat.SwapFaction:
  2651.             {
  2652.                 PartyMemberAI component8 = target.GetComponent<PartyMemberAI>();
  2653.                 Faction component9 = target.GetComponent<Faction>();
  2654.                 if (component9 != null)
  2655.                 {
  2656.                     component9.CurrentTeamInstance = this.m_cachedTeam;
  2657.                 }
  2658.                 AIController aIController;
  2659.                 if (component8)
  2660.                 {
  2661.                     aIController = component8;
  2662.                     component8.enabled = true;
  2663.                     component8.InitAI();
  2664.                     component8.AI.PopAllStates();
  2665.                     component8.Selected = true;
  2666.                 }
  2667.                 else
  2668.                 {
  2669.                     aIController = target.GetComponent<AIController>();
  2670.                 }
  2671.                 if (aIController != null)
  2672.                 {
  2673.                     AIState currentState = aIController.AI.CurrentState;
  2674.                     if (currentState.Priority < 2)
  2675.                     {
  2676.                         aIController.AI.PopAllStates();
  2677.                     }
  2678.                     else
  2679.                     {
  2680.                         aIController.AI.ClearQueuedStates();
  2681.                     }
  2682.                 }
  2683.                 break;
  2684.             }
  2685.             case StatusEffect.ModifiedStat.Athletics:
  2686.                 characterStats.AthleticsBonus -= (int)currentAppliedValue;
  2687.                 break;
  2688.             case StatusEffect.ModifiedStat.Lore:
  2689.                 characterStats.LoreBonus -= (int)currentAppliedValue;
  2690.                 break;
  2691.             case StatusEffect.ModifiedStat.Mechanics:
  2692.                 characterStats.MechanicsBonus -= (int)currentAppliedValue;
  2693.                 break;
  2694.             case StatusEffect.ModifiedStat.Survival:
  2695.                 characterStats.SurvivalBonus -= (int)currentAppliedValue;
  2696.                 break;
  2697.             case StatusEffect.ModifiedStat.Crafting:
  2698.                 characterStats.CraftingBonus -= (int)currentAppliedValue;
  2699.                 break;
  2700.             case StatusEffect.ModifiedStat.PushDefense:
  2701.                 characterStats.PushDefenseBonus -= (int)currentAppliedValue;
  2702.                 break;
  2703.             case StatusEffect.ModifiedStat.WhileStunnedDefense:
  2704.                 characterStats.WhileStunnedDefenseBonus -= (int)currentAppliedValue;
  2705.                 break;
  2706.             case StatusEffect.ModifiedStat.WhileKnockeddownDefense:
  2707.                 characterStats.WhileKnockeddownDefenseBonus -= (int)currentAppliedValue;
  2708.                 break;
  2709.             case StatusEffect.ModifiedStat.Constitution:
  2710.                 characterStats.ConstitutionBonus -= (int)currentAppliedValue;
  2711.                 break;
  2712.             case StatusEffect.ModifiedStat.Perception:
  2713.                 characterStats.PerceptionBonus -= (int)currentAppliedValue;
  2714.                 break;
  2715.             case StatusEffect.ModifiedStat.CritHitMultiplierBonus:
  2716.                 characterStats.CritHitDamageMultiplierBonus -= currentAppliedValue;
  2717.                 break;
  2718.             case StatusEffect.ModifiedStat.BonusGrazeToHitPercent:
  2719.                 characterStats.BonusGrazeToHitPercent -= currentAppliedValue;
  2720.                 break;
  2721.             case StatusEffect.ModifiedStat.BonusGrazeToMissPercent:
  2722.                 characterStats.BonusGrazeToMissPercent -= currentAppliedValue;
  2723.                 break;
  2724.             case StatusEffect.ModifiedStat.BonusCritToHitPercent:
  2725.                 characterStats.BonusCritToHitPercent -= currentAppliedValue;
  2726.                 break;
  2727.             case StatusEffect.ModifiedStat.BonusMissToGrazePercent:
  2728.                 characterStats.BonusMissToGrazePercent -= currentAppliedValue;
  2729.                 break;
  2730.             case StatusEffect.ModifiedStat.BonusHitToCritPercent:
  2731.                 characterStats.BonusHitToCritPercent -= currentAppliedValue;
  2732.                 break;
  2733.             case StatusEffect.ModifiedStat.BonusHitToGrazePercent:
  2734.                 characterStats.BonusHitToGrazePercent -= currentAppliedValue;
  2735.                 break;
  2736.             case StatusEffect.ModifiedStat.Confused:
  2737.             {
  2738.                 AIController component10 = target.GetComponent<AIController>();
  2739.                 if (component10 != null)
  2740.                 {
  2741.                     component10.AI.PopCurrentState();
  2742.                 }
  2743.                 break;
  2744.             }
  2745.             case StatusEffect.ModifiedStat.BonusMeleeWeaponDamage:
  2746.                 characterStats.BonusMeleeWeaponDamage -= currentAppliedValue;
  2747.                 break;
  2748.             case StatusEffect.ModifiedStat.BonusRangedWeaponDamage:
  2749.                 characterStats.BonusRangedWeaponDamage -= currentAppliedValue;
  2750.                 break;
  2751.             case StatusEffect.ModifiedStat.RateOfFireMult:
  2752.                 characterStats.RateOfFireMultiplier /= currentAppliedValue;
  2753.                 if (characterStats.RateOfFireMultiplier >= 1f & characterStats.RateOfFireMultiplier <= 1f)
  2754.                 {
  2755.                     characterStats.RateOfFireMultiplier = 1f;
  2756.                 }
  2757.                 break;
  2758.             case StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent:
  2759.                 characterStats.EnemyReflexGrazeToMissPercent -= currentAppliedValue;
  2760.                 break;
  2761.             case StatusEffect.ModifiedStat.EnemiesNeededToFlankAdj:
  2762.                 characterStats.EnemiesNeededToFlank -= (int)currentAppliedValue;
  2763.                 break;
  2764.             case StatusEffect.ModifiedStat.ConcentrationBonus:
  2765.                 characterStats.ConcentrationBonus -= currentAppliedValue;
  2766.                 break;
  2767.             case StatusEffect.ModifiedStat.DisableSpellcasting:
  2768.                 characterStats.SpellCastingDisabled--;
  2769.                 break;
  2770.             case StatusEffect.ModifiedStat.ResistAffliction:
  2771.             {
  2772.                 CharacterStats expr_F04 = characterStats;
  2773.                 expr_F04.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Remove(expr_F04.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseAffliction));
  2774.                 break;
  2775.             }
  2776.             case StatusEffect.ModifiedStat.PreventDeath:
  2777.                 characterStats.DeathPrevented--;
  2778.                 break;
  2779.             case StatusEffect.ModifiedStat.DOTTickMult:
  2780.                 characterStats.DOTTickMult /= currentAppliedValue;
  2781.                 break;
  2782.             case StatusEffect.ModifiedStat.ResistKeyword:
  2783.             {
  2784.                 CharacterStats expr_F52 = characterStats;
  2785.                 expr_F52.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Remove(expr_F52.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseKeyword));
  2786.                 break;
  2787.             }
  2788.             case StatusEffect.ModifiedStat.TransferDT:
  2789.                 if (this.m_owner != null)
  2790.                 {
  2791.                     CharacterStats component11 = this.m_owner.GetComponent<CharacterStats>();
  2792.                     if (component11 != null)
  2793.                     {
  2794.                         component11.DamageThreshhold[(int)this.Params.DmgType] -= currentAppliedValue;
  2795.                         characterStats.DamageThreshhold[(int)this.Params.DmgType] += currentAppliedValue;
  2796.                         if (this.Params.DmgType == DamagePacket.DamageType.All)
  2797.                         {
  2798.                             for (int k = 0; k < 7; k++)
  2799.                             {
  2800.                                 component11.DamageThreshhold[k] -= currentAppliedValue;
  2801.                                 characterStats.DamageThreshhold[k] += currentAppliedValue;
  2802.                             }
  2803.                         }
  2804.                     }
  2805.                 }
  2806.                 break;
  2807.             case StatusEffect.ModifiedStat.TransferRandomAttribute:
  2808.                 if (this.m_owner != null)
  2809.                 {
  2810.                     CharacterStats component12 = this.m_owner.GetComponent<CharacterStats>();
  2811.                     if (component12 != null)
  2812.                     {
  2813.                         switch (this.m_generalCounter)
  2814.                         {
  2815.                         case 0u:
  2816.                             component12.MightBonus -= (int)currentAppliedValue;
  2817.                             characterStats.MightBonus += (int)currentAppliedValue;
  2818.                             break;
  2819.                         case 1u:
  2820.                             component12.ConstitutionBonus -= (int)currentAppliedValue;
  2821.                             characterStats.ConstitutionBonus += (int)currentAppliedValue;
  2822.                             break;
  2823.                         case 2u:
  2824.                             component12.DexterityBonus -= (int)currentAppliedValue;
  2825.                             characterStats.DexterityBonus += (int)currentAppliedValue;
  2826.                             break;
  2827.                         case 3u:
  2828.                             component12.PerceptionBonus -= (int)currentAppliedValue;
  2829.                             characterStats.PerceptionBonus += (int)currentAppliedValue;
  2830.                             break;
  2831.                         case 4u:
  2832.                             component12.IntellectBonus -= (int)currentAppliedValue;
  2833.                             characterStats.IntellectBonus += (int)currentAppliedValue;
  2834.                             break;
  2835.                         case 5u:
  2836.                             component12.ResolveBonus -= (int)currentAppliedValue;
  2837.                             characterStats.ResolveBonus += (int)currentAppliedValue;
  2838.                             break;
  2839.                         }
  2840.                     }
  2841.                 }
  2842.                 break;
  2843.             case StatusEffect.ModifiedStat.Duplicate:
  2844.                 UnityEngine.Object.DestroyObject(this.ExtraObject, 1f);
  2845.                 break;
  2846.             case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
  2847.                 if (this.m_generalCounter == 1u)
  2848.                 {
  2849.                     characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
  2850.                     characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
  2851.                 }
  2852.                 break;
  2853.             case StatusEffect.ModifiedStat.EnemyHitToGrazePercent:
  2854.                 characterStats.EnemyHitToGrazePercent -= currentAppliedValue;
  2855.                 break;
  2856.             case StatusEffect.ModifiedStat.StunDurationMult:
  2857.                 characterStats.StunDurationMult /= currentAppliedValue;
  2858.                 break;
  2859.             case StatusEffect.ModifiedStat.KnockDownDurationMult:
  2860.                 characterStats.KnockDownDurationMult /= currentAppliedValue;
  2861.                 break;
  2862.             case StatusEffect.ModifiedStat.BonusArmorDTMultAtLowHealth:
  2863.                 characterStats.BonusArmorDTMultAtLowHealth /= currentAppliedValue;
  2864.                 break;
  2865.             case StatusEffect.ModifiedStat.PrimordialAccuracy:
  2866.                 characterStats.PrimordialAccuracyBonus -= (int)currentAppliedValue;
  2867.                 break;
  2868.             case StatusEffect.ModifiedStat.StopAnimation:
  2869.             {
  2870.                 AnimationController component13 = target.GetComponent<AnimationController>();
  2871.                 if (component13 != null && component2 != null)
  2872.                 {
  2873.                     component13.TimeScaleOverride--;
  2874.                     component2.Frozen = false;
  2875.                 }
  2876.                 break;
  2877.             }
  2878.             case StatusEffect.ModifiedStat.AddAfflictionImmunity:
  2879.                 if (this.Params.AfflictionPrefab != null)
  2880.                 {
  2881.                     characterStats.AfflictionImmunities.Remove(this.Params.AfflictionPrefab);
  2882.                 }
  2883.                 break;
  2884.             case StatusEffect.ModifiedStat.Invisible:
  2885.                 if (currentAppliedValue > 0f)
  2886.                 {
  2887.                     characterStats.InvisibilityState--;
  2888.                 }
  2889.                 break;
  2890.             case StatusEffect.ModifiedStat.WoundDelay:
  2891.                 characterStats.WoundDelay -= currentAppliedValue;
  2892.                 break;
  2893.             case StatusEffect.ModifiedStat.FinishingBlowDamageMult:
  2894.                 characterStats.FinishingBlowDamageMult /= currentAppliedValue;
  2895.                 break;
  2896.             case StatusEffect.ModifiedStat.ZealousAuraAoEMult:
  2897.                 characterStats.ZealousAuraRadiusMult /= Mathf.Sqrt(currentAppliedValue);
  2898.                 break;
  2899.             case StatusEffect.ModifiedStat.DelayUnconsciousness:
  2900.                 characterStats.UnconsciousnessDelayed--;
  2901.                 break;
  2902.             case StatusEffect.ModifiedStat.NegMoveTickMult:
  2903.                 characterStats.NegMoveTickMult /= currentAppliedValue;
  2904.                 break;
  2905.             case StatusEffect.ModifiedStat.FocusGainMult:
  2906.                 characterStats.FocusGainMult /= currentAppliedValue;
  2907.                 break;
  2908.             case StatusEffect.ModifiedStat.DisengagementDefense:
  2909.                 characterStats.DisengagementDefenseBonus -= (int)currentAppliedValue;
  2910.                 break;
  2911.             case StatusEffect.ModifiedStat.SpellDefense:
  2912.                 characterStats.SpellDefenseBonus -= (int)currentAppliedValue;
  2913.                 break;
  2914.             case StatusEffect.ModifiedStat.RangedDeflection:
  2915.                 characterStats.RangedDeflectionBonus -= (int)currentAppliedValue;
  2916.                 break;
  2917.             case StatusEffect.ModifiedStat.BonusUsesPerRestPastThree:
  2918.                 characterStats.BonusUsesPerRestPastThree -= (int)currentAppliedValue;
  2919.                 break;
  2920.             case StatusEffect.ModifiedStat.PoisonTickMult:
  2921.                 characterStats.PoisonTickMult /= currentAppliedValue;
  2922.                 break;
  2923.             case StatusEffect.ModifiedStat.DiseaseTickMult:
  2924.                 characterStats.DiseaseTickMult /= currentAppliedValue;
  2925.                 break;
  2926.             case StatusEffect.ModifiedStat.StalkersLinkDamageMult:
  2927.                 characterStats.StalkersLinkDamageMult /= currentAppliedValue;
  2928.                 break;
  2929.             case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
  2930.                 characterStats.ChanterPhraseRadiusMult /= Mathf.Sqrt(currentAppliedValue);
  2931.                 break;
  2932.             case StatusEffect.ModifiedStat.BonusHealMult:
  2933.                 characterStats.BonusHealMult /= currentAppliedValue;
  2934.                 break;
  2935.             case StatusEffect.ModifiedStat.SpellCastBonus:
  2936.             {
  2937.                 int num = (int)this.Params.ExtraValue - 1;
  2938.                 if (num >= 0 && num < 6)
  2939.                 {
  2940.                     characterStats.SpellCastBonus[num] -= (int)currentAppliedValue;
  2941.                 }
  2942.                 break;
  2943.             }
  2944.             case StatusEffect.ModifiedStat.AoEMult:
  2945.                 characterStats.AoERadiusMult /= Mathf.Sqrt(currentAppliedValue);
  2946.                 break;
  2947.             case StatusEffect.ModifiedStat.FrenzyDurationMult:
  2948.                 characterStats.FrenzyDurationMult /= currentAppliedValue;
  2949.                 break;
  2950.             case StatusEffect.ModifiedStat.ProneDurationMult:
  2951.                 characterStats.ProneDurationMult /= currentAppliedValue;
  2952.                 break;
  2953.             case StatusEffect.ModifiedStat.WildstrikeDamageMult:
  2954.                 characterStats.WildstrikeDamageMult /= currentAppliedValue;
  2955.                 break;
  2956.             case StatusEffect.ModifiedStat.HidesHealthStamina:
  2957.                 component.EnableHealthDisplay(true);
  2958.                 break;
  2959.             case StatusEffect.ModifiedStat.AllDefense:
  2960.                 characterStats.DeflectionBonus -= (int)currentAppliedValue;
  2961.                 characterStats.ReflexBonus -= (int)currentAppliedValue;
  2962.                 characterStats.WillBonus -= (int)currentAppliedValue;
  2963.                 characterStats.FortitudeBonus -= (int)currentAppliedValue;
  2964.                 break;
  2965.             case StatusEffect.ModifiedStat.MaxStaminaMult:
  2966.                 characterStats.MaxStaminaMultiplier /= currentAppliedValue;
  2967.                 break;
  2968.             case StatusEffect.ModifiedStat.CallbackOnDamaged:
  2969.                 if (this.Params.OnDamagedCallbackAbility != null)
  2970.                 {
  2971.                     component.OnDamaged -= new GameInputEventHandle(this.Params.OnDamagedCallbackAbility.HandleOnDamaged);
  2972.                 }
  2973.                 break;
  2974.             case StatusEffect.ModifiedStat.Accuracy:
  2975.                 characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
  2976.                 characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
  2977.                 break;
  2978.             case StatusEffect.ModifiedStat.CallbackAfterAttack:
  2979.                 if (this.m_abilityOrigin != null)
  2980.                 {
  2981.                     characterStats.OnPostDamageDealt -= new CombatEventHandler(this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallback);
  2982.                     this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallbackComplete();
  2983.                 }
  2984.                 break;
  2985.             }
  2986.         }
  2987.         if (this.m_target == target)
  2988.         {
  2989.             List<GameObject> list = new List<GameObject>(this.m_auraTargetsApplied.Keys);
  2990.             list.AddRange(this.m_auraTargetsUnapplied);
  2991.             foreach (GameObject current2 in list)
  2992.             {
  2993.                 this.RemoveAura(current2);
  2994.             }
  2995.             this.m_applied = false;
  2996.             this.m_effect_is_on_main_target = false;
  2997.             this.RemoveTriggerCallback();
  2998.         }
  2999.     }
  3000.     public void RemoveEffect()
  3001.     {
  3002.         if (this.m_timeActive <= 0f)
  3003.         {
  3004.             this.m_timeActive = 0.01f;
  3005.         }
  3006.         this.Duration = this.m_timeActive;
  3007.     }
  3008.     public void WhenLaunchesAttack(GameObject attacker, GameObject enemy)
  3009.     {
  3010.         if (!this.m_applied)
  3011.         {
  3012.             return;
  3013.         }
  3014.         if (attacker == enemy)
  3015.         {
  3016.             return;
  3017.         }
  3018.         float currentAppliedValue = this.CurrentAppliedValue;
  3019.         StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
  3020.         if (affectsStat != StatusEffect.ModifiedStat.BonusAccuracyOnSameEnemy)
  3021.         {
  3022.             if (affectsStat != StatusEffect.ModifiedStat.BonusDamageMultOnSameEnemy)
  3023.             {
  3024.                 if (affectsStat != StatusEffect.ModifiedStat.SneakAttackOnNearDead)
  3025.                 {
  3026.                     if (affectsStat != StatusEffect.ModifiedStat.BonusCritChanceOnSameEnemy)
  3027.                     {
  3028.                         if (affectsStat != StatusEffect.ModifiedStat.BonusAccuracyOnSameEnemyAsExtraObject)
  3029.                         {
  3030.                             if (affectsStat == StatusEffect.ModifiedStat.AccuracyByRace)
  3031.                             {
  3032.                                 CharacterStats component = enemy.GetComponent<CharacterStats>();
  3033.                                 if (component != null && component.CharacterRace == this.Params.RaceType)
  3034.                                 {
  3035.                                     CharacterStats component2 = attacker.GetComponent<CharacterStats>();
  3036.                                     if (component2 != null)
  3037.                                     {
  3038.                                         component2.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3039.                                         {
  3040.                                             AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
  3041.                                             Value = currentAppliedValue,
  3042.                                             OneHitUse = true
  3043.                                         }, this.AbilityType, null, true));
  3044.                                         component2.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3045.                                         {
  3046.                                             AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
  3047.                                             Value = currentAppliedValue,
  3048.                                             OneHitUse = true
  3049.                                         }, this.AbilityType, null, true));
  3050.                                     }
  3051.                                 }
  3052.                             }
  3053.                         }
  3054.                         else
  3055.                         {
  3056.                             if (this.m_extraObject != null)
  3057.                             {
  3058.                                 CharacterStats component3 = attacker.GetComponent<CharacterStats>();
  3059.                                 if (component3 != null)
  3060.                                 {
  3061.                                     AIController component4 = this.m_extraObject.GetComponent<AIController>();
  3062.                                     if (component4 != null && component4.CurrentTarget == enemy)
  3063.                                     {
  3064.                                         component3.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3065.                                         {
  3066.                                             AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
  3067.                                             Value = currentAppliedValue,
  3068.                                             OneHitUse = true
  3069.                                         }, this.AbilityType, null, true));
  3070.                                         component3.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3071.                                         {
  3072.                                             AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
  3073.                                             Value = currentAppliedValue,
  3074.                                             OneHitUse = true
  3075.                                         }, this.AbilityType, null, true));
  3076.                                     }
  3077.                                 }
  3078.                             }
  3079.                         }
  3080.                     }
  3081.                     else
  3082.                     {
  3083.                         CharacterStats component5 = attacker.GetComponent<CharacterStats>();
  3084.                         if (component5 != null)
  3085.                         {
  3086.                             PartyMemberAI[] partyMembers = PartyMemberAI.PartyMembers;
  3087.                             for (int i = 0; i < partyMembers.Length; i++)
  3088.                             {
  3089.                                 PartyMemberAI partyMemberAI = partyMembers[i];
  3090.                                 if (!(partyMemberAI == null) && !(partyMemberAI.gameObject == attacker))
  3091.                                 {
  3092.                                     if (partyMemberAI.CurrentTarget == enemy)
  3093.                                     {
  3094.                                         component5.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3095.                                         {
  3096.                                             AffectsStat = StatusEffect.ModifiedStat.BonusHitToCritPercent,
  3097.                                             Value = currentAppliedValue,
  3098.                                             OneHitUse = true
  3099.                                         }, this.AbilityType, null, true));
  3100.                                         break;
  3101.                                     }
  3102.                                 }
  3103.                             }
  3104.                         }
  3105.                     }
  3106.                 }
  3107.                 else
  3108.                 {
  3109.                     Health component6 = enemy.GetComponent<Health>();
  3110.                     if (component6 && component6.CurrentHealth / component6.MaxHealth <= currentAppliedValue)
  3111.                     {
  3112.                         CharacterStats component7 = attacker.GetComponent<CharacterStats>();
  3113.                         if (component7)
  3114.                         {
  3115.                             StatusEffectParams statusEffectParams = new StatusEffectParams();
  3116.                             statusEffectParams.AffectsStat = StatusEffect.ModifiedStat.BonusDamage;
  3117.                             statusEffectParams.DmgType = DamagePacket.DamageType.Crush;
  3118.                             Equipment component8 = attacker.GetComponent<Equipment>();
  3119.                             if (component8 != null && component8.PrimaryAttack != null)
  3120.                             {
  3121.                                 statusEffectParams.DmgType = component8.PrimaryAttack.DamageData.Type;
  3122.                             }
  3123.                             statusEffectParams.Value = 10f;
  3124.                             statusEffectParams.OneHitUse = true;
  3125.                             component7.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, statusEffectParams, this.AbilityType, null, true));
  3126.                             component7.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3127.                             {
  3128.                                 AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
  3129.                                 Value = 10f,
  3130.                                 OneHitUse = true
  3131.                             }, this.AbilityType, null, true));
  3132.                         }
  3133.                     }
  3134.                 }
  3135.             }
  3136.             else
  3137.             {
  3138.                 CharacterStats component9 = attacker.GetComponent<CharacterStats>();
  3139.                 if (component9 != null)
  3140.                 {
  3141.                     PartyMemberAI[] partyMembers2 = PartyMemberAI.PartyMembers;
  3142.                     for (int j = 0; j < partyMembers2.Length; j++)
  3143.                     {
  3144.                         PartyMemberAI partyMemberAI2 = partyMembers2[j];
  3145.                         if (!(partyMemberAI2 == null) && !(partyMemberAI2.gameObject == attacker))
  3146.                         {
  3147.                             if (partyMemberAI2.CurrentTarget == enemy)
  3148.                             {
  3149.                                 component9.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3150.                                 {
  3151.                                     AffectsStat = StatusEffect.ModifiedStat.BonusDamageMult,
  3152.                                     Value = currentAppliedValue,
  3153.                                     OneHitUse = true
  3154.                                 }, this.AbilityType, null, true));
  3155.                                 break;
  3156.                             }
  3157.                         }
  3158.                     }
  3159.                 }
  3160.             }
  3161.         }
  3162.         else
  3163.         {
  3164.             CharacterStats component10 = attacker.GetComponent<CharacterStats>();
  3165.             if (component10 != null)
  3166.             {
  3167.                 PartyMemberAI[] partyMembers3 = PartyMemberAI.PartyMembers;
  3168.                 for (int k = 0; k < partyMembers3.Length; k++)
  3169.                 {
  3170.                     PartyMemberAI partyMemberAI3 = partyMembers3[k];
  3171.                     if (!(partyMemberAI3 == null) && !(partyMemberAI3.gameObject == attacker))
  3172.                     {
  3173.                         if (partyMemberAI3.CurrentTarget == enemy)
  3174.                         {
  3175.                             component10.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3176.                             {
  3177.                                 AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
  3178.                                 Value = currentAppliedValue,
  3179.                                 OneHitUse = true
  3180.                             }, this.AbilityType, null, true));
  3181.                             component10.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
  3182.                             {
  3183.                                 AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
  3184.                                 Value = currentAppliedValue,
  3185.                                 OneHitUse = true
  3186.                             }, this.AbilityType, null, true));
  3187.                             break;
  3188.                         }
  3189.                     }
  3190.                 }
  3191.             }
  3192.         }
  3193.     }
  3194.     public void WhenHits(GameObject attacker, GameObject enemy, ref DamageInfo damage)
  3195.     {
  3196.         if (!this.m_applied)
  3197.         {
  3198.             return;
  3199.         }
  3200.         if (attacker == enemy)
  3201.         {
  3202.             return;
  3203.         }
  3204.         float currentAppliedValue = this.CurrentAppliedValue;
  3205.         StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
  3206.         switch (affectsStat)
  3207.         {
  3208.         case StatusEffect.ModifiedStat.MeleeAttackAllOnPath:
  3209.             if (damage.Attack is AttackMelee && !this.m_is_checking_melee_path)
  3210.             {
  3211.                 this.m_is_checking_melee_path = true;
  3212.                 damage.Attack.HandleBeam(attacker, enemy, Vector3.zero, CharacterStats.DefenseType.Reflex);
  3213.                 this.m_is_checking_melee_path = false;
  3214.             }
  3215.             return;
  3216.         case StatusEffect.ModifiedStat.BonusMeleeDamageFromWounds:
  3217.             if (damage.Attack is AttackMelee)
  3218.             {
  3219.                 CharacterStats component = attacker.GetComponent<CharacterStats>();
  3220.                 if (component != null)
  3221.                 {
  3222.                     int num = 0;
  3223.                     foreach (GenericAbility current in component.ActiveAbilities)
  3224.                     {
  3225.                         if (current is WoundsTrait)
  3226.                         {
  3227.                             num = component.CountStatusEffects(current.StatusEffects[0].Tag);
  3228.                             break;
  3229.                         }
  3230.                     }
  3231.                     if (num > 0)
  3232.                     {
  3233.                         DamagePacket.DamageProcType item = new DamagePacket.DamageProcType(this.Params.DmgType, (float)num * currentAppliedValue);
  3234.                         damage.Damage.DamageProc.Add(item);
  3235.                     }
  3236.                 }
  3237.             }
  3238.             return;
  3239.         case StatusEffect.ModifiedStat.BonusDTFromArmor:
  3240.         case StatusEffect.ModifiedStat.MeleeMissThresholdDelta_DO_NOT_USE:
  3241.         case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
  3242.             IL_4F:
  3243.             switch (affectsStat)
  3244.             {
  3245.             case StatusEffect.ModifiedStat.GainStaminaWhenHits:
  3246.             {
  3247.                 Health component2 = attacker.GetComponent<Health>();
  3248.                 if (component2 != null)
  3249.                 {
  3250.                     component2.AddStamina(damage.DamageAmount * currentAppliedValue);
  3251.                 }
  3252.                 return;
  3253.             }
  3254.             case StatusEffect.ModifiedStat.CanKnockDownOnCrit:
  3255.                 if (damage.IsCriticalHit)
  3256.                 {
  3257.                     CharacterStats component3 = attacker.GetComponent<CharacterStats>();
  3258.                     if (component3)
  3259.                     {
  3260.                         DamageInfo damageInfo = component3.ComputeSecondaryAttack(damage.Attack, enemy, CharacterStats.DefenseType.Fortitude);
  3261.                         List<StatusEffect> list = new List<StatusEffect>();
  3262.                         if (damageInfo.HitType != HitType.MISS)
  3263.                         {
  3264.                             CharacterStats component4 = enemy.GetComponent<CharacterStats>();
  3265.                             if (component4)
  3266.                             {
  3267.                                 StatusEffect statusEffect = StatusEffect.Create(attacker, new StatusEffectParams
  3268.                                 {
  3269.                                     AffectsStat = StatusEffect.ModifiedStat.KnockedDown,
  3270.                                     Duration = 5f
  3271.                                 }, this.AbilityType, damage, true);
  3272.                                 list.Add(statusEffect);
  3273.                                 statusEffect.EquipmentOrigin = this.EquipmentOrigin;
  3274.                                 component4.ApplyStatusEffect(statusEffect);
  3275.                             }
  3276.                         }
  3277.                         AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo, list);
  3278.                     }
  3279.                 }
  3280.                 return;
  3281.             case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
  3282.                 IL_74:
  3283.                 switch (affectsStat)
  3284.                 {
  3285.                 case StatusEffect.ModifiedStat.BonusDamageMult:
  3286.                     if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
  3287.                     {
  3288.                         damage.DamageAmount *= currentAppliedValue;
  3289.                     }
  3290.                     return;
  3291.                 case StatusEffect.ModifiedStat.FocusWhenHits:
  3292.                     if (damage.Attack != null && damage.Attack.AbilityOrigin == null)
  3293.                     {
  3294.                         CharacterStats component5 = attacker.GetComponent<CharacterStats>();
  3295.                         if (component5 != null)
  3296.                         {
  3297.                             component5.Focus += currentAppliedValue * component5.FocusGainMult;
  3298.                         }
  3299.                     }
  3300.                     return;
  3301.                 case StatusEffect.ModifiedStat.BeamDamageMult:
  3302.                     if (damage.Attack is AttackBeam)
  3303.                     {
  3304.                         for (uint num2 = 0u; num2 <= this.m_intervalCount; num2 += 1u)
  3305.                         {
  3306.                             damage.DamageAmount *= currentAppliedValue;
  3307.                         }
  3308.                     }
  3309.                     return;
  3310.                 default:
  3311.                 {
  3312.                     if (affectsStat == StatusEffect.ModifiedStat.DamageToDOT)
  3313.                     {
  3314.                         CharacterStats component6 = enemy.GetComponent<CharacterStats>();
  3315.                         if (component6)
  3316.                         {
  3317.                             StatusEffect statusEffect2 = StatusEffect.Create(attacker, new StatusEffectParams
  3318.                             {
  3319.                                 Apply = StatusEffect.ApplyType.ApplyOverTime,
  3320.                                 AffectsStat = StatusEffect.ModifiedStat.Damage,
  3321.                                 IntervalRate = StatusEffectParams.IntervalRateType.Damage,
  3322.                                 Duration = 30f,
  3323.                                 Value = damage.DamageAmount * currentAppliedValue,
  3324.                                 IsHostile = true
  3325.                             }, this.AbilityType, damage, true);
  3326.                             statusEffect2.EquipmentOrigin = this.EquipmentOrigin;
  3327.                             component6.ApplyStatusEffect(statusEffect2);
  3328.                             damage.DamageAmount = 0f;
  3329.                         }
  3330.                         return;
  3331.                     }
  3332.                     if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultIfTargetHasDOT)
  3333.                     {
  3334.                         CharacterStats component7 = enemy.GetComponent<CharacterStats>();
  3335.                         if (component7 != null && component7.CountDOTs() > 0)
  3336.                         {
  3337.                             damage.DamageAmount *= currentAppliedValue;
  3338.                         }
  3339.                         return;
  3340.                     }
  3341.                     if (affectsStat == StatusEffect.ModifiedStat.CanCripple)
  3342.                     {
  3343.                         if (UnityEngine.Random.Range(0f, 1f) < currentAppliedValue)
  3344.                         {
  3345.                             CharacterStats component8 = enemy.GetComponent<CharacterStats>();
  3346.                             if (component8)
  3347.                             {
  3348.                                 StatusEffect statusEffect3 = StatusEffect.Create(attacker, new StatusEffectParams
  3349.                                 {
  3350.                                     AffectsStat = StatusEffect.ModifiedStat.MovementRate,
  3351.                                     Duration = 30f,
  3352.                                     Value = -3f
  3353.                                 }, this.AbilityType, damage, true);
  3354.                                 statusEffect3.EquipmentOrigin = this.EquipmentOrigin;
  3355.                                 component8.ApplyStatusEffect(statusEffect3);
  3356.                             }
  3357.                         }
  3358.                         return;
  3359.                     }
  3360.                     if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultOnLowStaminaTarget)
  3361.                     {
  3362.                         Health component9 = enemy.GetComponent<Health>();
  3363.                         if (component9 != null && component9.CurrentStamina / component9.MaxStamina < 0.15f)
  3364.                         {
  3365.                             damage.DamageAmount *= currentAppliedValue;
  3366.                         }
  3367.                         return;
  3368.                     }
  3369.                     if (affectsStat == StatusEffect.ModifiedStat.CanStunOnCrit)
  3370.                     {
  3371.                         if (damage.IsCriticalHit)
  3372.                         {
  3373.                             CharacterStats component10 = attacker.GetComponent<CharacterStats>();
  3374.                             if (component10)
  3375.                             {
  3376.                                 DamageInfo damageInfo2 = component10.ComputeSecondaryAttack(damage.Attack, enemy, CharacterStats.DefenseType.Fortitude);
  3377.                                 List<StatusEffect> list2 = new List<StatusEffect>();
  3378.                                 if (damageInfo2.HitType != HitType.MISS)
  3379.                                 {
  3380.                                     CharacterStats component11 = enemy.GetComponent<CharacterStats>();
  3381.                                     if (component11)
  3382.                                     {
  3383.                                         StatusEffect statusEffect4 = StatusEffect.Create(attacker, new StatusEffectParams
  3384.                                         {
  3385.                                             AffectsStat = StatusEffect.ModifiedStat.Stunned,
  3386.                                             Duration = 5f
  3387.                                         }, this.AbilityType, damage, true);
  3388.                                         list2.Add(statusEffect4);
  3389.                                         statusEffect4.EquipmentOrigin = this.EquipmentOrigin;
  3390.                                         component11.ApplyStatusEffect(statusEffect4);
  3391.                                     }
  3392.                                 }
  3393.                                 AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo2, list2);
  3394.                             }
  3395.                         }
  3396.                         return;
  3397.                     }
  3398.                     if (affectsStat == StatusEffect.ModifiedStat.BonusDamageProc)
  3399.                     {
  3400.                         float num3 = currentAppliedValue;
  3401.                         if (this.m_abilityOrigin != null && this.m_abilityOrigin is Wildstrike)
  3402.                         {
  3403.                             CharacterStats component12 = attacker.GetComponent<CharacterStats>();
  3404.                             if (component12 != null)
  3405.                             {
  3406.                                 num3 *= component12.WildstrikeDamageMult;
  3407.                             }
  3408.                         }
  3409.                         DamagePacket.DamageProcType item2 = new DamagePacket.DamageProcType(this.Params.DmgType, num3 / 100f);
  3410.                         damage.Damage.DamageProc.Add(item2);
  3411.                         return;
  3412.                     }
  3413.                     if (affectsStat == StatusEffect.ModifiedStat.ApplyAttackEffects)
  3414.                     {
  3415.                         if (this.Params.AttackPrefab != null)
  3416.                         {
  3417.                             List<StatusEffect> appliedEffects = new List<StatusEffect>();
  3418.                             List<StatusEffect> list3 = new List<StatusEffect>();
  3419.                             this.Params.AttackPrefab.ApplyStatusEffects(enemy, damage, true, appliedEffects);
  3420.                             DamageInfo damageInfo3 = this.Params.AttackPrefab.ApplyAfflictions(enemy, damage, true, appliedEffects, list3);
  3421.                             this.Params.AttackPrefab.PushEnemy(enemy, this.Params.AttackPrefab.PushDistance, null, null);
  3422.                             if (this.Params.AttackPrefab.ExtraAOE != null)
  3423.                             {
  3424.                                 AttackAOE attackAOE = UnityEngine.Object.Instantiate(this.Params.AttackPrefab.ExtraAOE) as AttackAOE;
  3425.                                 attackAOE.Owner = attacker;
  3426.                                 attackAOE.transform.parent = attacker.transform;
  3427.                                 attackAOE.SkipAnimation = true;
  3428.                                 attackAOE.Launch(enemy);
  3429.                             }
  3430.                             GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitAttackerVisualEffect, attacker.transform.position, Quaternion.identity, 1f, attacker.transform);
  3431.                             GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitGroundVisualEffect, 1f, enemy.transform.position);
  3432.                             Transform hitTransform = this.Params.AttackPrefab.GetHitTransform(enemy);
  3433.                             GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitVisualEffect, hitTransform.position, hitTransform.rotation, 1f, hitTransform);
  3434.                             if (this.Params.AttackPrefab.AbilityOrigin != null)
  3435.                             {
  3436.                                 this.Params.AttackPrefab.AbilityOrigin.Deactivate(attacker);
  3437.                             }
  3438.                             AttackBase.s_NoDamage = true;
  3439.                             AttackBase.PostAttackMessages(enemy, damage, appliedEffects, true);
  3440.                             AttackBase.s_NoDamage = false;
  3441.                             if (damageInfo3 != null && damageInfo3 != damage)
  3442.                             {
  3443.                                 AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo3, list3);
  3444.                             }
  3445.                         }
  3446.                         return;
  3447.                     }
  3448.                     if (affectsStat == StatusEffect.ModifiedStat.DamageMultByRace)
  3449.                     {
  3450.                         CharacterStats component13 = enemy.GetComponent<CharacterStats>();
  3451.                         if (component13 != null && component13.CharacterRace == this.Params.RaceType)
  3452.                         {
  3453.                             damage.DamageAmount *= currentAppliedValue;
  3454.                         }
  3455.                         return;
  3456.                     }
  3457.                     if (affectsStat == StatusEffect.ModifiedStat.SpellDamageMult)
  3458.                     {
  3459.                         if (damage.Attack != null && damage.Attack.AbilityOrigin != null && damage.Attack.AbilityOrigin is GenericSpell && (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type))
  3460.                         {
  3461.                             damage.DamageAmount *= currentAppliedValue;
  3462.                         }
  3463.                         return;
  3464.                     }
  3465.                     if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultOnFlankedTarget)
  3466.                     {
  3467.                         CharacterStats component14 = enemy.GetComponent<CharacterStats>();
  3468.                         if (component14 != null & component14.HasStatusEffectFromAffliction(AfflictionData.Flanked))
  3469.                         {
  3470.                             damage.DamageAmount *= currentAppliedValue;
  3471.                         }
  3472.                         return;
  3473.                     }
  3474.                     if (affectsStat != StatusEffect.ModifiedStat.ApplyFinishingBlowDamage)
  3475.                     {
  3476.                         return;
  3477.                     }
  3478.                     CharacterStats component15 = attacker.GetComponent<CharacterStats>();
  3479.                     if (component15 != null)
  3480.                     {
  3481.                         foreach (GenericAbility current2 in component15.ActiveAbilities)
  3482.                         {
  3483.                             if (current2 is FinishingBlow)
  3484.                             {
  3485.                                 (current2 as FinishingBlow).AdjustDamage(ref damage, enemy);
  3486.                                 break;
  3487.                             }
  3488.                         }
  3489.                     }
  3490.                     return;
  3491.                 }
  3492.                 }
  3493.                 break;
  3494.             case StatusEffect.ModifiedStat.BonusDamageMultAtLowStamina:
  3495.             {
  3496.                 Health component16 = attacker.GetComponent<Health>();
  3497.                 if (component16.StaminaPercentage <= this.Params.ExtraValue)
  3498.                 {
  3499.                     damage.DamageAmount *= currentAppliedValue;
  3500.                 }
  3501.                 return;
  3502.             }
  3503.             case StatusEffect.ModifiedStat.BonusDamageMultOnKDSFTarget:
  3504.             {
  3505.                 bool flag = false;
  3506.                 CharacterStats component17 = enemy.GetComponent<CharacterStats>();
  3507.                 if (component17 != null)
  3508.                 {
  3509.                     flag = (component17.HasStatusEffectOfType(StatusEffect.ModifiedStat.KnockedDown) || component17.HasStatusEffectOfType(StatusEffect.ModifiedStat.Stunned) || component17.HasStatusEffectFromAffliction(AfflictionData.Flanked));
  3510.                 }
  3511.                 if (flag)
  3512.                 {
  3513.                     damage.DamageAmount *= currentAppliedValue;
  3514.                 }
  3515.                 return;
  3516.             }
  3517.             case StatusEffect.ModifiedStat.DamagePlusDOT:
  3518.             {
  3519.                 CharacterStats component18 = enemy.GetComponent<CharacterStats>();
  3520.                 if (component18)
  3521.                 {
  3522.                     StatusEffect statusEffect5 = StatusEffect.Create(attacker, new StatusEffectParams
  3523.                     {
  3524.                         Apply = StatusEffect.ApplyType.ApplyOverTime,
  3525.                         AffectsStat = StatusEffect.ModifiedStat.Damage,
  3526.                         DmgType = damage.Damage.Type,
  3527.                         IntervalRate = StatusEffectParams.IntervalRateType.Damage,
  3528.                         Duration = this.Params.ExtraValue,
  3529.                         Value = damage.DamageAmount * currentAppliedValue,
  3530.                         IsHostile = true
  3531.                     }, this.AbilityType, damage, true);
  3532.                     statusEffect5.EquipmentOrigin = this.EquipmentOrigin;
  3533.                     component18.ApplyStatusEffect(statusEffect5);
  3534.                 }
  3535.                 return;
  3536.             }
  3537.             }
  3538.             goto IL_74;
  3539.         case StatusEffect.ModifiedStat.CanStun:
  3540.             if (UnityEngine.Random.Range(0f, 1f) < currentAppliedValue)
  3541.             {
  3542.                 CharacterStats component19 = enemy.GetComponent<CharacterStats>();
  3543.                 if (component19)
  3544.                 {
  3545.                     StatusEffect statusEffect6 = StatusEffect.Create(attacker, new StatusEffectParams
  3546.                     {
  3547.                         AffectsStat = StatusEffect.ModifiedStat.Stunned,
  3548.                         Duration = 5f
  3549.                     }, this.AbilityType, damage, true);
  3550.                     statusEffect6.EquipmentOrigin = this.EquipmentOrigin;
  3551.                     component19.ApplyStatusEffect(statusEffect6);
  3552.                 }
  3553.             }
  3554.             return;
  3555.         }
  3556.         goto IL_4F;
  3557.     }
  3558.     public void WhenHit(GameObject attacker, GameObject enemy, ref DamageInfo damage)
  3559.     {
  3560.         if (!this.m_applied)
  3561.         {
  3562.             return;
  3563.         }
  3564.         if (attacker == enemy)
  3565.         {
  3566.             return;
  3567.         }
  3568.         float currentAppliedValue = this.CurrentAppliedValue;
  3569.         StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
  3570.         switch (affectsStat)
  3571.         {
  3572.         case StatusEffect.ModifiedStat.DamageToStamina:
  3573.             if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
  3574.             {
  3575.                 Health component = enemy.GetComponent<Health>();
  3576.                 if (component != null)
  3577.                 {
  3578.                     float amount = damage.DamageAmount * currentAppliedValue;
  3579.                     component.AddStamina(amount);
  3580.                 }
  3581.             }
  3582.             return;
  3583.         case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
  3584.         case StatusEffect.ModifiedStat.BonusHealMult:
  3585.             IL_4A:
  3586.             if (affectsStat == StatusEffect.ModifiedStat.AttackOnMeleeHit)
  3587.             {
  3588.                 if (damage.Attack is AttackMelee && this.m_params.AttackPrefab != null && attacker != null)
  3589.                 {
  3590.                     AttackBase attackBase = UnityEngine.Object.Instantiate(this.Params.AttackPrefab) as AttackBase;
  3591.                     attackBase.Owner = enemy;
  3592.                     attackBase.transform.parent = enemy.transform;
  3593.                     attackBase.SkipAnimation = true;
  3594.                     attackBase.Launch(attacker);
  3595.                 }
  3596.                 return;
  3597.             }
  3598.             if (affectsStat == StatusEffect.ModifiedStat.MinorSpellReflection)
  3599.             {
  3600.                 this.SpellReflect(3, attacker, enemy, ref damage);
  3601.                 return;
  3602.             }
  3603.             if (affectsStat == StatusEffect.ModifiedStat.DOTOnHit)
  3604.             {
  3605.                 if (enemy != null)
  3606.                 {
  3607.                     CharacterStats component2 = enemy.GetComponent<CharacterStats>();
  3608.                     if (component2)
  3609.                     {
  3610.                         component2.ApplyStatusEffect(StatusEffect.Create(attacker, new StatusEffectParams
  3611.                         {
  3612.                             Apply = StatusEffect.ApplyType.ApplyOverTime,
  3613.                             AffectsStat = StatusEffect.ModifiedStat.Damage,
  3614.                             DmgType = this.Params.DmgType,
  3615.                             IntervalRate = StatusEffectParams.IntervalRateType.Damage,
  3616.                             Duration = 10f,
  3617.                             Value = currentAppliedValue,
  3618.                             IsHostile = true
  3619.                         }, this.AbilityType, damage, true));
  3620.                     }
  3621.                 }
  3622.                 return;
  3623.             }
  3624.             if (affectsStat == StatusEffect.ModifiedStat.SpellReflection)
  3625.             {
  3626.                 this.SpellReflect(5, attacker, enemy, ref damage);
  3627.                 return;
  3628.             }
  3629.             if (affectsStat == StatusEffect.ModifiedStat.RangedGrazeReflection)
  3630.             {
  3631.                 this.RangedGrazeReflect((int)currentAppliedValue, attacker, enemy, ref damage);
  3632.                 return;
  3633.             }
  3634.             if (affectsStat != StatusEffect.ModifiedStat.DamageToStaminaRegen)
  3635.             {
  3636.                 return;
  3637.             }
  3638.             if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
  3639.             {
  3640.                 Health component3 = enemy.GetComponent<Health>();
  3641.                 CharacterStats component4 = enemy.GetComponent<CharacterStats>();
  3642.                 if (component4 != null && component3 != null)
  3643.                 {
  3644.                     component4.ApplyStatusEffect(StatusEffect.Create(enemy, new StatusEffectParams
  3645.                     {
  3646.                         AffectsStat = StatusEffect.ModifiedStat.Stamina,
  3647.                         Value = damage.DamageAmount * currentAppliedValue,
  3648.                         Duration = this.Params.ExtraValue,
  3649.                         IntervalRate = StatusEffectParams.IntervalRateType.Damage,
  3650.                         Apply = StatusEffect.ApplyType.ApplyOverTime
  3651.                     }, this.AbilityType, damage, true));
  3652.                 }
  3653.             }
  3654.             return;
  3655.         case StatusEffect.ModifiedStat.IncomingCritDamageMult:
  3656.             if (damage.IsCriticalHit && (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type))
  3657.             {
  3658.                 damage.DamageAmount *= currentAppliedValue;
  3659.             }
  3660.             return;
  3661.         }
  3662.         goto IL_4A;
  3663.     }
  3664.     private void SpellReflect(int spellLevel, GameObject attacker, GameObject enemy, ref DamageInfo damage)
  3665.     {
  3666.         if (damage == null || damage.Attack == null)
  3667.         {
  3668.             return;
  3669.         }
  3670.         GenericAbility abilityOrigin = damage.Attack.AbilityOrigin;
  3671.         if (abilityOrigin != null && attacker != null && enemy != null && abilityOrigin is GenericSpell && !(damage.Attack is AttackAOE) && damage.AttackIsHostile)
  3672.         {
  3673.             GenericSpell genericSpell = abilityOrigin as GenericSpell;
  3674.             if (genericSpell.SpellLevel <= spellLevel)
  3675.             {
  3676.                 this.m_generalCounter += (uint)genericSpell.SpellLevel;
  3677.                 if (this.m_generalCounter <= this.m_params.Value)
  3678.                 {
  3679.                     CharacterStats component = enemy.GetComponent<CharacterStats>();
  3680.                     if (component != null)
  3681.                     {
  3682.                         DamageInfo damageInfo = component.ComputeSecondaryAttack(damage.Attack, attacker, CharacterStats.DefenseType.Will);
  3683.                         AttackBase.PostAttackMessages(attacker, enemy, damageInfo, null, true);
  3684.                         if (damageInfo.HitType != HitType.MISS)
  3685.                         {
  3686.                             damage.IsMiss = true;
  3687.                             damage.IsGraze = false;
  3688.                             damage.IsCriticalHit = false;
  3689.                             damage.DamageAmount = 0f;
  3690.                             damage.HitTypeChangeAbility = this.AbilityOrigin;
  3691.                             if (damage.Attack is AttackRanged)
  3692.                             {
  3693.                                 Transform hitTransform = damage.Attack.GetHitTransform(attacker);
  3694.                                 (damage.Attack as AttackRanged).ProjectileLaunch(enemy.transform.position, hitTransform.position, attacker, 0, true);
  3695.                             }
  3696.                             else
  3697.                             {
  3698.                                 damage.Attack.StartCoroutine(damage.Attack.OnImpactDelay(0.5f, damage.Attack.gameObject, attacker));
  3699.                             }
  3700.                         }
  3701.                     }
  3702.                 }
  3703.                 if (this.m_generalCounter >= this.m_params.Value)
  3704.                 {
  3705.                     this.RemoveEffect();
  3706.                 }
  3707.             }
  3708.         }
  3709.     }
  3710.     private void RangedGrazeReflect(int accuracyAdjustment, GameObject attacker, GameObject enemy, ref DamageInfo damage)
  3711.     {
  3712.         if (damage.IsGraze && (damage.DefendedBy == CharacterStats.DefenseType.Deflect || damage.DefendedBy == CharacterStats.DefenseType.Reflex) && attacker != null && enemy != null && damage.Attack is AttackRanged && !(damage.Attack is AttackAOE))
  3713.         {
  3714.             damage.IsMiss = true;
  3715.             damage.IsGraze = false;
  3716.             damage.IsCriticalHit = false;
  3717.             damage.DamageAmount = 0f;
  3718.             AttackRanged attackRanged = damage.Attack as AttackRanged;
  3719.             attackRanged.AccuracyBonus += accuracyAdjustment;
  3720.             Transform hitTransform = damage.Attack.GetHitTransform(attacker);
  3721.             attackRanged.ProjectileLaunch(enemy.transform.position, hitTransform.position, attacker, 0, true);
  3722.         }
  3723.     }
  3724.     private int AdjustDefenseAffliction(CharacterStats.DefenseType defenseType, AttackBase attack, GameObject enemy)
  3725.     {
  3726.         if (attack != null && attack.HasAffliction(this.Params.AfflictionPrefab))
  3727.         {
  3728.             return (int)this.Params.Value;
  3729.         }
  3730.         return 0;
  3731.     }
  3732.     private int AdjustDefenseKeyword(CharacterStats.DefenseType defenseType, AttackBase attack, GameObject enemy)
  3733.     {
  3734.         if (attack != null && attack.HasKeyword(this.Params.Keyword))
  3735.         {
  3736.             return (int)this.Params.Value;
  3737.         }
  3738.         return 0;
  3739.     }
  3740.     private void HandleDestroyOnDeath(GameObject obj, GameEventArgs args)
  3741.     {
  3742.         this.RemoveEffect();
  3743.         UnityEngine.Object.DestroyObject(obj, 10f);
  3744.     }
  3745.     public void Reset()
  3746.     {
  3747.         if (this.m_applied)
  3748.         {
  3749.             this.ClearEffect(this.m_target);
  3750.         }
  3751.         this.m_timeActive = 0f;
  3752.         this.m_intervalTimer = 0f;
  3753.         this.m_intervalCount = 0u;
  3754.         this.m_auraTargetsApplied.Clear();
  3755.         this.m_auraTargetsUnapplied.Clear();
  3756.         if (this.m_abilityOrigin != null)
  3757.         {
  3758.             this.m_abilityOrigin.AuraTargetsWhoDefended.Clear();
  3759.         }
  3760.         this.m_triggerCount = 0;
  3761.         this.m_needsDurationCalculated = true;
  3762.     }
  3763.     public void Suspend()
  3764.     {
  3765.         if (this.m_suspensionCount == 0u)
  3766.         {
  3767.             this.ClearEffect(this.m_target);
  3768.         }
  3769.         this.m_suspensionCount += 1u;
  3770.     }
  3771.     public void Unsuspend()
  3772.     {
  3773.         if (this.m_suspensionCount > 0u)
  3774.         {
  3775.             this.m_suspensionCount -= 1u;
  3776.             if (this.m_suspensionCount == 0u)
  3777.             {
  3778.                 this.ApplyEffect(this.m_target);
  3779.             }
  3780.         }
  3781.     }
  3782.     public void Suppress()
  3783.     {
  3784.         if (!this.m_suppressed)
  3785.         {
  3786.             this.ClearEffect(this.m_target);
  3787.             this.m_suppressed = true;
  3788.         }
  3789.     }
  3790.     public void Unsuppress()
  3791.     {
  3792.         if (this.m_suppressed)
  3793.         {
  3794.             this.m_suppressed = false;
  3795.             this.ApplyEffect(this.m_target);
  3796.         }
  3797.     }
  3798.     public void FocusBreak()
  3799.     {
  3800.         if (this.DurationAfterBreak <= 0f)
  3801.         {
  3802.             return;
  3803.         }
  3804.         this.Duration = this.DurationAfterBreak;
  3805.         this.DurationAfterBreak = 0f;
  3806.         this.m_timeActive = 0f;
  3807.         if (this.TicksAfterBreak)
  3808.         {
  3809.             this.m_intervalTimer = this.Params.Interval;
  3810.         }
  3811.         else
  3812.         {
  3813.             this.m_intervalTimer = this.Duration;
  3814.         }
  3815.     }
  3816.     public void AddTriggerCallback()
  3817.     {
  3818.         if (this.m_triggerCallbackSet || this.Params.TriggerAdjustment == null)
  3819.         {
  3820.             return;
  3821.         }
  3822.         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.None)
  3823.         {
  3824.             return;
  3825.         }
  3826.         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMiss || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnTargetOfWillAttack || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnDamage || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  3827.         {
  3828.             Health component = this.m_target.GetComponent<Health>();
  3829.             if (component != null)
  3830.             {
  3831.                 component.OnDamaged += new GameInputEventHandle(this.HandleOnDamaged);
  3832.                 if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  3833.                 {
  3834.                     component.OnHealed += new GameInputEventHandle(this.HandleOnHealed);
  3835.                 }
  3836.                 this.m_triggerCallbackSet = true;
  3837.             }
  3838.             if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  3839.             {
  3840.                 this.HandleOnDamaged(null, null);
  3841.             }
  3842.             if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  3843.             {
  3844.                 this.HandleOnHealed(null, null);
  3845.             }
  3846.         }
  3847.         else
  3848.         {
  3849.             if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.Timer)
  3850.             {
  3851.                 this.m_triggerCallbackSet = true;
  3852.             }
  3853.             else
  3854.             {
  3855.                 if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMove)
  3856.                 {
  3857.                     Mover component2 = this.m_target.GetComponent<Mover>();
  3858.                     if (component2 != null)
  3859.                     {
  3860.                         component2.OnMovementStarted += new EventHandler(this.HandleOnMovementStarted);
  3861.                         component2.OnMovementStopped += new EventHandler(this.HandleOnMovementStopped);
  3862.                         this.m_triggerCallbackSet = true;
  3863.                     }
  3864.                 }
  3865.                 else
  3866.                 {
  3867.                     if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnKill)
  3868.                     {
  3869.                         Health component3 = this.m_target.GetComponent<Health>();
  3870.                         if (component3 != null)
  3871.                         {
  3872.                             component3.OnKill += new GameInputEventHandle(this.HandleOnKill);
  3873.                             this.m_triggerCallbackSet = true;
  3874.                         }
  3875.                     }
  3876.                     else
  3877.                     {
  3878.                         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnWeaponChange)
  3879.                         {
  3880.                             Equipment component4 = this.m_target.GetComponent<Equipment>();
  3881.                             if (component4 != null)
  3882.                             {
  3883.                                 component4.OnEquipmentChanged += new Equipment.EquipmentChanged(this.HandleOnWeaponChanged);
  3884.                                 this.m_triggerCallbackSet = true;
  3885.                             }
  3886.                         }
  3887.                         else
  3888.                         {
  3889.                             Debug.Log("Unhandled trigger callback");
  3890.                         }
  3891.                     }
  3892.                 }
  3893.             }
  3894.         }
  3895.     }
  3896.     public void RemoveTriggerCallback()
  3897.     {
  3898.         if (!this.m_triggerCallbackSet)
  3899.         {
  3900.             return;
  3901.         }
  3902.         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMiss || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnTargetOfWillAttack || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnDamage)
  3903.         {
  3904.             Health component = this.m_target.GetComponent<Health>();
  3905.             if (component != null)
  3906.             {
  3907.                 component.OnDamaged -= new GameInputEventHandle(this.HandleOnDamaged);
  3908.                 this.m_triggerCallbackSet = false;
  3909.             }
  3910.         }
  3911.         else
  3912.         {
  3913.             if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.Timer)
  3914.             {
  3915.                 this.m_triggerCallbackSet = false;
  3916.             }
  3917.             else
  3918.             {
  3919.                 if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMove)
  3920.                 {
  3921.                     Mover component2 = this.m_target.GetComponent<Mover>();
  3922.                     if (component2 != null)
  3923.                     {
  3924.                         component2.OnMovementStarted -= new EventHandler(this.HandleOnMovementStarted);
  3925.                         component2.OnMovementStopped -= new EventHandler(this.HandleOnMovementStopped);
  3926.                         this.m_triggerCallbackSet = false;
  3927.                     }
  3928.                 }
  3929.                 else
  3930.                 {
  3931.                     if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnKill)
  3932.                     {
  3933.                         Health component3 = this.m_target.GetComponent<Health>();
  3934.                         if (component3 != null)
  3935.                         {
  3936.                             component3.OnKill -= new GameInputEventHandle(this.HandleOnKill);
  3937.                             this.m_triggerCallbackSet = false;
  3938.                         }
  3939.                     }
  3940.                     else
  3941.                     {
  3942.                         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnWeaponChange)
  3943.                         {
  3944.                             Equipment component4 = this.m_target.GetComponent<Equipment>();
  3945.                             if (component4 != null)
  3946.                             {
  3947.                                 component4.OnEquipmentChanged -= new Equipment.EquipmentChanged(this.HandleOnWeaponChanged);
  3948.                                 this.m_triggerCallbackSet = false;
  3949.                             }
  3950.                         }
  3951.                     }
  3952.                 }
  3953.             }
  3954.         }
  3955.     }
  3956.     public void HandleClearingEffectOnResting()
  3957.     {
  3958.         if (this.Params.LastsUntilRest)
  3959.         {
  3960.             this.m_numRestCycles++;
  3961.             if (this.m_numRestCycles >= this.Params.MaxRestCycles)
  3962.             {
  3963.                 this.RemoveEffect();
  3964.             }
  3965.         }
  3966.     }
  3967.     private void HandleOnDamaged(GameObject myObject, GameEventArgs args)
  3968.     {
  3969.         if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMiss)
  3970.         {
  3971.             DamageInfo damageInfo = (DamageInfo)args.GenericData[0];
  3972.             if (damageInfo.IsMiss)
  3973.             {
  3974.                 this.OnTrigger();
  3975.             }
  3976.         }
  3977.         else
  3978.         {
  3979.             if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnStaminaPercentBelow || (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow && this.m_triggerCount == 0) || (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove && this.m_triggerCount == 1))
  3980.             {
  3981.                 Health component = this.m_target.GetComponent<Health>();
  3982.                 if (component != null && component.CurrentStamina / component.MaxStamina < this.Params.TriggerAdjustment.TriggerValue)
  3983.                 {
  3984.                     if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  3985.                     {
  3986.                         this.OffTrigger();
  3987.                     }
  3988.                     else
  3989.                     {
  3990.                         this.OnTrigger();
  3991.                     }
  3992.                 }
  3993.             }
  3994.             else
  3995.             {
  3996.                 if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnTargetOfWillAttack)
  3997.                 {
  3998.                     DamageInfo damageInfo2 = (DamageInfo)args.GenericData[0];
  3999.                     if (damageInfo2.DefendedBy == CharacterStats.DefenseType.Will)
  4000.                     {
  4001.                         this.OnTrigger();
  4002.                     }
  4003.                 }
  4004.                 else
  4005.                 {
  4006.                     if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnDamage)
  4007.                     {
  4008.                         this.OnTrigger();
  4009.                     }
  4010.                 }
  4011.             }
  4012.         }
  4013.     }
  4014.     private void HandleOnHealed(GameObject myObject, GameEventArgs args)
  4015.     {
  4016.         if ((this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow && this.m_triggerCount == 1) || (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove && this.m_triggerCount == 0))
  4017.         {
  4018.             Health component = this.m_target.GetComponent<Health>();
  4019.             if (component != null && component.CurrentStamina / component.MaxStamina >= this.Params.TriggerAdjustment.TriggerValue)
  4020.             {
  4021.                 if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
  4022.                 {
  4023.                     this.OnTrigger();
  4024.                 }
  4025.                 else
  4026.                 {
  4027.                     this.OffTrigger();
  4028.                 }
  4029.             }
  4030.         }
  4031.     }
  4032.     private void HandleOnMovementStarted(object sender, EventArgs e)
  4033.     {
  4034.         this.OnTrigger();
  4035.     }
  4036.     private void HandleOnMovementStopped(object sender, EventArgs e)
  4037.     {
  4038.         this.OffTrigger();
  4039.     }
  4040.     private void HandleOnKill(object sender, EventArgs e)
  4041.     {
  4042.         this.OnTrigger();
  4043.     }
  4044.     private void HandleOnWeaponChanged(Equippable.EquipmentSlot slot, Equippable oldEq, Equippable newEq)
  4045.     {
  4046.         if (slot == Equippable.EquipmentSlot.PrimaryWeapon || slot == Equippable.EquipmentSlot.SecondaryWeapon)
  4047.         {
  4048.             this.OnTrigger();
  4049.         }
  4050.     }
  4051.     public void OnTrigger()
  4052.     {
  4053.         if (this.m_triggerCount >= this.Params.TriggerAdjustment.MaxTriggerCount)
  4054.         {
  4055.             return;
  4056.         }
  4057.         if (this.Params.TriggerAdjustment.ValueAdjustment != 0f)
  4058.         {
  4059.             this.ApplyEffectHelper(this.m_target, this.Params.TriggerAdjustment.ValueAdjustment);
  4060.         }
  4061.         if (this.Params.TriggerAdjustment.DurationAdjustment != 0f)
  4062.         {
  4063.             if (this.Duration == 0f)
  4064.             {
  4065.                 this.ResetTimer();
  4066.             }
  4067.             this.Duration += this.Params.TriggerAdjustment.DurationAdjustment;
  4068.         }
  4069.         if (!this.Params.TriggerAdjustment.ResetTriggerOnEffectPulse)
  4070.         {
  4071.             this.m_triggerCount++;
  4072.             if (this.m_triggerCount == this.Params.TriggerAdjustment.MaxTriggerCount && this.Params.TriggerAdjustment.RemoveEffectAtMax)
  4073.             {
  4074.                 this.RemoveEffect();
  4075.             }
  4076.         }
  4077.     }
  4078.     public void OffTrigger()
  4079.     {
  4080.         if (this.m_triggerCount == 0)
  4081.         {
  4082.             return;
  4083.         }
  4084.         if (this.Params.TriggerAdjustment.ValueAdjustment != 0f)
  4085.         {
  4086.             this.ApplyEffectHelper(this.m_target, -this.Params.TriggerAdjustment.ValueAdjustment);
  4087.         }
  4088.         if (this.Params.TriggerAdjustment.DurationAdjustment != 0f)
  4089.         {
  4090.             this.Duration -= this.Params.TriggerAdjustment.DurationAdjustment;
  4091.         }
  4092.         this.m_triggerCount--;
  4093.     }
  4094.     private void HandleOnDamagedForReapply(GameObject myObject, GameEventArgs args)
  4095.     {
  4096.         this.m_damageToReapply += args.FloatData[0];
  4097.     }
  4098.     private void HandleStatsOnPreDamageAppliedForAbsorb(GameObject source, CombatEventArgs args)
  4099.     {
  4100.         if (args.Damage.DamageAmount < this.m_damageToAbsorb)
  4101.         {
  4102.             global::Console.AddMessage(string.Format(GUIUtils.GetText(1330), this.BundleName, args.Damage.DamageAmount.ToString("####0")), Color.white);
  4103.             this.m_damageToAbsorb -= args.Damage.DamageAmount;
  4104.             args.Damage.DamageAmount = 0f;
  4105.         }
  4106.         else
  4107.         {
  4108.             global::Console.AddMessage(string.Format(GUIUtils.GetText(1331), this.BundleName, this.m_damageToAbsorb.ToString("####0")), Color.white);
  4109.             args.Damage.DamageAmount -= this.m_damageToAbsorb;
  4110.             this.m_damageToAbsorb = 0f;
  4111.             this.RemoveEffect();
  4112.         }
  4113.     }
  4114.     public void ResetTimer()
  4115.     {
  4116.         this.m_timeActive = 0f;
  4117.     }
  4118.     public bool BundlesWith(StatusEffect other)
  4119.     {
  4120.         return (this.BundleName != null && this.BundleName.Equals(other.BundleName)) || (this.BundleId >= 0 && this.BundleId == other.BundleId);
  4121.     }
  4122.     public string GetDisplayName()
  4123.     {
  4124.         string text = this.BundleName;
  4125.         if (string.IsNullOrEmpty(text))
  4126.         {
  4127.             if (this.AfflictionOrigin != null)
  4128.             {
  4129.                 return this.AfflictionOrigin.DisplayName.GetText();
  4130.             }
  4131.             if (this.AbilityOrigin != null)
  4132.             {
  4133.                 return GenericAbility.Name(this.AbilityOrigin);
  4134.             }
  4135.             if (this.EquipmentOrigin != null)
  4136.             {
  4137.                 return this.EquipmentOrigin.Name;
  4138.             }
  4139.             if (this.PhraseOrigin != null)
  4140.             {
  4141.                 return this.PhraseOrigin.DisplayName.ToString();
  4142.             }
  4143.             if (this.Owner != null)
  4144.             {
  4145.                 text = string.Format(GUIUtils.GetText(1313), CharacterStats.Name(this.Owner));
  4146.             }
  4147.         }
  4148.         return text;
  4149.     }
  4150.     public override int GetHashCode()
  4151.     {
  4152.         return base.GetHashCode();
  4153.     }
  4154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement