// Updates the ai normally public virtual void updateAINormal(Unit unit, BattleMap map) { // Variables int[] spot; int[] target= map.getClosestEnemy(unit.mapPos[0], unit.mapPos[1], map.getTeamID(unit.mapPos)); AttackInfo info= AttackInfo.createBasicAttack(map.getFullUnitID(unit.mapPos), target, ref map); int heuristic; // Get Target info.range= new int[] {1, 1}; map.aiSearch(unit.mapPos[0], unit.mapPos[1], unit.move, info.range[1], false, map.getTeamID(unit.mapPos), info, target); spot= map.findAISpot(unit.mapPos[0], unit.mapPos[1], info.range, map.aggressiveAI); if(!unit.isWalkingDone) { ai_moveUnit(unit, map, spot, false); map.destroyPaths(); map.endUnitWalking(map.getFullUnitID(unit.mapPos)); if(unit.isTurnEnded) return; } heuristic= map.getHeuristic(unit.mapPos, map.getUnitXY(target)); if(!unit.isAttackingDone && heuristic>= info.range[0] && heuristic<= info.range[1]) { ai_attackUnit(unit, map, info, false); map.destroyPaths(); map.endUnitAttacking(map.getFullUnitID(unit.mapPos)); if(unit.isTurnEnded) return; } }