Ejemplo n.º 1
0
    public override List <HexCell> GetAffectedCells(HexCell fromCell, HexCell targetCell)
    {
        List <HexCell> affectedCells     = new List <HexCell>();
        HexDirection   directionToTarget = HexDirectionExtension.GetDirectionTo(fromCell, targetCell);

        affectedCells.Add(targetCell);
        affectedCells.AddRange(CellFinder.GetAllCellsInLine(targetCell, directionToTarget, rangeAfterFirstHit, (c) => c.Traversable == true));
        return(affectedCells);
    }
Ejemplo n.º 2
0
    public override void ApplyEffect(Character attacker, Character target, bool crit, bool hostile)
    {
        if (IsValidEffectTarget(hostile))
        {
            HexDirection directionToTarget = HexDirectionExtension.GetDirectionTo(attacker.Location, target.Location);

            HexCell newCell = target.Location;
            for (int i = 0; i < hexes; i++)
            {
                HexCell cellToTry = pull ? newCell.GetNeighbor(HexDirectionExtension.Opposite(directionToTarget)) : newCell.GetNeighbor(directionToTarget);
                if (!target.CanEnter(cellToTry))
                {
                    break;
                }
                newCell = cellToTry;
            }
            target.Location = newCell;
        }
    }