public override IEnumerator StartMyActivationCoroutine() { Ability thunderStrike = mySpellBook.GetAbilityByName("Thunder Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability lightningBolt = mySpellBook.GetAbilityByName("Lightning Bolt"); Ability chainLightning = mySpellBook.GetAbilityByName("Chain Lightning"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Thunder Strike else if (myCurrentTarget.myPassiveManager.shocked && EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, thunderStrike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformThunderStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Chain Lightning else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, chainLightning.abilityRange) && EntityLogic.IsAbilityUseable(this, chainLightning, myCurrentTarget) && EntityLogic.GetAllEnemiesWithinRange(myCurrentTarget, 1).Count > 0) { Action action = AbilityLogic.Instance.PerformChainLightning(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Lightning Bolt else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, lightningBolt.abilityRange) && EntityLogic.IsAbilityUseable(this, lightningBolt, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformLightningBolt(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, strike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if ( EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, thunderStrike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
public override IEnumerator StartMyActivationCoroutine() { Ability move = mySpellBook.GetAbilityByName("Move"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability fireBall = mySpellBook.GetAbilityByName("Fire Ball"); Ability melt = mySpellBook.GetAbilityByName("Melt"); Ability combustion = mySpellBook.GetAbilityByName("Combustion"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Melt best target else if (EntityLogic.GetBestMeltTarget(this) != null && EntityLogic.IsTargetInRange(this, EntityLogic.GetBestMeltTarget(this), melt.abilityRange) && EntityLogic.IsAbilityUseable(this, melt, EntityLogic.GetBestMeltTarget(this))) { Action action = AbilityLogic.Instance.PerformMelt(this, EntityLogic.GetBestMeltTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Else, Melt current target if in range, and if it has block else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, melt.abilityRange) && myCurrentTarget.currentBlock > 0 && EntityLogic.IsAbilityUseable(this, melt, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformMelt(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Combustion best target else if (EntityLogic.GetBestCombustionTarget(this) != null && EntityLogic.IsTargetInRange(this, EntityLogic.GetBestCombustionTarget(this), melt.abilityRange) && EntityLogic.IsAbilityUseable(this, melt, EntityLogic.GetBestCombustionTarget(this)) && EntityLogic.GetBestCombustionTarget(this).myPassiveManager.burningStacks > 5 && EntityLogic.GetAllEnemiesWithinRange(EntityLogic.GetBestCombustionTarget(this), 1).Count > 1 ) { Action action = AbilityLogic.Instance.PerformCombustion(this, EntityLogic.GetBestMeltTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Combustion current target if burning enough else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, melt.abilityRange) && EntityLogic.IsAbilityUseable(this, melt, myCurrentTarget) && myCurrentTarget.myPassiveManager.burningStacks > 5 && EntityLogic.GetAllEnemiesWithinRange(myCurrentTarget, 1).Count > 1 ) { Action action = AbilityLogic.Instance.PerformCombustion(this, EntityLogic.GetBestMeltTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Fire ball else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, fireBall.abilityRange) && EntityLogic.IsAbilityUseable(this, fireBall, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformFireBall(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if ( EntityLogic.IsTargetInRange(this, myCurrentTarget, fireBall.abilityRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, fireBall, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
public override IEnumerator StartMyActivationCoroutine() { Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability provoke = mySpellBook.GetAbilityByName("Provoke"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability testudo = mySpellBook.GetAbilityByName("Testudo"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Provoke else if (EntityLogic.IsAbilityUseable(this, provoke, myCurrentTarget) && EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange)) { Action action = AbilityLogic.Instance.PerformProvoke(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsAbilityUseable(this, strike, myCurrentTarget) && EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange)) { Action action = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Testudo, if in melee else if (EntityLogic.IsAbilityUseable(this, strike) && EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Count > 0) { Action action = AbilityLogic.Instance.PerformTestudo(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
public override IEnumerator StartMyActivationCoroutine() { Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability smash = mySpellBook.GetAbilityByName("Smash"); Ability whirlwind = mySpellBook.GetAbilityByName("Whirlwind"); ActionStart: // Pause if game over event has started while (EventManager.Instance.gameOverEventStarted) { yield return(null); } // Decide on target SetTargetDefender(EntityLogic.GetBestTarget(this, true)); if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Smash else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, smash, myCurrentTarget) ) { Action action = AbilityLogic.Instance.PerformSmash(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Whirlwind else if (EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Count > 1 && EntityLogic.IsAbilityUseable(this, whirlwind)) { Action action = AbilityLogic.Instance.PerformWhirlwind(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, strike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, strike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
public override IEnumerator StartMyActivationCoroutine() { // Get ability data Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability charge = mySpellBook.GetAbilityByName("Charge"); Ability whirlwind = mySpellBook.GetAbilityByName("Whirlwind"); ActionStart: // Pause if game over event has started while (EventManager.Instance.gameOverEventStarted) { yield return(null); } // Decide on target SetTargetDefender(EntityLogic.GetBestTarget(this, true)); // below line used later to prevent charging against a this is already in melee with List <Tile> tilesInMyMeleeRange = LevelManager.Instance.GetTilesWithinRange(currentMeleeRange, tile); // End activation if stunned, out of energy, etc if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Try Charge else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, charge.abilityRange + EntityLogic.GetTotalMobility(this)) && EntityLogic.IsAbilityUseable(this, charge, myCurrentTarget) && tilesInMyMeleeRange.Contains(myCurrentTarget.tile) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, charge.abilityRange + EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, charge.abilityRange + EntityLogic.GetTotalMobility(this)); Action chargeAction = AbilityLogic.Instance.PerformCharge(this, myCurrentTarget, destination); yield return(new WaitUntil(() => chargeAction.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Whirlwind else if (EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Count > 1 && EntityLogic.IsAbilityUseable(this, whirlwind)) { Action action = AbilityLogic.Instance.PerformWhirlwind(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, strike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, strike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
private IEnumerator StartEntityOnActivationEndEventsCoroutine(LivingEntity entity, Action action) { Debug.Log("LivingEntityManager.StartEntityOnActivationEndEventsCoroutine() called for " + entity.myName); bool eventCompleted = false; // Wrap events in a while statement to allow a stoppage if the character dies during their end activation events while (eventCompleted == false && entity.inDeathProcess == false && entity != null) { // Remove/apply relevant status effects and passives if (entity.myPassiveManager.vulnerable) { Debug.Log("OnActivationEndCoroutine() clearing Vulnerable..."); entity.myPassiveManager.ModifyVulnerable(-1); yield return(new WaitForSeconds(1f)); } // Remove Weakened if (entity.myPassiveManager.weakened) { Debug.Log("OnActivationEndCoroutine() clearing Weakened..."); entity.myPassiveManager.ModifyWeakened(-1); yield return(new WaitForSeconds(1f)); } // Remove Immobilized if (entity.myPassiveManager.immobilized) { Debug.Log("OnActivationEndCoroutine() clearing Immobilized..."); entity.myPassiveManager.ModifyImmobilized(-entity.myPassiveManager.immobilizedStacks); yield return(new WaitForSeconds(1f)); } // Remove Blind if (entity.myPassiveManager.blind) { Debug.Log("OnActivationEndCoroutine() clearing Blind..."); entity.myPassiveManager.ModifyBlind(-entity.myPassiveManager.blindStacks); yield return(new WaitForSeconds(1f)); } // Remove Disarmed if (entity.myPassiveManager.disarmed) { Debug.Log("OnActivationEndCoroutine() clearing Disarmed..."); entity.myPassiveManager.ModifyDisarmed(-entity.myPassiveManager.disarmedStacks); yield return(new WaitForSeconds(1f)); } // Remove Silenced if (entity.myPassiveManager.silenced) { Debug.Log("OnActivationEndCoroutine() clearing Silenced..."); entity.myPassiveManager.ModifySilenced(-entity.myPassiveManager.silencedStacks); yield return(new WaitForSeconds(1f)); } // Remove Stunned if (entity.myPassiveManager.stunned) { Debug.Log("OnActivationEndCoroutine() clearing Stunned.."); entity.myPassiveManager.ModifyStunned(-entity.myPassiveManager.stunnedStacks); yield return(new WaitForSeconds(1f)); } // Remove Sleep if (entity.myPassiveManager.sleep) { Debug.Log("OnActivationEndCoroutine() clearing Sleep..."); entity.myPassiveManager.ModifySleep(-entity.myPassiveManager.sleepStacks); yield return(new WaitForSeconds(1f)); } // Remove Taunted if (entity.myPassiveManager.taunted) { Debug.Log("OnActivationEndCoroutine() clearing Taunted..."); entity.myPassiveManager.ModifyTaunted(-entity.myPassiveManager.tauntedStacks, null); yield return(new WaitForSeconds(1f)); } // Remove Chilled if (entity.myPassiveManager.chilled) { Debug.Log("OnActivationEndCoroutine() clearing Chilled..."); entity.myPassiveManager.ModifyChilled(-entity.myPassiveManager.chilledStacks); yield return(new WaitForSeconds(1f)); } // Remove Shocked if (entity.myPassiveManager.shocked) { Debug.Log("OnActivationEndCoroutine() clearing Shocked..."); entity.myPassiveManager.ModifyShocked(-entity.myPassiveManager.shockedStacks); yield return(new WaitForSeconds(1f)); } // Encouraging Aura if (entity.myPassiveManager.encouragingAura) { Debug.Log("OnActivationEndCoroutine() checking Encouraging Aura.."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Encouraging Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateHolyNova(entity.transform.position); yield return(new WaitForSeconds(0.5f)); List <Tile> tilesInEncouragingPresenceRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entitty in allLivingEntities) { if (tilesInEncouragingPresenceRange.Contains(entitty.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entitty)) { Debug.Log("Character " + entitty.name + " is within range of Encouraging presence, granting bonus Energy..."); VisualEffectManager.Instance.CreateGainEnergyBuffEffect(entitty.transform.position); entitty.ModifyCurrentEnergy(entity.myPassiveManager.encouragingAuraStacks); } } yield return(new WaitForSeconds(1f)); } // Soul Drain Aura if (entity.myPassiveManager.soulDrainAura) { Debug.Log("OnActivationEndCoroutine() checking Soul Drain Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Soul Drain Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateShadowNova(entity.transform.position); List <Tile> tilesInSoulDrainAuraRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInSoulDrainAuraRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy) == false) { Debug.Log("Character " + entityy.name + " is within range of Sould Drain Aura, stealing Strength..."); entityy.ModifyCurrentStrength(-entity.myPassiveManager.soulDrainAuraStacks); entity.ModifyCurrentStrength(entity.myPassiveManager.soulDrainAuraStacks); } } yield return(new WaitForSeconds(1f)); } // Hateful Aura if (entity.myPassiveManager.hatefulAura) { Debug.Log("OnActivationEndCoroutine() checking Hateful Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Hateful Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateShadowNova(entity.transform.position); List <Tile> tilesInHatefulPresenceRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInHatefulPresenceRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy)) { Debug.Log("Character " + entityy.name + " is within range of Hateful Aura, granting bonus Strength..."); entityy.myPassiveManager.ModifyBonusStrength(entity.myPassiveManager.hatefulAuraStacks); } } yield return(new WaitForSeconds(1f)); } // Fiery Aura if (entity.myPassiveManager.fieryAura) { Debug.Log("OnActivationEndCoroutine() checking Fiery Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Fiery Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateFireNova(entity.transform.position); List <Tile> tilesInFieryAuraRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); List <LivingEntity> targetsHit = new List <LivingEntity>(); // Get targets hit foreach (LivingEntity entityy in allLivingEntities) { if (tilesInFieryAuraRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy) == false) { targetsHit.Add(entityy); } } // Damage targets hit foreach (LivingEntity entityyy in targetsHit) { int finalDamageValue = CombatLogic.Instance.GetFinalDamageValueAfterAllCalculations(entity, entityyy, null, "Fire", false, entity.myPassiveManager.fieryAuraStacks); Action damageAction = CombatLogic.Instance.HandleDamage(finalDamageValue, entity, entityyy, "Fire"); yield return(new WaitUntil(() => damageAction.ActionResolved() == true)); } yield return(new WaitForSeconds(1f)); } // Shadow Aura if (entity.myPassiveManager.shadowAura) { Debug.Log("OnActivationEndCoroutine() checking Shadow Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Shadow Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateShadowNova(entity.transform.position); List <Tile> tilesInShadowAuraRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInShadowAuraRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy) == false) { entityy.myPassiveManager.ModifyWeakened(1); } } yield return(new WaitForSeconds(1f)); } // Storm Aura if (entity.myPassiveManager.stormAura) { Debug.Log("OnActivationEndCoroutine() checking Storm Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Storm Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateLightningNova(entity.transform.position); List <LivingEntity> stormAuraRange = EntityLogic.GetAllEnemiesWithinRange(entity, EntityLogic.GetTotalAuraSize(entity)); List <LivingEntity> targetsHit = new List <LivingEntity>(); // are there even enemies within aura range? if (stormAuraRange.Count > 0) { // get a random target 2 times for (int i = 0; i < 2; i++) { targetsHit.Add(stormAuraRange[Random.Range(0, stormAuraRange.Count)]); } // Resolve hits against targets foreach (LivingEntity entityy in targetsHit) { if (entityy.inDeathProcess == false) { // Calc daamage int finalDamageValue = CombatLogic.Instance.GetFinalDamageValueAfterAllCalculations(entity, entityy, null, "Air", false, entity.myPassiveManager.stormAuraStacks); // Shoot lightning ball Action lightningShotAction = VisualEffectManager.Instance.ShootToonLightningBall(entity.transform.position, entityy.transform.position); yield return(new WaitUntil(() => lightningShotAction.ActionResolved() == true)); // Handle damage Action abilityAction = CombatLogic.Instance.HandleDamage(finalDamageValue, entity, entityy, "Air"); yield return(new WaitUntil(() => abilityAction.ActionResolved() == true)); } } yield return(new WaitForSeconds(1f)); } } // Guardian Aura if (entity.myPassiveManager.guardianAura) { Debug.Log("OnActivationEndCoroutine() checking Guardian Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Guardian Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateHolyNova(entity.transform.position); List <Tile> tilesInGuardianAuraRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInGuardianAuraRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy)) { // Give target block entityy.ModifyCurrentBlock(CombatLogic.Instance.CalculateBlockGainedByEffect(entity.myPassiveManager.guardianAuraStacks, entity)); } } yield return(new WaitForSeconds(1f)); } // Toxic Aura if (entity.myPassiveManager.toxicAura) { Debug.Log("OnActivationEndCoroutine() checking Toxic Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Toxic Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreatePoisonNova(entity.transform.position); List <Tile> tilesInToxicAuraRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInToxicAuraRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy) == false) { // Modify Poisoned entityy.myPassiveManager.ModifyPoisoned(entity.myPassiveManager.toxicAuraStacks, entity); } } yield return(new WaitForSeconds(1f)); } // Sacred Aura if (entity.myPassiveManager.sacredAura) { Debug.Log("OnActivationEndCoroutine() checking Sacred Aura..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Sacred Aura"); yield return(new WaitForSeconds(0.5f)); VisualEffectManager.Instance.CreateHolyNova(entity.transform.position); List <Tile> tilesInEncouragingPresenceRange = LevelManager.Instance.GetTilesWithinRange(EntityLogic.GetTotalAuraSize(entity), entity.tile); foreach (LivingEntity entityy in allLivingEntities) { if (tilesInEncouragingPresenceRange.Contains(entityy.tile) && CombatLogic.Instance.IsTargetFriendly(entity, entityy)) { Debug.Log("Character " + entityy.name + " is within range of Sacred Aura, removing debuffs..."); VisualEffectManager.Instance.CreateHolyBuffEffect(entityy.transform.position); // Remove Blind if (entityy.myPassiveManager.blind) { entityy.myPassiveManager.ModifyBlind(-entityy.myPassiveManager.blindStacks); yield return(new WaitForSeconds(0.5f)); } // Remove Disarmed if (entityy.myPassiveManager.disarmed) { entityy.myPassiveManager.ModifyDisarmed(-entityy.myPassiveManager.disarmedStacks); yield return(new WaitForSeconds(0.5f)); } // Remove Silenced if (entityy.myPassiveManager.silenced) { entityy.myPassiveManager.ModifySilenced(-entityy.myPassiveManager.silencedStacks); yield return(new WaitForSeconds(0.5f)); } // Remove Weakened if (entityy.myPassiveManager.weakened) { entityy.myPassiveManager.ModifyWeakened(-entityy.myPassiveManager.weakenedStacks); yield return(new WaitForSeconds(0.5f)); } // Remove Vulnerable if (entityy.myPassiveManager.vulnerable) { entityy.myPassiveManager.ModifyVulnerable(-entityy.myPassiveManager.vulnerableStacks); yield return(new WaitForSeconds(0.5f)); } } } yield return(new WaitForSeconds(1f)); } // Regeneration if (entity.myPassiveManager.regeneration) { Debug.Log("OnActivationEndCoroutine() checking Regeneration..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Regeneration"); entity.ModifyCurrentHealth(entity.myPassiveManager.regenerationStacks); yield return(new WaitForSeconds(0.5f)); } // Poisoned if (entity.myPassiveManager.poisoned) { Debug.Log("OnActivationEndCoroutine() checking Poisoned..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Poisoned"); yield return(new WaitForSeconds(0.5f)); int poisonDamageFinalValue = CombatLogic.Instance.GetDamageValueAfterResistances(entity.myPassiveManager.poisonedStacks, "Poison", entity); Action poisonDamage = CombatLogic.Instance.HandleDamage(poisonDamageFinalValue, null, entity, "Poison", null); yield return(new WaitUntil(() => poisonDamage.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); } // Burning if (entity.myPassiveManager.burning) { Debug.Log("OnActivationEndCoroutine() checking Burning..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Burning"); yield return(new WaitForSeconds(0.5f)); int fireDamageFinalValue = CombatLogic.Instance.GetDamageValueAfterResistances(entity.myPassiveManager.burningStacks, "Fire", entity); Action burningDamage = CombatLogic.Instance.HandleDamage(fireDamageFinalValue, null, entity, "Fire", null); yield return(new WaitUntil(() => burningDamage.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); } // Fading if (entity.myPassiveManager.fading) { Debug.Log("OnActivationEndCoroutine() checking Fading..."); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Fading"); yield return(new WaitForSeconds(0.5f)); Action fadingDamage = CombatLogic.Instance.HandleDamage(entity.myPassiveManager.fadingStacks, entity, entity, "None", null, true); yield return(new WaitUntil(() => fadingDamage.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); } // Remove Temporary Imbuements // Air Imbuement if (entity.myPassiveManager.temporaryAirImbuement) { Debug.Log("OnActivationEndCoroutine() checking Temporary Air Imbuement..."); entity.myPassiveManager.ModifyTemporaryAirImbuement(-entity.myPassiveManager.temporaryAirImbuementStacks); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Air Imbuement Removed"); yield return(new WaitForSeconds(1f)); } // Fire Imbuement if (entity.myPassiveManager.temporaryFireImbuement) { Debug.Log("OnActivationEndCoroutine() checking Temporary Fire Imbuement..."); entity.myPassiveManager.ModifyTemporaryFireImbuement(-entity.myPassiveManager.temporaryFireImbuementStacks); VisualEffectManager.Instance.CreateStatusEffect(entity.transform.position, "Fire Imbuement Removed"); yield return(new WaitForSeconds(1f)); } // Shadow Imbuement if (entity.myPassiveManager.temporaryShadowImbuement) { Debug.Log("OnActivationEndCoroutine() checking Temporary Shadow Imbuement..."); entity.myPassiveManager.ModifyTemporaryShadowImbuement(-entity.myPassiveManager.temporaryShadowImbuementStacks); yield return(new WaitForSeconds(1f)); } // Frost Imbuement if (entity.myPassiveManager.temporaryFrostImbuement) { Debug.Log("OnActivationEndCoroutine() checking Temporary Frost Imbuement..."); entity.myPassiveManager.ModifyTemporaryFrostImbuement(-entity.myPassiveManager.temporaryFrostImbuementStacks); yield return(new WaitForSeconds(1f)); } // Poison Imbuement if (entity.myPassiveManager.temporaryPoisonImbuement) { Debug.Log("OnActivationEndCoroutine() checking Temporary Poison Imbuement..."); entity.myPassiveManager.ModifyTemporaryPoisonImbuement(-entity.myPassiveManager.temporaryPoisonImbuementStacks); yield return(new WaitForSeconds(1f)); } // Rapid Cloaking if (entity.myPassiveManager.rapidCloaking) { Debug.Log("OnActivationEndCoroutine() checking Rapid Cloaking..."); entity.myPassiveManager.ModifyCamoflage(1); yield return(new WaitForSeconds(1f)); } // Camoflage from 'Thieves Guild Membership' state /* * if (entity.defender && * StateManager.Instance.DoesPlayerAlreadyHaveState("Thieves Guild Membership") && * entity.myPassiveManager.camoflage == false && * TurnChangeNotifier.Instance.currentTurnCount == 1) * { * Debug.Log("OnActivationEndCoroutine() checking Thieves Guild Membership..."); * entity.myPassiveManager.ModifyCamoflage(1); * yield return new WaitForSeconds(1f); * } */ // Tile related events if (entity.tile.myTileType == Tile.TileType.Grass) { Debug.Log("OnActivationEndCoroutine() checking Grass Tile (Camoflage)..."); if (entity.myPassiveManager.camoflage == false) { entity.myPassiveManager.ModifyCamoflage(1); yield return(new WaitForSeconds(1)); } if (entity.myPassiveManager.forestWisdom) { entity.myPassiveManager.ModifyBonusWisdom(2); yield return(new WaitForSeconds(1)); } } // Remove Temporary Core + Secondary Stats // Bonus Strength if (entity.myPassiveManager.temporaryBonusStrength) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Strength..."); entity.myPassiveManager.ModifyTemporaryStrength(-entity.myPassiveManager.temporaryBonusStrengthStacks); yield return(new WaitForSeconds(1f)); } // Bonus Dexterity if (entity.myPassiveManager.temporaryBonusDexterity) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Dexterity..."); entity.myPassiveManager.ModifyTemporaryDexterity(-entity.myPassiveManager.temporaryBonusDexterityStacks); yield return(new WaitForSeconds(1f)); } // Bonus Stamina if (entity.myPassiveManager.temporaryBonusStamina) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Stamina..."); entity.myPassiveManager.ModifyTemporaryStamina(-entity.myPassiveManager.temporaryBonusStaminaStacks); yield return(new WaitForSeconds(1)); } // Bonus Wisdom if (entity.myPassiveManager.temporaryBonusWisdom) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Wisdom..."); entity.myPassiveManager.ModifyTemporaryWisdom(-entity.myPassiveManager.temporaryBonusWisdomStacks); yield return(new WaitForSeconds(1f)); } // Bonus Initiative if (entity.myPassiveManager.temporaryBonusInitiative) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Initiative..."); entity.myPassiveManager.ModifyTemporaryInitiative(-entity.myPassiveManager.temporaryBonusInitiativeStacks); yield return(new WaitForSeconds(1f)); } // Bonus Mobility if (entity.myPassiveManager.temporaryBonusMobility) { Debug.Log("OnActivationEndCoroutine() checking Temporary Bonus Mobility..."); entity.myPassiveManager.ModifyTemporaryMobility(-entity.myPassiveManager.temporaryBonusMobilityStacks); yield return(new WaitForSeconds(1f)); } // Remove Terrified if (entity.myPassiveManager.terrified) { Debug.Log("OnActivationEndCoroutine() checking Terrified..."); entity.myPassiveManager.ModifyTerrified(-entity.myPassiveManager.terrifiedStacks); yield return(new WaitForSeconds(1f)); } // Remove Temporary True Sight if (entity.myPassiveManager.temporaryTrueSight) { Debug.Log("OnActivationEndCoroutine() checking Temporary True Sight..."); entity.myPassiveManager.ModifyTemporaryTrueSight(-entity.myPassiveManager.temporaryTrueSightStacks); yield return(new WaitForSeconds(1f)); } // Remove Dark Gift if (entity.myPassiveManager.darkGift) { Debug.Log("OnActivationEndCoroutine() checking Dark Gift..."); entity.myPassiveManager.ModifyDarkGift(-entity.myPassiveManager.darkGiftStacks); yield return(new WaitForSeconds(1f)); } // Remove Pure Hate if (entity.myPassiveManager.pureHate) { Debug.Log("OnActivationEndCoroutine() checking Pure Hate..."); entity.myPassiveManager.ModifyPureHate(-entity.myPassiveManager.pureHateStacks); yield return(new WaitForSeconds(1f)); } // Remove Temporary Hawk Eye if (entity.myPassiveManager.temporaryHawkEye) { Debug.Log("OnActivationEndCoroutine() checking Temporary Hawk Eye..."); entity.myPassiveManager.ModifyTemporaryHawkEyeBonus(-entity.myPassiveManager.temporaryHawkEyeStacks); yield return(new WaitForSeconds(1f)); } // Remove Berserk if (entity.myPassiveManager.berserk) { Debug.Log("OnActivationEndCoroutine() checking Berserk..."); entity.myPassiveManager.ModifyBerserk(-entity.myPassiveManager.berserkStacks); yield return(new WaitForSeconds(1f)); } // All effects completed and checked Debug.Log("LivingEntityManager.StartEntityOnActivationEndEventsCoroutine() finished 'while' loop"); eventCompleted = true; Debug.Log("LivingEntityManager.StartEntityOnActivationEndEventsCoroutine() 'eventCompleted' bool marked as true..."); } // Resolve Debug.Log("LivingEntityManager.StartEntityOnActivationEndEventsCoroutine() finished and resolving..."); yield return(new WaitForSeconds(0.5f)); action.actionResolved = true; }
public override IEnumerator StartMyActivationCoroutine() { Ability move = mySpellBook.GetAbilityByName("Move"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability toxicSlash = mySpellBook.GetAbilityByName("Toxic Slash"); Ability chemicalReaction = mySpellBook.GetAbilityByName("Chemical Reaction"); Ability noxiousFumes = mySpellBook.GetAbilityByName("Noxious Fumes"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Noxious Fumes else if (EntityLogic.GetAllEnemiesWithinRange(this, 1).Count > 0 && EntityLogic.IsAbilityUseable(this, noxiousFumes, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformNoxiousFumes(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Toxic Slash else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, toxicSlash, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformToxicSlash(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Chemical Reaction else if (EntityLogic.GetBestChemicalReactionTarget(this) != null && EntityLogic.IsTargetInRange(this, EntityLogic.GetBestChemicalReactionTarget(this), chemicalReaction.abilityRange) && EntityLogic.IsAbilityUseable(this, chemicalReaction, EntityLogic.GetBestChemicalReactionTarget(this)) ) { SetTargetDefender(EntityLogic.GetBestChemicalReactionTarget(this)); Action action = AbilityLogic.Instance.PerformChemicalReaction(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, strike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if ( EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }
public override IEnumerator StartMyActivationCoroutine() { Ability twinStrike = mySpellBook.GetAbilityByName("Twin Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability dash = mySpellBook.GetAbilityByName("Dash"); Ability shank = mySpellBook.GetAbilityByName("Shank"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, false, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Shank best target else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, shank)) { Action action = AbilityLogic.Instance.PerformShank(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Twin Strike best target else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, twinStrike, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformTwinStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Shank closest target else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), currentMeleeRange) && EntityLogic.IsAbilityUseable(this, shank, EntityLogic.GetBestTarget(this, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformShank(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike closest target else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), currentMeleeRange) && EntityLogic.IsAbilityUseable(this, twinStrike, EntityLogic.GetBestTarget(this, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformTwinStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Dash else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, false, true), currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && // dont dash if already in melee (this would trigger a free strike) EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Count == 0 && EntityLogic.IsAbilityUseable(this, dash) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(dash, twinStrike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, EntityLogic.GetBestTarget(this, false, true), currentMeleeRange, dash.abilityPrimaryValue + EntityLogic.GetTotalMobility(this)) != null ) { SetTargetDefender(EntityLogic.GetBestTarget(this, false, true)); Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, dash.abilityPrimaryValue + EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformDash(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, false, true), currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, twinStrike, this) ) { SetTargetDefender(EntityLogic.GetBestTarget(this, false, true)); Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)); Action movementAction = AbilityLogic.Instance.PerformMove(this, destination); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); // small delay here in order to seperate the two actions a bit. yield return(new WaitForSeconds(1f)); goto ActionStart; } // If, for whatever reason, we cant attack or move towards the weakest enemy, attack the nearest enemy // Shank closest target else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), currentMeleeRange) && EntityLogic.IsAbilityUseable(this, shank, EntityLogic.GetBestTarget(this, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformShank(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Twin Strike else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), currentMeleeRange) && EntityLogic.IsAbilityUseable(this, twinStrike, EntityLogic.GetBestTarget(this, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformTwinStrike(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Can't do anything more, end activation else { LivingEntityManager.Instance.EndEntityActivation(this); } }