public static void Jump() { if (GameState.s_playerCharacter.IsMouseOnWalkMesh()) { foreach (var partymember in PartyMemberAI.GetSelectedPartyMembers()) { partymember.transform.position = GameInput.WorldMousePosition; } } else { global::Console.AddMessage("Mouse is not on navmesh."); } }
public int GetSpellCastMaxNew(GameObject caster, int spellLevel) { int num = 2147483647; bool calcBonusSpells = IEModOptions.BonusSpellsPerDay; if (caster != null && spellLevel >= 1) { CharacterStats component = caster.GetComponent <CharacterStats>(); if (component != null) { num = this.SpellCastMaxLookup(component.CharacterClass, component.Level, spellLevel); if (num == 2147483647) { if (CharacterStats.IsPlayableClass(component.CharacterClass)) { PartyMemberAI component2 = caster.GetComponent <PartyMemberAI>(); if (component2 != null) { num = 0; } } } else if (num == -1) { num = 2147483647; } if (num > 0 && num < 2147483647) { int bonusSpells = 0; if (calcBonusSpells) { for (int c = 14 + spellLevel; c <= component.Intellect; c += 4) { ++bonusSpells; } } num += component.SpellCastBonus[spellLevel - 1] + bonusSpells; } } } return(num); }
/// <summary> /// Unlocks Container under cursor /// </summary> public static void Unlock() { GameObject underCursor = GameCursor.GenericUnderCursor; OCL container = underCursor.GetComponent <OCL>(); List <GameObject> partyMembers = PartyMemberAI.GetSelectedPartyMembers(); IEnumerator <GameObject> enumerator = partyMembers.GetEnumerator(); try { enumerator.MoveNext(); if (container) { container.Unlock(enumerator.Current); } } finally { if (enumerator == null) { } enumerator.Dispose(); } }
private static void DropInventory() { PartyMemberAI selChar = UIInventoryManager.Instance.SelectedCharacter.gameObject.Component <PartyMemberAI>(); Container container = GameResources.LoadPrefab <Container>("DefaultDropItem", false); //assign another mesh, less ugly, less giant, less looking like a f*****g 3 year old baby? ugh.................. var dropObject = GameResources.Instantiate <GameObject>(container.gameObject, selChar.gameObject.transform.position, Quaternion.identity); dropObject.tag = "DropItem"; dropObject.layer = LayerUtility.FindLayerValue("Dynamics"); dropObject.transform.localRotation = Quaternion.AngleAxis(Random.Range((float)0f, (float)360f), Vector3.up); InstanceID eid = dropObject.Component <InstanceID>(); eid.Guid = Guid.NewGuid(); eid.UniqueID = eid.Guid.ToString(); dropObject.Component <Persistence>().TemplateOnly = true; Container component = dropObject.Component <Container>(); component.ManualLabelName = "Drop Items"; component.DeleteMeIfEmpty = true; AlphaControl control = dropObject.AddComponent <AlphaControl>(); if (control != null) { control.Alpha = 0f; control.FadeIn(1f); } // opening created container... code taken from Container.Open() UILootManager.Instance.SetData(selChar, dropObject.Component <Inventory>(), dropObject.gameObject); UILootManager.Instance.ShowWindow(); dropObject.Component <Inventory>().CloseInventoryCB = component.CloseInventoryCB; }
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); } } }
public static void ChangeClass(string guid, string charclass) { GameObject npc = null; string charname = guid.Replace("_", " "); foreach (var partymember in PartyMemberAI.PartyMembers) { if (partymember != null && RemoveDiacritics(partymember.gameObject.GetComponent <CharacterStats>().Name()).Contains(charname)) { npc = partymember.gameObject; } } if (npc == null) { npc = UnityEngine.GameObject.Find(guid); } if (npc != null) { bool goOn = false; try { if (Enum.Parse(typeof(CharacterStats.Class), charclass) != null) { goOn = true; } } catch { global::Console.AddMessage(charclass + " - not found as a class."); } if (goOn) { object newclassobj = Enum.Parse(typeof(CharacterStats.Class), charclass); int newclassId = Convert.ToInt32(newclassobj); List <string> Innates = new List <string>(); //Put all innate non-racial talents and abilities here (case insensitive): Innates.Add("crucible_of_the_soul"); Innates.Add("armed_to_the_teeth"); Innates.Add("speaker_to_the_restless"); Innates.Add("dominion_of_the_sleepers"); Innates.Add("steps_to_the_wheel"); Innates.Add("Beraths_Boon"); Innates.Add("Hyleas_Boon"); Innates.Add("Waels_Boon"); Innates.Add("Galawains_Boon"); Innates.Add("Rymrgands_Boon"); Innates.Add("Skaens_Boon"); Innates.Add("Second_Skin"); Innates.Add("The_Merciless_Hand"); Innates.Add("Mob_Justice"); Innates.Add("Mob Justice"); //the ability has a space in place of an underscore... Innates.Add("Blooded_Hunter"); Innates.Add("Song_of_the_Heavens"); Innates.Add("Wild_Running"); Innates.Add("Dungeon_Delver"); Innates.Add("Scale-Breaker"); Innates.Add("Gift_from_the_Machine"); Innates.Add("Effigys_Resentment"); //should work for all types if (npc.GetComponent <CharacterStats>().name.Contains("Sagani")) { Innates.Add("SummonCompanionArcticFox"); } //========================================================================== //REMOVE TALENTS //========================================================================== List <GenericTalent> talentRemoveList = new List <GenericTalent>(); foreach (GenericTalent activeTalent in npc.GetComponent <CharacterStats>().ActiveTalents) { bool saveMe = false; foreach (string innate in Innates) { if (activeTalent.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { talentRemoveList.Add(activeTalent); } } foreach (GenericTalent talentToRemove in talentRemoveList) { AbilityProgressionTable.RemoveAbilityFromCharacter(talentToRemove.gameObject, npc.GetComponent <CharacterStats>()); } talentRemoveList.Clear(); foreach (GenericTalent talent in npc.GetComponent <CharacterStats>().Talents) { bool saveMe = false; foreach (string innate in Innates) { if (talent.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { talentRemoveList.Add(talent); } } foreach (GenericTalent talentToRemove in talentRemoveList) { AbilityProgressionTable.RemoveAbilityFromCharacter(talentToRemove.gameObject, npc.GetComponent <CharacterStats>()); } //========================================================================== //========================================================================== //REMOVE ABILITIES //========================================================================== List <GenericAbility> abilRemoveList = new List <GenericAbility>(); foreach (GenericAbility activeAbility in npc.GetComponent <CharacterStats>().ActiveAbilities) { if (activeAbility.EffectType == GenericAbility.AbilityType.Racial) { continue; } bool saveMe = false; foreach (string innate in Innates) { if (activeAbility.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { abilRemoveList.Add(activeAbility); } } foreach (GenericAbility abilToRemove in abilRemoveList) { abilToRemove.ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(abilToRemove.gameObject, npc.GetComponent <CharacterStats>()); } abilRemoveList.Clear(); foreach (GenericAbility ability in npc.GetComponent <CharacterStats>().Abilities) { if (ability.EffectType == GenericAbility.AbilityType.Racial) { continue; } bool saveMe = false; foreach (string innate in Innates) { if (ability.gameObject.name.IndexOf(innate, StringComparison.OrdinalIgnoreCase) >= 0) //look for substring { saveMe = true; break; } } if (!saveMe) { abilRemoveList.Add(ability); } } foreach (GenericAbility abilToRemove in abilRemoveList) { abilToRemove.ForceDeactivate(npc); AbilityProgressionTable.RemoveAbilityFromCharacter(abilToRemove.gameObject, npc.GetComponent <CharacterStats>()); } //========================================================================== // remove ranger's pet if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Ranger && !npc.GetComponent <CharacterStats>().name.Contains("Sagani")) { foreach (var cre in npc.GetComponent <AIController>().SummonedCreatureList) { if (GameUtilities.IsAnimalCompanion(cre.gameObject)) { PartyMemberAI.RemoveFromActiveParty(cre.GetComponent <PartyMemberAI>(), true); cre.GetComponent <Persistence>().UnloadsBetweenLevels = true; cre.GetComponent <Health>().m_isAnimalCompanion = false; cre.GetComponent <Health>().ApplyDamageDirectly(1000); cre.GetComponent <Health>().ApplyDamageDirectly(1000); global::Console.AddMessage(cre.GetComponent <CharacterStats>().Name() + " is free from its bonds and returns to the wilds to be with its own kind.", Color.green); cre.SetActive(false); } } //npc.GetComponent<AIController> ().SummonedCreatureList.Clear (); } // remove or give grimoire if (npc.GetComponent <CharacterStats>().CharacterClass != (CharacterStats.Class)newclassId) { if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Wizard) { npc.GetComponent <Equipment>().UnEquip(Equippable.EquipmentSlot.Grimoire); } npc.GetComponent <CharacterStats>().CharacterClass = (CharacterStats.Class)newclassId; if (npc.GetComponent <CharacterStats>().CharacterClass == CharacterStats.Class.Wizard) { // equip an empty grimoire...? Equippable grim = GameResources.LoadPrefab <Equippable>("empty_grimoire_01", true); if (grim != null) { grim.GetComponent <Grimoire>().PrimaryOwnerName = npc.GetComponent <CharacterStats>().Name(); npc.GetComponent <Equipment>().Equip(grim); } } } //BaseDeflection,BaseFortitude,BaseReflexes,BaseWill,MeleeAccuracyBonus,RangedAccuracyBonus,MaxHealth,MaxStamina,HealthStaminaPerLevel,ClassHealthMultiplier object comp = (object)npc.GetComponent <CharacterStats>(); DataManager.AdjustFromData(ref comp); npc.GetComponent <CharacterStats>().Level = 0; npc.GetComponent <CharacterStats>().StealthSkill = 0; npc.GetComponent <CharacterStats>().StealthBonus = 0; npc.GetComponent <CharacterStats>().AthleticsSkill = 0; npc.GetComponent <CharacterStats>().AthleticsBonus = 0; npc.GetComponent <CharacterStats>().LoreSkill = 0; npc.GetComponent <CharacterStats>().LoreBonus = 0; npc.GetComponent <CharacterStats>().MechanicsSkill = 0; npc.GetComponent <CharacterStats>().MechanicsBonus = 0; npc.GetComponent <CharacterStats>().SurvivalSkill = 0; npc.GetComponent <CharacterStats>().SurvivalBonus = 0; npc.GetComponent <CharacterStats>().RemainingSkillPoints = 0; string HeOrShe = npc.GetComponent <CharacterStats>().Gender.ToString(); global::Console.AddMessage(npc.GetComponent <CharacterStats>().Name() + " has reformed into a " + charclass + ". " + (HeOrShe == "Male" ? "He" : "She") + " lost all " + (HeOrShe == "Male" ? "his" : "her") + " previous abilities and talents.", Color.green); } } else { global::Console.AddMessage("Couldn't find: " + guid, Color.yellow); } }
// PartyMemberAI public void UpdateNew() { if (this.m_mover != null && this.m_mover.AIController == null) { this.m_mover.AIController = this; } if (this.m_instructionTimer > 0f) { PartyMemberAI mInstructionTimer = this; mInstructionTimer.m_instructionTimer = mInstructionTimer.m_instructionTimer - Time.deltaTime; } if (this.m_instructions != null) { foreach (SpellCastData mInstruction in this.m_instructions) { mInstruction.Update(); } } if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty) { UIDebug.Instance.SetText("Party Debug", PartyMemberAI.GetPartyDebugOutput(), Color.cyan); UIDebug.Instance.SetTextPosition("Party Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight); } if (this.m_destinationCircleState != null) { if (!base.StateManager.IsStateInStack(this.m_destinationCircleState)) { this.m_destinationCircleState = null; this.HideDestination(); } else { this.ShowDestination(this.m_destinationCirclePosition); } } if (!(GameState.s_playerCharacter != null) || !GameState.s_playerCharacter.RotatingFormation || !this.Selected) { this.HideDestinationTarget(); } else { this.ShowDestinationTarget(this.m_desiredFormationPosition); } if (this.m_revealer == null) { this.CreateFogRevealer(); } else { this.m_revealer.WorldPos = base.gameObject.transform.position; this.m_revealer.RequiresRefresh = false; } if (GameState.Paused) { base.CheckForNullEngagements(); if (this.m_ai != null) { this.m_ai.Update(); } base.DrawDebugText(); return; } if (this.m_ai == null) { return; } if (GameState.Option.AutoPause.IsEventSet(AutoPauseOptions.PauseEvent.EnemySpotted) || IEModOptions.FastSneak != IEModOptions.FastSneakOptions.Normal) { this.UpdateEnemySpotted(); } if (this.QueuedAbility != null && this.QueuedAbility.Ready) { AIState currentState = this.m_ai.CurrentState; Consumable component = this.QueuedAbility.GetComponent <Consumable>(); if (!(component != null) || !component.IsIngestibleOrPotion) { Attack attack = currentState as Attack; TargetedAttack targetedAttack = currentState as TargetedAttack; if (this.QueuedAbility.Passive || attack == null && targetedAttack == null) { this.QueuedAbility.Activate(currentState.Owner); } else if (targetedAttack == null || !this.QueuedAbility.UsePrimaryAttack && !this.QueuedAbility.UseFullAttack) { Ability queuedAbility = AIStateManager.StatePool.Allocate <Ability>(); queuedAbility.QueuedAbility = this.QueuedAbility; if (attack == null) { base.StateManager.PushState(queuedAbility); } else if (!attack.CanCancel) { base.StateManager.QueueStateAtTop(queuedAbility); } else { attack.OnCancel(); base.StateManager.PopCurrentState(); base.StateManager.PushState(queuedAbility); } } } else { ConsumePotion queuedState = this.m_ai.QueuedState as ConsumePotion; if (!(currentState is ConsumePotion) && (queuedState == null || currentState.Priority < 1)) { ConsumePotion animationVariation = AIStateManager.StatePool.Allocate <ConsumePotion>(); base.StateManager.PushState(animationVariation); animationVariation.Ability = this.QueuedAbility; animationVariation.ConsumeAnimation = component.AnimationVariation; AttackBase primaryAttack = this.GetPrimaryAttack(); if (!(primaryAttack is AttackMelee) || !(primaryAttack as AttackMelee).Unarmed) { animationVariation.HiddenObjects = primaryAttack.GetComponentsInChildren <Renderer>(); } } } this.QueuedAbility = null; } BaseUpdate(); if (GameState.IsLoading || GameState.s_playerCharacter == null) { return; } if (this.m_alphaControl != null && this.m_alphaControl.Alpha < 1.401298E-45f) { this.m_alphaControl.Alpha = 1f; } if (this.m_mover != null && !GameState.InCombat) { bool fastSneakActive = false; if (IEModOptions.FastSneak != IEModOptions.FastSneakOptions.Normal && !(mod_Player.WalkMode)) { bool canSeeEnemy = false; if (IEModOptions.FastSneak == IEModOptions.FastSneakOptions.FastScoutingSingleLOS) { canSeeEnemy = this.m_enemySpotted; } else if (IEModOptions.FastSneak == IEModOptions.FastSneakOptions.FastScoutingAllLOS) { // if the fastSneak mod is active, then check if any enemies are spotted // if so...we walk for (int i = 0; i < PartyMemberAI.PartyMembers.Length; ++i) { var p = PartyMemberAI.PartyMembers[i]; if (p != null && p.m_enemySpotted) { canSeeEnemy = true; break; } } } else { //Should never get here, but make default behavior to not override stealth canSeeEnemy = true; } if (!canSeeEnemy) { fastSneakActive = true; } } bool flag = ((Stealth.IsInStealthMode(base.gameObject) && !fastSneakActive) || mod_Player.WalkMode); float desiredSpeed = (!flag ? this.m_mover.GetRunSpeed() : this.m_mover.GetWalkSpeed()); GameObject[] selectedPartyMembers = PartyMemberAI.SelectedPartyMembers; for (int i = 0; i < (int)selectedPartyMembers.Length; i++) { GameObject gameObject = selectedPartyMembers[i]; if (!(gameObject == null) && !(gameObject == base.gameObject) && flag == Stealth.IsInStealthMode(gameObject)) { Mover mover = gameObject.GetComponent <Mover>(); if (((!Stealth.IsInStealthMode(gameObject) || fastSneakActive) ? mover.GetRunSpeed() : mover.GetWalkSpeed()) < desiredSpeed) { desiredSpeed = mover.DesiredSpeed; } } } if (desiredSpeed < this.m_mover.GetWalkSpeed() * 0.75f) { desiredSpeed = this.m_mover.GetWalkSpeed(); } this.m_mover.UseCustomSpeed(desiredSpeed); } }
public bool mod_IsValidTarget(GameObject target, GameObject caster, TargetType validType) { //+ UNTOUCHED ORIGINAL CODE if (IgnoreValidTargetCheck()) { return(true); } if (target == null) { return(false); } if (caster == null) { caster = Owner; } Health component = target.GetComponent <Health>(); if (component == null || !component.CanBeTargeted || !target.activeInHierarchy) { return(false); } if (component.Dead) { if (!TargetTypeUtils.ValidTargetDead(validType)) { return(false); } } else if (component.Unconscious && !TargetTypeUtils.ValidTargetUnconscious(validType)) { return(false); } AIController aIController = GameUtilities.FindActiveAIController(target); if (aIController != null && aIController.IsBusy) { return(false); } CharacterStats characterStat = target.GetComponent <CharacterStats>(); if (ApplyOnceOnly && m_ability != null && characterStat != null && characterStat.CountStatusEffects(m_ability) > 0) { return(false); } Faction casterFaction = caster.GetComponent <Faction>(); Faction targetFaction = target.GetComponent <Faction>(); //+ END ORIGINAL CODE //!+ MODIFICATIONS //Replaced all appearances of 'faction.IsHostile(target) || component1 != null && component1.IsHostile(caster)' with 'HostileEvenIfConfused(target,caster)' switch (validType) { case TargetType.All: { return(true); } case TargetType.Hostile: { if (HostileEvenIfConfused(target, caster)) { return(true); } break; } case TargetType.Friendly: { if (FriendlyRightNowAndAlsoWhenConfused(target, caster)) { return(true); } break; } case TargetType.FriendlyUnconscious: { if (casterFaction != null && component.Unconscious && !component.Dead && !casterFaction.IsHostile(target) && (targetFaction == null || !targetFaction.IsHostile(caster))) { return(true); } break; } case TargetType.AllDeadOrUnconscious: { if (component.Unconscious || component.Dead) { return(true); } break; } case TargetType.HostileWithGrimoire: { if (HostileEvenIfConfused(target, caster)) { Equipment equipment = target.GetComponent <Equipment>(); if (equipment != null && equipment.CurrentItems != null && equipment.CurrentItems.Grimoire != null) { return(true); } } break; } case TargetType.HostileVessel: { if (HostileEvenIfConfused(target, caster) && characterStat != null && characterStat.CharacterRace == CharacterStats.Race.Vessel) { return(true); } break; } case TargetType.HostileBeast: { if (HostileEvenIfConfused(target, caster) && characterStat != null && characterStat.CharacterRace == CharacterStats.Race.Beast) { return(true); } break; } case TargetType.Dead: { if (component.Dead) { return(true); } break; } case TargetType.Ally: { PartyMemberAI partyMemberAI = caster.GetComponent <PartyMemberAI>(); PartyMemberAI partyMemberAI1 = target.GetComponent <PartyMemberAI>(); if (partyMemberAI != null && partyMemberAI.gameObject.activeInHierarchy) { if (partyMemberAI1 != null && partyMemberAI1.gameObject.activeInHierarchy) { return(true); } } else if (partyMemberAI1 == null || !partyMemberAI1.gameObject.activeInHierarchy) { return(true); } break; } case TargetType.AllyNotSelf: { if (target != caster && IsValidTarget(target, caster, TargetType.Ally)) { return(true); } break; } case TargetType.AllyNotSelfOrHostile: { if (IsValidTarget(target, caster, TargetType.Hostile) || IsValidTarget(target, caster, TargetType.AllyNotSelf)) { return(true); } break; } case TargetType.NotSelf: { if (target != caster) { return(true); } break; } case TargetType.DragonOrDrake: { if (characterStat != null && (characterStat.CharacterClass == CharacterStats.Class.Drake || characterStat.CharacterClass == CharacterStats.Class.AdraDragon || characterStat.CharacterClass == CharacterStats.Class.SkyDragon)) { return(true); } break; } case TargetType.FriendlyIncludingCharmed: { if (!HostileEvenIfConfused(target, caster)) { return(true); } if (caster != null) { if (casterFaction != null && aIController != null) { Team originalTeam = aIController.GetOriginalTeam(); if (originalTeam != null && originalTeam.GetRelationship(casterFaction.CurrentTeam) != Faction.Relationship.Hostile) { return(true); } } } break; } case TargetType.Self: { if (target == caster) { return(true); } break; } case TargetType.FriendlyNotVessel: { if (characterStat != null && characterStat.CharacterRace != CharacterStats.Race.Vessel && !HostileEvenIfConfused(target, caster)) { return(true); } break; } case AttackBase.TargetType.SpiritOrSummonedCreature: { if (characterStat && characterStat.CharacterRace == CharacterStats.Race.Spirit || aIController && aIController.SummonType == AIController.AISummonType.Summoned) { return(true); } break; } case AttackBase.TargetType.OwnAnimalCompanion: { if (aIController.SummonType == AIController.AISummonType.AnimalCompanion && aIController.Summoner == caster) { return(true); } break; } case AttackBase.TargetType.HostileWithNpcAppearance: { NPCAppearance nPCAppearance = target.GetComponent <NPCAppearance>(); if (nPCAppearance && nPCAppearance.isActiveAndEnabled && this.IsValidTarget(target, caster, AttackBase.TargetType.Hostile)) { return(true); } break; } case AttackBase.TargetType.OwnerOfPairedAbility: { PairedAbility pairedAbility = base.GetComponent <PairedAbility>(); if (!pairedAbility) { UIDebug.Instance.LogOnScreenWarning(string.Concat("Ability '", base.name, "' must have a PairedAbility component to use OwnerOfPairedAbility target type."), UIDebug.Department.Design, 10f); return(false); } return(!pairedAbility.OtherAbility ? false : target == pairedAbility.OtherAbility.Owner); } case AttackBase.TargetType.AnyWithResonance: { return(characterStat.CountStatusEffects("resonance", caster) > 0); } } //!+END MODIFICATIONS return(false); }
// PartyMemberAI public void UpdateNew() { if (this.m_mover != null && this.m_mover.AIController == null) { this.m_mover.AIController = this; } if (this.m_instructionTimer > 0f) { PartyMemberAI mInstructionTimer = this; mInstructionTimer.m_instructionTimer = mInstructionTimer.m_instructionTimer - Time.deltaTime; } if (this.m_instructions != null) { for (int i = 0; i < this.m_instructions.Count; i++) { this.m_instructions[i].Update(); } } if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty) { UIDebug.Instance.SetText("Party Debug", PartyMemberAI.GetPartyDebugOutput(), Color.cyan); UIDebug.Instance.SetTextPosition("Party Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight); } if (this.m_destinationCircleState != null) { if (!base.StateManager.IsStateInStack(this.m_destinationCircleState)) { this.m_destinationCircleState = null; this.HideDestination(); } else { this.ShowDestination(this.m_destinationCirclePosition); } } if (!(GameState.s_playerCharacter != null) || !GameState.s_playerCharacter.RotatingFormation || !this.Selected) { this.HideDestinationTarget(); } else { this.ShowDestinationTarget(this.m_desiredFormationPosition); } if (this.m_revealer == null) { this.CreateFogRevealer(); } else { this.m_revealer.WorldPos = base.gameObject.transform.position; this.m_revealer.RequiresRefresh = false; } if (GameState.Paused) { base.CheckForNullEngagements(); if (this.m_ai != null) { this.m_ai.Update(); } return; } if (this.m_ai == null) { return; } if (GameState.Option.AutoPause.IsEventSet(AutoPauseOptions.PauseEvent.EnemySpotted)) { this.UpdateEnemySpotted(); } if (this.QueuedAbility != null && this.QueuedAbility.Ready) { AIState currentState = this.m_ai.CurrentState; Consumable component = this.QueuedAbility.GetComponent <Consumable>(); if (!(component != null) || !component.IsFoodDrugOrPotion) { Attack attack = currentState as Attack; TargetedAttack targetedAttack = currentState as TargetedAttack; if (this.QueuedAbility.Passive || attack == null && targetedAttack == null) { this.QueuedAbility.Activate(currentState.Owner); } else if (targetedAttack == null || !this.QueuedAbility.UsePrimaryAttack && !this.QueuedAbility.UseFullAttack) { Ability queuedAbility = AIStateManager.StatePool.Allocate <Ability>(); queuedAbility.QueuedAbility = this.QueuedAbility; if (attack == null) { base.StateManager.PushState(queuedAbility); } else if (!attack.CanCancel) { base.StateManager.QueueStateAtTop(queuedAbility); } else { attack.OnCancel(); base.StateManager.PopCurrentState(); base.StateManager.PushState(queuedAbility); } } } else { ConsumePotion queuedState = this.m_ai.QueuedState as ConsumePotion; if (!(currentState is ConsumePotion) && (queuedState == null || currentState.Priority < 1)) { ConsumePotion animationVariation = AIStateManager.StatePool.Allocate <ConsumePotion>(); base.StateManager.PushState(animationVariation); animationVariation.Ability = this.QueuedAbility; animationVariation.ConsumeAnimation = component.AnimationVariation; AttackBase primaryAttack = this.GetPrimaryAttack(); if (!(primaryAttack is AttackMelee) || !(primaryAttack as AttackMelee).Unarmed) { animationVariation.HiddenObjects = primaryAttack.GetComponentsInChildren <Renderer>(); } } } this.QueuedAbility = null; } BaseUpdate(); if (GameState.IsLoading || GameState.s_playerCharacter == null) { return; } if (this.m_alphaControl != null && this.m_alphaControl.Alpha < 1.401298E-45f) { this.m_alphaControl.Alpha = 1f; } if (this.m_mover != null && !GameState.InCombat) { bool fastSneakActive = false; bool canSeeEnemy = false; bool flag = true; for (int i = 0; i < PartyMemberAI.PartyMembers.Length; ++i) { var p = PartyMemberAI.PartyMembers[i]; if (p != null && p.m_enemySpotted) { canSeeEnemy = true; break; } } if (!canSeeEnemy) { fastSneakActive = true; } if (Stealth.IsInStealthMode(base.gameObject) && !fastSneakActive) { flag = false; } this.m_mover.UseCustomSpeed((flag ? 4f : 2f)); } }
// PartyMemberAI public void UpdateNew() { if (this.m_mover != null && this.m_mover.AIController == null) { this.m_mover.AIController = this; } if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty) { UIDebug.Instance.SetText("Party Debug", PartyMemberAI.GetPartyDebugOutput(), Color.cyan); UIDebug.Instance.SetTextPosition("Party Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight); } if (this.m_destinationCircleState != null) { if (base.StateManager.IsStateInStack(this.m_destinationCircleState)) { this.ShowDestination(this.m_destinationCirclePosition); } else { this.m_destinationCircleState = null; this.HideDestination(); } } if (GameState.s_playerCharacter != null && GameState.s_playerCharacter.RotatingFormation && this.Selected) { this.ShowDestinationTarget(this.m_desiredFormationPosition); } else { this.HideDestinationTarget(); } if (this.m_revealer != null) { this.m_revealer.WorldPos = base.gameObject.transform.position; this.m_revealer.RequiresRefresh = false; } else { this.CreateFogRevealer(); } if (GameState.Paused) { base.CheckForNullEngagements(); if (this.m_ai != null) { this.m_ai.Update(); } base.DrawDebugText(); return; } if (this.m_ai == null) { return; } if (GameState.Option.AutoPause.IsEventSet(AutoPauseOptions.PauseEvent.EnemySpotted)) { this.UpdateEnemySpotted(); } if (this.QueuedAbility != null && this.QueuedAbility.Ready) { AIState currentState = this.m_ai.CurrentState; Consumable component = this.QueuedAbility.GetComponent <Consumable>(); if (component != null && component.Type == Consumable.ConsumableType.Ingestible) { ConsumePotion consumePotion = this.m_ai.QueuedState as ConsumePotion; if (!(currentState is ConsumePotion) && (consumePotion == null || currentState.Priority < 1)) { ConsumePotion consumePotion2 = AIStateManager.StatePool.Allocate <ConsumePotion>(); base.StateManager.PushState(consumePotion2); consumePotion2.Ability = this.QueuedAbility; AttackBase primaryAttack = this.GetPrimaryAttack(); if (!(primaryAttack is AttackMelee) || !(primaryAttack as AttackMelee).Unarmed) { consumePotion2.HiddenObjects = primaryAttack.GetComponentsInChildren <Renderer>(); } } } else { Attack attack = currentState as Attack; if (this.QueuedAbility.Passive || attack == null) { this.QueuedAbility.Activate(currentState.Owner); } else { Ability ability = AIStateManager.StatePool.Allocate <Ability>(); ability.QueuedAbility = this.QueuedAbility; if (attack != null) { if (attack.CanCancel) { attack.OnCancel(); base.StateManager.PopCurrentState(); base.StateManager.PushState(ability); } else { base.StateManager.QueueStateAtTop(ability); } } else { base.StateManager.PushState(ability); } } } this.QueuedAbility = null; } BaseUpdate(); // modified if (GameState.IsLoading || GameState.s_playerCharacter == null) { return; } if (this.m_alphaControl != null && this.m_alphaControl.Alpha < 1.401298E-45f) { this.m_alphaControl.Alpha = 1f; } if (this.m_mover != null && !GameState.InCombat) { var walk = false; // modified if (GameState.InStealthMode) { // If FastSneak is not enabled we walk if (!IEModOptions.FastSneak) { walk = true; } else { // if the fastSneak mod is active, then check if any enemies are spotted // if so...we walk for (int i = 0; i < PartyMemberAI.PartyMembers.Length; ++i) { var p = PartyMemberAI.PartyMembers[i]; if (p != null && p.m_enemySpotted) { walk = true; break; } } } } // walk mode overrides fast sneak mode if (Mod_NoEngagement_Player.WalkMode) { walk = true; } float num = (!walk) ? this.m_mover.GetRunSpeed() : this.m_mover.GetWalkSpeed(); // modified GameObject[] selectedPartyMembers = PartyMemberAI.SelectedPartyMembers; for (int i = 0; i < selectedPartyMembers.Length; i++) { GameObject gameObject = selectedPartyMembers[i]; if (!(gameObject == null) && !(gameObject == base.gameObject)) { Mover component2 = gameObject.GetComponent <Mover>(); float num2 = (!walk) ? component2.GetRunSpeed() : component2.GetWalkSpeed(); // modified if (num2 < num) { num = component2.DesiredSpeed; } } } if (num < this.m_mover.GetWalkSpeed() * 0.75f) { num = this.m_mover.GetWalkSpeed(); } this.m_mover.UseCustomSpeed(num); } if (this.m_suspicionDecayTimer > 0f) { this.m_suspicionDecayTimer -= Time.deltaTime; } if (this.m_suspicionDecayTimer <= 0f) { for (int j = this.m_detectingMe.Count - 1; j >= 0; j--) { this.m_detectingMe[j].m_time -= (float)AttackData.Instance.StealthDecayRate * Time.deltaTime; if (this.m_detectingMe[j].m_time <= 0f) { this.m_detectingMe.RemoveAt(j); } } } }
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; } } }
private new void HandleKnockedDownEvent(GameEventArgs args) { if (args.IntData[0] != 1) { //Console.AddMessage($"-- KnockedDown: stack count={m_numKnockdownStacks}"); if (--m_numKnockdownStacks > 0) { return; // don't do anything, since we have more active knockdown "stacks" } m_numKnockdownStacks = 0; // don't ever go negative AI.Achievement.KnockedDown knockedDown = this.StateManager.FindState(typeof(AI.Achievement.KnockedDown)) as AI.Achievement.KnockedDown; if (knockedDown != null) { //Console.AddMessage(" => standing up..."); knockedDown.Standup(); } } else { //Console.AddMessage($"++ KnockedDown: stack count={m_numKnockdownStacks}"); m_numKnockdownStacks++; this.CancelCurrentAttack(); AI.Achievement.KnockedDown knockedDown = this.StateManager.FindState(typeof(AI.Achievement.KnockedDown)) as AI.Achievement.KnockedDown; if (knockedDown == null) { // TODO: look for deferred state in the PushedBack one; with current logic newer knockdown can override stored one's duration, even if it is longer... //Console.AddMessage(" => no knockdowns active, allocating new state..."); knockedDown = AIStateManager.StatePool.Allocate <AI.Achievement.KnockedDown>(); if (!(this.StateManager.CurrentState is AI.Achievement.PushedBack)) { //Console.AddMessage(" => pushing it..."); this.StateManager.CurrentState.OnCancel(); this.StateManager.PushState(knockedDown); } else { //Console.AddMessage(" => deferring it..."); (this.StateManager.CurrentState as AI.Achievement.PushedBack).SetKnockedDownState(knockedDown); } knockedDown.SetKnockdownTime(args.FloatData[0]); } else { //Console.AddMessage(" => updating time left..."); knockedDown.ResetKnockedDown(args.FloatData[0]); } // this is standard status effect handling piece of code AIController baseThis = this; if (baseThis is PartyMemberAI && args.GameObjectData[0] != null) { PartyMemberAI component = args.GameObjectData[0].GetComponent <PartyMemberAI>(); if (component != null && component.gameObject.activeInHierarchy) { knockedDown.InCombatOverride = false; } } } }
protected void UpdateCursorNew() { ToggleWalkMode(); if (this.m_isCasting && this.m_castAbility != null) { if (!this.m_castAbility.ReadyForUI) { this.CancelModes(true); } if (this.m_castAbility != null && !this.m_castAbility.IsValidTarget(GameCursor.CharacterUnderCursor)) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; return; } } if (GameCursor.UiObjectUnderCursor != null) { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; if (this.m_isCasting && GameCursor.OverrideCharacterUnderCursor != null) { GameCursor.DesiredCursor = this.GetCastingCursor(); } return; } bool flag = PartyMemberAI.IsPrimaryPartyMemberSelected(); if (this.m_isSelecting) { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; } else { if (this.IsInForceAttackMode) { if (GameCursor.CharacterUnderCursor != null) { Health component = GameCursor.CharacterUnderCursor.GetComponent <Health>(); PartyMemberAI component2 = GameCursor.CharacterUnderCursor.GetComponent <PartyMemberAI>(); if (component == null || !component.CanBeTargeted || (component2 != null && component2.Selected)) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; } else { GameCursor.DesiredCursor = this.GetAttackCursor(); } } else { GameCursor.DesiredCursor = this.GetAttackCursor(); } } else { if (this.m_isCasting) { GameCursor.DesiredCursor = this.GetCastingCursor(); } else { if (this.RotatingFormation) { GameCursor.DesiredCursor = GameCursor.CursorType.RotateFormation; } else { if (GameCursor.ObjectUnderCursor != null) { Faction component3 = GameCursor.ObjectUnderCursor.GetComponent <Faction>(); Health component4 = GameCursor.ObjectUnderCursor.GetComponent <Health>(); Trap component5 = GameCursor.ObjectUnderCursor.GetComponent <Trap>(); Container component6 = GameCursor.ObjectUnderCursor.GetComponent <Container>(); if (component3 != null && (component5 == null || component5.Visible) && (!component4 || component4.CurrentHealth > 0f) && component6 == null) { if (component5 != null) { if (component3.RelationshipToPlayer == Faction.Relationship.Hostile && !GameCursor.OverrideCharacterUnderCursor && !flag) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; } else { Collider2D component7 = GameCursor.ObjectUnderCursor.GetComponent <Collider2D>(); if (component7 != null && component5.CanDisarm) { GameCursor.DesiredCursor = GameCursor.CursorType.Disarm; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; } } } else { if (component3.RelationshipToPlayer == Faction.Relationship.Hostile && !GameCursor.OverrideCharacterUnderCursor) { GameCursor.DesiredCursor = this.GetAttackCursor(); } else { NPCDialogue component8 = GameCursor.ObjectUnderCursor.GetComponent <NPCDialogue>(); PartyMemberAI component9 = GameCursor.ObjectUnderCursor.GetComponent <PartyMemberAI>(); AIController component10 = GameCursor.ObjectUnderCursor.GetComponent <AIController>(); if (flag && (!component10 || (!component10.IsBusy && !component10.IsFactionSwapped())) && component8 && (component9 == null || !component9.IsInSlot)) { GameCursor.DesiredCursor = GameCursor.CursorType.Talk; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; } } } } else { TrapTriggerGeneric component11 = GameCursor.ObjectUnderCursor.GetComponent <TrapTriggerGeneric>(); if (component11) { GameCursor.DesiredCursor = GameCursor.CursorType.AreaTransition; return; } Door component12 = GameCursor.ObjectUnderCursor.GetComponent <Door>(); if (component12) { if (component12.CurrentState == OCL.State.Closed) { GameCursor.DesiredCursor = GameCursor.CursorType.OpenDoor; } else { if (component12.CurrentState == OCL.State.Open) { if (component12.IsAnyMoverIntersectingNavMeshObstacle()) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; } else { GameCursor.DesiredCursor = GameCursor.CursorType.CloseDoor; } } else { if (component12.CurrentState == OCL.State.Locked) { GameCursor.DesiredCursor = GameCursor.CursorType.LockedDoor; } } } return; } Container component13 = GameCursor.ObjectUnderCursor.GetComponent <Container>(); if (component13 != null) { if (!flag) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; return; } if (component5 != null && !component5.Disarmed && component5.Visible && component5.CanDisarm && GameState.InStealthMode) { GameCursor.DesiredCursor = GameCursor.CursorType.Disarm; return; } if (!GameState.InCombat) { if (component13.CurrentState == OCL.State.Closed) { if (component13.StealingFactionID != FactionName.None) { GameCursor.DesiredCursor = GameCursor.CursorType.Stealing; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Loot; } } else { if (component13.CurrentState == OCL.State.Locked) { if (component13.StealingFactionID != FactionName.None) { GameCursor.DesiredCursor = GameCursor.CursorType.StealingLocked; } else { GameCursor.DesiredCursor = GameCursor.CursorType.LockedDoor; } } } } return; } else { AutoLootContainer component14 = GameCursor.ObjectUnderCursor.GetComponent <AutoLootContainer>(); if (component14 && flag && !GameState.InCombat) { GameCursor.DesiredCursor = GameCursor.CursorType.Interact; return; } RestInteraction component15 = GameCursor.ObjectUnderCursor.GetComponent <RestInteraction>(); if (component15 && flag && !GameState.InCombat) { GameCursor.DesiredCursor = GameCursor.CursorType.Interact; return; } Animate component16 = GameCursor.ObjectUnderCursor.GetComponent <Animate>(); if (component16 && flag) { GameCursor.DesiredCursor = GameCursor.CursorType.Interact; return; } SceneTransition component17 = GameCursor.ObjectUnderCursor.GetComponent <SceneTransition>(); if (component17) { if (GameCursor.CursorOverride != GameCursor.CursorType.None) { GameCursor.DesiredCursor = GameCursor.CursorOverride; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; } return; } ScriptedInteraction component18 = GameCursor.ObjectUnderCursor.GetComponent <ScriptedInteraction>(); if (component18 && (!component18.IsUsable || PartyMemberAI.IsPartyMemberUnconscious())) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; return; } Collider2D component19 = GameCursor.ObjectUnderCursor.GetComponent <Collider2D>(); if (component19 && (component5 == null || component5.Visible)) { if (!flag) { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; return; } if (GameCursor.CursorOverride != GameCursor.CursorType.None) { GameCursor.DesiredCursor = GameCursor.CursorOverride; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Normal; } return; } } } } else { if (this.IsMouseOnWalkMesh()) { if (GameState.InCombat && this.IsSelectedPartyMemberEngaged()) { GameCursor.DesiredCursor = GameCursor.CursorType.Disengage; } else { GameCursor.DesiredCursor = GameCursor.CursorType.Walk; } } else { GameCursor.DesiredCursor = GameCursor.CursorType.NoWalk; } } } } } } this.WantsAttackAdvantageCursor = false; }
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); } } }