Example #1
0
    /// <summary> Utility method that returns a list of Tiles that satisfy the range values in TargetAbilityData. </summary>
    protected IEnumerable <Tile> GetDefaultRangeTiles()
    {
        var tile = unit.tile;
        IEnumerable <Tile> res;

        if (range.enabled)
        {
            if (rangeMode == RangeMode.Distance)
            {
                res = Game.grid.Radius(tile, range.current);
            }
            else
            {
                res = Pathing.GetDistanceField(tile, range.current, Pathers.For(rangeMode)).tiles.Keys;
            }
        }
        else
        {
            res = Game.grid.tiles.Values;
        }

        if (requiresVision.current)
        {
            res = res.Where(h => Game.grid.HasSight(tile, h));
        }

        return(res);
    }
Example #2
0
    public override Targeter GetTargeter()
    {
        var movement       = unit.movement.current;
        var freeMovement   = movement - usedMovement;
        var energyMovement = GetPaidMovement(movement, unit.energy.current);

        return(new MoveAbilityTargeter(unit, this, freeMovement, energyMovement,
                                       onComplete: t => PostDefaultAbilityEvent(t.selections.ToArray())
                                       )
        {
            pather = Pathers.For(rangeMode), cc = CostCalculators.For(rangeMode)
        });
    }
Example #3
0
 public PathConfirmAbilityTargeter(Unit unit, TargetAbility ability, float maxCost, Action <Targeter> onComplete, Action <Targeter> onCancel = null) : base(unit, ability, onComplete, onCancel)
 {
     pather ??= Pathers.For(ability.rangeMode);
     cc ??= CostCalculators.For(ability.rangeMode);
     field = Pathing.GetCostField(unit.tile, maxCost: maxCost, pather: pather, costCalculator: cc);
 }
Example #4
0
    public override IEnumerable <Tile> GetTargets()
    {
        var movement       = unit.movement.current;
        var freeMovement   = movement - usedMovement;
        var energyMovement = GetPaidMovement(movement, unit.energy.current);
        var maxCost        = freeMovement + energyMovement;
        var res            = Pathing.GetCostField(unit.tile, maxCost: maxCost, pather: Pathers.For(rangeMode), costCalculator: CostCalculators.For(rangeMode)).tiles.Keys;

        return(res);
    }