//Moves towards the targeted Unit //Uses Dijstrka to find its path (not implemented) //follows path for as long as it has movement public override void Move(Character target) { LastAttacker = target; if (!GridHandler.CheckForEnemyWithinRange(_gridPos, _myWeapon, _myTeam, _lastToHitMe)) { GridHandler.DijkstraMove(this, GridHandler.RetrieveTile(target.CurrentPosition), _currMovement); return; } else { _stratRef.StartWaiting(); } }
//overload for GetMyAbilities //pass any specific ability element and target //returns all skills with specified ability element and are withing range of target List <Ability> GetMyAbilities(DamageType skillType, Character target) { List <Ability> usables = new List <Ability>(); for (int i = 0; i < _me.Abilities.Count; i++) { if (_me.Abilities[i].Element == skillType && GridHandler.CheckForEnemyWithinRange(_me.CurrentPosition, _me.Abilities[i], _me.Team, _currTarget)) { if (_me.CurrMana > _me.Abilities[i].Cost) { usables.Add(_me.Abilities[i]); } } } return(usables); }
//Gets all abilities that DO NOT HEAL //returns list with all applicable abilities List <Ability> GetMyAbilities() { List <Ability> usables = new List <Ability>(); for (int i = 0; i < _me.Abilities.Count; i++) { if (_me.Abilities[i].Element != DamageType.HEALING && GridHandler.CheckForEnemyWithinRange(_me.CurrentPosition, _me.Abilities[i], _me.Team)) { if (_me.CurrMana > _me.Abilities[i].Cost) { usables.Add(_me.Abilities[i]); } } } return(usables); }
//AI tries to attack any enemy near them void TryAttack() { //Debug.Log("trying to attack"); if (!_hasAttacked) { if (GridHandler.CheckForEnemyWithinRange(_me.CurrentPosition, _me.HeldWeapon, _me.Team, _currTarget)) { Debug.Log("trying to attack target"); _hasAttacked = true; _me.Attack(_currTarget); } else { Debug.Log("for some reason i did not attack"); StartWaiting(); } } else { Debug.Log("I've already attacked"); StartWaiting(); } }