Esempio n. 1
0
 private void UpdateNew()
 {
     if (this.m_bestiaryReference)
     {
         return;
     }
     this.FatigueUpdate(Time.deltaTime * (float)WorldTime.Instance.GameSecondsPerRealSecond, this.IsMoving);
     this.NoiseUpdate(Time.deltaTime);
     this.DetectUpdate(Time.deltaTime);
     this.TrapCooldownTimerUpdate(Time.deltaTime);
     if (this.m_weaponSwitchingTimer >= 0f)
     {
         this.m_weaponSwitchingTimer -= Time.deltaTime;
     }
     if (this.m_interruptTimer >= 0f)
     {
         this.m_interruptTimer -= Time.deltaTime;
     }
     if (this.CurrentGrimoireCooldown > 0f)
     {
         this.CurrentGrimoireCooldown -= Time.deltaTime;
         if (this.CurrentGrimoireCooldown < 0f)
         {
             this.CurrentGrimoireCooldown = 0f;
         }
     }
     if (!this.HasStatusEffectThatPausesRecoveryTimer())
     {
         float num = 1f;
         if (this.IsMoving && !IEModOptions.RemoveMovingRecovery)                 //MOD
         {
             num = AttackData.Instance.MovingRecoveryMult;
             if (this.m_equipment != null && this.m_equipment.PrimaryAttack != null && this.m_equipment.PrimaryAttack is AttackRanged)
             {
                 num += this.RangedMovingRecoveryReductionPct;
             }
         }
         float num2 = Time.deltaTime * num;
         if (this.m_recoveryTimer > 0f)
         {
             this.m_recoveryTimer -= num2;
         }
         for (GenericAbility.ActivationGroup activationGroup = GenericAbility.ActivationGroup.None; activationGroup < GenericAbility.ActivationGroup.Count; activationGroup++)
         {
             if (this.m_modalCooldownTimer[(int)activationGroup] > 0f)
             {
                 this.m_modalCooldownTimer[(int)activationGroup] -= num2;
             }
         }
     }
     for (int i = this.m_statusEffects.Count - 1; i >= 0; i--)
     {
         if (this.m_statusEffects[i].Expired)
         {
             StatusEffect statusEffect = this.m_statusEffects[i];
             this.m_statusEffects.RemoveAt(i);
             this.m_updateTracker = true;
             if (this.OnClearStatusEffect != null)
             {
                 this.OnClearStatusEffect(statusEffect);
             }
             statusEffect.Reset();
         }
     }
     for (int j = this.m_abilities.Count - 1; j >= 0; j--)
     {
         if (this.m_abilities[j] == null)
         {
             this.m_abilities.RemoveAt(j);
         }
         else
         {
             GenericAbility genericAbility = this.m_abilities[j];
             if (genericAbility.Passive && !genericAbility.Activated && genericAbility.Ready && genericAbility.IsLoaded)
             {
                 genericAbility.Activate();
                 this.m_updateTracker = true;
             }
         }
     }
     if (this.m_updateTracker)
     {
         this.m_updateTracker = false;
         this.ClearStackTracker();
         for (int k = 0; k < this.m_statusEffects.Count; k++)
         {
             StatusEffect statusEffect2 = this.m_statusEffects[k];
             if (!statusEffect2.IsSuspended)
             {
                 bool isSuppressed = statusEffect2.IsSuppressed;
                 bool flag         = false;
                 for (int l = 0; l < this.m_statusEffects.Count; l++)
                 {
                     if (k != l)
                     {
                         StatusEffect statusEffect3 = this.m_statusEffects[l];
                         if (!statusEffect3.IsSuspended)
                         {
                             if (statusEffect3.Suppresses(statusEffect2, k > l))
                             {
                                 flag = true;
                                 break;
                             }
                         }
                     }
                 }
                 if (isSuppressed && !flag)
                 {
                     statusEffect2.Unsuppress();
                 }
                 else if (!isSuppressed && flag)
                 {
                     statusEffect2.Suppress();
                 }
             }
         }
     }
     for (int m = 0; m < this.m_statusEffects.Count; m++)
     {
         StatusEffect statusEffect4 = this.m_statusEffects[m];
         if (statusEffect4.Stackable && !statusEffect4.HasBeenApplied)
         {
             statusEffect4.ApplyEffect(base.gameObject);
         }
         if (!statusEffect4.Stackable && !statusEffect4.IsSuspended && this.m_statusEffects.Count > 1 && !statusEffect4.IsSuppressed)
         {
             StatusEffect trackedEffect = this.GetTrackedEffect(statusEffect4.NonstackingEffectType, statusEffect4.GetStackingKey());
             int          num3          = this.m_statusEffects.IndexOf(trackedEffect);
             if (m != num3 || trackedEffect == null || trackedEffect.IsSuspended || statusEffect4.Suppresses(trackedEffect, num3 > m))
             {
                 if (trackedEffect != null && trackedEffect.Applied)
                 {
                     trackedEffect.Suppress();
                 }
                 this.AddTrackedEffect(statusEffect4);
             }
         }
     }
     if (CharacterStats.s_PlayFatigueSoundWhenNotLoading && UIInterstitialManager.Instance != null && !UIInterstitialManager.Instance.WindowActive() && !GameState.IsLoading)
     {
         IEnumerable <PartyMemberAI> onlyPrimaryPartyMembers = PartyMemberAI.OnlyPrimaryPartyMembers;
         if (onlyPrimaryPartyMembers != null)
         {
             List <PartyMemberAI> list = new List <PartyMemberAI>();
             foreach (PartyMemberAI current in onlyPrimaryPartyMembers)
             {
                 if (!(current == null))
                 {
                     CharacterStats component = current.GetComponent <CharacterStats>();
                     if (component != null && component.GetFatigueLevel() != CharacterStats.FatigueLevel.None)
                     {
                         list.Add(current);
                     }
                 }
             }
             while (list.Count > 0 && AfflictionData.Instance.TravelFatigueSoundTimer <= 0f)
             {
                 PartyMemberAI partyMemberAI = list[UnityEngine.Random.Range(0, list.Count)];
                 this.PlayPartyMemberFatigueSound(partyMemberAI);
                 list.Remove(partyMemberAI);
             }
             if (list != null)
             {
                 list.Clear();
                 list = null;
             }
         }
         CharacterStats.s_PlayFatigueSoundWhenNotLoading = false;
     }
     if (this.m_stackTracker != null)
     {
         foreach (KeyValuePair <int, Dictionary <int, StatusEffect> > current2 in this.m_stackTracker)
         {
             foreach (KeyValuePair <int, StatusEffect> current3 in current2.Value)
             {
                 StatusEffect value = current3.Value;
                 if (value != null)
                 {
                     if (!value.HasBeenApplied)
                     {
                         value.Unsuppress();
                         value.ApplyEffect(base.gameObject);
                     }
                 }
             }
         }
     }
     for (int n = 0; n < this.m_statusEffects.Count; n++)
     {
         this.m_statusEffects[n].Update();
     }
     if (this.IsPartyMember && GameCursor.CharacterUnderCursor && this.m_equipment)
     {
         PartyMemberAI component2 = base.GetComponent <PartyMemberAI>();
         if (component2 && component2.Selected)
         {
             for (int num4 = 0; num4 < this.m_abilities.Count; num4++)
             {
                 FlankingAbility flankingAbility = this.m_abilities[num4] as FlankingAbility;
                 if (flankingAbility && flankingAbility.CanSneakAttackEnemy(GameCursor.CharacterUnderCursor, this.m_equipment.PrimaryAttack))
                 {
                     if (GameCursor.DesiredCursor == GameCursor.CursorType.Attack)
                     {
                         GameCursor.DesiredCursor = GameCursor.CursorType.AttackAdvantage;
                     }
                     GameState.s_playerCharacter.WantsAttackAdvantageCursor = true;
                     break;
                 }
             }
         }
     }
     if (this.IsPartyMember && !GameState.InCombat && !TimeController.Instance.Paused)
     {
         int maxLevelCanLevelUpTo = this.GetMaxLevelCanLevelUpTo();
         if (maxLevelCanLevelUpTo > this.Level && maxLevelCanLevelUpTo > this.m_NotifiedLevel)
         {
             GameUtilities.LaunchEffect(InGameHUD.Instance.LevelUpVfx, 1f, base.transform, null);
             UIHealthstringManager.Instance.ShowNotice(GUIUtils.GetText(807), base.gameObject, 2.5f);
             this.m_NotifiedLevel = this.GetMaxLevelCanLevelUpTo();
         }
     }
     if (CharacterStats.DebugStats)
     {
         Faction component3 = base.GetComponent <Faction>();
         if (component3 != null && component3.MousedOver)
         {
             UIDebug.Instance.SetText("Character Stats Debug", this.GetCharacterStatsDebugOutput(), Color.cyan);
             UIDebug.Instance.SetTextPosition("Character Stats Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
         }
     }
 }
Esempio n. 2
0
 private void UpdateNew()
 {
     if (this.m_bestiaryReference)
     {
         return;
     }
     this.NoiseUpdate(Time.deltaTime);
     this.DetectUpdate(Time.deltaTime);
     this.TrapCooldownTimerUpdate(Time.deltaTime);
     if (this.m_weaponSwitchingTimer >= 0f)
     {
         CharacterStats mWeaponSwitchingTimer = this;
         mWeaponSwitchingTimer.m_weaponSwitchingTimer = mWeaponSwitchingTimer.m_weaponSwitchingTimer - Time.deltaTime;
     }
     if (this.m_interruptTimer >= 0f)
     {
         CharacterStats mInterruptTimer = this;
         mInterruptTimer.m_interruptTimer = mInterruptTimer.m_interruptTimer - Time.deltaTime;
     }
     if (this.CurrentGrimoireCooldown > 0f)
     {
         CharacterStats currentGrimoireCooldown = this;
         currentGrimoireCooldown.CurrentGrimoireCooldown = currentGrimoireCooldown.CurrentGrimoireCooldown - Time.deltaTime;
         if (this.CurrentGrimoireCooldown < 0f)
         {
             this.CurrentGrimoireCooldown = 0f;
         }
     }
     if (!this.HasStatusEffectThatPausesRecoveryTimer())
     {
         float movingRecoveryMult = 1f;
         if (this.IsMoving && !IEModOptions.RemoveMovingRecovery) //IEMOD - Modded line
         {
             movingRecoveryMult = AttackData.Instance.MovingRecoveryMult;
             if (this.m_equipment != null && this.m_equipment.PrimaryAttack != null && this.m_equipment.PrimaryAttack is AttackRanged)
             {
                 movingRecoveryMult = movingRecoveryMult + this.RangedMovingRecoveryReductionPct;
             }
         }
         float single = Time.deltaTime * movingRecoveryMult;
         if (this.m_recoveryTimer > 0f)
         {
             CharacterStats mRecoveryTimer = this;
             mRecoveryTimer.m_recoveryTimer = mRecoveryTimer.m_recoveryTimer - single;
         }
         for (GenericAbility.ActivationGroup i = GenericAbility.ActivationGroup.None; i < GenericAbility.ActivationGroup.Count; i = (GenericAbility.ActivationGroup)((int)i + (int)GenericAbility.ActivationGroup.A))
         {
             if (this.m_modalCooldownTimer[(int)i] > 0f)
             {
                 this.m_modalCooldownTimer[(int)i] = this.m_modalCooldownTimer[(int)i] - single;
             }
         }
     }
     for (int j = this.m_statusEffects.Count - 1; j >= 0; j--)
     {
         if (this.m_statusEffects[j].Expired)
         {
             StatusEffect item = this.m_statusEffects[j];
             this.m_statusEffects.RemoveAt(j);
             this.m_updateTracker = true;
             if (this.OnClearStatusEffect != null)
             {
                 this.OnClearStatusEffect(base.gameObject, item);
             }
             item.Reset();
         }
     }
     for (int k = this.m_abilities.Count - 1; k >= 0; k--)
     {
         if (this.m_abilities[k] != null)
         {
             GenericAbility genericAbility = this.m_abilities[k];
             if (genericAbility.Passive && !genericAbility.Activated && genericAbility.Ready && genericAbility.IsLoaded)
             {
                 genericAbility.Activate();
                 this.m_updateTracker = true;
             }
         }
         else
         {
             this.m_abilities.RemoveAt(k);
         }
     }
     if (this.m_updateTracker)
     {
         this.m_updateTracker = false;
         this.ClearStackTracker();
         for (int l = 0; l < this.m_statusEffects.Count; l++)
         {
             StatusEffect statusEffect = this.m_statusEffects[l];
             if (!statusEffect.IsSuspended)
             {
                 bool isSuppressed = statusEffect.IsSuppressed;
                 bool flag         = false;
                 for (int m = 0; m < this.m_statusEffects.Count; m++)
                 {
                     if (l != m)
                     {
                         StatusEffect item1 = this.m_statusEffects[m];
                         if (!item1.IsSuspended)
                         {
                             if (item1.Suppresses(statusEffect, l > m))
                             {
                                 flag = true;
                                 break;
                             }
                         }
                     }
                 }
                 if (isSuppressed && !flag)
                 {
                     statusEffect.Unsuppress();
                 }
                 else if (!isSuppressed && flag)
                 {
                     statusEffect.Suppress();
                 }
             }
         }
     }
     for (int n = 0; n < this.m_statusEffects.Count; n++)
     {
         StatusEffect statusEffect1 = this.m_statusEffects[n];
         if (statusEffect1.Stackable)
         {
             if (!statusEffect1.HasBeenApplied)
             {
                 statusEffect1.ApplyEffect(base.gameObject);
             }
         }
         else if (!statusEffect1.IsSuspended && !statusEffect1.IsSuppressed)
         {
             StatusEffect trackedEffect = this.GetTrackedEffect(statusEffect1.NonstackingEffectType, statusEffect1.GetStackingKey());
             int          num           = this.m_statusEffects.IndexOf(trackedEffect);
             if (trackedEffect == null || trackedEffect.IsSuspended || statusEffect1.Suppresses(trackedEffect, num > n))
             {
                 if (trackedEffect != null && trackedEffect.Applied)
                 {
                     trackedEffect.Suppress();
                 }
                 this.AddTrackedEffect(statusEffect1);
             }
         }
     }
     if (CharacterStats.s_PlayFatigueSoundWhenNotLoading && UIInterstitialManager.Instance != null && !UIInterstitialManager.Instance.WindowActive() && !GameState.IsLoading)
     {
         IEnumerable <PartyMemberAI> onlyPrimaryPartyMembers = PartyMemberAI.OnlyPrimaryPartyMembers;
         if (onlyPrimaryPartyMembers != null)
         {
             List <PartyMemberAI>        partyMemberAIs = new List <PartyMemberAI>();
             CharacterStats              component      = null;
             IEnumerator <PartyMemberAI> enumerator     = onlyPrimaryPartyMembers.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     PartyMemberAI current = enumerator.Current;
                     if (current != null)
                     {
                         component = current.GetComponent <CharacterStats>();
                         if (!(component != null) || component.CurrentFatigueLevel == CharacterStats.FatigueLevel.None)
                         {
                             continue;
                         }
                         partyMemberAIs.Add(current);
                     }
                 }
             }
             finally
             {
                 if (enumerator == null)
                 {
                 }
                 enumerator.Dispose();
             }
             while (partyMemberAIs.Count > 0 && AfflictionData.Instance.TravelFatigueSoundTimer <= 0f)
             {
                 PartyMemberAI partyMemberAI = partyMemberAIs[OEIRandom.Index(partyMemberAIs.Count)];
                 this.PlayPartyMemberFatigueSound(partyMemberAI);
                 partyMemberAIs.Remove(partyMemberAI);
             }
             if (partyMemberAIs != null)
             {
                 partyMemberAIs.Clear();
                 partyMemberAIs = null;
             }
         }
         CharacterStats.s_PlayFatigueSoundWhenNotLoading = false;
     }
     if (this.m_stackTracker != null)
     {
         foreach (KeyValuePair <int, Dictionary <int, StatusEffect> > mStackTracker in this.m_stackTracker)
         {
             foreach (KeyValuePair <int, StatusEffect> value in mStackTracker.Value)
             {
                 StatusEffect value1 = value.Value;
                 if (value1 == null || value1.HasBeenApplied)
                 {
                     continue;
                 }
                 value1.Unsuppress();
                 value1.ApplyEffect(base.gameObject);
             }
         }
     }
     for (int o = 0; o < this.m_statusEffects.Count; o++)
     {
         this.m_statusEffects[o].Update();
     }
     if (this.IsPartyMember && GameCursor.CharacterUnderCursor && this.m_equipment)
     {
         PartyMemberAI component1 = base.GetComponent <PartyMemberAI>();
         if (component1 && component1.Selected)
         {
             int num1 = 0;
             while (num1 < this.m_abilities.Count)
             {
                 FlankingAbility flankingAbility = this.m_abilities[num1] as FlankingAbility;
                 if (!flankingAbility || !flankingAbility.CanSneakAttackEnemy(GameCursor.CharacterUnderCursor, this.m_equipment.PrimaryAttack))
                 {
                     num1++;
                 }
                 else
                 {
                     if (GameCursor.DesiredCursor == GameCursor.CursorType.Attack)
                     {
                         GameCursor.DesiredCursor = GameCursor.CursorType.AttackAdvantage;
                     }
                     GameState.s_playerCharacter.WantsAttackAdvantageCursor = true;
                     break;
                 }
             }
         }
     }
     if (this.IsPartyMember && !GameState.InCombat && !TimeController.Instance.Paused)
     {
         int maxLevelCanLevelUpTo = this.GetMaxLevelCanLevelUpTo();
         if (maxLevelCanLevelUpTo > this.Level && maxLevelCanLevelUpTo > this.m_NotifiedLevel)
         {
             GameUtilities.LaunchEffect(InGameHUD.Instance.LevelUpVfx, 1f, base.transform, null);
             UIHealthstringManager.Instance.ShowNotice(GUIUtils.GetText(807), base.gameObject, 2.5f);
             this.m_NotifiedLevel = this.GetMaxLevelCanLevelUpTo();
         }
     }
     if (CharacterStats.DebugStats)
     {
         Faction faction = base.GetComponent <Faction>();
         if (faction != null && faction.MousedOver)
         {
             UIDebug.Instance.SetText("Character Stats Debug", this.GetCharacterStatsDebugOutput(), Color.cyan);
             UIDebug.Instance.SetTextPosition("Character Stats Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
         }
     }
 }