Exemple #1
0
    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);
        }
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
    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);
        }
    }
Exemple #4
0
    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");
        Ability smash     = mySpellBook.GetAbilityByName("Smash");
        Ability kttb      = mySpellBook.GetAbilityByName("Kick To The Balls");

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);
        }

        // Charge
        else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, charge.abilityRange + EntityLogic.GetTotalMobility(this)) &&
                 EntityLogic.IsAbilityUseable(this, charge, myCurrentTarget) &&
                 EntityLogic.GetAllEnemiesWithinRange(this, currentMeleeRange).Contains(myCurrentTarget) == 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;
        }

        // Kick To The Balls
        else if (EntityLogic.IsTargetInRange(this, myCurrentTarget, currentMeleeRange) &&
                 EntityLogic.IsAbilityUseable(this, kttb, myCurrentTarget))
        {
            Action action = AbilityLogic.Instance.PerformKickToTheBalls(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;
        }

        // 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;
        }

        // 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);
        }
    }
Exemple #5
0
    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);
        }
    }
Exemple #6
0
    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);
        }
    }