示例#1
0
        public ActionInformation ShootFireball(Level level, AbilityDetails abilityDetails)
        {
            Func<Tile, ActionAnimationScript> actionScriptGenerator = (tile) => ShootFireballAction(level, abilityDetails, tile);
            TileSelector abilityRange = TileSelectorHelper.EnemyTileSelector(level, level.GetTileOfActor(this), Team, 5);
            Func<Tile, TileSelector> abilityAreaOfEffect = TileSelectorHelper.SingleTile;

            return new ActionInformation(actionScriptGenerator, abilityRange, abilityAreaOfEffect, ActionType.Attack);
        }
示例#2
0
        public override void MakeAIDecision(Level currentLevel, Action<ActionInformation, Tile> onComplete)
        {
            var enemyOrClosest = temp_GetEnemyInRangeOrClosest(currentLevel);
            var ability = AbilityList.Single(x => x.AbilityDetails.AbilityName == "Fireball");
            if (CanAction() && enemyOrClosest.Item2 <= 5)
            {
                onComplete(ShootFireball(currentLevel, ability.AbilityDetails),
                           currentLevel.GetTileOfActor(enemyOrClosest.Item1));

                return;
            }
            if (CanAction() && enemyOrClosest.Item2 <= CurrentStats.MovementRange + 5)
            {
                Tile moveToTile = temp_GetTileClosestToEnemy(currentLevel, enemyOrClosest.Item1);
                if (moveToTile != null)
                {
                    onComplete(MoveToTile(currentLevel), moveToTile);
                }
                return;
            }

            onComplete(Wait(Vector3.Zero), null);
        }
示例#3
0
        private Tile temp_GetTileClosestToEnemy(Level currentLevel, ActorBase targetActor)
        {
            var candidateTiles = TileSelectorHelper.StandardMovementTileSelector(currentLevel,
                                                                                currentLevel.GetTileOfActor(this), this).ValidTiles();
            Tile targetTile = currentLevel.GetTileOfActor(targetActor);
            int distance = Int16.MaxValue;
            Tile moveToTile = null;
            foreach (var candidateTile in candidateTiles)
            {
                int candidateDistance = MathUtils.DistanceBetweenTiles(candidateTile, targetTile);
                if (candidateDistance < distance)
                {
                    distance = candidateDistance;
                    moveToTile = candidateTile;
                }
            }

            return moveToTile;
        }
示例#4
0
        private Tuple<ActorBase, int> temp_GetEnemyInRangeOrClosest(Level currentLevel)
        {
            Tuple<ActorBase, int> closestEnemy = null;
            foreach (var enemy in currentLevel.Actors.Where(x => x.Team != this.Team && x.IsTargetable()))
            {
                Tile enemyTile = currentLevel.GetTileOfActor(enemy);
                Tile myTile = currentLevel.GetTileOfActor(this);
                int distance = MathUtils.DistanceBetweenTiles(myTile, enemyTile);
                if (closestEnemy == null || distance < closestEnemy.Item2)
                {
                    closestEnemy = Tuple.Create(enemy, distance);
                }
            }

            return closestEnemy;
        }
示例#5
0
        protected virtual ActionAnimationScript MoveToTileAction(Tile goalTile, Level level)
        {
            IList<Tile> path = AStar.CalculateAStarPath(level.GetTileOfActor(this), goalTile, level, this);

            var script = MoveToTileScript.MakeScript(path, this);

            return script;
        }
示例#6
0
 public ActionInformation MoveToTile(Level level)
 {
     Func<Tile, ActionAnimationScript> scriptGenerator = (tile) => MoveToTileAction(tile, level);
     TileSelector abilityRange = TileSelectorHelper.StandardMovementTileSelector(level, level.GetTileOfActor(this), this);
     Func<Tile, TileSelector> areaOfEffect = TileSelectorHelper.SingleTile;
     return new ActionInformation(scriptGenerator, abilityRange, areaOfEffect, ActionType.Move);
 }