public override IEnumerator StartMyActivationCoroutine() { Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); ActionStart: while (EventManager.Instance.gameOverEventStarted) { yield return(null); } SetTargetDefender(EntityLogic.GetClosestValidEnemy(this)); if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Strike else if (EntityLogic.IsAbilityUseable(this, strike) && 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; } // Move else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, strike, this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null) { SetTargetDefender(EntityLogic.GetClosestEnemy(this)); 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 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 shoot = mySpellBook.GetAbilityByName("Shoot"); Ability snipe = mySpellBook.GetAbilityByName("Snipe"); Ability impalingBolt = mySpellBook.GetAbilityByName("Impaling Bolt"); Ability pinningShot = mySpellBook.GetAbilityByName("Pinning Shot"); Ability overwatch = mySpellBook.GetAbilityByName("Overwatch"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, false, false, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Impaling Bolt else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), 1) && EntityLogic.IsAbilityUseable(this, impalingBolt, EntityLogic.GetBestTarget(this, true)) ) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformImpalingBolt(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Pinning Shot else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), pinningShot.abilityRange) && EntityLogic.IsAbilityUseable(this, pinningShot, EntityLogic.GetBestTarget(this, true)) ) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Action action = AbilityLogic.Instance.PerformPinningShot(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Overwatch else if (EntityLogic.IsAbilityUseable(this, overwatch) && myPassiveManager.overwatch == false ) { Action action = AbilityLogic.Instance.PerformOverwatch(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Snipe else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, snipe.abilityRange) && EntityLogic.IsAbilityUseable(this, snipe, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformSnipe(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Shoot most vulnerable target else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, shoot.abilityRange) && EntityLogic.IsAbilityUseable(this, shoot, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformShoot(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Shoot the target with lowest current HP else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, false, true), shoot.abilityRange) && EntityLogic.IsAbilityUseable(this, shoot, EntityLogic.GetBestTarget(this, false, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, false, true)); Action action = AbilityLogic.Instance.PerformShoot(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Shoot the closest target if the most vulnerable and lowest HP target cant be targetted else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), shoot.abilityRange) && EntityLogic.IsAbilityUseable(this, shoot, EntityLogic.GetBestTarget(this, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Debug.Log("Skeleton Archer using shoot against closest target: " + myCurrentTarget.myName); Action action = AbilityLogic.Instance.PerformShoot(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Is any target in range and valid? // Try move into range if nothing is in range else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, true), shoot.abilityRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, shoot, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, EntityLogic.GetBestTarget(this, true), currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null && EntityLogic.IsAbilityUseable(this, move) ) { SetTargetDefender(EntityLogic.GetBestTarget(this, true)); Debug.Log("Skeleton Archer moving towards: " + myCurrentTarget.myName); 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 move = mySpellBook.GetAbilityByName("Move"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability fireBall = mySpellBook.GetAbilityByName("Fire Ball"); Ability frostBolt = mySpellBook.GetAbilityByName("Frost Bolt"); Ability icyFocus = mySpellBook.GetAbilityByName("Icy Focus"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Icy Focus else if (EntityLogic.IsTargetInRange(this, this, icyFocus.abilityRange) && EntityLogic.IsAbilityUseable(this, icyFocus, myCurrentTarget) ) { Action action = AbilityLogic.Instance.PerformIcyFocus(this, this); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Frost Bolt else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, frostBolt.abilityRange) && EntityLogic.IsAbilityUseable(this, frostBolt, myCurrentTarget) && myCurrentTarget.myPassiveManager.immobilized == false ) { Action action = AbilityLogic.Instance.PerformFrostBolt(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Fireball the most vulnerable target else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, false, false, true), fireBall.abilityRange) && EntityLogic.IsAbilityUseable(this, fireBall, EntityLogic.GetBestTarget(this, false, false, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, false, false, true)); Action action = AbilityLogic.Instance.PerformFireBall(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Fireball the target with lowest current HP else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestTarget(this, false, true), fireBall.abilityRange) && EntityLogic.IsAbilityUseable(this, fireBall, EntityLogic.GetBestTarget(this, false, true))) { SetTargetDefender(EntityLogic.GetBestTarget(this, false, true)); Action action = AbilityLogic.Instance.PerformFireBall(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Fireball the closest target if the most vulnerable and the weakest cant be targetted 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; } // 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, 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() { // Get ability data Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability fortify = mySpellBook.GetAbilityByName("Fortify"); Ability testudo = mySpellBook.GetAbilityByName("Testudo"); Ability shieldSlam = mySpellBook.GetAbilityByName("Shield Slam"); Ability provoke = mySpellBook.GetAbilityByName("Provoke"); ActionStart: // Pause if game over event has started while (EventManager.Instance.gameOverEventStarted) { yield return(null); } // Decide on target SetTargetDefender(EntityLogic.GetBestTarget(this, true)); // End activation if stunned, out of energy, etc if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Fortify else if (EntityLogic.IsAbilityUseable(this, fortify, EntityLogic.GetBestFortifyTarget(this)) && EntityLogic.GetBestFortifyTarget(this) != null) { Action action = AbilityLogic.Instance.PerformFortify(this, EntityLogic.GetBestFortifyTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Testudo else if (EntityLogic.IsAbilityUseable(this, testudo)) { Action action = AbilityLogic.Instance.PerformTestudo(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Shield Slam else if (EntityLogic.IsAbilityUseable(this, shieldSlam, myCurrentTarget) && EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && currentBlock >= 10) { Action action = AbilityLogic.Instance.PerformShieldSlam(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // 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.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); } }
public override IEnumerator StartMyActivationCoroutine() { Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability healingLight = mySpellBook.GetAbilityByName("Healing Light"); Ability chaosBolt = mySpellBook.GetAbilityByName("Chaos Bolt"); Ability invigorate = mySpellBook.GetAbilityByName("Invigorate"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Healing Light else if (EntityLogic.IsTargetInRange(this, GetBestHealingLightTarget(), healingLight.abilityRange) && GetBestHealingLightTarget().currentHealth < GetBestHealingLightTarget().currentMaxHealth&& EntityLogic.IsAbilityUseable(this, healingLight, GetBestHealingLightTarget())) { Action action = AbilityLogic.Instance.PerformHealingLight(this, GetBestHealingLightTarget()); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Invigorate else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetBestInvigorateTarget(this), invigorate.abilityRange) && EntityLogic.IsAbilityUseable(this, invigorate, EntityLogic.GetBestInvigorateTarget(this))) { Action action = AbilityLogic.Instance.PerformInvigorate(this, EntityLogic.GetBestInvigorateTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Chaos Bolt else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, chaosBolt.abilityRange) && EntityLogic.IsAbilityUseable(this, chaosBolt, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformChaosBolt(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)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Move else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, chaosBolt.abilityRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, chaosBolt, 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() { // Get ability data Ability twinSTrike = mySpellBook.GetAbilityByName("Twin Strike"); Ability move = mySpellBook.GetAbilityByName("Move"); Ability dash = mySpellBook.GetAbilityByName("Dash"); Ability evasion = mySpellBook.GetAbilityByName("Evasion"); Ability tendonSlash = mySpellBook.GetAbilityByName("Tendon Slash"); Ability disarm = mySpellBook.GetAbilityByName("Disarm"); ActionStart: // Pause if game over event has started while (EventManager.Instance.gameOverEventStarted) { yield return(null); } // Decide on target SetTargetDefender(EntityLogic.GetBestTarget(this, true)); // End activation if stunned, out of energy, etc if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Evasion else if (EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Count > 1 && EntityLogic.IsAbilityUseable(this, evasion, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformEvasion(this, this); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Disarm else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, disarm, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformDisarm(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Tendon Slash else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, tendonSlash, myCurrentTarget)) { Action action = AbilityLogic.Instance.PerformTendonSlash(this, myCurrentTarget); yield return(new WaitUntil(() => action.ActionResolved() == true)); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // Twin Strike 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)); // 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, twinSTrike, 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 move = mySpellBook.GetAbilityByName("Move"); Ability inspire = mySpellBook.GetAbilityByName("Inspire"); Ability fortify = mySpellBook.GetAbilityByName("Fortify"); Ability provoke = mySpellBook.GetAbilityByName("Provoke"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Fortify else if (EntityLogic.IsAbilityUseable(this, fortify, EntityLogic.GetBestFortifyTarget(this)) && EntityLogic.GetBestFortifyTarget(this) != null) { Action action = AbilityLogic.Instance.PerformFortify(this, EntityLogic.GetBestFortifyTarget(this)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Inspire best target if they are in range else if (EntityLogic.IsTargetInRange(this, GetBestInspireTarget(), inspire.abilityRange) && EntityLogic.IsAbilityUseable(this, inspire, GetBestInspireTarget())) { Action action = AbilityLogic.Instance.PerformInspire(this, GetBestInspireTarget()); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Inspire something else if the best target is not in range else if (GetBestInspireTargetInRange(inspire.abilityRange) != null && EntityLogic.IsAbilityUseable(this, inspire, GetBestInspireTargetInRange(inspire.abilityRange))) { Action action = AbilityLogic.Instance.PerformInspire(this, GetBestInspireTargetInRange(inspire.abilityRange)); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // 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 closest target 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)); 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 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 move = mySpellBook.GetAbilityByName("Move"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability toxicRain = mySpellBook.GetAbilityByName("Toxic Rain"); Ability summonToxicZombie = mySpellBook.GetAbilityByName("Summon Toxic Zombie"); Ability chemicalReaction = mySpellBook.GetAbilityByName("Chemical Reaction"); Ability drain = mySpellBook.GetAbilityByName("Drain"); ActionStart: SetTargetDefender(EntityLogic.GetBestTarget(this, true)); while (EventManager.Instance.gameOverEventStarted) { yield return(null); } // if unable to do anything, just end activation if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // try move to grass/better position if there is one in range of mobility else if (EntityLogic.IsAbleToMove(this) && EntityLogic.GetValidGrassTileWithinRange(this, EntityLogic.GetTotalMobility(this)) != null && tile.myTileType != Tile.TileType.Grass && EntityLogic.IsAbilityUseable(this, move) ) { Action movementAction = AbilityLogic.Instance.PerformMove(this, EntityLogic.GetValidGrassTileWithinRange(this, EntityLogic.GetTotalMobility(this))); yield return(new WaitUntil(() => movementAction.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Toxic Rain else if (EntityLogic.IsAbilityUseable(this, toxicRain)) { Action action = AbilityLogic.Instance.PerformToxicRain(this); yield return(new WaitUntil(() => action.ActionResolved() == true)); yield return(new WaitForSeconds(0.5f)); goto ActionStart; } /* * // Summon toxic zombies * else if (EntityLogic.IsAbilityUseable(this, summonToxicZombie)) * { * Action action = AbilityLogic.Instance.PerformSummonToxicZombie(this, myCurrentTarget); * yield return new WaitUntil(() => action.ActionResolved() == true); * yield return new WaitForSeconds(0.5f); * 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; } // Drain else if (EntityLogic.GetBestDrainTarget(this) != null && EntityLogic.IsTargetInRange(this, EntityLogic.GetBestDrainTarget(this), chemicalReaction.abilityRange) && EntityLogic.IsAbilityUseable(this, chemicalReaction, EntityLogic.GetBestDrainTarget(this)) ) { SetTargetDefender(EntityLogic.GetBestDrainTarget(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.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; } // 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() { Ability move = mySpellBook.GetAbilityByName("Move"); Ability siphonLife = mySpellBook.GetAbilityByName("Siphon Life"); Ability twinStrike = mySpellBook.GetAbilityByName("Twin Strike"); Ability strike = mySpellBook.GetAbilityByName("Strike"); Ability dash = mySpellBook.GetAbilityByName("Dash"); ChooseRandomTargetingLogic(); ActionStart: while (EventManager.Instance.gameOverEventStarted) { yield return(null); } if (myCurrentTarget.currentHealth <= 0 || myCurrentTarget == null) { ChooseRandomTargetingLogic(); } if (EntityLogic.IsAbleToTakeActions(this) == false) { LivingEntityManager.Instance.EndEntityActivation(this); } // Siphon Life else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, siphonLife.abilityRange) && EntityLogic.IsAbilityUseable(this, siphonLife) ) { //SetTargetDefender(GetClosestDefender()); VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Siphon Life"); yield return(new WaitForSeconds(0.5f)); //Action slAction = AbilityLogic.Instance.PerformSiphonLife(this, myCurrentTarget); // yield return new WaitUntil(() => slAction.ActionResolved() == true); // brief delay between actions yield return(new WaitForSeconds(1f)); goto ActionStart; } // If unable to siphon life the ideal target, siphon the closest valid target else if (EntityLogic.IsTargetInRange(this, EntityLogic.GetClosestEnemy(this), siphonLife.abilityRange) && EntityLogic.IsAbilityUseable(this, siphonLife) ) { SetTargetDefender(EntityLogic.GetClosestEnemy(this)); VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Siphon Life"); yield return(new WaitForSeconds(0.5f)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Twin Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, twinStrike)) { //SetTargetDefender(GetDefenderWithLowestCurrentHP()); VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Twin Strike"); yield return(new WaitForSeconds(0.5f)); Action twinStrikeAction = AbilityLogic.Instance.PerformTwinStrike(this, myCurrentTarget); yield return(new WaitUntil(() => twinStrikeAction.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Strike else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) && EntityLogic.IsAbilityUseable(this, strike)) { //SetTargetDefender(GetDefenderWithLowestCurrentHP()); VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Strike"); yield return(new WaitForSeconds(0.5f)); Action strikeAction = AbilityLogic.Instance.PerformStrike(this, myCurrentTarget); yield return(new WaitUntil(() => strikeAction.ActionResolved() == true)); yield return(new WaitForSeconds(1f)); goto ActionStart; } // Dash else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, dash) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(dash, strike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, dash.abilityPrimaryValue) != null ) { VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Dash"); yield return(new WaitForSeconds(0.5f)); Tile destination = EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, dash.abilityPrimaryValue); Action dashAction = AbilityLogic.Instance.PerformDash(this, destination); yield return(new WaitUntil(() => dashAction.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, myCurrentTarget, currentMeleeRange) == false && EntityLogic.IsAbleToMove(this) && EntityLogic.IsAbilityUseable(this, move) && EntityLogic.CanPerformAbilityTwoAfterAbilityOne(move, strike, this) && EntityLogic.GetBestValidMoveLocationBetweenMeAndTarget(this, myCurrentTarget, currentMeleeRange, EntityLogic.GetTotalMobility(this)) != null ) { VisualEffectManager.Instance.CreateStatusEffect(transform.position, "Move"); yield return(new WaitForSeconds(0.5f)); 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); } }