// Update is called once per frame void Update() { if (Input.GetButtonDown("Ability1")) { if (currentAbility) { // when player can choose different items but to chosen item in currentability currentAbility = abilityNames[0]; StartCoroutine(AbilityCoroutine(currentAbility.Duration)); Debug.Log("Ability1"); } } if (Input.GetButtonDown("Ability2")) { if (currentAbility) { currentAbility = abilityNames[1]; StartCoroutine(AbilityCoroutine(currentAbility.Duration)); Debug.Log("Ability2"); } } if (Input.GetButtonDown("Ability3")) { if (currentAbility) { currentAbility = abilityNames[2]; StartCoroutine(AbilityCoroutine(currentAbility.Duration)); Debug.Log("Ability3"); } } }
private void OnUndocked(GenericShip dockingHost) { dockingHost.OnCanReleaseDockedShipRegular -= DenyRelease; HostShip.PilotInfo = new PilotCardInfo( dockingHost.PilotInfo.PilotName, dockingHost.PilotInfo.Initiative, 6, isLimited: true, charges: dockingHost.PilotInfo.Charges, regensCharges: dockingHost.PilotInfo.RegensCharges ); Type pilotAbilityType = dockingHost.PilotInfo.AbilityType; if (pilotAbilityType != null) { GenericAbility pilotAbility = (GenericAbility)System.Activator.CreateInstance(pilotAbilityType); pilotAbility.Initialize(HostShip); HostShip.PilotAbilities.Add(pilotAbility); } HostShip.InitializeState(); Roster.UpdateShipStats(HostShip); }
private void CopyPilotAbilityToHost(GenericShip ship) { GenericAbility abilityCopy = (GenericAbility)Activator.CreateInstance(HostShip.PilotInfo.AbilityType); HostShip.DockingHost.PilotAbilities.Add(abilityCopy); abilityCopy.Initialize(HostShip.DockingHost); }
public static bool mod_ShowOnSpellBar(GenericAbility ability, CharacterStats stats, int spellLevel) { if (ability.Passive) { return false; } GenericSpell genericSpell = ability as GenericSpell; GenericCipherAbility genericCipherAbility = ability as GenericCipherAbility; if (!genericSpell) { return genericCipherAbility && (spellLevel <= 0 || genericCipherAbility.SpellLevel == spellLevel); } if (genericSpell.SpellClass != stats.CharacterClass && spellLevel > 0 && genericSpell.SpellLevel == spellLevel && IEModOptions.HideAnticlassSpells) { return true; } if (genericSpell.SpellClass != stats.CharacterClass || (spellLevel > 0 && genericSpell.SpellLevel != spellLevel)) { return false; } if (stats.CharacterClass != CharacterStats.Class.Wizard || !genericSpell.NeedsGrimoire) { return true; } Equipment component = stats.GetComponent<Equipment>(); if (component == null || component.CurrentItems == null || component.CurrentItems.Grimoire == null) { return false; } Grimoire component2 = component.CurrentItems.Grimoire.GetComponent<Grimoire>(); return !(component2 == null) && component2.HasSpell(genericSpell); }
private void RemovePilotAbilityFromHost(GenericShip ship) { GenericAbility copiedAbility = HostShip.DockingHost.PilotAbilities.First(n => n.GetType() == HostShip.PilotInfo.AbilityType); copiedAbility.DeactivateAbility(); HostShip.DockingHost.PilotAbilities.Remove(copiedAbility); }
/// <summary> /// Restore spell usages /// Direct call to Scripts AdvanceTimeByHoursNoRest /// </summary> public static void RestoreSpellsAndAbility() { GameObject underCursor = GameCursor.CharacterUnderCursor; CharacterStats stats = underCursor.GetComponent <CharacterStats>(); if (stats) { for (int i = 0; i < stats.SpellCastCount.Length; i++) { stats.SpellCastCount[i] = 0; } } IEnumerator <GenericAbility> enumerator = stats.ActiveAbilities.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericAbility current = enumerator.Current; if (current == null) { continue; } current.RestoreCooldown(); } } finally { if (enumerator == null) { } enumerator.Dispose(); } }
/// <summary> /// Adds a new Generic Ability to the Ability List. /// Then it saves the list and refreshes the Panel. /// </summary> public void AddNewAbility() { GenericAbility ability = new GenericAbility(); Abilities.Add(ability); Save(); RefreshMenuItems(); }
public float GetCurrentBonusMultiplierNew(global::CharacterStats stats, GenericAbility abilityOrigin) { if (stats == null) { return(1f); } float bonus = 0f; if (IEModOptions.NPCDispositionFix || (GameState.s_playerCharacter != null && stats.gameObject == GameState.s_playerCharacter.gameObject)) // added ((Mod_GameOptions_GameMode)GameState.Mode).NPCDispositionFix || { float single = 1f; if (abilityOrigin != null) { single = single * abilityOrigin.GatherAbilityModProduct(AbilityMod.AbilityModType.NegativeReligiousTraitMultiplier); } if (stats.CharacterClass == CharacterStats.Class.Priest) { global::Religion.DeityData deityDatum = this.FindDeityData(stats.Deity); if (deityDatum != null) { bonus = bonus + this.GetBonus(deityDatum.PositiveTrait[0], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(deityDatum.PositiveTrait[1], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(deityDatum.NegativeTrait[0], this.NegativeTraitBonus) * single; bonus = bonus + this.GetBonus(deityDatum.NegativeTrait[1], this.NegativeTraitBonus) * single; } } else if (stats.CharacterClass == CharacterStats.Class.Paladin) { global::Religion.PaladinOrderData paladinOrderDatum = this.FindPaladinOrderData(stats.PaladinOrder); if (paladinOrderDatum != null) { /* patching in dis/favored dispositions for Pallegina's order */ if (stats.PaladinOrder == PaladinOrder.FrermasMesCancSuolias) { var favored1 = IEModOptions.PalleginaFavored1; var favored2 = IEModOptions.PalleginaFavored2; var disfavored1 = IEModOptions.PalleginaDisfavored1; var disfavored2 = IEModOptions.PalleginaDisfavored2; paladinOrderDatum.PositiveTrait = new Disposition.Axis[2]; paladinOrderDatum.PositiveTrait[0] = favored1; paladinOrderDatum.PositiveTrait[1] = favored2; paladinOrderDatum.NegativeTrait = new Disposition.Axis[2]; paladinOrderDatum.NegativeTrait[0] = disfavored1; paladinOrderDatum.NegativeTrait[1] = disfavored2; } /**************************************************************************************/ bonus = bonus + this.GetBonus(paladinOrderDatum.PositiveTrait[0], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(paladinOrderDatum.PositiveTrait[1], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(paladinOrderDatum.NegativeTrait[0], this.NegativeTraitBonus) * single; bonus = bonus + this.GetBonus(paladinOrderDatum.NegativeTrait[1], this.NegativeTraitBonus) * single; } } } bonus = bonus + 1f; return(bonus); }
public float GetCurrentBonusMultiplierNew(CharacterStats stats, GenericAbility abilityOrigin) { if (stats == null) { return 1f; } float bonus = 0f; if (IEModOptions.NPCDispositionFix || (GameState.s_playerCharacter != null && stats.gameObject == GameState.s_playerCharacter.gameObject)) // added ((Mod_GameOptions_GameMode)GameState.Mode).NPCDispositionFix || { float single = 1f; if (abilityOrigin != null) { single = single * abilityOrigin.GatherAbilityModProduct(AbilityMod.AbilityModType.NegativeReligiousTraitMultiplier); } if (stats.CharacterClass == CharacterStats.Class.Priest) { global::Religion.DeityData deityDatum = this.FindDeityData(stats.Deity); if (deityDatum != null) { bonus = bonus + this.GetBonus(deityDatum.PositiveTrait[0], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(deityDatum.PositiveTrait[1], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(deityDatum.NegativeTrait[0], this.NegativeTraitBonus) * single; bonus = bonus + this.GetBonus(deityDatum.NegativeTrait[1], this.NegativeTraitBonus) * single; } } else if (stats.CharacterClass == CharacterStats.Class.Paladin) { global::Religion.PaladinOrderData paladinOrderDatum = this.FindPaladinOrderData(stats.PaladinOrder); if (paladinOrderDatum != null) { /* patching in dis/favored dispositions for Pallegina's order */ if (stats.PaladinOrder == PaladinOrder.FrermasMesCancSuolias) { var favored1 = IEModOptions.PalleginaFavored1; var favored2 = IEModOptions.PalleginaFavored2; var disfavored1 = IEModOptions.PalleginaDisfavored1; var disfavored2 = IEModOptions.PalleginaDisfavored2; paladinOrderDatum.PositiveTrait = new Disposition.Axis[2]; paladinOrderDatum.PositiveTrait[0] = favored1; paladinOrderDatum.PositiveTrait[1] = favored2; paladinOrderDatum.NegativeTrait = new Disposition.Axis[2]; paladinOrderDatum.NegativeTrait[0] = disfavored1; paladinOrderDatum.NegativeTrait[1] = disfavored2; } /**************************************************************************************/ bonus = bonus + this.GetBonus(paladinOrderDatum.PositiveTrait[0], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(paladinOrderDatum.PositiveTrait[1], this.PositiveTraitBonus); bonus = bonus + this.GetBonus(paladinOrderDatum.NegativeTrait[0], this.NegativeTraitBonus) * single; bonus = bonus + this.GetBonus(paladinOrderDatum.NegativeTrait[1], this.NegativeTraitBonus) * single; } } } bonus = bonus + 1f; return bonus; }
/// <summary> /// Iterates all abilities on the /// </summary> protected void setupAbilities() { if (info.isUnit || info.isPseudoUnit) { _accumulatedModifier = new UnitAbility(); } else if (info.isBuilding) { _accumulatedModifier = new BuildingAbility(); } else { _accumulatedModifier = new ResourceAbility(); } foreach (EntityAbility ability in info.abilities) { // Try to get class with this name string abilityName = ability.ability.Replace(" ", ""); if (abilityName.Length == 0) { abilityName = ability.name.Replace(" ", ""); } Ability newAbility = null; try { var constructor = Type.GetType(abilityName). GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(UnitAbility), typeof(GameObject) }, null); if (constructor == null) { // Invalid constructor, use GenericAbility newAbility = new GenericAbility(ability, gameObject); } else { // Class found, use that! newAbility = (Ability)constructor.Invoke(new object[2] { ability, gameObject }); } } catch (Exception /*e*/) { // No such class, use the GenericAbility class newAbility = new GenericAbility(ability, gameObject); } newAbility.register(Ability.Actions.ENABLED, onAbilityToggled); newAbility.register(Ability.Actions.DISABLED, onAbilityToggled); _abilities.Add(newAbility); } }
private void ActivateIg2000Ability() { foreach (var ship in HostShip.Owner.Ships) { if (ship.Value.ShipId != HostShip.ShipId) { if (ship.Value.UpgradeBar.GetUpgradesOnlyFaceup().Any(n => n.UpgradeInfo.Name == "IG-2000")) { Type pilotAbilityType = ship.Value.PilotAbilities[0].GetType(); GenericAbility pilotAbility = (GenericAbility)System.Activator.CreateInstance(pilotAbilityType); pilotAbility.Initialize(HostShip); HostShip.PilotAbilities.Add(pilotAbility); } } } }
private void OnUndocked(GenericShip dockingHost) { HostShip.PilotName = dockingHost.PilotName; HostShip.PilotSkill = dockingHost.PilotSkill; HostShip.UsesCharges = dockingHost.UsesCharges; HostShip.MaxCharges = dockingHost.MaxCharges; HostShip.Charges = dockingHost.Charges; Type pilotAbilityType = dockingHost.PilotAbilities[0].GetType(); GenericAbility pilotAbility = (GenericAbility)System.Activator.CreateInstance(pilotAbilityType); pilotAbility.Initialize(HostShip); HostShip.PilotAbilities.Add(pilotAbility); Roster.UpdateShipStats(HostShip); }
private void OnUndocked(GenericShip dockingHost) { HostShip.PilotInfo = new PilotCardInfo( dockingHost.PilotInfo.PilotName, dockingHost.PilotInfo.Initiative, 6, isLimited: true, charges: dockingHost.PilotInfo.Charges, regensCharges: dockingHost.PilotInfo.RegensCharges ); Type pilotAbilityType = dockingHost.PilotInfo.AbilityType; GenericAbility pilotAbility = (GenericAbility)System.Activator.CreateInstance(pilotAbilityType); pilotAbility.Initialize(HostShip); HostShip.PilotAbilities.Add(pilotAbility); Roster.UpdateShipStats(HostShip); }
public static bool mod_ShowOnSpellBar(GenericAbility ability, CharacterStats stats, int spellLevel) { if (ability.Passive) { return(false); } GenericSpell genericSpell = ability as GenericSpell; GenericCipherAbility genericCipherAbility = ability as GenericCipherAbility; if (!genericSpell) { return(genericCipherAbility && (spellLevel <= 0 || genericCipherAbility.SpellLevel == spellLevel)); } if (genericSpell.SpellClass != stats.CharacterClass && spellLevel > 0 && genericSpell.SpellLevel == spellLevel && IEModOptions.HideAnticlassSpells) { return(true); } if (genericSpell.SpellClass != stats.CharacterClass || (spellLevel > 0 && genericSpell.SpellLevel != spellLevel)) { return(false); } if (stats.CharacterClass != CharacterStats.Class.Wizard || !genericSpell.NeedsGrimoire) { return(true); } Equipment component = stats.GetComponent <Equipment>(); if (component == null || component.CurrentItems == null || component.CurrentItems.Grimoire == null) { return(false); } Grimoire component2 = component.CurrentItems.Grimoire.GetComponent <Grimoire>(); return(!(component2 == null) && component2.HasSpell(genericSpell)); }
public static void Ori_AutoPause(AutoPauseOptions.PauseEvent evt, GameObject target, GameObject triggerer, GenericAbility ability = null) { }
private void HandleGameUtilitiesOnCombatEnd(object sender, EventArgs e) { try { this.m_MarkersAppliedThisCombat.Clear(); for (int i = this.m_statusEffects.Count - 1; i >= 0; i--) { if (this.m_statusEffects[i].LastsUntilCombatEnds) { this.ClearEffect(this.m_statusEffects[i]); } else if (this.m_statusEffects[i].AbilityOrigin && this.m_statusEffects[i].AbilityOrigin.CombatOnly) { this.ClearEffect(this.m_statusEffects[i]); } else if (this.m_statusEffects[i].IsDOT) { this.ClearEffect(this.m_statusEffects[i]); } } IEnumerator <GenericAbility> enumerator = this.ActiveAbilities.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericAbility current = enumerator.Current; if (current == null) { continue; } current.HandleGameUtilitiesOnCombatEnd(sender, e); } } finally { if (enumerator == null) { } enumerator.Dispose(); } if (base.gameObject != null) { int num = 0; while (num < 8) { num++; } } this.PlayPartyFatigueSoundIfAble(); //Start of mod for (int i = 0; i < (int)this.SpellCastCount.Length; i++) { this.SpellCastCount[i] = 0; } //End of mod } catch (Exception exception) { Debug.LogException(exception, this); if (UIDebug.Instance) { UIDebug.Instance.LogOnScreenWarning("Exception in CharacterStats.HandleGameUtilitiesOnCombatEnd! Please Fix!", UIDebug.Department.Programming, 10f); } } }
public new void Reload() { CharacterStats characterStat; UIWidget uIWidget; bool flag; AttackBase attackBase; AttackBase attackBase1; this.m_NeedsReload = false; this.DragPanel.ResetPosition(); StringBuilder stringBuilder = new StringBuilder(); GenericAbility component = null; AttackBase component1 = null; if (this.InspectionObject) { component1 = this.InspectionObject.GetComponent <AttackBase>(); component = this.InspectionObject.GetComponent <GenericAbility>(); if (component1) { component1.UICleanStatusEffects(); } if (component) { component.UICleanStatusEffects(); } } this.EnchantButton.gameObject.SetActive(false); this.CompareButton.gameObject.SetActive(false); this.LearnSpellButton.gameObject.SetActive(false); this.ExamineButton.gameObject.SetActive(false); this.SoulbindButton.gameObject.SetActive(false); this.EnchantParent.gameObject.SetActive(false); this.ItemTypeLabel.text = string.Empty; this.ImageTexture.mainTexture = null; this.LargeImageTexture.mainTexture = null; string empty = string.Empty; this.TitleSepAnchor.widgetContainer = this.IconBackground; this.TitleSepAnchor.side = UIAnchor.Side.Right; if (this.InspectionObject == null) { this.TitleLabel.text = string.Empty; this.EffectTextLabel.text = string.Empty; this.ImageTexture.alpha = 0f; this.DragPanel.ResetPosition(); this.ButtonsGrid.Reposition(); return; } CharacterStats characterStat1 = this.InspectionObject.GetComponent <CharacterStats>(); if (this.m_InspectStat == StatusEffect.ModifiedStat.NoEffect) { Item item = this.InspectionObject.GetComponent <Item>(); Phrase phrase = this.InspectionObject.GetComponent <Phrase>(); GenericTalent genericTalent = this.InspectionObject.GetComponent <GenericTalent>(); EquipmentSoulbind equipmentSoulbind = this.InspectionObject.GetComponent <EquipmentSoulbind>(); ItemMod itemMod = this.InspectionObject.GetComponent <ItemMod>(); if (item) { this.LargeImageTexture.alpha = 1f; this.LargeImageTexture.mainTexture = item.GetIconLargeTexture(); this.LargeImageTexture.MakePixelPerfect(); this.TitleLabel.text = item.Name; if (item.DescriptionText.IsValidString) { stringBuilder.AppendLine(item.DescriptionText.GetText()); stringBuilder.AppendLine(); } } if (!equipmentSoulbind || !this.ObjectOwner) { this.SoulbindButton.gameObject.SetActive(false); } else { this.SoulbindButton.gameObject.SetActive((!equipmentSoulbind.IsBound ? true : !equipmentSoulbind.CannotUnbind)); } if (equipmentSoulbind) { this.SoulbindButton.Label.GetComponent <GUIStringLabel>().SetString((!equipmentSoulbind.IsBound ? 2030 : 2031)); string extraDescription = equipmentSoulbind.GetExtraDescription(); if (!string.IsNullOrEmpty(extraDescription)) { stringBuilder.AppendLine(extraDescription); stringBuilder.AppendLine(); } empty = equipmentSoulbind.GetPencilSketch(); } if (this.InspectionObject.GetComponent <QuestAsset>()) { this.ExamineButton.gameObject.SetActive(true); } Equippable equippable = item as Equippable; if (equippable) { BackerContent backerContent = this.InspectionObject.GetComponent <BackerContent>(); if (backerContent) { stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.Append(GUIUtils.GetText(994)); stringBuilder.Append(" "); stringBuilder.Append(backerContent.BackerName); } bool flag1 = (this.InspectionObject.GetComponent <Shield>() || this.InspectionObject.GetComponent <Armor>() || equippable is Weapon ? !equipmentSoulbind : false); bool flag2 = (!flag1 ? false : !equippable.IsPrefab); if (equippable.EquippedOwner) { CharacterStats component2 = equippable.EquippedOwner.GetComponent <CharacterStats>(); if (component2) { if (!component2.IsEquipmentLocked) { Equipment equipment = component2.GetComponent <Equipment>(); if (equipment && equipment.IsSlotLocked(equippable.EquippedSlot)) { flag2 = false; } } else { flag2 = false; } } } characterStat = (!UILootManager.Instance || !UILootManager.Instance.IsVisible ? UIInventoryManager.Instance.SelectedCharacter : UILootManager.Instance.SelectedCharacter); if (!characterStat || this.NoCompare) { this.CompareButton.gameObject.SetActive(false); } else { Equipment equipment1 = characterStat.GetComponent <Equipment>(); IEnumerable <Item.UIEquippedItem> comparisonTargets = UIInventoryEquipment.GetComparisonTargets(this.InspectionObject.GetComponent <Equippable>(), equipment1); this.CompareButton.gameObject.SetActive((!equipment1 || !comparisonTargets.Any <Item.UIEquippedItem>() ? false : !equipment1.CurrentItems.Contains <Equippable>(equippable))); } if (flag1 && this.LblEnchantValue && this.LblEnchantValue) { this.LblEnchantLabel.text = string.Concat(GUIUtils.GetText(1987), ": "); this.LblEnchantValue.text = GUIUtils.Format(451, new object[] { equippable.TotalItemModValue(), ItemMod.MaximumModValue }); } this.EnchantParent.gameObject.SetActive(flag1); flag = (!flag2 || this.m_IsStore || this.m_NoEnchant ? false : !GameState.InCombat); this.EnchantButton.gameObject.SetActive(flag); //Start of mod if (equipmentSoulbind) { this.EnchantButton.gameObject.SetActive(true); } //End of mod string equippableItemType = UIItemInspectManager.GetEquippableItemType(this.InspectionObject, null, equippable); if (equippableItemType.Length > 0) { this.ItemTypeLabel.text = equippableItemType; } } else if (phrase) { this.ImageTexture.alpha = 1f; if (phrase.Icon) { this.ImageTexture.mainTexture = phrase.Icon; } this.ImageTexture.MakePixelPerfect(); this.TitleLabel.text = phrase.DisplayName.GetText(); if (phrase.Description.IsValidString) { stringBuilder.AppendLine(phrase.Description.GetText()); } } else if (component) { this.ImageTexture.alpha = 1f; if (component.Icon) { this.ImageTexture.mainTexture = component.Icon; } this.ImageTexture.MakePixelPerfect(); if (!item) { this.TitleLabel.text = GenericAbility.Name(component); } if (component.Description.IsValidString && !item) { stringBuilder.AppendLine(component.Description.GetText()); } if (component1) { this.ItemTypeLabel.text = component1.GetKeywordsString(); } this.LearnSpellButton.gameObject.SetActive(this.LearnSpellAllowed); } else if (genericTalent) { this.ImageTexture.alpha = 1f; if (genericTalent.Icon) { this.ImageTexture.mainTexture = genericTalent.Icon; } this.ImageTexture.MakePixelPerfect(); if (genericTalent.Description.IsValidString) { stringBuilder.AppendLine(genericTalent.Description.GetText()); } this.TitleLabel.text = genericTalent.Name(this.ObjectOwner); } else if (!itemMod) { BackerContent backerContent1 = this.InspectionObject.GetComponent <BackerContent>(); if (backerContent1) { this.ImageTexture.alpha = 0f; this.TitleLabel.text = backerContent1.BackerName; stringBuilder.AppendLine(backerContent1.BackerDescription.GetText()); stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.Append(GUIUtils.GetText(994, CharacterStats.GetGender(backerContent1))); stringBuilder.Append(' '); stringBuilder.Append(backerContent1.BackerName); } if (characterStat1) { this.TitleLabel.text = characterStat1.Name(); } } else { this.TitleLabel.text = itemMod.DisplayName.GetText(); } StringEffects stringEffect = new StringEffects(); string str = UIItemInspectManager.GetEffectText(this.InspectionObject, this.ObjectOwner, stringEffect, false).TrimEnd(new char[0]); this.StringEffectDisplay.Load(stringEffect); if (!this.StringEffectDisplay.Empty) { str = string.Concat(str, "\n", GUIUtils.GetText(1604)); } if (item && !item.IsQuestItem && !(item is CampingSupplies) && !(item is Currency)) { string empty1 = string.Empty; if (this.ItemTypeLabel.text.Length > 0) { empty1 = string.Concat(empty1, "\n"); } empty1 = string.Concat(empty1, GUIUtils.GetText(1499), ": ", GUIUtils.Format(466, new object[] { item.GetDefaultSellValue() })); this.ItemTypeLabel.text = string.Concat(this.ItemTypeLabel.text, empty1); } if (Glossary.Instance) { str = Glossary.Instance.AddUrlTags(str); } this.EffectTextLabel.text = str.Trim(); if (this.Goals) { this.Goals.Set(equipmentSoulbind, this.SoulbindUnlockMode); } this.FlavorTextLabel.text = stringBuilder.ToString().TrimEnd(new char[0]); } else { CharacterStats.SkillType skillType = StatusEffect.ModifiedStatToSkillType(this.m_InspectStat); CharacterStats.AttributeScoreType attributeScoreType = StatusEffect.ModifiedStatToAttributeScoreType(this.m_InspectStat); CharacterStats.DefenseType defenseType = StatusEffect.ModifiedStatToDefenseType(this.m_InspectStat); string str1 = string.Empty; if (characterStat1) { if (skillType != CharacterStats.SkillType.Count) { this.TitleLabel.text = GUIUtils.GetSkillTypeString(skillType); str1 = string.Concat(characterStat1.CalculateSkill(skillType).ToString(), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetSkillEffectsInverted(characterStat1, skillType, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = GUIUtils.GetSkillTypeDescriptionString(skillType); } else if (attributeScoreType != CharacterStats.AttributeScoreType.Count) { this.TitleLabel.text = GUIUtils.GetAttributeScoreTypeString(attributeScoreType); str1 = string.Concat(characterStat1.GetAttributeScore(attributeScoreType).ToString(), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetAttributeEffectsInverted(characterStat1, attributeScoreType, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = GUIUtils.GetAttributeScoreDescriptionString(attributeScoreType); } else if (defenseType != CharacterStats.DefenseType.None) { this.TitleLabel.text = GUIUtils.GetDefenseTypeString(defenseType); str1 = string.Concat(characterStat1.CalculateDefense(defenseType).ToString(), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetDefenseEffectsInverted(characterStat1, defenseType, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = GUIUtils.GetDefenseTypeDescription(defenseType); } else if (this.m_InspectStat == StatusEffect.ModifiedStat.InterruptBonus) { this.TitleLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 173); str1 = string.Concat(characterStat1.ComputeInterruptHelper().ToString("#0"), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetInterruptEffectsInverted(characterStat1, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 174); } else if (this.m_InspectStat == StatusEffect.ModifiedStat.ConcentrationBonus) { this.TitleLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 159); str1 = string.Concat(characterStat1.ComputeConcentrationHelper().ToString("#0"), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetConcentrationEffectsInverted(characterStat1, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 160); } else if (this.m_InspectStat == StatusEffect.ModifiedStat.DamageThreshhold) { this.TitleLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 157); if (this.m_InspectDamageType != DamagePacket.DamageType.All && this.m_InspectDamageType != DamagePacket.DamageType.None) { UILabel titleLabel = this.TitleLabel; titleLabel.text = string.Concat(titleLabel.text, GUIUtils.Format(1731, new object[] { GUIUtils.GetDamageTypeString(this.m_InspectDamageType) })); } float single = characterStat1.CalcDT(this.m_InspectDamageType, false); str1 = string.Concat(single.ToString("#0"), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetDamageThresholdEffectsInverted(characterStat1, this.m_InspectDamageType, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 158); } else if (this.m_InspectStat == StatusEffect.ModifiedStat.Damage) { this.TitleLabel.text = GUIUtils.GetText(428); Equipment equipment2 = this.InspectionObject.GetComponent <Equipment>(); if (!equipment2) { attackBase1 = null; } else { attackBase1 = (!this.m_InspectOffhand ? equipment2.PrimaryAttack : equipment2.SecondaryAttack); } AttackBase attackBase2 = attackBase1; DamageInfo damageInfo = new DamageInfo(null, 0f, attackBase2); characterStat1.AdjustDamageForUi(damageInfo); str1 = string.Concat(damageInfo.GetAdjustedDamageRangeString(), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetDamageEffectsInverted(characterStat1, attackBase2, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 194); } else if (this.m_InspectStat == StatusEffect.ModifiedStat.Accuracy) { this.TitleLabel.text = GUIUtils.GetText(369); Equipment component3 = this.InspectionObject.GetComponent <Equipment>(); if (!component3) { attackBase = null; } else { attackBase = (!this.m_InspectOffhand ? component3.PrimaryAttack : component3.SecondaryAttack); } AttackBase attackBase3 = attackBase; int num = characterStat1.CalculateAccuracyForUi(attackBase3, null, null); str1 = string.Concat(num.ToString(), GUIUtils.Format(1731, new object[] { UICharacterSheetContentManager.GetAccuracyEffectsInverted(characterStat1, attackBase3, GUIUtils.Comma(), UIGlobalColor.LinkStyle.NONE) })); this.FlavorTextLabel.text = StringTableManager.GetText(DatabaseString.StringTableType.Cyclopedia, 84); } } string str2 = string.Concat(CharacterStats.Name(characterStat1), ": ", str1); if (Glossary.Instance) { str2 = Glossary.Instance.AddUrlTags(str2); } this.EffectTextLabel.text = str2; } if (this.NoDescription) { this.FlavorTextLabel.text = string.Empty; } if (this.PencilSketch) { this.PencilSketch.SetPath(empty); } if (this.LargeImageTexture.mainTexture) { this.ImageTexture.mainTexture = null; } this.TitleSepAnchor.pixelOffset.y = 0f; if (this.ImageTexture.mainTexture) { Transform iconBackground = this.IconBackground.transform; Vector3 imageTexture = this.ImageTexture.transform.localScale; Vector3 vector3 = this.ImageTexture.transform.localScale; iconBackground.localScale = new Vector3(imageTexture.x + 12f, vector3.y + 12f, 1f); if (this.TitleLabel.processedText.Contains("\n")) { this.TitleSepAnchor.pixelOffset.y = -(float)this.TitleLabel.font.size; } this.TitleSepAnchor.widgetContainer = this.IconBackground; } else if (!this.LargeImageTexture.mainTexture) { this.TitleSepAnchor.widgetContainer = this.IconBackground; this.TitleSepAnchor.side = UIAnchor.Side.Left; } else { Vector3 largeImageTexture = this.LargeImageTexture.transform.localScale; if (largeImageTexture.x > 78f) { float single1 = largeImageTexture.y / largeImageTexture.x; largeImageTexture.x = 78f; largeImageTexture.y = largeImageTexture.x * single1; } else if (largeImageTexture.y > 78f) { float single2 = largeImageTexture.x / largeImageTexture.y; largeImageTexture.y = 78f; largeImageTexture.x = largeImageTexture.y * single2; } this.LargeImageTexture.transform.localScale = largeImageTexture; this.LargeImageBackground.transform.localScale = new Vector3(largeImageTexture.x + 12f, largeImageTexture.y + 12f, 1f); if (this.TitleLabel.processedText.Contains("\n")) { this.TitleSepAnchor.pixelOffset.y = -(float)this.TitleLabel.font.size * 0.5f; } this.TitleSepAnchor.widgetContainer = this.LargeImageBackground; } this.ImageTexture.alpha = (!this.ImageTexture.mainTexture ? 0f : 1f); this.LargeImageTexture.alpha = (!this.LargeImageTexture.mainTexture ? 0f : 1f); this.IconBackground.alpha = (!this.ImageTexture.mainTexture ? 0f : 0.6666667f); this.LargeImageBackground.alpha = (!this.LargeImageTexture.mainTexture ? 0f : 0.6666667f); uIWidget = (this.ImageTexture.alpha <= 0f ? this.LargeImageTexture : this.ImageTexture); this.TitleLabel.GetComponent <UIShrinkOpposingWidget>().Widget = uIWidget; this.EffectTextLabel.gameObject.SetActive(!string.IsNullOrEmpty(this.EffectTextLabel.text)); UIWidgetUtils.UpdateDependents(base.gameObject, 2); this.ButtonsGrid.Reposition(); this.LayoutScrollArea.Reposition(); this.DragPanel.ResetPosition(); }
public bool FilterTargets(GenericAbility ability, GenericShip ship) { return(ability.FilterTargetsByParameters(ship, MinRange, MaxRange, InArcType, TargetTypes, HasToken, ShipTypesOnly)); }
private new void HandleGameUtilitiesOnCombatEnd(object sender, EventArgs e) { try { this.m_MarkersAppliedThisCombat.Clear(); for (int i = this.m_statusEffects.Count - 1; i >= 0; i--) { if (this.m_statusEffects[i].LastsUntilCombatEnds) { this.ClearEffect(this.m_statusEffects[i]); } else if (this.m_statusEffects[i].AbilityOrigin && this.m_statusEffects[i].AbilityOrigin.CombatOnly) { this.ClearEffect(this.m_statusEffects[i]); } else if (this.m_statusEffects[i].IsDOT) { this.ClearEffect(this.m_statusEffects[i]); } } IEnumerator <GenericAbility> enumerator = this.ActiveAbilities.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericAbility current = enumerator.Current; if (current == null) { continue; } current.HandleGameUtilitiesOnCombatEnd(sender, e); } } finally { if (enumerator == null) { } enumerator.Dispose(); } if (base.gameObject != null) { int num = 0; while (num < 8) { num++; } //Start of mod // Make sure char is a valid caster CharacterStats charStats = base.gameObject.GetComponent <CharacterStats>(); if (charStats != null) { if (charStats.CharacterClass == Class.Priest || charStats.CharacterClass == Class.Wizard || charStats.CharacterClass == Class.Druid) { ResetSpellUsage(charStats); } } //End of mod } this.PlayPartyFatigueSoundIfAble(); } catch (Exception exception) { Debug.LogException(exception, this); if (UIDebug.Instance) { UIDebug.Instance.LogOnScreenWarning("Exception in CharacterStats.HandleGameUtilitiesOnCombatEnd! Please Fix!", UIDebug.Department.Programming, 10f); } } }
protected void OnyxUpdateNew() { //base.OnyxUpdate(); if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.E)) { Game.Console.AddMessage("Pressed LCtrl and E to reset Empower"); //SingletonBehavior<PartyManager>.Instance.GetSelectedPartyMemberGameObjects() var selchars = m_selectedCharacters; if (selchars != null) // there's a selected char { foreach (var selchar in selchars) { //this resets the # used empowered per combat to 0 selchar.ResetEmpower(); //set empower pts to MaxEmpowerPoints selchar.EmpowerPoints = selchar.MaxEmpowerPoints; } } } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.S)) { Game.Console.AddMessage("Pressed LCtrl and S to reset Spellcasts"); var selchars = m_selectedCharacters; if (selchars != null) // there's a selected char { foreach (var selchar in selchars) { // FROM EmpowerResources, hopefully fixes spellcasts foreach (AccruedResourceTrait accruedResourceTrait in selchar.AbilityList.FindAbilitiesByType <AccruedResourceTrait>()) { //accruedResourceTrait.RestoreResource(accruedResourceTrait.GetSelfEmpowerRestoreCount()); accruedResourceTrait.RestoreResource(accruedResourceTrait.GetResourceMax() - accruedResourceTrait.GetResource()); } for (CharacterClass characterClass = CharacterClass.None; characterClass < CharacterClass.Count; characterClass++) { for (int i = 1; i <= GlobalGameSettingsGameData.Instance.MaxSpellLevel; i++) { OnyxInt spellCastMax = SingletonBehavior <SpellMax> .Instance.GetSpellCastMax(selchar, characterClass, i); selchar.RestoreSpellCasts(characterClass, i, spellCastMax); } selchar.AddClassAbilityPoolPoints(characterClass, selchar.GetMaxPowerPoolPoints(characterClass, null)); } } } } this.m_RefreshTimer -= TimeController.UnscaledDeltaTime; if (this.m_NeedsRefresh || this.m_RefreshTimer <= 0f) { this.m_NeedsRefresh = false; this.m_RefreshTimer = float.PositiveInfinity; this.Refresh(); } if (GameInput.GetControlDownWithRepeat(MappedControl.UP_ABILITY, true)) { this.NavigateVertical(1); } else if (GameInput.GetControlDownWithRepeat(MappedControl.DOWN_ABILITY, true)) { this.NavigateVertical(-1); } if (GameInput.GetControlDownWithRepeat(MappedControl.NEXT_ABILITY, true)) { if (this.m_SelectionRow < 0) { this.SelectFirstButton(); } else { this.NavigateHorizontal(1); } } else if (GameInput.GetControlDownWithRepeat(MappedControl.PREVIOUS_ABILITY, true)) { if (this.m_SelectionRow < 0) { this.SelectLastButton(); } else { this.NavigateHorizontal(-1); } } UIAbilityBarButton selectedButton = this.GetSelectedButton(); if (selectedButton && !selectedButton.gameObject.activeInHierarchy) { this.CancelSelection(); } if (this.m_SelectionTooltipDelay > 0f) { this.m_SelectionTooltipDelay -= TimeController.UnscaledDeltaTime; if (this.m_SelectionTooltipDelay <= 0f && selectedButton) { selectedButton.ShowTooltip(); } } UIAbilityBarButton selectedButton2 = this.GetSelectedButton(); if (selectedButton2 && !Player.IsCastingOrRetargeting() && GameInput.GetControlUp(MappedControl.CAST_SELECTED_ABILITY, true)) { selectedButton2.Trigger(); } if (this.SelectedObject != null) { CharacterHotkeyBindings orAddComponent = ResourceManager.GetOrAddComponent <CharacterHotkeyBindings>(this.SelectedObject.gameObject); if (GameInput.IsKeyUpAvailable(KeyCode.Mouse0) && orAddComponent != null) { orAddComponent.Activate(SingletonBehavior <GameInput> .Instance.LastKeyUp); } if ((this.m_hotkeyRow == null || !this.m_hotkeyRow.gameObject.activeSelf) && (this.m_rows.Count < 2 || this.m_rows[1] == this.m_hotkeyRow || this.m_rows[1].IsEmpty) && orAddComponent != null && !ICollectionUtils.IsNullOrEmpty <KeyValuePair <KeyControl, Guid> >(orAddComponent.AbilityHotkeys)) { this.m_hotkeyRow = this.ShowSubrow(null, 1); this.m_hotkeyRow.SetIdentification(GuiStringTable.GetText(1662)); this.m_hotkeyRow.AddHotkeySet(); } AIController component = ComponentUtils.GetComponent <AIController>(this.m_selectedCharacter); GenericAbility genericAbility = (!component) ? null : component.GetCurrentIntroStateAbility(); if (genericAbility != null && genericAbility.Attack != null && !genericAbility.Attack.ForcedTarget) { if (this.m_castControlRow == null || !this.m_castControlRow.gameObject.activeSelf) { this.m_castControlRow = this.ShowSubrow(null, 2); this.m_castControlRow.SetIdentification(GuiStringTable.GetText(2994)); this.m_castControlRow.AddCurrentCastSet(); } } else { this.HideSubrow(2); } } }
protected virtual void UpdateNew() { if (this.CooldownType == GenericAbility.CooldownMode.PerEncounter && !GameState.InCombat && this.m_perEncounterResetTimer > 0f) { this.m_perEncounterResetTimer -= Time.deltaTime; if (this.m_perEncounterResetTimer <= 0f) { this.m_cooldownCounter = 0; this.m_perEncounterResetTimer = 0f; } } if (this.m_activated) { if (this.ClearsOnMovement && this.IsMoving) { this.HideFromCombatLog = true; this.Deactivate(this.m_owner); return; } //MOD (Remove combat-only restrictions) - changed this condition: if (this.CombatOnly && !GameState.InCombat && !(IEModOptions.CombatOnlyMod)) { this.Deactivate(this.m_owner); return; } if (this.NonCombatOnly && GameState.InCombat) { this.Deactivate(this.m_owner); return; } } if (!GameState.Paused) { if (this.m_statusEffectsNeeded && !this.m_statusEffectsActivated) { this.ActivateStatusEffects(); } else if (!this.m_statusEffectsNeeded && this.m_statusEffectsActivated) { this.DeactivateStatusEffects(); } } if (this.m_activated && !this.m_applied) { if (this.CanApply()) { if (this.m_target != null) { this.Apply(this.m_target); } else { this.Apply(this.m_targetPoint); } } return; } if (!this.Passive && this.Modal) { bool flag = this.m_ownerHealth && (this.m_ownerHealth.Dead || this.m_ownerHealth.Unconscious); if (this.m_activatedLaunching) { if (flag || !this.m_UITriggered) { this.m_activatedLaunching = false; this.m_rez_modal_cooldown = 5f; } else if (this.m_UITriggered && this.CombatOnly && GameState.InCombat && !this.m_activated && this.m_rez_modal_cooldown <= 0f) { PartyMemberAI component = this.m_owner.GetComponent <PartyMemberAI>(); if (component) { Ability ability = component.StateManager.FindState(typeof(Ability)) as Ability; if (ability == null || ability.QueuedAbility != this) { this.m_activatedLaunching = false; } } else { this.m_activatedLaunching = false; } } else if (this.m_UITriggered && this.NonCombatOnly && !GameState.InCombat && !this.m_activated && this.m_rez_modal_cooldown <= 0f) { PartyMemberAI component2 = this.m_owner.GetComponent <PartyMemberAI>(); if (component2) { Ability ability2 = component2.StateManager.FindState(typeof(Ability)) as Ability; if (ability2 == null || ability2.QueuedAbility != this) { this.m_activatedLaunching = false; } } else { this.m_activatedLaunching = false; } } else if (this.m_rez_modal_cooldown > 0f) { this.m_rez_modal_cooldown -= Time.deltaTime; } } if (this.m_activated && this.CombatOnly && flag) { this.Deactivate(this.m_owner); this.m_activatedLaunching = false; } if (!GameState.Paused && this.m_ownerPartyAI != null && this.m_ownerPartyAI.gameObject.activeInHierarchy && this.m_UITriggered != (this.m_activated || this.m_activatedLaunching)) { if (this.m_activated) { this.Deactivate(this.m_owner); } else if (this.m_ownerPartyAI != null && this.m_ownerPartyAI.QueuedAbility == this) { this.m_ownerPartyAI.QueuedAbility = null; } else if (this.m_UITriggered && !flag) { if (this.Ready) { this.LaunchAttack(base.gameObject, false, null, null, null); } } else { this.m_rez_modal_cooldown = 5f; this.m_activatedLaunching = false; } } } else if (!this.Passive && this.m_UITriggered) { this.m_UITriggered = false; if (this.m_ownerPartyAI != null && this.m_ownerPartyAI.Selected) { if (this.TriggerOnHit) { this.m_activated = true; return; } if (this.UsePrimaryAttack || this.UseFullAttack) { Equipment component3 = this.m_owner.GetComponent <Equipment>(); if (component3 != null) { AttackBase primaryAttack = component3.PrimaryAttack; if (primaryAttack != null && this.m_ownerStats != null) { GenericAbility component4 = base.gameObject.GetComponent <GenericAbility>(); AttackBase component5 = base.gameObject.GetComponent <AttackBase>(); if (this.m_attackBase != null) { StatusEffect[] array = new StatusEffect[1]; StatusEffectParams statusEffectParams = new StatusEffectParams(); statusEffectParams.AffectsStat = StatusEffect.ModifiedStat.ApplyAttackEffects; statusEffectParams.AttackPrefab = this.m_attackBase; statusEffectParams.OneHitUse = true; GenericAbility.AbilityType abType = GenericAbility.AbilityType.Ability; if (this is GenericSpell) { abType = GenericAbility.AbilityType.Spell; } array[0] = StatusEffect.Create(this.m_owner, this, statusEffectParams, abType, null, true); if (this.m_attackBase.UseAttackVariationOnFullAttack && this.UseFullAttack) { this.LaunchAttack(primaryAttack.gameObject, this.UseFullAttack, component4, array, component5, this.m_attackBase.AttackVariation); } else { this.LaunchAttack(primaryAttack.gameObject, this.UseFullAttack, component4, array, component5); } } else { this.LaunchAttack(primaryAttack.gameObject, this.UseFullAttack, component4, null, component5); } } } } else { this.LaunchAttack(base.gameObject, false, null, null, null); } } } else if (this.m_activated && this.m_applied && !this.Passive && !this.Modal && !this.m_permanent && !this.UseFullAttack && !this.UsePrimaryAttack && (this.m_attackBase == null || this.AttackComplete)) { this.m_activated = false; this.m_activatedLaunching = false; this.m_applied = false; this.OnInactive(); } if (this.IsTriggeredPassive) { if (this.EffectTriggeredThisFrame) { if (this.m_owner && FogOfWar.PointVisibleInFog(this.m_owner.transform.position)) { this.ReportActivation(); } this.EffectTriggeredThisFrame = false; } if (this.EffectUntriggeredThisFrame) { if (this.m_owner && FogOfWar.PointVisibleInFog(this.m_owner.transform.position)) { this.ReportDeactivation(); } this.EffectUntriggeredThisFrame = false; } } }
public void mod_FindNewSpells(List <GenericSpell> newSpells, CharacterStats casterStats, int maxSpellLevel) { if (!casterStats) { return; } int num = Mathf.Min(maxSpellLevel, 8); for (int i = 0; i < num; i++) { for (int j = 0; j < MaxSpellsPerLevel + (int)IEModOptions.ExtraWizardSpells; j++) { GenericSpell spellData = this.Spells[i].SpellData[j]; if (spellData != null) { bool flag = false; IEnumerator <GenericAbility> enumerator = casterStats.ActiveAbilities.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericAbility current = enumerator.Current; if (!(current is GenericSpell) || spellData.DisplayName.StringID != current.DisplayName.StringID) { continue; } flag = true; break; } } finally { if (enumerator == null) { } enumerator.Dispose(); } if (!flag && !newSpells.Contains(spellData)) { newSpells.Add(spellData); } } } } //if (caster == null) //{ // return null; //} //CharacterStats component = caster.GetComponent<CharacterStats>(); //if (component == null) //{ // return null; //} //List<GenericSpell> list = new List<GenericSpell>(); //int num = MaxSpellLevel; //if (max_spell_level < num) //{ // num = max_spell_level; //} //for (int i = 0; i < num; i++) //{ // for (int j = 0; j < MaxSpellsPerLevel + (int)IEModOptions.ExtraWizardSpells; j++) // { // if (this.Spells[i].SpellData[j] != null) // { // bool flag = false; // foreach (GenericAbility current in component.ActiveAbilities) // { // if (current is GenericSpell && this.Spells[i].SpellData[j].DisplayName.StringID == current.DisplayName.StringID) // { // flag = true; // break; // } // } // if (!flag) // { // list.Add(this.Spells[i].SpellData[j]); // } // } // } //} //GenericSpell result = null; //if (list.Count > 0) //{ // int index = UnityEngine.Random.Range(0, list.Count); // result = list[index]; //} //return result; }
public static void Mod_AutoPause(AutoPauseOptions.PauseEvent evt, GameObject target, GameObject triggerer, GenericAbility ability = null) { bool wasPaused = TimeController.Instance.IsSafePaused; Ori_AutoPause(evt, target, triggerer, ability); if (!wasPaused && TimeController.Instance.IsSafePaused) { // auto-pause happened; remember real time SmarterUnpauseManager.AutoPauseTime = TimeController.Instance.RealtimeSinceStartupThisFrame; // Console.AddMessage($"Auto-pausing at: {SmarterUnpauseManager.AutoPauseTime}"); } }
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); } } }
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); } } }