Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- [AddComponentMenu("Toolbox/Status Effect")]
- public class StatusEffect
- {
- public enum ModifiedStat
- {
- MaxHealth,
- MaxStamina,
- Health,
- Stamina,
- MeleeAccuracy,
- RangedAccuracy,
- Deflection,
- Fortitude,
- Reflex,
- Will,
- StaminaRechargeRate,
- AttackSpeed,
- Stealth,
- BonusDamage,
- DamageThreshhold,
- DamageMinimum,
- MovementRate,
- NonTargetable,
- NonMobile,
- KnockedDown,
- EngagedEnemyCount,
- EngagementRadius,
- EngagementAccuracy,
- EngagementDamage,
- Engageable,
- Damage,
- Stunned,
- BonusUnarmedDamage,
- MeleeAttackDistanceMult,
- RangedAttackDistanceMult,
- MeleeAttackAllOnPath,
- BonusMeleeDamageFromWounds,
- BonusDTFromArmor,
- MeleeMissThresholdDelta_DO_NOT_USE,
- MeleeDamageRangePctIncreaseToMin,
- CanStun,
- SneakAttackOnNearDead,
- MeleeCritThresholdDelta_DO_NOT_USE,
- RangedCritThresholdDelta_DO_NOT_USE,
- CanCripple,
- MarkedPrey,
- SuspendHostileEffects,
- BonusMeleeDamage,
- ImmuneToEngageStop,
- HealthLossPctMult,
- BonusDamageMult,
- FocusWhenHits,
- BeamDamageMult,
- DrainResolveForDeflection,
- ReapplyDamage,
- ReapplyDamageToNearbyEnemies,
- ReloadSpeed,
- DropTrap,
- StasisShield,
- SuspendBeneficialEffects,
- DamageBasedOnInverseHealth,
- Resolve,
- Might,
- Dexterity,
- Intellect,
- SummonWeapon,
- TransferStamina,
- StaminaRechargeRateMult,
- VesselAccuracy,
- BeastAccuracy,
- WilderAccuracy,
- StunDefense,
- KnockdownDefense,
- PoisonDefense,
- DiseaseDefense,
- DistantEnemyBonus,
- BonusDamageMultOnLowStaminaTarget,
- BonusCritChanceOnSameEnemy,
- BonusAccuracyForNearestAllyOnSameEnemy,
- EnemyCritToHitPercent,
- HostileEffectDurationMult,
- DeflectReflexGrazeToMissPercent,
- FortitudeWillGrazeToMissPercent,
- ExtraStraightBounces,
- DamageToDOT,
- BonusDamageMultIfTargetHasDOT,
- RedirectMeleeAttacks,
- HostileAOEDamageMultiplier,
- ImprovedFlanking,
- DTBypass,
- StealSpell,
- SwapFaction,
- AttackOnMeleeHit,
- MinorSpellReflection,
- Athletics,
- Lore,
- Mechanics,
- Survival,
- Crafting,
- PushDefense,
- WhileStunnedDefense,
- WhileKnockeddownDefense,
- BonusAccuracyOnSameEnemy,
- BonusDamageMultOnSameEnemy,
- Constitution,
- Perception,
- CritHitMultiplierBonus,
- BonusGrazeToHitPercent,
- CanStunOnCrit,
- BonusGrazeToMissPercent,
- BonusCritToHitPercent,
- BonusMissToGrazePercent,
- BonusHitToCritPercent,
- BonusHitToGrazePercent,
- BonusDamageProc,
- Confused,
- BonusMeleeWeaponDamage,
- BonusRangedWeaponDamage,
- RateOfFireMult,
- ApplyAttackEffects,
- EnemyReflexGrazeToMissPercent,
- StaminaPercent,
- EnemiesNeededToFlankAdj,
- ConcentrationBonus,
- DOTOnHit,
- SpellReflection,
- DisableSpellcasting,
- ResistAffliction,
- PreventDeath,
- AdjustDurationBeneficialEffects,
- DOTTickMult,
- AdjustDurationHostileEffects,
- ResistKeyword,
- TransferDT,
- TransferRandomAttribute,
- Disintegrate,
- BonusAccuracyOnSameEnemyAsExtraObject,
- Duplicate,
- GainStaminaWhenHits,
- CanKnockDownOnCrit,
- BonusAccuracyAtLowStamina,
- BonusDamageMultAtLowStamina,
- BonusDamageMultOnKDSFTarget,
- DamagePlusDOT,
- RangedGrazeReflection,
- EnemyHitToGrazePercent,
- StunDurationMult,
- KnockDownDurationMult,
- BonusArmorDTMultAtLowHealth,
- AccuracyByRace,
- DamageMultByRace,
- Fatigue,
- DUMMY_EFFECT_IncreasedWeaponReach,
- PrimordialAccuracy,
- StopAnimation,
- AddAfflictionImmunity,
- Invisible,
- WoundDelay,
- SpellDamageMult,
- FinishingBlowDamageMult,
- ZealousAuraAoEMult,
- DelayUnconsciousness,
- NegMoveTickMult,
- BonusDamageMultOnFlankedTarget,
- FocusGainMult,
- DisengagementDefense,
- SpellDefense,
- RangedDeflection,
- BonusUsesPerRestPastThree,
- PoisonTickMult,
- DiseaseTickMult,
- StalkersLinkDamageMult,
- DamageToStamina,
- ChanterPhraseAoEMult,
- BonusHealMult,
- IncomingCritDamageMult,
- SpellCastBonus,
- AoEMult,
- FrenzyDurationMult,
- ProneDurationMult,
- WildstrikeDamageMult,
- ReviveAndAddStamina,
- DamageToStaminaRegen,
- LaunchAttack,
- HidesHealthStamina,
- AllDefense,
- MaxStaminaMult,
- CallbackOnDamaged,
- ApplyFinishingBlowDamage,
- NoEffect,
- Accuracy,
- TransferDamageToStamina,
- CallbackAfterAttack,
- Count
- }
- public struct HitTypeModifier
- {
- public StatusEffect.ModifiedStat ModifiedStat;
- public HitType From;
- public HitType To;
- public HitTypeModifier(StatusEffect.ModifiedStat stat, HitType from, HitType to)
- {
- this.ModifiedStat = stat;
- this.From = from;
- this.To = to;
- }
- }
- public enum ApplyType
- {
- ApplyOnTick,
- ApplyOverTime,
- ApplyAtEnd
- }
- public static StatusEffect.HitTypeModifier[] HitTypeStats = new StatusEffect.HitTypeModifier[]
- {
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyCritToHitPercent, HitType.CRIT, HitType.HIT),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyHitToGrazePercent, HitType.HIT, HitType.GRAZE),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent, HitType.GRAZE, HitType.MISS),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusGrazeToHitPercent, HitType.GRAZE, HitType.HIT),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusCritToHitPercent, HitType.CRIT, HitType.HIT),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusMissToGrazePercent, HitType.MISS, HitType.GRAZE),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusHitToCritPercent, HitType.HIT, HitType.CRIT),
- new StatusEffect.HitTypeModifier(StatusEffect.ModifiedStat.BonusHitToGrazePercent, HitType.HIT, HitType.GRAZE)
- };
- protected StatusEffectParams m_params;
- protected GameObject m_source;
- protected GameObject m_owner;
- [Persistent]
- protected uint m_id;
- [Persistent]
- protected Equippable.EquipmentSlot m_slot = Equippable.EquipmentSlot.None;
- [Persistent]
- protected bool m_applied;
- [Persistent]
- protected float m_duration;
- [Persistent]
- protected float m_durationOverride;
- [Persistent]
- protected bool m_needsDurationCalculated = true;
- [Persistent]
- protected float m_timeActive;
- [Persistent]
- protected float m_intervalTimer;
- [Persistent]
- protected uint m_intervalCount;
- [Persistent(Persistent.ConversionType.GUIDLink)]
- protected GameObject m_target;
- protected CharacterStats m_targetStats;
- [Persistent]
- protected bool m_deleteOnClear;
- [Persistent]
- protected bool m_effect_is_on_main_target;
- [Persistent]
- protected uint m_generalCounter = (uint)UnityEngine.Random.Range(0, 6);
- [Persistent]
- protected int m_bundleId = -1;
- protected List<GameObject> m_appliedFX = new List<GameObject>();
- protected Dictionary<GameObject, GameObject> m_auraTargetsApplied = new Dictionary<GameObject, GameObject>();
- protected List<GameObject> m_auraTargetsUnapplied = new List<GameObject>();
- protected List<GameObject> m_forcedAuraTargets = new List<GameObject>();
- [Persistent]
- protected float m_scale = 1f;
- [Persistent]
- protected float m_religiousScale = 1f;
- private bool m_is_checking_melee_path;
- [Persistent]
- private uint m_suspensionCount;
- [Persistent]
- private bool m_suppressed;
- [Persistent]
- private float m_timeApplied;
- [Persistent]
- private int m_numRestCycles;
- [Persistent]
- private GenericSpell m_spell;
- [Persistent]
- private Team m_cachedTeam;
- [Persistent(Persistent.ConversionType.GUIDLink)]
- private GameObject m_extraObject;
- [Persistent]
- private GenericAbility.AbilityType m_stackingType;
- private GenericAbility m_abilityOrigin;
- private Equippable m_equipmentOrigin;
- [Persistent]
- private Phrase m_phraseOrigin;
- [Persistent]
- private Affliction m_afflictionOrigin;
- [Persistent]
- private string m_afflictionKeyword;
- [Persistent]
- private float m_damageToReapply;
- [Persistent]
- private float m_damageToAbsorb;
- [Persistent]
- private int m_triggerCount;
- [Persistent]
- private bool m_triggerCallbackSet;
- [Persistent]
- private float m_durationAfterBreak;
- [Persistent]
- private bool m_ticksAfterBreak;
- [Persistent]
- private float m_increasePerTick;
- [Persistent(Persistent.ConversionType.GUIDLink)]
- public GameObject Source
- {
- get
- {
- return this.m_source;
- }
- set
- {
- this.m_source = value;
- }
- }
- public int BundleId
- {
- get
- {
- return this.m_bundleId;
- }
- set
- {
- this.m_bundleId = value;
- }
- }
- public GameObject ExtraObject
- {
- get
- {
- return this.m_extraObject;
- }
- set
- {
- this.m_extraObject = value;
- }
- }
- public GenericAbility.AbilityType AbilityType
- {
- get
- {
- return this.m_stackingType;
- }
- set
- {
- this.m_stackingType = value;
- }
- }
- [Persistent(Persistent.ConversionType.GUIDLink)]
- public GenericAbility AbilityOrigin
- {
- get
- {
- return this.m_abilityOrigin;
- }
- set
- {
- this.m_abilityOrigin = value;
- }
- }
- [Persistent(Persistent.ConversionType.GUIDLink)]
- public Equippable EquipmentOrigin
- {
- get
- {
- return this.m_equipmentOrigin;
- }
- set
- {
- this.m_equipmentOrigin = value;
- }
- }
- public Phrase PhraseOrigin
- {
- get
- {
- return this.m_phraseOrigin;
- }
- set
- {
- this.m_phraseOrigin = value;
- }
- }
- public Affliction AfflictionOrigin
- {
- get
- {
- return this.m_afflictionOrigin;
- }
- set
- {
- this.m_afflictionOrigin = value;
- if (this.m_afflictionOrigin == AfflictionData.Prone)
- {
- CharacterStats component = this.m_owner.GetComponent<CharacterStats>();
- if (component != null)
- {
- this.Duration *= component.ProneDurationMult;
- }
- }
- }
- }
- public string AfflictionKeyword
- {
- get
- {
- return this.m_afflictionKeyword;
- }
- set
- {
- this.m_afflictionKeyword = value.Trim().ToLowerInvariant();
- }
- }
- public float DurationAfterBreak
- {
- get
- {
- return this.m_durationAfterBreak;
- }
- set
- {
- this.m_durationAfterBreak = value;
- }
- }
- public bool TicksAfterBreak
- {
- get
- {
- return this.m_ticksAfterBreak;
- }
- set
- {
- this.m_ticksAfterBreak = value;
- }
- }
- public float IncreasePerTick
- {
- get
- {
- return this.m_increasePerTick;
- }
- set
- {
- this.m_increasePerTick = value;
- }
- }
- public float FriendlyRadius
- {
- get
- {
- float num = this.m_params.FriendlyRadius;
- if (this.Owner != null)
- {
- CharacterStats component = this.Owner.GetComponent<CharacterStats>();
- if (component != null)
- {
- num *= component.StatEffectAreaMultiplier;
- }
- }
- if (this.m_abilityOrigin != null)
- {
- num *= this.m_abilityOrigin.RadiusMultiplier;
- }
- if (num > 0f && this.m_triggerCallbackSet && this.m_triggerCount > 0)
- {
- num += this.m_params.TriggerAdjustment.RadiusAdjustment * (float)this.m_triggerCount;
- }
- return num;
- }
- set
- {
- this.m_params.FriendlyRadius = value;
- }
- }
- public float HostileRadius
- {
- get
- {
- float num = this.m_params.HostileRadius;
- if (this.Owner != null)
- {
- CharacterStats component = this.Owner.GetComponent<CharacterStats>();
- if (component != null)
- {
- num *= component.StatEffectAreaMultiplier;
- }
- }
- if (num > 0f && this.m_triggerCallbackSet && this.m_triggerCount > 0)
- {
- num += this.m_params.TriggerAdjustment.RadiusAdjustment * (float)this.m_triggerCount;
- }
- return num;
- }
- set
- {
- this.m_params.HostileRadius = value;
- }
- }
- public bool IsHostileAura
- {
- get
- {
- return this.HostileRadius > 0f && this.FriendlyRadius == 0f;
- }
- }
- public bool IsAura
- {
- get
- {
- return this.HostileRadius > 0f || this.FriendlyRadius > 0f;
- }
- }
- [Persistent(Persistent.ConversionType.GUIDLink)]
- public GameObject Owner
- {
- get
- {
- return this.m_owner;
- }
- set
- {
- this.m_owner = value;
- }
- }
- public bool Stackable
- {
- get
- {
- if (this.Params.Value < 0f)
- {
- return true;
- }
- switch (this.AbilityType)
- {
- case GenericAbility.AbilityType.Equipment:
- return false;
- case GenericAbility.AbilityType.Ring:
- return false;
- case GenericAbility.AbilityType.Spell:
- return false;
- case GenericAbility.AbilityType.Attribute:
- return true;
- case GenericAbility.AbilityType.Ability:
- return true;
- case GenericAbility.AbilityType.Talent:
- return true;
- default:
- return true;
- }
- }
- }
- public bool IsSuppressed
- {
- get
- {
- return this.m_suppressed;
- }
- }
- public bool Applied
- {
- get
- {
- return this.m_applied;
- }
- }
- public bool HasBeenApplied
- {
- get
- {
- return this.m_timeActive > 0f || (this.m_applied && this.Duration == 0f);
- }
- }
- public bool Expired
- {
- get
- {
- return this.Duration != 0f && this.TimeLeft <= 0f && this.DurationAfterBreak <= 0f;
- }
- }
- public float TimeApplied
- {
- get
- {
- return this.m_timeApplied;
- }
- }
- public Equippable.EquipmentSlot Slot
- {
- get
- {
- return this.m_slot;
- }
- set
- {
- this.m_slot = value;
- }
- }
- [Persistent]
- public StatusEffectParams Params
- {
- get
- {
- return this.m_params;
- }
- set
- {
- this.m_params = value;
- if (this.m_params != null && this.m_params.OnAppliedVisualEffect != null && this.m_target != null)
- {
- Transform transform = AttackBase.GetTransform(this.m_target, this.Params.VisualEffectAttach);
- GameObject gameObject = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
- if (gameObject != null)
- {
- this.m_appliedFX.Add(gameObject);
- }
- }
- }
- }
- public float CurrentAppliedValue
- {
- get
- {
- float num = this.Scale * this.m_religiousScale;
- float num2 = 0f;
- if (this.Params.TriggerAdjustment != null)
- {
- num2 = this.Params.TriggerAdjustment.ValueAdjustment * (float)this.m_triggerCount;
- }
- float num3 = this.Params.Value + num2;
- if (this.AfflictionOrigin == null)
- {
- if (this.IsScaledMultiplier)
- {
- num3 -= 1f;
- num3 *= num;
- num3 += 1f;
- }
- else
- {
- if (!this.IsDOT)
- {
- num3 *= num;
- }
- }
- }
- return num3;
- }
- }
- public float Duration
- {
- get
- {
- return this.m_duration;
- }
- set
- {
- this.m_duration = value;
- }
- }
- public bool LastsUntilCombatEnds
- {
- get
- {
- return this.Params.LastsUntilCombatEnds;
- }
- }
- public bool LastsUntilRest
- {
- get
- {
- return this.Params.LastsUntilRest;
- }
- }
- public float TimeLeft
- {
- get
- {
- if (this.Duration == 0f)
- {
- return 0f;
- }
- return this.Duration - this.m_timeActive;
- }
- }
- public float Scale
- {
- get
- {
- return this.m_scale;
- }
- set
- {
- this.m_scale = value;
- }
- }
- public string HitStrength
- {
- get
- {
- if (this.Scale < 1f)
- {
- return GUIUtils.GetText(55);
- }
- if (this.Scale > 1f)
- {
- return GUIUtils.GetText(56);
- }
- return string.Empty;
- }
- }
- public bool IsDOT
- {
- get
- {
- 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))
- {
- if (this.Params.Value < 0f && (this.Params.AffectsStat == StatusEffect.ModifiedStat.Health || this.Params.AffectsStat == StatusEffect.ModifiedStat.Stamina || this.Params.AffectsStat == StatusEffect.ModifiedStat.StaminaPercent))
- {
- return true;
- }
- if (this.Params.Value > 0f && this.Params.AffectsStat == StatusEffect.ModifiedStat.Damage)
- {
- return true;
- }
- if (this.Params.AffectsStat == StatusEffect.ModifiedStat.TransferStamina)
- {
- return true;
- }
- if (this.Params.AffectsStat == StatusEffect.ModifiedStat.TransferDamageToStamina)
- {
- return true;
- }
- }
- return false;
- }
- }
- public bool IsScaledMultiplier
- {
- get
- {
- 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;
- }
- }
- public bool IsNegativeMovementEffect
- {
- get
- {
- return (this.Params.Value < 0f && this.Params.AffectsStat == StatusEffect.ModifiedStat.MovementRate) || (this.Params.AffectsStat == StatusEffect.ModifiedStat.NonMobile || this.Params.AffectsStat == StatusEffect.ModifiedStat.StopAnimation);
- }
- }
- public bool IsPoisonEffect
- {
- get
- {
- 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));
- }
- }
- public bool IsDiseaseEffect
- {
- get
- {
- 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));
- }
- }
- public List<GameObject> ForcedAuraTargets
- {
- get
- {
- return this.m_forcedAuraTargets;
- }
- }
- public bool DeleteOnClear
- {
- get
- {
- return this.m_deleteOnClear;
- }
- set
- {
- this.m_deleteOnClear = value;
- }
- }
- public uint EffectID
- {
- get
- {
- return this.m_id;
- }
- set
- {
- this.m_id = value;
- }
- }
- public string BundleName
- {
- get
- {
- if (this.AfflictionOrigin != null)
- {
- return this.AfflictionOrigin.DisplayName.ToString();
- }
- if (this.AbilityOrigin != null)
- {
- return GenericAbility.Name(this.AbilityOrigin);
- }
- if (this.EquipmentOrigin != null)
- {
- return this.EquipmentOrigin.Name;
- }
- if (this.PhraseOrigin != null)
- {
- return this.PhraseOrigin.DisplayName.ToString();
- }
- return null;
- }
- }
- public static bool StatModifiesRatio(StatusEffect.ModifiedStat stat)
- {
- 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;
- }
- public static StatusEffect.ModifiedStat AttributeTypeToModifiedStat(CharacterStats.AttributeScoreType type)
- {
- switch (type)
- {
- case CharacterStats.AttributeScoreType.Resolve:
- return StatusEffect.ModifiedStat.Resolve;
- case CharacterStats.AttributeScoreType.Might:
- return StatusEffect.ModifiedStat.Might;
- case CharacterStats.AttributeScoreType.Dexterity:
- return StatusEffect.ModifiedStat.Dexterity;
- case CharacterStats.AttributeScoreType.Intellect:
- return StatusEffect.ModifiedStat.Intellect;
- case CharacterStats.AttributeScoreType.Constitution:
- return StatusEffect.ModifiedStat.Constitution;
- case CharacterStats.AttributeScoreType.Perception:
- return StatusEffect.ModifiedStat.Perception;
- default:
- return StatusEffect.ModifiedStat.Count;
- }
- }
- public static StatusEffect.ModifiedStat SkillTypeToModifiedStat(CharacterStats.SkillType skill)
- {
- switch (skill)
- {
- case CharacterStats.SkillType.Stealth:
- return StatusEffect.ModifiedStat.Stealth;
- case CharacterStats.SkillType.Athletics:
- return StatusEffect.ModifiedStat.Athletics;
- case CharacterStats.SkillType.Lore:
- return StatusEffect.ModifiedStat.Lore;
- case CharacterStats.SkillType.Mechanics:
- return StatusEffect.ModifiedStat.Mechanics;
- case CharacterStats.SkillType.Survival:
- return StatusEffect.ModifiedStat.Survival;
- case CharacterStats.SkillType.Crafting:
- return StatusEffect.ModifiedStat.Crafting;
- default:
- return StatusEffect.ModifiedStat.Count;
- }
- }
- public float DotExpectedDamage(GameObject target)
- {
- Health component = target.GetComponent<Health>();
- if (this.Params.AffectsStat != StatusEffect.ModifiedStat.Damage && this.Params.AffectsStat != StatusEffect.ModifiedStat.DamageBasedOnInverseHealth)
- {
- return 0f;
- }
- float num = 1f;
- if (this.Params.AffectsStat == StatusEffect.ModifiedStat.DamageBasedOnInverseHealth)
- {
- num = 1f - component.CurrentHealth / component.MaxHealth;
- }
- long num2 = (long)Mathf.FloorToInt(this.Params.Duration / this.Params.Interval) - (long)((ulong)this.m_intervalCount);
- if (this.IncreasePerTick > 0f)
- {
- return this.Params.Value * num * (float)(num2 * (num2 + 1L) / 2L) * this.IncreasePerTick;
- }
- return this.Params.Value * num * (float)num2;
- }
- public static List<List<StatusEffect>> FilterAfflictions(ref List<StatusEffect> effectList)
- {
- List<List<StatusEffect>> list = new List<List<StatusEffect>>();
- for (int i = effectList.Count - 1; i >= 0; i--)
- {
- StatusEffect statusEffect = effectList[i];
- if (statusEffect.AfflictionOrigin)
- {
- List<StatusEffect> list2 = null;
- bool flag = false;
- for (int j = 0; j < list.Count; j++)
- {
- if (list[j][0].AfflictionOrigin == statusEffect.AfflictionOrigin)
- {
- list2 = list[j];
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- list2 = new List<StatusEffect>();
- list.Add(list2);
- }
- list2.Add(statusEffect);
- effectList.Remove(statusEffect);
- }
- }
- return list;
- }
- public static List<StatusEffect> BundleEffects(ref List<StatusEffect> effectList, out float longestDuration)
- {
- longestDuration = 0f;
- if (effectList.Count == 0)
- {
- return null;
- }
- List<StatusEffect> list = new List<StatusEffect>();
- list.Add(effectList[0]);
- effectList.RemoveAt(0);
- longestDuration = list[0].TimeLeft;
- for (int i = effectList.Count - 1; i >= 0; i--)
- {
- StatusEffect statusEffect = effectList[i];
- if (statusEffect.BundlesWith(list[0]))
- {
- list.Add(statusEffect);
- effectList.Remove(statusEffect);
- if (statusEffect.TimeLeft > longestDuration)
- {
- longestDuration = statusEffect.TimeLeft;
- }
- }
- }
- return list;
- }
- public static StatusEffect Create(GameObject owner, StatusEffectParams param, GenericAbility.AbilityType abType, DamageInfo hitInfo, bool deleteOnClear)
- {
- return StatusEffect.Create(owner, param, abType, hitInfo, deleteOnClear, 0f);
- }
- public static StatusEffect Create(GameObject owner, StatusEffectParams param, GenericAbility.AbilityType abType, DamageInfo hitInfo, bool deleteOnClear, float durationOverride)
- {
- StatusEffect statusEffect = new StatusEffect();
- GameObject gameObject = GameUtilities.FindParentCharacter(owner);
- statusEffect.m_owner = gameObject;
- statusEffect.Params = param;
- statusEffect.AbilityType = abType;
- statusEffect.m_abilityOrigin = owner.GetComponent<GenericAbility>();
- if (hitInfo != null)
- {
- if (hitInfo.IsCriticalHit)
- {
- statusEffect.Scale = CharacterStats.CritMultiplier;
- }
- if (hitInfo.IsGraze)
- {
- statusEffect.Scale = CharacterStats.GrazeMultiplier;
- }
- }
- statusEffect.m_needsDurationCalculated = true;
- statusEffect.m_durationOverride = durationOverride;
- statusEffect.CalculateDuration();
- statusEffect.DeleteOnClear = deleteOnClear;
- statusEffect.m_timeApplied = Time.time;
- if (param.ChecksReligion)
- {
- statusEffect.m_religiousScale = Religion.Instance.GetCurrentBonusMultiplier(gameObject, statusEffect.m_abilityOrigin);
- }
- GenericCipherAbility component = owner.GetComponent<GenericCipherAbility>();
- if (component != null)
- {
- statusEffect.DurationAfterBreak = component.DurationAfterBreak;
- statusEffect.TicksAfterBreak = component.TicksAfterBreak;
- statusEffect.IncreasePerTick = component.IncreasePerTick;
- }
- return statusEffect;
- }
- public void Restored()
- {
- if (this.m_target)
- {
- this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
- }
- }
- public void Update()
- {
- this.UpdateHelper(Time.deltaTime);
- }
- public void TimeJumpUpdate(float seconds)
- {
- if (seconds <= 0f)
- {
- return;
- }
- this.UpdateHelper(seconds);
- }
- private void UpdateHelper(float seconds)
- {
- if (this.m_target == null)
- {
- return;
- }
- if (this.m_suspensionCount > 0u)
- {
- return;
- }
- if (this.m_intervalTimer > 0f)
- {
- float num = seconds;
- if (this.m_targetStats != null)
- {
- if (this.IsDOT)
- {
- num *= this.m_targetStats.DOTTickMult;
- }
- if (this.IsNegativeMovementEffect)
- {
- num *= this.m_targetStats.NegMoveTickMult;
- }
- if (this.IsPoisonEffect)
- {
- num *= this.m_targetStats.PoisonTickMult;
- }
- if (this.IsDiseaseEffect)
- {
- num *= this.m_targetStats.DiseaseTickMult;
- }
- }
- this.m_intervalTimer -= num;
- }
- this.m_timeActive += seconds;
- if (!this.m_suppressed && this.m_applied)
- {
- this.UpdateActiveEffect(seconds);
- }
- if (this.Duration > 0f && this.m_timeActive > this.Duration && this.DurationAfterBreak <= 0f)
- {
- this.ClearEffect(this.m_target);
- }
- }
- private void UpdateActiveEffect(float seconds)
- {
- 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))
- {
- this.OnTrigger();
- }
- if ((this.Duration > 0f || this.Params.Interval > 0f) && this.m_target != null && this.m_intervalTimer <= 0f)
- {
- float num = (this.Duration <= 0f) ? 1f : this.Duration;
- float friendlyRadius = this.FriendlyRadius;
- float hostileRadius = this.HostileRadius;
- bool flag = friendlyRadius > 0f || hostileRadius > 0f;
- if (this.Duration > 0f && this.m_timeActive >= this.Duration)
- {
- if (this.DurationAfterBreak <= 0f)
- {
- if (this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd)
- {
- this.ApplyEffect(this.m_target, this.Params.Value);
- if (flag || this.m_forcedAuraTargets.Count > 0)
- {
- this.ApplyAura(this.Params.Value);
- }
- }
- this.ClearEffect(this.m_target);
- }
- }
- else
- {
- if (this.m_intervalTimer <= 0f)
- {
- this.m_intervalTimer = this.Params.Interval;
- if (this.Params.Apply != StatusEffect.ApplyType.ApplyAtEnd)
- {
- if (flag || this.m_forcedAuraTargets.Count > 0)
- {
- Vector3 b = (!(this.m_target != null)) ? this.Owner.transform.position : this.m_target.transform.position;
- List<GameObject> list = new List<GameObject>(this.m_auraTargetsApplied.Keys);
- list.AddRange(this.m_auraTargetsUnapplied);
- foreach (GameObject current in list)
- {
- if (!(current == null))
- {
- float sqrMagnitude = (current.transform.position - b).sqrMagnitude;
- if (sqrMagnitude > friendlyRadius * friendlyRadius && sqrMagnitude > hostileRadius * hostileRadius)
- {
- this.RemoveAura(current);
- }
- }
- }
- }
- if (this.Params.Interval > 0f && this.Params.Apply != StatusEffect.ApplyType.ApplyOverTime)
- {
- if (!flag || this.m_params.ContinuousApplicationAura || !this.m_effect_is_on_main_target)
- {
- this.ApplyEffect(this.m_target, this.Params.Value);
- }
- if (flag || this.m_forcedAuraTargets.Count > 0)
- {
- this.ApplyAura(this.Params.Value);
- }
- }
- else
- {
- float num2 = seconds;
- if (this.Params.Interval > 0f)
- {
- num2 = this.Params.Interval;
- }
- float num3 = this.Params.Value * (1f / num) * num2;
- this.ApplyEffect(this.m_target, num3);
- if (flag || this.m_forcedAuraTargets.Count > 0)
- {
- this.ApplyAura(num3);
- }
- }
- }
- this.m_intervalCount += 1u;
- }
- }
- }
- }
- private void ApplyAura(float amount)
- {
- if (this.m_target == null)
- {
- return;
- }
- foreach (Faction current in Faction.ActiveFactionComponents)
- {
- if (!(current == null) && !(current.gameObject == null) && !(current.gameObject == this.m_target))
- {
- Faction.Relationship relationship = current.GetRelationship(this.m_target);
- CharacterStats component = current.gameObject.GetComponent<CharacterStats>();
- if (!(component == null))
- {
- Health component2 = current.gameObject.GetComponent<Health>();
- if (!(component2 != null) || component2.Targetable)
- {
- float sqrMagnitude = (current.transform.position - this.m_target.transform.position).sqrMagnitude;
- 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))
- {
- bool flag = this.m_auraTargetsApplied.ContainsKey(current.gameObject) || this.m_auraTargetsUnapplied.Contains(current.gameObject);
- bool applied = false;
- bool flag2 = true;
- if (!flag && this.m_owner != null && this.m_abilityOrigin != null && this.m_abilityOrigin.AuraDefense != CharacterStats.DefenseType.None)
- {
- if (this.m_abilityOrigin.AuraTargetsWhoDefended.ContainsKey(current.gameObject))
- {
- if (this.m_abilityOrigin.AuraTargetsWhoDefended[current.gameObject] == HitType.MISS)
- {
- flag2 = false;
- }
- }
- else
- {
- CharacterStats component3 = this.m_owner.GetComponent<CharacterStats>();
- if (component3 != null)
- {
- DamageInfo damageInfo = component3.ComputeSecondaryAttack(null, current.gameObject, this.m_abilityOrigin.AuraDefense);
- this.m_abilityOrigin.AuraTargetsWhoDefended.Add(current.gameObject, damageInfo.HitType);
- if (damageInfo.HitType == HitType.MISS)
- {
- flag2 = false;
- }
- List<StatusEffect> list = new List<StatusEffect>();
- list.Add(this);
- AttackBase.PostAttackMessages(current.gameObject, this.Owner, damageInfo, list, true);
- }
- }
- }
- if ((!flag || this.m_params.ContinuousApplicationAura) && flag2 && !this.m_auraTargetsUnapplied.Contains(current.gameObject))
- {
- applied = this.ApplyEffect(current.gameObject, amount);
- }
- if (!flag)
- {
- this.AddAura(current.gameObject, applied);
- }
- }
- }
- }
- }
- }
- }
- public void AddAura(GameObject obj, bool applied)
- {
- if (this == null)
- {
- return;
- }
- if (obj == null)
- {
- return;
- }
- if (applied)
- {
- CharacterStats component = obj.GetComponent<CharacterStats>();
- if (component != null)
- {
- component.AurasAffectingMeReadOnly.Add(this);
- if (component.OnAddStatusEffect != null)
- {
- component.OnAddStatusEffect(this, true);
- }
- }
- Transform transform = AttackBase.GetTransform(obj, this.Params.VisualEffectAttach);
- GameObject value = GameUtilities.LaunchLoopingEffect(this.m_params.OnAuraVisualEffect, transform.position, transform.rotation, 1f, transform);
- this.m_auraTargetsApplied.Add(obj, value);
- }
- else
- {
- this.m_auraTargetsUnapplied.Add(obj);
- }
- Health component2 = obj.GetComponent<Health>();
- if (component2 != null)
- {
- component2.OnDeath += new GameInputEventHandle(this.HandleAuraOnDeathAndDestroy);
- }
- }
- public void RemoveAura(GameObject obj)
- {
- if (obj == null)
- {
- return;
- }
- if (this.m_auraTargetsUnapplied.Contains(obj))
- {
- this.m_auraTargetsUnapplied.Remove(obj);
- if (this.m_abilityOrigin != null && this.m_abilityOrigin.AuraTargetsWhoDefended.ContainsKey(obj))
- {
- this.m_abilityOrigin.AuraTargetsWhoDefended.Remove(obj);
- }
- }
- else
- {
- CharacterStats component = obj.GetComponent<CharacterStats>();
- if (component)
- {
- component.AurasAffectingMeReadOnly.Remove(this);
- if (component.OnClearStatusEffect != null)
- {
- component.OnClearStatusEffect(this);
- }
- }
- this.ClearEffect(obj);
- UnityEngine.Object.DestroyObject(this.m_auraTargetsApplied[obj]);
- this.m_auraTargetsApplied.Remove(obj);
- }
- Health component2 = obj.GetComponent<Health>();
- if (component2 != null)
- {
- component2.OnDeath -= new GameInputEventHandle(this.HandleAuraOnDeathAndDestroy);
- }
- }
- private void HandleAuraOnDeathAndDestroy(GameObject obj, GameEventArgs args)
- {
- if (this.m_auraTargetsApplied.ContainsKey(obj) || this.m_auraTargetsUnapplied.Contains(obj))
- {
- this.RemoveAura(obj);
- }
- }
- private void CalculateDuration()
- {
- float num = this.Params.Duration;
- if (this.m_durationOverride > 0f)
- {
- num = this.m_durationOverride;
- }
- num *= this.Scale;
- if (this.m_owner != null)
- {
- CharacterStats component = this.m_owner.GetComponent<CharacterStats>();
- if (component != null)
- {
- num *= component.StatEffectDurationMultiplier;
- if (this.Params.IsHostile)
- {
- num *= component.HostileEffectDurationMultiplier;
- }
- if (this.m_abilityOrigin != null && this.m_abilityOrigin is Frenzy)
- {
- num *= component.FrenzyDurationMult;
- }
- }
- }
- this.Duration = num;
- if (this.Params.ChecksReligion)
- {
- this.m_religiousScale = Religion.Instance.GetCurrentBonusMultiplier(this.m_owner, this.m_abilityOrigin);
- }
- }
- public virtual void ApplyEffect(GameObject target)
- {
- if (this.m_needsDurationCalculated)
- {
- this.CalculateDuration();
- this.m_needsDurationCalculated = false;
- }
- this.m_target = target;
- if (this.m_target != null)
- {
- this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
- }
- bool applied = this.m_applied;
- if (this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd)
- {
- if (this.Duration <= 0f || this.Params.Interval <= 0f)
- {
- Debug.Log("Apply-at-end status effect has no duration or interval!", target);
- }
- this.m_applied = true;
- }
- else
- {
- bool flag = this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime || this.Params.Interval > 0f;
- if (flag && !this.HasBeenApplied)
- {
- this.m_applied = true;
- }
- else
- {
- this.ApplyEffect(target, this.Params.Value);
- if (this.HostileRadius > 0f || this.FriendlyRadius > 0f)
- {
- this.ApplyAura(this.Params.Value);
- }
- }
- }
- if (this.m_applied && !applied && target != null)
- {
- Transform transform = AttackBase.GetTransform(target, this.Params.VisualEffectAttach);
- GameUtilities.LaunchEffect(this.m_params.OnStartVisualEffect, transform.position, transform.rotation, 1f, transform);
- if (this.Params.VisualEffectAttach >= AttackBase.EffectAttachType.Fx_Bone_01 && this.Params.VisualEffectAttach <= AttackBase.EffectAttachType.Fx_Bone_10)
- {
- Equipment component = target.GetComponent<Equipment>();
- if (component != null)
- {
- EquipmentSet currentItems = component.CurrentItems;
- if (currentItems != null && currentItems.PrimaryWeapon != null)
- {
- AnimationBoneMapper component2 = target.GetComponent<AnimationBoneMapper>();
- if (component2 != null)
- {
- for (AttackBase.EffectAttachType effectAttachType = AttackBase.EffectAttachType.Fx_Bone_01; effectAttachType <= AttackBase.EffectAttachType.Fx_Bone_10; effectAttachType++)
- {
- transform = null;
- if (component2.HasBone(currentItems.PrimaryWeapon.gameObject, effectAttachType))
- {
- transform = component2[currentItems.PrimaryWeapon.gameObject, effectAttachType];
- }
- if (transform != null)
- {
- GameObject gameObject = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
- if (gameObject != null)
- {
- this.m_appliedFX.Add(gameObject);
- }
- }
- }
- }
- }
- }
- }
- else
- {
- GameObject gameObject2 = GameUtilities.LaunchLoopingEffect(this.m_params.OnAppliedVisualEffect, transform.position, transform.rotation, 1f, transform);
- if (gameObject2 != null)
- {
- this.m_appliedFX.Add(gameObject2);
- }
- }
- this.AddTriggerCallback();
- }
- }
- public virtual bool ApplyEffect(GameObject target, float appliedValue)
- {
- if (this.m_target == null)
- {
- this.m_target = target;
- if (this.m_target != null)
- {
- this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
- }
- }
- if (!this.Params.CanApply((!(this.AbilityOrigin != null)) ? this.Owner : this.AbilityOrigin.gameObject, target, this.m_target))
- {
- return false;
- }
- bool flag = this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime || this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd || this.Params.Interval > 0f;
- if (this.m_applied && !flag && target == this.m_target)
- {
- return false;
- }
- if (this.HostileRadius > 0f && this.FriendlyRadius <= 0f && this.m_target == target)
- {
- this.m_applied = true;
- return false;
- }
- if (!this.ApplyEffectHelper(target, appliedValue))
- {
- return false;
- }
- this.m_applied = true;
- if (this.m_target == target)
- {
- this.m_effect_is_on_main_target = true;
- }
- return true;
- }
- private bool ApplyEffectHelper(GameObject target, float appliedValue)
- {
- if (target == null)
- {
- return false;
- }
- CharacterStats characterStats = this.m_targetStats;
- if (characterStats == null || target != this.m_target)
- {
- characterStats = target.GetComponent<CharacterStats>();
- }
- Health component = target.GetComponent<Health>();
- Mover component2 = target.GetComponent<Mover>();
- Equipment component3 = target.GetComponent<Equipment>();
- if (characterStats == null || component == null)
- {
- Debug.LogError(target.name + " doesn't have a health and/or CharacterStats component. Unable to apply status effect!");
- return false;
- }
- if (this.AfflictionOrigin == null)
- {
- if (this.IsScaledMultiplier)
- {
- appliedValue -= 1f;
- appliedValue *= this.Scale * this.m_religiousScale;
- appliedValue += 1f;
- }
- else
- {
- if (!this.IsDOT)
- {
- appliedValue *= this.Scale * this.m_religiousScale;
- }
- }
- }
- switch (this.Params.AffectsStat)
- {
- case StatusEffect.ModifiedStat.MaxHealth:
- if (!component.Dead)
- {
- if (appliedValue > 0f)
- {
- characterStats.MaxHealth += appliedValue;
- component.CurrentHealth += appliedValue;
- }
- else
- {
- component.ApplyHealthChangeDirectly(appliedValue, this.m_owner);
- }
- }
- break;
- case StatusEffect.ModifiedStat.MaxStamina:
- if (!component.Unconscious)
- {
- characterStats.StaminaBonus += appliedValue;
- component.CurrentStamina += appliedValue;
- }
- break;
- case StatusEffect.ModifiedStat.Health:
- if (!component.Dead)
- {
- component.ApplyHealthChangeDirectly(appliedValue, this.m_owner);
- }
- break;
- case StatusEffect.ModifiedStat.Stamina:
- if (!component.Dead)
- {
- component.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
- }
- break;
- case StatusEffect.ModifiedStat.MeleeAccuracy:
- characterStats.MeleeAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.RangedAccuracy:
- characterStats.RangedAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Deflection:
- characterStats.DeflectionBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Fortitude:
- characterStats.FortitudeBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Reflex:
- characterStats.ReflexBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Will:
- characterStats.WillBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.StaminaRechargeRate:
- characterStats.StaminaRechargeBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.AttackSpeed:
- characterStats.AttackSpeedMultiplier *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.Stealth:
- characterStats.StealthBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusDamage:
- if (this.Params.DmgType < DamagePacket.DamageType.Count)
- {
- characterStats.BonusDamage[(int)this.Params.DmgType] += appliedValue;
- }
- else
- {
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int i = 0; i < 7; i++)
- {
- characterStats.BonusDamage[i] += appliedValue;
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.DamageThreshhold:
- characterStats.DamageThreshhold[(int)this.Params.DmgType] += appliedValue;
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int j = 0; j < 7; j++)
- {
- characterStats.DamageThreshhold[j] += appliedValue;
- }
- }
- break;
- case StatusEffect.ModifiedStat.DamageMinimum:
- characterStats.DamageMinBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.MovementRate:
- if (component2)
- {
- component2.SetRunSpeed(component2.RunSpeed + appliedValue);
- component2.SetWalkSpeed(component2.WalkSpeed + appliedValue);
- }
- break;
- case StatusEffect.ModifiedStat.NonTargetable:
- component.Targetable = false;
- break;
- case StatusEffect.ModifiedStat.NonMobile:
- if (component2)
- {
- component2.Frozen = true;
- }
- break;
- case StatusEffect.ModifiedStat.KnockedDown:
- {
- AIController component4 = target.GetComponent<AIController>();
- if (component4 != null)
- {
- GameEventArgs gameEventArgs = new GameEventArgs();
- gameEventArgs.Type = GameEventType.KnockedDown;
- gameEventArgs.FloatData = new float[1];
- float num = this.Duration * characterStats.KnockDownDurationMult;
- num -= 1.7f;
- if (num <= 0.1f)
- {
- num = 0.1f;
- }
- gameEventArgs.FloatData[0] = num;
- gameEventArgs.IntData = new int[1];
- gameEventArgs.IntData[0] = 1;
- component4.OnEvent(gameEventArgs);
- }
- break;
- }
- case StatusEffect.ModifiedStat.EngagedEnemyCount:
- characterStats.EngageableEnemyCount += (int)appliedValue;
- if (characterStats.EngageableEnemyCount < 0)
- {
- characterStats.EngageableEnemyCount = 0;
- }
- break;
- case StatusEffect.ModifiedStat.EngagementRadius:
- characterStats.EngagementDistanceBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.EngagementAccuracy:
- characterStats.DisengagementAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.EngagementDamage:
- characterStats.DisengagementDamageBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.Engageable:
- characterStats.ImmuneToEngagement = true;
- break;
- case StatusEffect.ModifiedStat.Damage:
- if (!component.Unconscious && !component.Dead)
- {
- if (this.IncreasePerTick > 0f)
- {
- component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
- }
- else
- {
- component.ApplyDamageDirectly(appliedValue, this.Params.DmgType, this.Owner, this);
- }
- }
- break;
- case StatusEffect.ModifiedStat.Stunned:
- if (this.m_timeActive < 1.401298E-45f)
- {
- AIController component5 = target.GetComponent<AIController>();
- if (component5 != null)
- {
- GameEventArgs gameEventArgs2 = new GameEventArgs();
- gameEventArgs2.Type = GameEventType.Stunned;
- gameEventArgs2.FloatData = new float[1];
- gameEventArgs2.FloatData[0] = this.Duration * characterStats.StunDurationMult;
- gameEventArgs2.IntData = new int[1];
- gameEventArgs2.IntData[0] = 1;
- component5.OnEvent(gameEventArgs2);
- }
- }
- break;
- case StatusEffect.ModifiedStat.BonusUnarmedDamage:
- characterStats.BonusUnarmedDamage += appliedValue;
- break;
- case StatusEffect.ModifiedStat.MeleeAttackDistanceMult:
- characterStats.MeleeAttackDistanceMultiplier = appliedValue;
- break;
- case StatusEffect.ModifiedStat.RangedAttackDistanceMult:
- characterStats.RangedAttackDistanceMultiplier = appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusDTFromArmor:
- characterStats.BonusDTFromArmor += appliedValue;
- break;
- case StatusEffect.ModifiedStat.MeleeMissThresholdDelta_DO_NOT_USE:
- case StatusEffect.ModifiedStat.MeleeCritThresholdDelta_DO_NOT_USE:
- case StatusEffect.ModifiedStat.RangedCritThresholdDelta_DO_NOT_USE:
- Debug.LogError(this.Params.AffectsStat.ToString() + " is DEPRECATED! Do not use!");
- break;
- case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
- characterStats.MeleeDamageRangePctIncreaseToMin += appliedValue;
- break;
- case StatusEffect.ModifiedStat.SuspendHostileEffects:
- characterStats.SuspendEffects(CharacterStats.EffectType.Hostile);
- break;
- case StatusEffect.ModifiedStat.BonusMeleeDamage:
- characterStats.BonusMeleeDamage += appliedValue;
- break;
- case StatusEffect.ModifiedStat.ImmuneToEngageStop:
- characterStats.ImmuneToEngageStop = true;
- break;
- case StatusEffect.ModifiedStat.HealthLossPctMult:
- characterStats.HealthLossPercentMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.DrainResolveForDeflection:
- characterStats.ResolveBonus += (int)appliedValue;
- if (this.m_owner != null)
- {
- CharacterStats component6 = this.m_owner.GetComponent<CharacterStats>();
- if (component6)
- {
- StatusEffectParams statusEffectParams = new StatusEffectParams();
- statusEffectParams.AffectsStat = StatusEffect.ModifiedStat.Deflection;
- statusEffectParams.Value = this.Params.ExtraValue;
- statusEffectParams.Duration = this.Duration;
- statusEffectParams.IsHostile = false;
- StatusEffect statusEffect = StatusEffect.Create(this.m_owner, statusEffectParams, this.AbilityType, null, true);
- statusEffect.DurationAfterBreak = this.DurationAfterBreak;
- characterStats.ApplyStatusEffectImmediate(statusEffect);
- }
- }
- break;
- case StatusEffect.ModifiedStat.ReapplyDamage:
- if (this.m_intervalCount > 0u)
- {
- component.ApplyDamageDirectly(this.m_damageToReapply * (this.Params.Value + this.IncreasePerTick * (this.m_intervalCount - 1u)), DamagePacket.DamageType.Raw, this.Owner, this);
- this.m_damageToReapply = 0f;
- }
- else
- {
- component.OnDamaged += new GameInputEventHandle(this.HandleOnDamagedForReapply);
- this.m_damageToReapply = 0f;
- }
- break;
- case StatusEffect.ModifiedStat.ReapplyDamageToNearbyEnemies:
- if (this.m_intervalCount > 0u)
- {
- GameObject[] array = GameUtilities.CreaturesInRange(target.transform.position, 3f, target, true);
- if (array != null)
- {
- GameObject[] array2 = array;
- for (int k = 0; k < array2.Length; k++)
- {
- GameObject gameObject = array2[k];
- Health component7 = gameObject.GetComponent<Health>();
- if (component7 != null)
- {
- component7.ApplyDamageDirectly(this.m_damageToReapply * (this.Params.Value + this.IncreasePerTick * (this.m_intervalCount - 1u)), DamagePacket.DamageType.Raw, this.Owner, this);
- }
- }
- }
- this.m_damageToReapply = 0f;
- }
- else
- {
- component.OnDamaged += new GameInputEventHandle(this.HandleOnDamagedForReapply);
- this.m_damageToReapply = 0f;
- }
- break;
- case StatusEffect.ModifiedStat.ReloadSpeed:
- characterStats.ReloadSpeedMultiplier = appliedValue;
- break;
- case StatusEffect.ModifiedStat.DropTrap:
- if (component2 != null)
- {
- Vector3 lastPosition = component2.LastPosition;
- if (lastPosition != target.transform.position)
- {
- HazardAttack.PlaceTrap(this.Params.TrapPrefab, lastPosition, target);
- }
- }
- break;
- case StatusEffect.ModifiedStat.StasisShield:
- if (this.m_damageToAbsorb == 0f)
- {
- characterStats.OnPreDamageApplied += new CombatEventHandler(this.HandleStatsOnPreDamageAppliedForAbsorb);
- this.m_damageToAbsorb = appliedValue;
- AIController component8 = target.GetComponent<AIController>();
- if (component8 != null)
- {
- GameEventArgs gameEventArgs3 = new GameEventArgs();
- gameEventArgs3.Type = GameEventType.Stunned;
- gameEventArgs3.FloatData = new float[1];
- gameEventArgs3.FloatData[0] = this.Duration;
- gameEventArgs3.IntData = new int[1];
- gameEventArgs3.IntData[0] = 1;
- component8.OnEvent(gameEventArgs3);
- }
- }
- break;
- case StatusEffect.ModifiedStat.SuspendBeneficialEffects:
- characterStats.SuspendEffects(CharacterStats.EffectType.Beneficial);
- break;
- case StatusEffect.ModifiedStat.DamageBasedOnInverseHealth:
- if (!component.Dead)
- {
- float num2 = 1f - component.CurrentHealth / component.MaxHealth;
- if (this.IncreasePerTick > 0f)
- {
- component.ApplyDamageDirectly(appliedValue * num2 * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
- }
- else
- {
- component.ApplyDamageDirectly(appliedValue * num2, this.Params.DmgType, this.Owner, this);
- }
- }
- break;
- case StatusEffect.ModifiedStat.Resolve:
- characterStats.ResolveBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Might:
- characterStats.MightBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Dexterity:
- characterStats.DexterityBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Intellect:
- characterStats.IntellectBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.SummonWeapon:
- if (component3 != null)
- {
- component3.PushSummonedWeapon(this.Params.EquippablePrefab);
- }
- break;
- case StatusEffect.ModifiedStat.TransferStamina:
- if (this.m_owner != null)
- {
- Health component9 = this.m_owner.GetComponent<Health>();
- if (component9 != null)
- {
- component9.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
- }
- }
- component.ApplyStaminaChangeDirectly(-appliedValue, this.m_owner, this, false);
- break;
- case StatusEffect.ModifiedStat.StaminaRechargeRateMult:
- characterStats.StaminaRechargeMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.VesselAccuracy:
- characterStats.VesselAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.BeastAccuracy:
- characterStats.BeastAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.WilderAccuracy:
- characterStats.WilderAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.StunDefense:
- characterStats.StunDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.KnockdownDefense:
- characterStats.KnockdownDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.PoisonDefense:
- characterStats.PoisonDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.DiseaseDefense:
- characterStats.DiseaseDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.DistantEnemyBonus:
- characterStats.DistantEnemyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusAccuracyForNearestAllyOnSameEnemy:
- characterStats.NearestAllyWithSharedTargetAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.EnemyCritToHitPercent:
- characterStats.EnemyCritToHitPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.HostileEffectDurationMult:
- characterStats.AdjustEffectDurations(CharacterStats.EffectType.Hostile, appliedValue);
- characterStats.HostileEffectDurationMultiplier *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent:
- characterStats.DeflectReflexGrazeToMissPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent:
- characterStats.FortitudeWillGrazeToMissPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.ExtraStraightBounces:
- characterStats.ExtraStraightBounces += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.RedirectMeleeAttacks:
- characterStats.RedirectMeleeAttacks = true;
- break;
- case StatusEffect.ModifiedStat.HostileAOEDamageMultiplier:
- characterStats.HostileAOEDamageMultiplier *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ImprovedFlanking:
- characterStats.ImprovedFlanking++;
- break;
- case StatusEffect.ModifiedStat.DTBypass:
- characterStats.DTBypass += (float)((int)appliedValue);
- break;
- case StatusEffect.ModifiedStat.StealSpell:
- if (this.m_owner != null)
- {
- CharacterStats component10 = this.m_owner.GetComponent<CharacterStats>();
- if (component10 != null)
- {
- if (this.m_spell != null)
- {
- component10.ActiveAbilities.Remove(this.m_spell);
- }
- if (component3 != null && component3.CurrentItems != null && component3.CurrentItems.Grimoire != null)
- {
- Grimoire component11 = component3.CurrentItems.Grimoire.GetComponent<Grimoire>();
- if (component11 != null)
- {
- GenericSpell genericSpell = component11.FindNewSpell(this.m_owner, (int)this.Params.Value);
- if (genericSpell != null)
- {
- this.m_spell = (GenericSpell)component10.InstantiateAbility(genericSpell, GenericAbility.AbilityType.Spell);
- this.m_spell.IsFree = true;
- this.m_spell.NeedsGrimoire = false;
- this.m_spell.ProhibitFromGrimoire = true;
- }
- }
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.SwapFaction:
- {
- PartyMemberAI component12 = target.GetComponent<PartyMemberAI>();
- AIController aIController;
- if (component12)
- {
- component12.enabled = false;
- target.AddComponent<AIPackageController>();
- aIController = component12;
- }
- else
- {
- aIController = target.GetComponent<AIController>();
- }
- if (aIController != null)
- {
- AIState currentState = aIController.AI.CurrentState;
- if (currentState.Priority < 2)
- {
- aIController.AI.PopAllStates();
- }
- else
- {
- aIController.AI.ClearQueuedStates();
- }
- }
- Faction component13 = target.GetComponent<Faction>();
- Faction component14 = this.m_owner.GetComponent<Faction>();
- if (component13 != null && component14 != null)
- {
- this.m_cachedTeam = component13.CurrentTeamInstance;
- component13.ModifyToMatch(component14);
- }
- break;
- }
- case StatusEffect.ModifiedStat.Athletics:
- characterStats.AthleticsBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Lore:
- characterStats.LoreBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Mechanics:
- characterStats.MechanicsBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Survival:
- characterStats.SurvivalBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Crafting:
- characterStats.CraftingBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.PushDefense:
- characterStats.PushDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.WhileStunnedDefense:
- characterStats.WhileStunnedDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.WhileKnockeddownDefense:
- characterStats.WhileKnockeddownDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Constitution:
- characterStats.ConstitutionBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.Perception:
- characterStats.PerceptionBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.CritHitMultiplierBonus:
- characterStats.CritHitDamageMultiplierBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusGrazeToHitPercent:
- characterStats.BonusGrazeToHitPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusGrazeToMissPercent:
- characterStats.BonusGrazeToMissPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusCritToHitPercent:
- characterStats.BonusCritToHitPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusMissToGrazePercent:
- characterStats.BonusMissToGrazePercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusHitToCritPercent:
- characterStats.BonusHitToCritPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusHitToGrazePercent:
- characterStats.BonusHitToGrazePercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.Confused:
- {
- AIController component15 = target.GetComponent<AIController>();
- if (component15 != null)
- {
- component15.AI.PopAllStates();
- }
- break;
- }
- case StatusEffect.ModifiedStat.BonusMeleeWeaponDamage:
- characterStats.BonusMeleeWeaponDamage += appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusRangedWeaponDamage:
- characterStats.BonusRangedWeaponDamage += appliedValue;
- break;
- case StatusEffect.ModifiedStat.RateOfFireMult:
- characterStats.RateOfFireMultiplier *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ApplyAttackEffects:
- if (this.Params.AttackPrefab != null && this.Params.AttackPrefab.AbilityOrigin != null && !this.Params.AttackPrefab.AbilityOrigin.ActivateBeforeAttack)
- {
- this.Params.AttackPrefab.AbilityOrigin.Activate();
- }
- break;
- case StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent:
- characterStats.EnemyReflexGrazeToMissPercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.StaminaPercent:
- component.ApplyStaminaChangeDirectly(appliedValue * component.MaxStamina, this.m_owner, this, false);
- break;
- case StatusEffect.ModifiedStat.EnemiesNeededToFlankAdj:
- characterStats.EnemiesNeededToFlank += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.ConcentrationBonus:
- characterStats.ConcentrationBonus += appliedValue;
- break;
- case StatusEffect.ModifiedStat.DisableSpellcasting:
- characterStats.SpellCastingDisabled++;
- break;
- case StatusEffect.ModifiedStat.ResistAffliction:
- {
- CharacterStats expr_12DD = characterStats;
- expr_12DD.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Combine(expr_12DD.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseAffliction));
- characterStats.AdjustStatusEffectDurationsFromAffliction(this.Params.AfflictionPrefab, this.Params.ExtraValue);
- break;
- }
- case StatusEffect.ModifiedStat.PreventDeath:
- characterStats.DeathPrevented++;
- break;
- case StatusEffect.ModifiedStat.AdjustDurationBeneficialEffects:
- characterStats.AdjustStatusEffectDurations(CharacterStats.EffectType.Beneficial, this.Params.Value, this);
- break;
- case StatusEffect.ModifiedStat.DOTTickMult:
- characterStats.DOTTickMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.AdjustDurationHostileEffects:
- characterStats.AdjustStatusEffectDurations(CharacterStats.EffectType.Hostile, this.Params.Value, this);
- break;
- case StatusEffect.ModifiedStat.ResistKeyword:
- {
- CharacterStats expr_1376 = characterStats;
- expr_1376.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Combine(expr_1376.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseKeyword));
- characterStats.AdjustStatusEffectDurationsFromKeyword(this.Params.Keyword, this.Params.ExtraValue);
- break;
- }
- case StatusEffect.ModifiedStat.TransferDT:
- if (this.m_owner != null)
- {
- CharacterStats component16 = this.m_owner.GetComponent<CharacterStats>();
- if (component16 != null)
- {
- component16.DamageThreshhold[(int)this.Params.DmgType] += appliedValue;
- characterStats.DamageThreshhold[(int)this.Params.DmgType] -= appliedValue;
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int l = 0; l < 7; l++)
- {
- component16.DamageThreshhold[l] += appliedValue;
- characterStats.DamageThreshhold[l] -= appliedValue;
- }
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.TransferRandomAttribute:
- if (this.m_owner != null)
- {
- CharacterStats component17 = this.m_owner.GetComponent<CharacterStats>();
- if (component17 != null)
- {
- switch (this.m_generalCounter)
- {
- case 0u:
- component17.MightBonus += (int)appliedValue;
- characterStats.MightBonus -= (int)appliedValue;
- break;
- case 1u:
- component17.ConstitutionBonus += (int)appliedValue;
- characterStats.ConstitutionBonus -= (int)appliedValue;
- break;
- case 2u:
- component17.DexterityBonus += (int)appliedValue;
- characterStats.DexterityBonus -= (int)appliedValue;
- break;
- case 3u:
- component17.PerceptionBonus += (int)appliedValue;
- characterStats.PerceptionBonus -= (int)appliedValue;
- break;
- case 4u:
- component17.IntellectBonus += (int)appliedValue;
- characterStats.IntellectBonus -= (int)appliedValue;
- break;
- case 5u:
- component17.ResolveBonus += (int)appliedValue;
- characterStats.ResolveBonus -= (int)appliedValue;
- break;
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.Disintegrate:
- if (!component.Dead)
- {
- if (this.IncreasePerTick > 0f)
- {
- component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, DamagePacket.DamageType.Raw, this.Owner, this);
- }
- else
- {
- component.ApplyDamageDirectly(appliedValue, DamagePacket.DamageType.Raw, this.Owner, this);
- }
- if (component.Dead)
- {
- UnityEngine.Object.DestroyObject(this.Owner, 0.1f);
- }
- }
- break;
- case StatusEffect.ModifiedStat.Duplicate:
- {
- this.ExtraObject = MirrorCharacterUtils.MirrorCharacter(target, MirrorCharacterUtils.MirrorType.NewCharacter);
- this.ExtraObject.transform.parent = target.transform;
- this.ExtraObject.transform.localPosition = new Vector3(1f, 0f, 0f);
- if (this.Params.EquippablePrefab != null)
- {
- Equipment component18 = this.ExtraObject.GetComponent<Equipment>();
- if (component18 != null)
- {
- component18.PushSummonedWeapon(this.Params.EquippablePrefab);
- }
- }
- Health component19 = this.ExtraObject.GetComponent<Health>();
- if (component19 != null)
- {
- component19.OnDeath += new GameInputEventHandle(this.HandleDestroyOnDeath);
- }
- CharacterStats component20 = this.ExtraObject.GetComponent<CharacterStats>();
- if (component20 != null)
- {
- component20.OverrideName = string.Format(GUIUtils.GetText(1373), characterStats.Name());
- }
- break;
- }
- case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
- if (component.StaminaPercentage <= this.Params.ExtraValue)
- {
- characterStats.MeleeAccuracyBonus += (int)appliedValue;
- characterStats.RangedAccuracyBonus += (int)appliedValue;
- this.m_generalCounter = 1u;
- }
- break;
- case StatusEffect.ModifiedStat.EnemyHitToGrazePercent:
- characterStats.EnemyHitToGrazePercent += appliedValue;
- break;
- case StatusEffect.ModifiedStat.StunDurationMult:
- characterStats.StunDurationMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.KnockDownDurationMult:
- characterStats.KnockDownDurationMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusArmorDTMultAtLowHealth:
- characterStats.BonusArmorDTMultAtLowHealth *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.Fatigue:
- characterStats.Fatigue += appliedValue;
- break;
- case StatusEffect.ModifiedStat.PrimordialAccuracy:
- characterStats.PrimordialAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.StopAnimation:
- {
- AnimationController component21 = target.GetComponent<AnimationController>();
- if (component21 != null && component2 != null)
- {
- component21.TimeScaleOverride++;
- component2.Frozen = true;
- }
- break;
- }
- case StatusEffect.ModifiedStat.AddAfflictionImmunity:
- if (this.Params.AfflictionPrefab != null)
- {
- characterStats.AfflictionImmunities.Add(this.Params.AfflictionPrefab);
- characterStats.ClearEffectFromAffliction(this.Params.AfflictionPrefab);
- }
- break;
- case StatusEffect.ModifiedStat.Invisible:
- if (appliedValue > 0f)
- {
- characterStats.InvisibilityState++;
- }
- break;
- case StatusEffect.ModifiedStat.WoundDelay:
- characterStats.WoundDelay += appliedValue;
- break;
- case StatusEffect.ModifiedStat.FinishingBlowDamageMult:
- characterStats.FinishingBlowDamageMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ZealousAuraAoEMult:
- characterStats.ZealousAuraRadiusMult *= Mathf.Sqrt(appliedValue);
- break;
- case StatusEffect.ModifiedStat.DelayUnconsciousness:
- characterStats.UnconsciousnessDelayed++;
- break;
- case StatusEffect.ModifiedStat.NegMoveTickMult:
- characterStats.NegMoveTickMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.FocusGainMult:
- characterStats.FocusGainMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.DisengagementDefense:
- characterStats.DisengagementDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.SpellDefense:
- characterStats.SpellDefenseBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.RangedDeflection:
- characterStats.RangedDeflectionBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusUsesPerRestPastThree:
- characterStats.BonusUsesPerRestPastThree += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.PoisonTickMult:
- characterStats.PoisonTickMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.DiseaseTickMult:
- characterStats.DiseaseTickMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.StalkersLinkDamageMult:
- characterStats.StalkersLinkDamageMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
- characterStats.ChanterPhraseRadiusMult *= Mathf.Sqrt(appliedValue);
- break;
- case StatusEffect.ModifiedStat.BonusHealMult:
- characterStats.BonusHealMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.SpellCastBonus:
- {
- int num3 = (int)this.Params.ExtraValue - 1;
- if (num3 >= 0 && num3 < 6)
- {
- characterStats.SpellCastBonus[num3] += (int)appliedValue;
- }
- break;
- }
- case StatusEffect.ModifiedStat.AoEMult:
- characterStats.AoERadiusMult *= Mathf.Sqrt(appliedValue);
- break;
- case StatusEffect.ModifiedStat.FrenzyDurationMult:
- characterStats.FrenzyDurationMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ProneDurationMult:
- characterStats.ProneDurationMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.WildstrikeDamageMult:
- characterStats.WildstrikeDamageMult *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.ReviveAndAddStamina:
- if (!component.Dead)
- {
- if (component.Unconscious)
- {
- component.OnRevive();
- }
- component.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
- }
- break;
- case StatusEffect.ModifiedStat.LaunchAttack:
- if (this.m_owner != null && this.Params.AttackPrefab != null)
- {
- AttackBase attackBase = UnityEngine.Object.Instantiate(this.Params.AttackPrefab) as AttackBase;
- attackBase.Owner = this.m_owner;
- attackBase.transform.parent = this.m_owner.transform;
- attackBase.SkipAnimation = true;
- attackBase.Launch(target);
- }
- break;
- case StatusEffect.ModifiedStat.HidesHealthStamina:
- component.EnableHealthDisplay(false);
- break;
- case StatusEffect.ModifiedStat.AllDefense:
- characterStats.DeflectionBonus += (int)appliedValue;
- characterStats.ReflexBonus += (int)appliedValue;
- characterStats.WillBonus += (int)appliedValue;
- characterStats.FortitudeBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.MaxStaminaMult:
- characterStats.MaxStaminaMultiplier *= appliedValue;
- break;
- case StatusEffect.ModifiedStat.CallbackOnDamaged:
- if (this.Params.OnDamagedCallbackAbility != null)
- {
- component.OnDamaged += new GameInputEventHandle(this.Params.OnDamagedCallbackAbility.HandleOnDamaged);
- }
- break;
- case StatusEffect.ModifiedStat.Accuracy:
- characterStats.MeleeAccuracyBonus += (int)appliedValue;
- characterStats.RangedAccuracyBonus += (int)appliedValue;
- break;
- case StatusEffect.ModifiedStat.TransferDamageToStamina:
- if (this.m_owner != null)
- {
- Health component22 = this.m_owner.GetComponent<Health>();
- if (component22 != null)
- {
- if (this.IncreasePerTick > 0f)
- {
- component22.ApplyStaminaChangeDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.m_owner, this, false);
- }
- else
- {
- component22.ApplyStaminaChangeDirectly(appliedValue, this.m_owner, this, false);
- }
- }
- }
- if (this.Params.DmgType < DamagePacket.DamageType.Count)
- {
- if (this.IncreasePerTick > 0f)
- {
- component.ApplyDamageDirectly(appliedValue * this.IncreasePerTick * this.m_intervalCount, this.Params.DmgType, this.Owner, this);
- }
- else
- {
- component.ApplyDamageDirectly(appliedValue, this.Params.DmgType, this.Owner, this);
- }
- }
- else
- {
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- Debug.LogError(this.Params.AffectsStat.ToString() + " is using DamageType of All, which is not supported!");
- }
- }
- break;
- case StatusEffect.ModifiedStat.CallbackAfterAttack:
- if (this.m_abilityOrigin != null)
- {
- characterStats.OnPostDamageDealt += new CombatEventHandler(this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallback);
- }
- break;
- }
- return true;
- }
- public virtual void ClearEffect(GameObject target)
- {
- if (!this.m_applied)
- {
- return;
- }
- if (this.m_target == target && this.m_triggerCount == 1 && this.Params.TriggerAdjustment.ResetTriggerOnEffectEnd)
- {
- this.OffTrigger();
- return;
- }
- if (this.m_appliedFX.Count > 0)
- {
- foreach (GameObject current in this.m_appliedFX)
- {
- GameUtilities.ShutDownLoopingEffect(current);
- UnityEngine.Object.DestroyObject(current, 5f);
- }
- this.m_appliedFX.Clear();
- }
- if (target == null)
- {
- return;
- }
- Transform transform = AttackBase.GetTransform(target, this.Params.VisualEffectAttach);
- GameUtilities.LaunchEffect(this.m_params.OnStopVisualEffect, transform.position, transform.rotation, 1f, transform);
- CharacterStats characterStats = this.m_targetStats;
- if (target != this.m_target || characterStats == null)
- {
- characterStats = target.GetComponent<CharacterStats>();
- }
- Health component = target.GetComponent<Health>();
- Mover component2 = target.GetComponent<Mover>();
- if (characterStats == null || component == null)
- {
- Debug.LogError(target.name + " doesn't have a health and/or CharacterStats component. Unable to remove status effect!");
- return;
- }
- float currentAppliedValue = this.CurrentAppliedValue;
- if (this.m_target != target || this.m_effect_is_on_main_target)
- {
- switch (this.Params.AffectsStat)
- {
- case StatusEffect.ModifiedStat.MaxHealth:
- characterStats.MaxHealth -= currentAppliedValue;
- component.CurrentHealth -= currentAppliedValue;
- if (component.CurrentHealth <= 0f)
- {
- component.CurrentHealth = 1f;
- }
- break;
- case StatusEffect.ModifiedStat.MaxStamina:
- characterStats.StaminaBonus -= currentAppliedValue;
- component.CurrentStamina -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.MeleeAccuracy:
- characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.RangedAccuracy:
- characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Deflection:
- characterStats.DeflectionBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Fortitude:
- characterStats.FortitudeBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Reflex:
- characterStats.ReflexBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Will:
- characterStats.WillBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.StaminaRechargeRate:
- characterStats.StaminaRechargeBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.AttackSpeed:
- characterStats.AttackSpeedMultiplier /= currentAppliedValue;
- if (characterStats.AttackSpeedMultiplier >= 1f & characterStats.AttackSpeedMultiplier <= 1f)
- {
- characterStats.AttackSpeedMultiplier = 1f;
- }
- break;
- case StatusEffect.ModifiedStat.Stealth:
- characterStats.StealthBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusDamage:
- if (this.Params.DmgType < DamagePacket.DamageType.Count)
- {
- characterStats.BonusDamage[(int)this.Params.DmgType] -= currentAppliedValue;
- }
- else
- {
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int i = 0; i < 7; i++)
- {
- characterStats.BonusDamage[i] -= currentAppliedValue;
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.DamageThreshhold:
- characterStats.DamageThreshhold[(int)this.Params.DmgType] -= currentAppliedValue;
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int j = 0; j < 7; j++)
- {
- characterStats.DamageThreshhold[j] -= currentAppliedValue;
- }
- }
- break;
- case StatusEffect.ModifiedStat.DamageMinimum:
- characterStats.DamageMinBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.MovementRate:
- if (component2)
- {
- component2.SetRunSpeed(component2.RunSpeed - currentAppliedValue);
- component2.SetWalkSpeed(component2.WalkSpeed - currentAppliedValue);
- }
- break;
- case StatusEffect.ModifiedStat.NonTargetable:
- component.Targetable = true;
- break;
- case StatusEffect.ModifiedStat.NonMobile:
- if (component2)
- {
- component2.Frozen = false;
- }
- break;
- case StatusEffect.ModifiedStat.KnockedDown:
- {
- AIController component3 = target.GetComponent<AIController>();
- if (component3 != null)
- {
- GameEventArgs gameEventArgs = new GameEventArgs();
- gameEventArgs.Type = GameEventType.KnockedDown;
- gameEventArgs.IntData = new int[1];
- gameEventArgs.IntData[0] = 0;
- component3.OnEvent(gameEventArgs);
- }
- break;
- }
- case StatusEffect.ModifiedStat.EngagedEnemyCount:
- characterStats.EngageableEnemyCount -= (int)currentAppliedValue;
- if (characterStats.EngageableEnemyCount < 0)
- {
- characterStats.EngageableEnemyCount = 0;
- }
- break;
- case StatusEffect.ModifiedStat.EngagementRadius:
- characterStats.EngagementDistanceBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.EngagementAccuracy:
- characterStats.DisengagementAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.EngagementDamage:
- characterStats.DisengagementDamageBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Engageable:
- characterStats.ImmuneToEngagement = false;
- break;
- case StatusEffect.ModifiedStat.Stunned:
- {
- AIController component4 = target.GetComponent<AIController>();
- if (component4 != null)
- {
- GameEventArgs gameEventArgs2 = new GameEventArgs();
- gameEventArgs2.Type = GameEventType.Stunned;
- gameEventArgs2.IntData = new int[1];
- gameEventArgs2.IntData[0] = 0;
- component4.OnEvent(gameEventArgs2);
- }
- break;
- }
- case StatusEffect.ModifiedStat.BonusUnarmedDamage:
- characterStats.BonusUnarmedDamage -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.MeleeAttackDistanceMult:
- characterStats.MeleeAttackDistanceMultiplier = 1f;
- break;
- case StatusEffect.ModifiedStat.RangedAttackDistanceMult:
- characterStats.RangedAttackDistanceMultiplier = 1f;
- break;
- case StatusEffect.ModifiedStat.BonusDTFromArmor:
- characterStats.BonusDTFromArmor -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
- characterStats.MeleeDamageRangePctIncreaseToMin -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.SuspendHostileEffects:
- characterStats.UnsuspendEffects(CharacterStats.EffectType.Hostile, this.m_timeApplied);
- break;
- case StatusEffect.ModifiedStat.BonusMeleeDamage:
- characterStats.BonusMeleeDamage -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ImmuneToEngageStop:
- characterStats.ImmuneToEngageStop = false;
- break;
- case StatusEffect.ModifiedStat.HealthLossPctMult:
- characterStats.HealthLossPercentMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DrainResolveForDeflection:
- characterStats.ResolveBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ReapplyDamage:
- case StatusEffect.ModifiedStat.ReapplyDamageToNearbyEnemies:
- component.OnDamaged -= new GameInputEventHandle(this.HandleOnDamagedForReapply);
- break;
- case StatusEffect.ModifiedStat.ReloadSpeed:
- characterStats.ReloadSpeedMultiplier /= currentAppliedValue;
- if (characterStats.ReloadSpeedMultiplier >= 1f & characterStats.ReloadSpeedMultiplier <= 1f)
- {
- characterStats.ReloadSpeedMultiplier = 1f;
- }
- break;
- case StatusEffect.ModifiedStat.StasisShield:
- {
- characterStats.OnPreDamageApplied -= new CombatEventHandler(this.HandleStatsOnPreDamageAppliedForAbsorb);
- AIController component5 = target.GetComponent<AIController>();
- if (component5 != null)
- {
- GameEventArgs gameEventArgs3 = new GameEventArgs();
- gameEventArgs3.Type = GameEventType.Stunned;
- gameEventArgs3.IntData = new int[1];
- gameEventArgs3.IntData[0] = 0;
- component5.OnEvent(gameEventArgs3);
- }
- break;
- }
- case StatusEffect.ModifiedStat.SuspendBeneficialEffects:
- characterStats.UnsuspendEffects(CharacterStats.EffectType.Beneficial, this.m_timeApplied);
- break;
- case StatusEffect.ModifiedStat.Resolve:
- characterStats.ResolveBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Might:
- characterStats.MightBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Dexterity:
- characterStats.DexterityBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Intellect:
- characterStats.IntellectBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.SummonWeapon:
- {
- Equipment component6 = target.GetComponent<Equipment>();
- if (component6 != null)
- {
- component6.PopSummonedWeapon();
- }
- break;
- }
- case StatusEffect.ModifiedStat.StaminaRechargeRateMult:
- if (currentAppliedValue != 0f)
- {
- characterStats.StaminaRechargeMult /= currentAppliedValue;
- }
- break;
- case StatusEffect.ModifiedStat.VesselAccuracy:
- characterStats.VesselAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BeastAccuracy:
- characterStats.BeastAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.WilderAccuracy:
- characterStats.WilderAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.StunDefense:
- characterStats.StunDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.KnockdownDefense:
- characterStats.KnockdownDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.PoisonDefense:
- characterStats.PoisonDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DiseaseDefense:
- characterStats.DiseaseDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DistantEnemyBonus:
- characterStats.DistantEnemyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusAccuracyForNearestAllyOnSameEnemy:
- characterStats.NearestAllyWithSharedTargetAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.EnemyCritToHitPercent:
- characterStats.EnemyCritToHitPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.HostileEffectDurationMult:
- characterStats.HostileEffectDurationMultiplier /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DeflectReflexGrazeToMissPercent:
- characterStats.DeflectReflexGrazeToMissPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.FortitudeWillGrazeToMissPercent:
- characterStats.FortitudeWillGrazeToMissPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ExtraStraightBounces:
- characterStats.ExtraStraightBounces -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.RedirectMeleeAttacks:
- characterStats.RedirectMeleeAttacks = false;
- break;
- case StatusEffect.ModifiedStat.HostileAOEDamageMultiplier:
- characterStats.HostileAOEDamageMultiplier /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ImprovedFlanking:
- characterStats.ImprovedFlanking--;
- break;
- case StatusEffect.ModifiedStat.DTBypass:
- characterStats.DTBypass -= (float)((int)currentAppliedValue);
- break;
- case StatusEffect.ModifiedStat.StealSpell:
- if (this.m_owner != null && this.m_spell != null)
- {
- CharacterStats component7 = this.m_owner.GetComponent<CharacterStats>();
- if (component7 != null)
- {
- component7.ActiveAbilities.Remove(this.m_spell);
- }
- }
- break;
- case StatusEffect.ModifiedStat.SwapFaction:
- {
- PartyMemberAI component8 = target.GetComponent<PartyMemberAI>();
- Faction component9 = target.GetComponent<Faction>();
- if (component9 != null)
- {
- component9.CurrentTeamInstance = this.m_cachedTeam;
- }
- AIController aIController;
- if (component8)
- {
- aIController = component8;
- component8.enabled = true;
- component8.InitAI();
- component8.AI.PopAllStates();
- component8.Selected = true;
- }
- else
- {
- aIController = target.GetComponent<AIController>();
- }
- if (aIController != null)
- {
- AIState currentState = aIController.AI.CurrentState;
- if (currentState.Priority < 2)
- {
- aIController.AI.PopAllStates();
- }
- else
- {
- aIController.AI.ClearQueuedStates();
- }
- }
- break;
- }
- case StatusEffect.ModifiedStat.Athletics:
- characterStats.AthleticsBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Lore:
- characterStats.LoreBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Mechanics:
- characterStats.MechanicsBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Survival:
- characterStats.SurvivalBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Crafting:
- characterStats.CraftingBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.PushDefense:
- characterStats.PushDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.WhileStunnedDefense:
- characterStats.WhileStunnedDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.WhileKnockeddownDefense:
- characterStats.WhileKnockeddownDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Constitution:
- characterStats.ConstitutionBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Perception:
- characterStats.PerceptionBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.CritHitMultiplierBonus:
- characterStats.CritHitDamageMultiplierBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusGrazeToHitPercent:
- characterStats.BonusGrazeToHitPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusGrazeToMissPercent:
- characterStats.BonusGrazeToMissPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusCritToHitPercent:
- characterStats.BonusCritToHitPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusMissToGrazePercent:
- characterStats.BonusMissToGrazePercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusHitToCritPercent:
- characterStats.BonusHitToCritPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusHitToGrazePercent:
- characterStats.BonusHitToGrazePercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.Confused:
- {
- AIController component10 = target.GetComponent<AIController>();
- if (component10 != null)
- {
- component10.AI.PopCurrentState();
- }
- break;
- }
- case StatusEffect.ModifiedStat.BonusMeleeWeaponDamage:
- characterStats.BonusMeleeWeaponDamage -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusRangedWeaponDamage:
- characterStats.BonusRangedWeaponDamage -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.RateOfFireMult:
- characterStats.RateOfFireMultiplier /= currentAppliedValue;
- if (characterStats.RateOfFireMultiplier >= 1f & characterStats.RateOfFireMultiplier <= 1f)
- {
- characterStats.RateOfFireMultiplier = 1f;
- }
- break;
- case StatusEffect.ModifiedStat.EnemyReflexGrazeToMissPercent:
- characterStats.EnemyReflexGrazeToMissPercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.EnemiesNeededToFlankAdj:
- characterStats.EnemiesNeededToFlank -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ConcentrationBonus:
- characterStats.ConcentrationBonus -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DisableSpellcasting:
- characterStats.SpellCastingDisabled--;
- break;
- case StatusEffect.ModifiedStat.ResistAffliction:
- {
- CharacterStats expr_F04 = characterStats;
- expr_F04.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Remove(expr_F04.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseAffliction));
- break;
- }
- case StatusEffect.ModifiedStat.PreventDeath:
- characterStats.DeathPrevented--;
- break;
- case StatusEffect.ModifiedStat.DOTTickMult:
- characterStats.DOTTickMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ResistKeyword:
- {
- CharacterStats expr_F52 = characterStats;
- expr_F52.OnDefenseAdjustment = (CharacterStats.DefenseEvent)Delegate.Remove(expr_F52.OnDefenseAdjustment, new CharacterStats.DefenseEvent(this.AdjustDefenseKeyword));
- break;
- }
- case StatusEffect.ModifiedStat.TransferDT:
- if (this.m_owner != null)
- {
- CharacterStats component11 = this.m_owner.GetComponent<CharacterStats>();
- if (component11 != null)
- {
- component11.DamageThreshhold[(int)this.Params.DmgType] -= currentAppliedValue;
- characterStats.DamageThreshhold[(int)this.Params.DmgType] += currentAppliedValue;
- if (this.Params.DmgType == DamagePacket.DamageType.All)
- {
- for (int k = 0; k < 7; k++)
- {
- component11.DamageThreshhold[k] -= currentAppliedValue;
- characterStats.DamageThreshhold[k] += currentAppliedValue;
- }
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.TransferRandomAttribute:
- if (this.m_owner != null)
- {
- CharacterStats component12 = this.m_owner.GetComponent<CharacterStats>();
- if (component12 != null)
- {
- switch (this.m_generalCounter)
- {
- case 0u:
- component12.MightBonus -= (int)currentAppliedValue;
- characterStats.MightBonus += (int)currentAppliedValue;
- break;
- case 1u:
- component12.ConstitutionBonus -= (int)currentAppliedValue;
- characterStats.ConstitutionBonus += (int)currentAppliedValue;
- break;
- case 2u:
- component12.DexterityBonus -= (int)currentAppliedValue;
- characterStats.DexterityBonus += (int)currentAppliedValue;
- break;
- case 3u:
- component12.PerceptionBonus -= (int)currentAppliedValue;
- characterStats.PerceptionBonus += (int)currentAppliedValue;
- break;
- case 4u:
- component12.IntellectBonus -= (int)currentAppliedValue;
- characterStats.IntellectBonus += (int)currentAppliedValue;
- break;
- case 5u:
- component12.ResolveBonus -= (int)currentAppliedValue;
- characterStats.ResolveBonus += (int)currentAppliedValue;
- break;
- }
- }
- }
- break;
- case StatusEffect.ModifiedStat.Duplicate:
- UnityEngine.Object.DestroyObject(this.ExtraObject, 1f);
- break;
- case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
- if (this.m_generalCounter == 1u)
- {
- characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
- characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
- }
- break;
- case StatusEffect.ModifiedStat.EnemyHitToGrazePercent:
- characterStats.EnemyHitToGrazePercent -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.StunDurationMult:
- characterStats.StunDurationMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.KnockDownDurationMult:
- characterStats.KnockDownDurationMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusArmorDTMultAtLowHealth:
- characterStats.BonusArmorDTMultAtLowHealth /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.PrimordialAccuracy:
- characterStats.PrimordialAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.StopAnimation:
- {
- AnimationController component13 = target.GetComponent<AnimationController>();
- if (component13 != null && component2 != null)
- {
- component13.TimeScaleOverride--;
- component2.Frozen = false;
- }
- break;
- }
- case StatusEffect.ModifiedStat.AddAfflictionImmunity:
- if (this.Params.AfflictionPrefab != null)
- {
- characterStats.AfflictionImmunities.Remove(this.Params.AfflictionPrefab);
- }
- break;
- case StatusEffect.ModifiedStat.Invisible:
- if (currentAppliedValue > 0f)
- {
- characterStats.InvisibilityState--;
- }
- break;
- case StatusEffect.ModifiedStat.WoundDelay:
- characterStats.WoundDelay -= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.FinishingBlowDamageMult:
- characterStats.FinishingBlowDamageMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ZealousAuraAoEMult:
- characterStats.ZealousAuraRadiusMult /= Mathf.Sqrt(currentAppliedValue);
- break;
- case StatusEffect.ModifiedStat.DelayUnconsciousness:
- characterStats.UnconsciousnessDelayed--;
- break;
- case StatusEffect.ModifiedStat.NegMoveTickMult:
- characterStats.NegMoveTickMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.FocusGainMult:
- characterStats.FocusGainMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DisengagementDefense:
- characterStats.DisengagementDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.SpellDefense:
- characterStats.SpellDefenseBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.RangedDeflection:
- characterStats.RangedDeflectionBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.BonusUsesPerRestPastThree:
- characterStats.BonusUsesPerRestPastThree -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.PoisonTickMult:
- characterStats.PoisonTickMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.DiseaseTickMult:
- characterStats.DiseaseTickMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.StalkersLinkDamageMult:
- characterStats.StalkersLinkDamageMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
- characterStats.ChanterPhraseRadiusMult /= Mathf.Sqrt(currentAppliedValue);
- break;
- case StatusEffect.ModifiedStat.BonusHealMult:
- characterStats.BonusHealMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.SpellCastBonus:
- {
- int num = (int)this.Params.ExtraValue - 1;
- if (num >= 0 && num < 6)
- {
- characterStats.SpellCastBonus[num] -= (int)currentAppliedValue;
- }
- break;
- }
- case StatusEffect.ModifiedStat.AoEMult:
- characterStats.AoERadiusMult /= Mathf.Sqrt(currentAppliedValue);
- break;
- case StatusEffect.ModifiedStat.FrenzyDurationMult:
- characterStats.FrenzyDurationMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.ProneDurationMult:
- characterStats.ProneDurationMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.WildstrikeDamageMult:
- characterStats.WildstrikeDamageMult /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.HidesHealthStamina:
- component.EnableHealthDisplay(true);
- break;
- case StatusEffect.ModifiedStat.AllDefense:
- characterStats.DeflectionBonus -= (int)currentAppliedValue;
- characterStats.ReflexBonus -= (int)currentAppliedValue;
- characterStats.WillBonus -= (int)currentAppliedValue;
- characterStats.FortitudeBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.MaxStaminaMult:
- characterStats.MaxStaminaMultiplier /= currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.CallbackOnDamaged:
- if (this.Params.OnDamagedCallbackAbility != null)
- {
- component.OnDamaged -= new GameInputEventHandle(this.Params.OnDamagedCallbackAbility.HandleOnDamaged);
- }
- break;
- case StatusEffect.ModifiedStat.Accuracy:
- characterStats.MeleeAccuracyBonus -= (int)currentAppliedValue;
- characterStats.RangedAccuracyBonus -= (int)currentAppliedValue;
- break;
- case StatusEffect.ModifiedStat.CallbackAfterAttack:
- if (this.m_abilityOrigin != null)
- {
- characterStats.OnPostDamageDealt -= new CombatEventHandler(this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallback);
- this.m_abilityOrigin.HandleStatsOnPostDamageDealtCallbackComplete();
- }
- break;
- }
- }
- if (this.m_target == target)
- {
- List<GameObject> list = new List<GameObject>(this.m_auraTargetsApplied.Keys);
- list.AddRange(this.m_auraTargetsUnapplied);
- foreach (GameObject current2 in list)
- {
- this.RemoveAura(current2);
- }
- this.m_applied = false;
- this.m_effect_is_on_main_target = false;
- this.RemoveTriggerCallback();
- }
- }
- public void RemoveEffect()
- {
- if (this.m_timeActive <= 0f)
- {
- this.m_timeActive = 0.01f;
- }
- this.Duration = this.m_timeActive;
- }
- public void WhenLaunchesAttack(GameObject attacker, GameObject enemy)
- {
- if (!this.m_applied)
- {
- return;
- }
- if (attacker == enemy)
- {
- return;
- }
- float currentAppliedValue = this.CurrentAppliedValue;
- StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
- if (affectsStat != StatusEffect.ModifiedStat.BonusAccuracyOnSameEnemy)
- {
- if (affectsStat != StatusEffect.ModifiedStat.BonusDamageMultOnSameEnemy)
- {
- if (affectsStat != StatusEffect.ModifiedStat.SneakAttackOnNearDead)
- {
- if (affectsStat != StatusEffect.ModifiedStat.BonusCritChanceOnSameEnemy)
- {
- if (affectsStat != StatusEffect.ModifiedStat.BonusAccuracyOnSameEnemyAsExtraObject)
- {
- if (affectsStat == StatusEffect.ModifiedStat.AccuracyByRace)
- {
- CharacterStats component = enemy.GetComponent<CharacterStats>();
- if (component != null && component.CharacterRace == this.Params.RaceType)
- {
- CharacterStats component2 = attacker.GetComponent<CharacterStats>();
- if (component2 != null)
- {
- component2.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- component2.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- }
- }
- }
- }
- else
- {
- if (this.m_extraObject != null)
- {
- CharacterStats component3 = attacker.GetComponent<CharacterStats>();
- if (component3 != null)
- {
- AIController component4 = this.m_extraObject.GetComponent<AIController>();
- if (component4 != null && component4.CurrentTarget == enemy)
- {
- component3.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- component3.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- }
- }
- }
- }
- }
- else
- {
- CharacterStats component5 = attacker.GetComponent<CharacterStats>();
- if (component5 != null)
- {
- PartyMemberAI[] partyMembers = PartyMemberAI.PartyMembers;
- for (int i = 0; i < partyMembers.Length; i++)
- {
- PartyMemberAI partyMemberAI = partyMembers[i];
- if (!(partyMemberAI == null) && !(partyMemberAI.gameObject == attacker))
- {
- if (partyMemberAI.CurrentTarget == enemy)
- {
- component5.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.BonusHitToCritPercent,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- break;
- }
- }
- }
- }
- }
- }
- else
- {
- Health component6 = enemy.GetComponent<Health>();
- if (component6 && component6.CurrentHealth / component6.MaxHealth <= currentAppliedValue)
- {
- CharacterStats component7 = attacker.GetComponent<CharacterStats>();
- if (component7)
- {
- StatusEffectParams statusEffectParams = new StatusEffectParams();
- statusEffectParams.AffectsStat = StatusEffect.ModifiedStat.BonusDamage;
- statusEffectParams.DmgType = DamagePacket.DamageType.Crush;
- Equipment component8 = attacker.GetComponent<Equipment>();
- if (component8 != null && component8.PrimaryAttack != null)
- {
- statusEffectParams.DmgType = component8.PrimaryAttack.DamageData.Type;
- }
- statusEffectParams.Value = 10f;
- statusEffectParams.OneHitUse = true;
- component7.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, statusEffectParams, this.AbilityType, null, true));
- component7.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
- Value = 10f,
- OneHitUse = true
- }, this.AbilityType, null, true));
- }
- }
- }
- }
- else
- {
- CharacterStats component9 = attacker.GetComponent<CharacterStats>();
- if (component9 != null)
- {
- PartyMemberAI[] partyMembers2 = PartyMemberAI.PartyMembers;
- for (int j = 0; j < partyMembers2.Length; j++)
- {
- PartyMemberAI partyMemberAI2 = partyMembers2[j];
- if (!(partyMemberAI2 == null) && !(partyMemberAI2.gameObject == attacker))
- {
- if (partyMemberAI2.CurrentTarget == enemy)
- {
- component9.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.BonusDamageMult,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- break;
- }
- }
- }
- }
- }
- }
- else
- {
- CharacterStats component10 = attacker.GetComponent<CharacterStats>();
- if (component10 != null)
- {
- PartyMemberAI[] partyMembers3 = PartyMemberAI.PartyMembers;
- for (int k = 0; k < partyMembers3.Length; k++)
- {
- PartyMemberAI partyMemberAI3 = partyMembers3[k];
- if (!(partyMemberAI3 == null) && !(partyMemberAI3.gameObject == attacker))
- {
- if (partyMemberAI3.CurrentTarget == enemy)
- {
- component10.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.MeleeAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- component10.ApplyStatusEffectImmediate(StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.RangedAccuracy,
- Value = currentAppliedValue,
- OneHitUse = true
- }, this.AbilityType, null, true));
- break;
- }
- }
- }
- }
- }
- }
- public void WhenHits(GameObject attacker, GameObject enemy, ref DamageInfo damage)
- {
- if (!this.m_applied)
- {
- return;
- }
- if (attacker == enemy)
- {
- return;
- }
- float currentAppliedValue = this.CurrentAppliedValue;
- StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
- switch (affectsStat)
- {
- case StatusEffect.ModifiedStat.MeleeAttackAllOnPath:
- if (damage.Attack is AttackMelee && !this.m_is_checking_melee_path)
- {
- this.m_is_checking_melee_path = true;
- damage.Attack.HandleBeam(attacker, enemy, Vector3.zero, CharacterStats.DefenseType.Reflex);
- this.m_is_checking_melee_path = false;
- }
- return;
- case StatusEffect.ModifiedStat.BonusMeleeDamageFromWounds:
- if (damage.Attack is AttackMelee)
- {
- CharacterStats component = attacker.GetComponent<CharacterStats>();
- if (component != null)
- {
- int num = 0;
- foreach (GenericAbility current in component.ActiveAbilities)
- {
- if (current is WoundsTrait)
- {
- num = component.CountStatusEffects(current.StatusEffects[0].Tag);
- break;
- }
- }
- if (num > 0)
- {
- DamagePacket.DamageProcType item = new DamagePacket.DamageProcType(this.Params.DmgType, (float)num * currentAppliedValue);
- damage.Damage.DamageProc.Add(item);
- }
- }
- }
- return;
- case StatusEffect.ModifiedStat.BonusDTFromArmor:
- case StatusEffect.ModifiedStat.MeleeMissThresholdDelta_DO_NOT_USE:
- case StatusEffect.ModifiedStat.MeleeDamageRangePctIncreaseToMin:
- IL_4F:
- switch (affectsStat)
- {
- case StatusEffect.ModifiedStat.GainStaminaWhenHits:
- {
- Health component2 = attacker.GetComponent<Health>();
- if (component2 != null)
- {
- component2.AddStamina(damage.DamageAmount * currentAppliedValue);
- }
- return;
- }
- case StatusEffect.ModifiedStat.CanKnockDownOnCrit:
- if (damage.IsCriticalHit)
- {
- CharacterStats component3 = attacker.GetComponent<CharacterStats>();
- if (component3)
- {
- DamageInfo damageInfo = component3.ComputeSecondaryAttack(damage.Attack, enemy, CharacterStats.DefenseType.Fortitude);
- List<StatusEffect> list = new List<StatusEffect>();
- if (damageInfo.HitType != HitType.MISS)
- {
- CharacterStats component4 = enemy.GetComponent<CharacterStats>();
- if (component4)
- {
- StatusEffect statusEffect = StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.KnockedDown,
- Duration = 5f
- }, this.AbilityType, damage, true);
- list.Add(statusEffect);
- statusEffect.EquipmentOrigin = this.EquipmentOrigin;
- component4.ApplyStatusEffect(statusEffect);
- }
- }
- AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo, list);
- }
- }
- return;
- case StatusEffect.ModifiedStat.BonusAccuracyAtLowStamina:
- IL_74:
- switch (affectsStat)
- {
- case StatusEffect.ModifiedStat.BonusDamageMult:
- if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- case StatusEffect.ModifiedStat.FocusWhenHits:
- if (damage.Attack != null && damage.Attack.AbilityOrigin == null)
- {
- CharacterStats component5 = attacker.GetComponent<CharacterStats>();
- if (component5 != null)
- {
- component5.Focus += currentAppliedValue * component5.FocusGainMult;
- }
- }
- return;
- case StatusEffect.ModifiedStat.BeamDamageMult:
- if (damage.Attack is AttackBeam)
- {
- for (uint num2 = 0u; num2 <= this.m_intervalCount; num2 += 1u)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- }
- return;
- default:
- {
- if (affectsStat == StatusEffect.ModifiedStat.DamageToDOT)
- {
- CharacterStats component6 = enemy.GetComponent<CharacterStats>();
- if (component6)
- {
- StatusEffect statusEffect2 = StatusEffect.Create(attacker, new StatusEffectParams
- {
- Apply = StatusEffect.ApplyType.ApplyOverTime,
- AffectsStat = StatusEffect.ModifiedStat.Damage,
- IntervalRate = StatusEffectParams.IntervalRateType.Damage,
- Duration = 30f,
- Value = damage.DamageAmount * currentAppliedValue,
- IsHostile = true
- }, this.AbilityType, damage, true);
- statusEffect2.EquipmentOrigin = this.EquipmentOrigin;
- component6.ApplyStatusEffect(statusEffect2);
- damage.DamageAmount = 0f;
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultIfTargetHasDOT)
- {
- CharacterStats component7 = enemy.GetComponent<CharacterStats>();
- if (component7 != null && component7.CountDOTs() > 0)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.CanCripple)
- {
- if (UnityEngine.Random.Range(0f, 1f) < currentAppliedValue)
- {
- CharacterStats component8 = enemy.GetComponent<CharacterStats>();
- if (component8)
- {
- StatusEffect statusEffect3 = StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.MovementRate,
- Duration = 30f,
- Value = -3f
- }, this.AbilityType, damage, true);
- statusEffect3.EquipmentOrigin = this.EquipmentOrigin;
- component8.ApplyStatusEffect(statusEffect3);
- }
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultOnLowStaminaTarget)
- {
- Health component9 = enemy.GetComponent<Health>();
- if (component9 != null && component9.CurrentStamina / component9.MaxStamina < 0.15f)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.CanStunOnCrit)
- {
- if (damage.IsCriticalHit)
- {
- CharacterStats component10 = attacker.GetComponent<CharacterStats>();
- if (component10)
- {
- DamageInfo damageInfo2 = component10.ComputeSecondaryAttack(damage.Attack, enemy, CharacterStats.DefenseType.Fortitude);
- List<StatusEffect> list2 = new List<StatusEffect>();
- if (damageInfo2.HitType != HitType.MISS)
- {
- CharacterStats component11 = enemy.GetComponent<CharacterStats>();
- if (component11)
- {
- StatusEffect statusEffect4 = StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.Stunned,
- Duration = 5f
- }, this.AbilityType, damage, true);
- list2.Add(statusEffect4);
- statusEffect4.EquipmentOrigin = this.EquipmentOrigin;
- component11.ApplyStatusEffect(statusEffect4);
- }
- }
- AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo2, list2);
- }
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.BonusDamageProc)
- {
- float num3 = currentAppliedValue;
- if (this.m_abilityOrigin != null && this.m_abilityOrigin is Wildstrike)
- {
- CharacterStats component12 = attacker.GetComponent<CharacterStats>();
- if (component12 != null)
- {
- num3 *= component12.WildstrikeDamageMult;
- }
- }
- DamagePacket.DamageProcType item2 = new DamagePacket.DamageProcType(this.Params.DmgType, num3 / 100f);
- damage.Damage.DamageProc.Add(item2);
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.ApplyAttackEffects)
- {
- if (this.Params.AttackPrefab != null)
- {
- List<StatusEffect> appliedEffects = new List<StatusEffect>();
- List<StatusEffect> list3 = new List<StatusEffect>();
- this.Params.AttackPrefab.ApplyStatusEffects(enemy, damage, true, appliedEffects);
- DamageInfo damageInfo3 = this.Params.AttackPrefab.ApplyAfflictions(enemy, damage, true, appliedEffects, list3);
- this.Params.AttackPrefab.PushEnemy(enemy, this.Params.AttackPrefab.PushDistance, null, null);
- if (this.Params.AttackPrefab.ExtraAOE != null)
- {
- AttackAOE attackAOE = UnityEngine.Object.Instantiate(this.Params.AttackPrefab.ExtraAOE) as AttackAOE;
- attackAOE.Owner = attacker;
- attackAOE.transform.parent = attacker.transform;
- attackAOE.SkipAnimation = true;
- attackAOE.Launch(enemy);
- }
- GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitAttackerVisualEffect, attacker.transform.position, Quaternion.identity, 1f, attacker.transform);
- GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitGroundVisualEffect, 1f, enemy.transform.position);
- Transform hitTransform = this.Params.AttackPrefab.GetHitTransform(enemy);
- GameUtilities.LaunchEffect(this.Params.AttackPrefab.OnHitVisualEffect, hitTransform.position, hitTransform.rotation, 1f, hitTransform);
- if (this.Params.AttackPrefab.AbilityOrigin != null)
- {
- this.Params.AttackPrefab.AbilityOrigin.Deactivate(attacker);
- }
- AttackBase.s_NoDamage = true;
- AttackBase.PostAttackMessages(enemy, damage, appliedEffects, true);
- AttackBase.s_NoDamage = false;
- if (damageInfo3 != null && damageInfo3 != damage)
- {
- AttackBase.PostAttackMessagesSecondaryEffect(enemy, damageInfo3, list3);
- }
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.DamageMultByRace)
- {
- CharacterStats component13 = enemy.GetComponent<CharacterStats>();
- if (component13 != null && component13.CharacterRace == this.Params.RaceType)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.SpellDamageMult)
- {
- 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))
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.BonusDamageMultOnFlankedTarget)
- {
- CharacterStats component14 = enemy.GetComponent<CharacterStats>();
- if (component14 != null & component14.HasStatusEffectFromAffliction(AfflictionData.Flanked))
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- if (affectsStat != StatusEffect.ModifiedStat.ApplyFinishingBlowDamage)
- {
- return;
- }
- CharacterStats component15 = attacker.GetComponent<CharacterStats>();
- if (component15 != null)
- {
- foreach (GenericAbility current2 in component15.ActiveAbilities)
- {
- if (current2 is FinishingBlow)
- {
- (current2 as FinishingBlow).AdjustDamage(ref damage, enemy);
- break;
- }
- }
- }
- return;
- }
- }
- break;
- case StatusEffect.ModifiedStat.BonusDamageMultAtLowStamina:
- {
- Health component16 = attacker.GetComponent<Health>();
- if (component16.StaminaPercentage <= this.Params.ExtraValue)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- case StatusEffect.ModifiedStat.BonusDamageMultOnKDSFTarget:
- {
- bool flag = false;
- CharacterStats component17 = enemy.GetComponent<CharacterStats>();
- if (component17 != null)
- {
- flag = (component17.HasStatusEffectOfType(StatusEffect.ModifiedStat.KnockedDown) || component17.HasStatusEffectOfType(StatusEffect.ModifiedStat.Stunned) || component17.HasStatusEffectFromAffliction(AfflictionData.Flanked));
- }
- if (flag)
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- case StatusEffect.ModifiedStat.DamagePlusDOT:
- {
- CharacterStats component18 = enemy.GetComponent<CharacterStats>();
- if (component18)
- {
- StatusEffect statusEffect5 = StatusEffect.Create(attacker, new StatusEffectParams
- {
- Apply = StatusEffect.ApplyType.ApplyOverTime,
- AffectsStat = StatusEffect.ModifiedStat.Damage,
- DmgType = damage.Damage.Type,
- IntervalRate = StatusEffectParams.IntervalRateType.Damage,
- Duration = this.Params.ExtraValue,
- Value = damage.DamageAmount * currentAppliedValue,
- IsHostile = true
- }, this.AbilityType, damage, true);
- statusEffect5.EquipmentOrigin = this.EquipmentOrigin;
- component18.ApplyStatusEffect(statusEffect5);
- }
- return;
- }
- }
- goto IL_74;
- case StatusEffect.ModifiedStat.CanStun:
- if (UnityEngine.Random.Range(0f, 1f) < currentAppliedValue)
- {
- CharacterStats component19 = enemy.GetComponent<CharacterStats>();
- if (component19)
- {
- StatusEffect statusEffect6 = StatusEffect.Create(attacker, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.Stunned,
- Duration = 5f
- }, this.AbilityType, damage, true);
- statusEffect6.EquipmentOrigin = this.EquipmentOrigin;
- component19.ApplyStatusEffect(statusEffect6);
- }
- }
- return;
- }
- goto IL_4F;
- }
- public void WhenHit(GameObject attacker, GameObject enemy, ref DamageInfo damage)
- {
- if (!this.m_applied)
- {
- return;
- }
- if (attacker == enemy)
- {
- return;
- }
- float currentAppliedValue = this.CurrentAppliedValue;
- StatusEffect.ModifiedStat affectsStat = this.Params.AffectsStat;
- switch (affectsStat)
- {
- case StatusEffect.ModifiedStat.DamageToStamina:
- if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
- {
- Health component = enemy.GetComponent<Health>();
- if (component != null)
- {
- float amount = damage.DamageAmount * currentAppliedValue;
- component.AddStamina(amount);
- }
- }
- return;
- case StatusEffect.ModifiedStat.ChanterPhraseAoEMult:
- case StatusEffect.ModifiedStat.BonusHealMult:
- IL_4A:
- if (affectsStat == StatusEffect.ModifiedStat.AttackOnMeleeHit)
- {
- if (damage.Attack is AttackMelee && this.m_params.AttackPrefab != null && attacker != null)
- {
- AttackBase attackBase = UnityEngine.Object.Instantiate(this.Params.AttackPrefab) as AttackBase;
- attackBase.Owner = enemy;
- attackBase.transform.parent = enemy.transform;
- attackBase.SkipAnimation = true;
- attackBase.Launch(attacker);
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.MinorSpellReflection)
- {
- this.SpellReflect(3, attacker, enemy, ref damage);
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.DOTOnHit)
- {
- if (enemy != null)
- {
- CharacterStats component2 = enemy.GetComponent<CharacterStats>();
- if (component2)
- {
- component2.ApplyStatusEffect(StatusEffect.Create(attacker, new StatusEffectParams
- {
- Apply = StatusEffect.ApplyType.ApplyOverTime,
- AffectsStat = StatusEffect.ModifiedStat.Damage,
- DmgType = this.Params.DmgType,
- IntervalRate = StatusEffectParams.IntervalRateType.Damage,
- Duration = 10f,
- Value = currentAppliedValue,
- IsHostile = true
- }, this.AbilityType, damage, true));
- }
- }
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.SpellReflection)
- {
- this.SpellReflect(5, attacker, enemy, ref damage);
- return;
- }
- if (affectsStat == StatusEffect.ModifiedStat.RangedGrazeReflection)
- {
- this.RangedGrazeReflect((int)currentAppliedValue, attacker, enemy, ref damage);
- return;
- }
- if (affectsStat != StatusEffect.ModifiedStat.DamageToStaminaRegen)
- {
- return;
- }
- if (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type)
- {
- Health component3 = enemy.GetComponent<Health>();
- CharacterStats component4 = enemy.GetComponent<CharacterStats>();
- if (component4 != null && component3 != null)
- {
- component4.ApplyStatusEffect(StatusEffect.Create(enemy, new StatusEffectParams
- {
- AffectsStat = StatusEffect.ModifiedStat.Stamina,
- Value = damage.DamageAmount * currentAppliedValue,
- Duration = this.Params.ExtraValue,
- IntervalRate = StatusEffectParams.IntervalRateType.Damage,
- Apply = StatusEffect.ApplyType.ApplyOverTime
- }, this.AbilityType, damage, true));
- }
- }
- return;
- case StatusEffect.ModifiedStat.IncomingCritDamageMult:
- if (damage.IsCriticalHit && (this.Params.DmgType == DamagePacket.DamageType.All || this.Params.DmgType == damage.Damage.Type))
- {
- damage.DamageAmount *= currentAppliedValue;
- }
- return;
- }
- goto IL_4A;
- }
- private void SpellReflect(int spellLevel, GameObject attacker, GameObject enemy, ref DamageInfo damage)
- {
- if (damage == null || damage.Attack == null)
- {
- return;
- }
- GenericAbility abilityOrigin = damage.Attack.AbilityOrigin;
- if (abilityOrigin != null && attacker != null && enemy != null && abilityOrigin is GenericSpell && !(damage.Attack is AttackAOE) && damage.AttackIsHostile)
- {
- GenericSpell genericSpell = abilityOrigin as GenericSpell;
- if (genericSpell.SpellLevel <= spellLevel)
- {
- this.m_generalCounter += (uint)genericSpell.SpellLevel;
- if (this.m_generalCounter <= this.m_params.Value)
- {
- CharacterStats component = enemy.GetComponent<CharacterStats>();
- if (component != null)
- {
- DamageInfo damageInfo = component.ComputeSecondaryAttack(damage.Attack, attacker, CharacterStats.DefenseType.Will);
- AttackBase.PostAttackMessages(attacker, enemy, damageInfo, null, true);
- if (damageInfo.HitType != HitType.MISS)
- {
- damage.IsMiss = true;
- damage.IsGraze = false;
- damage.IsCriticalHit = false;
- damage.DamageAmount = 0f;
- damage.HitTypeChangeAbility = this.AbilityOrigin;
- if (damage.Attack is AttackRanged)
- {
- Transform hitTransform = damage.Attack.GetHitTransform(attacker);
- (damage.Attack as AttackRanged).ProjectileLaunch(enemy.transform.position, hitTransform.position, attacker, 0, true);
- }
- else
- {
- damage.Attack.StartCoroutine(damage.Attack.OnImpactDelay(0.5f, damage.Attack.gameObject, attacker));
- }
- }
- }
- }
- if (this.m_generalCounter >= this.m_params.Value)
- {
- this.RemoveEffect();
- }
- }
- }
- }
- private void RangedGrazeReflect(int accuracyAdjustment, GameObject attacker, GameObject enemy, ref DamageInfo damage)
- {
- 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))
- {
- damage.IsMiss = true;
- damage.IsGraze = false;
- damage.IsCriticalHit = false;
- damage.DamageAmount = 0f;
- AttackRanged attackRanged = damage.Attack as AttackRanged;
- attackRanged.AccuracyBonus += accuracyAdjustment;
- Transform hitTransform = damage.Attack.GetHitTransform(attacker);
- attackRanged.ProjectileLaunch(enemy.transform.position, hitTransform.position, attacker, 0, true);
- }
- }
- private int AdjustDefenseAffliction(CharacterStats.DefenseType defenseType, AttackBase attack, GameObject enemy)
- {
- if (attack != null && attack.HasAffliction(this.Params.AfflictionPrefab))
- {
- return (int)this.Params.Value;
- }
- return 0;
- }
- private int AdjustDefenseKeyword(CharacterStats.DefenseType defenseType, AttackBase attack, GameObject enemy)
- {
- if (attack != null && attack.HasKeyword(this.Params.Keyword))
- {
- return (int)this.Params.Value;
- }
- return 0;
- }
- private void HandleDestroyOnDeath(GameObject obj, GameEventArgs args)
- {
- this.RemoveEffect();
- UnityEngine.Object.DestroyObject(obj, 10f);
- }
- public void Reset()
- {
- if (this.m_applied)
- {
- this.ClearEffect(this.m_target);
- }
- this.m_timeActive = 0f;
- this.m_intervalTimer = 0f;
- this.m_intervalCount = 0u;
- this.m_auraTargetsApplied.Clear();
- this.m_auraTargetsUnapplied.Clear();
- if (this.m_abilityOrigin != null)
- {
- this.m_abilityOrigin.AuraTargetsWhoDefended.Clear();
- }
- this.m_triggerCount = 0;
- this.m_needsDurationCalculated = true;
- }
- public void Suspend()
- {
- if (this.m_suspensionCount == 0u)
- {
- this.ClearEffect(this.m_target);
- }
- this.m_suspensionCount += 1u;
- }
- public void Unsuspend()
- {
- if (this.m_suspensionCount > 0u)
- {
- this.m_suspensionCount -= 1u;
- if (this.m_suspensionCount == 0u)
- {
- this.ApplyEffect(this.m_target);
- }
- }
- }
- public void Suppress()
- {
- if (!this.m_suppressed)
- {
- this.ClearEffect(this.m_target);
- this.m_suppressed = true;
- }
- }
- public void Unsuppress()
- {
- if (this.m_suppressed)
- {
- this.m_suppressed = false;
- this.ApplyEffect(this.m_target);
- }
- }
- public void FocusBreak()
- {
- if (this.DurationAfterBreak <= 0f)
- {
- return;
- }
- this.Duration = this.DurationAfterBreak;
- this.DurationAfterBreak = 0f;
- this.m_timeActive = 0f;
- if (this.TicksAfterBreak)
- {
- this.m_intervalTimer = this.Params.Interval;
- }
- else
- {
- this.m_intervalTimer = this.Duration;
- }
- }
- public void AddTriggerCallback()
- {
- if (this.m_triggerCallbackSet || this.Params.TriggerAdjustment == null)
- {
- return;
- }
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.None)
- {
- return;
- }
- 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)
- {
- Health component = this.m_target.GetComponent<Health>();
- if (component != null)
- {
- component.OnDamaged += new GameInputEventHandle(this.HandleOnDamaged);
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
- {
- component.OnHealed += new GameInputEventHandle(this.HandleOnHealed);
- }
- this.m_triggerCallbackSet = true;
- }
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
- {
- this.HandleOnDamaged(null, null);
- }
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow || this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
- {
- this.HandleOnHealed(null, null);
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.Timer)
- {
- this.m_triggerCallbackSet = true;
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMove)
- {
- Mover component2 = this.m_target.GetComponent<Mover>();
- if (component2 != null)
- {
- component2.OnMovementStarted += new EventHandler(this.HandleOnMovementStarted);
- component2.OnMovementStopped += new EventHandler(this.HandleOnMovementStopped);
- this.m_triggerCallbackSet = true;
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnKill)
- {
- Health component3 = this.m_target.GetComponent<Health>();
- if (component3 != null)
- {
- component3.OnKill += new GameInputEventHandle(this.HandleOnKill);
- this.m_triggerCallbackSet = true;
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnWeaponChange)
- {
- Equipment component4 = this.m_target.GetComponent<Equipment>();
- if (component4 != null)
- {
- component4.OnEquipmentChanged += new Equipment.EquipmentChanged(this.HandleOnWeaponChanged);
- this.m_triggerCallbackSet = true;
- }
- }
- else
- {
- Debug.Log("Unhandled trigger callback");
- }
- }
- }
- }
- }
- }
- public void RemoveTriggerCallback()
- {
- if (!this.m_triggerCallbackSet)
- {
- return;
- }
- 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)
- {
- Health component = this.m_target.GetComponent<Health>();
- if (component != null)
- {
- component.OnDamaged -= new GameInputEventHandle(this.HandleOnDamaged);
- this.m_triggerCallbackSet = false;
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.Timer)
- {
- this.m_triggerCallbackSet = false;
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMove)
- {
- Mover component2 = this.m_target.GetComponent<Mover>();
- if (component2 != null)
- {
- component2.OnMovementStarted -= new EventHandler(this.HandleOnMovementStarted);
- component2.OnMovementStopped -= new EventHandler(this.HandleOnMovementStopped);
- this.m_triggerCallbackSet = false;
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnKill)
- {
- Health component3 = this.m_target.GetComponent<Health>();
- if (component3 != null)
- {
- component3.OnKill -= new GameInputEventHandle(this.HandleOnKill);
- this.m_triggerCallbackSet = false;
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnWeaponChange)
- {
- Equipment component4 = this.m_target.GetComponent<Equipment>();
- if (component4 != null)
- {
- component4.OnEquipmentChanged -= new Equipment.EquipmentChanged(this.HandleOnWeaponChanged);
- this.m_triggerCallbackSet = false;
- }
- }
- }
- }
- }
- }
- }
- public void HandleClearingEffectOnResting()
- {
- if (this.Params.LastsUntilRest)
- {
- this.m_numRestCycles++;
- if (this.m_numRestCycles >= this.Params.MaxRestCycles)
- {
- this.RemoveEffect();
- }
- }
- }
- private void HandleOnDamaged(GameObject myObject, GameEventArgs args)
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnMiss)
- {
- DamageInfo damageInfo = (DamageInfo)args.GenericData[0];
- if (damageInfo.IsMiss)
- {
- this.OnTrigger();
- }
- }
- else
- {
- 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))
- {
- Health component = this.m_target.GetComponent<Health>();
- if (component != null && component.CurrentStamina / component.MaxStamina < this.Params.TriggerAdjustment.TriggerValue)
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
- {
- this.OffTrigger();
- }
- else
- {
- this.OnTrigger();
- }
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnTargetOfWillAttack)
- {
- DamageInfo damageInfo2 = (DamageInfo)args.GenericData[0];
- if (damageInfo2.DefendedBy == CharacterStats.DefenseType.Will)
- {
- this.OnTrigger();
- }
- }
- else
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.OnDamage)
- {
- this.OnTrigger();
- }
- }
- }
- }
- }
- private void HandleOnHealed(GameObject myObject, GameEventArgs args)
- {
- if ((this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentBelow && this.m_triggerCount == 1) || (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove && this.m_triggerCount == 0))
- {
- Health component = this.m_target.GetComponent<Health>();
- if (component != null && component.CurrentStamina / component.MaxStamina >= this.Params.TriggerAdjustment.TriggerValue)
- {
- if (this.Params.TriggerAdjustment.Type == StatusEffectTrigger.TriggerType.WhileStaminaPercentAbove)
- {
- this.OnTrigger();
- }
- else
- {
- this.OffTrigger();
- }
- }
- }
- }
- private void HandleOnMovementStarted(object sender, EventArgs e)
- {
- this.OnTrigger();
- }
- private void HandleOnMovementStopped(object sender, EventArgs e)
- {
- this.OffTrigger();
- }
- private void HandleOnKill(object sender, EventArgs e)
- {
- this.OnTrigger();
- }
- private void HandleOnWeaponChanged(Equippable.EquipmentSlot slot, Equippable oldEq, Equippable newEq)
- {
- if (slot == Equippable.EquipmentSlot.PrimaryWeapon || slot == Equippable.EquipmentSlot.SecondaryWeapon)
- {
- this.OnTrigger();
- }
- }
- public void OnTrigger()
- {
- if (this.m_triggerCount >= this.Params.TriggerAdjustment.MaxTriggerCount)
- {
- return;
- }
- if (this.Params.TriggerAdjustment.ValueAdjustment != 0f)
- {
- this.ApplyEffectHelper(this.m_target, this.Params.TriggerAdjustment.ValueAdjustment);
- }
- if (this.Params.TriggerAdjustment.DurationAdjustment != 0f)
- {
- if (this.Duration == 0f)
- {
- this.ResetTimer();
- }
- this.Duration += this.Params.TriggerAdjustment.DurationAdjustment;
- }
- if (!this.Params.TriggerAdjustment.ResetTriggerOnEffectPulse)
- {
- this.m_triggerCount++;
- if (this.m_triggerCount == this.Params.TriggerAdjustment.MaxTriggerCount && this.Params.TriggerAdjustment.RemoveEffectAtMax)
- {
- this.RemoveEffect();
- }
- }
- }
- public void OffTrigger()
- {
- if (this.m_triggerCount == 0)
- {
- return;
- }
- if (this.Params.TriggerAdjustment.ValueAdjustment != 0f)
- {
- this.ApplyEffectHelper(this.m_target, -this.Params.TriggerAdjustment.ValueAdjustment);
- }
- if (this.Params.TriggerAdjustment.DurationAdjustment != 0f)
- {
- this.Duration -= this.Params.TriggerAdjustment.DurationAdjustment;
- }
- this.m_triggerCount--;
- }
- private void HandleOnDamagedForReapply(GameObject myObject, GameEventArgs args)
- {
- this.m_damageToReapply += args.FloatData[0];
- }
- private void HandleStatsOnPreDamageAppliedForAbsorb(GameObject source, CombatEventArgs args)
- {
- if (args.Damage.DamageAmount < this.m_damageToAbsorb)
- {
- global::Console.AddMessage(string.Format(GUIUtils.GetText(1330), this.BundleName, args.Damage.DamageAmount.ToString("####0")), Color.white);
- this.m_damageToAbsorb -= args.Damage.DamageAmount;
- args.Damage.DamageAmount = 0f;
- }
- else
- {
- global::Console.AddMessage(string.Format(GUIUtils.GetText(1331), this.BundleName, this.m_damageToAbsorb.ToString("####0")), Color.white);
- args.Damage.DamageAmount -= this.m_damageToAbsorb;
- this.m_damageToAbsorb = 0f;
- this.RemoveEffect();
- }
- }
- public void ResetTimer()
- {
- this.m_timeActive = 0f;
- }
- public bool BundlesWith(StatusEffect other)
- {
- return (this.BundleName != null && this.BundleName.Equals(other.BundleName)) || (this.BundleId >= 0 && this.BundleId == other.BundleId);
- }
- public string GetDisplayName()
- {
- string text = this.BundleName;
- if (string.IsNullOrEmpty(text))
- {
- if (this.AfflictionOrigin != null)
- {
- return this.AfflictionOrigin.DisplayName.GetText();
- }
- if (this.AbilityOrigin != null)
- {
- return GenericAbility.Name(this.AbilityOrigin);
- }
- if (this.EquipmentOrigin != null)
- {
- return this.EquipmentOrigin.Name;
- }
- if (this.PhraseOrigin != null)
- {
- return this.PhraseOrigin.DisplayName.ToString();
- }
- if (this.Owner != null)
- {
- text = string.Format(GUIUtils.GetText(1313), CharacterStats.Name(this.Owner));
- }
- }
- return text;
- }
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement