Example #1
0
        public static IEnumerable <MapPoint> GetSpellRange(short sourceCellId, SpellLevels spellLevel, int additionalRange = 0)
        {
            var mp    = MapPoint.FromCellId(sourceCellId);
            int range = spellLevel.Range + (spellLevel.RangeCanBeBoosted ? additionalRange : 0);

            if (spellLevel.CastInLine && spellLevel.CastInDiagonal)
            {
                return(Shaper.ShapeCross(mp.X, mp.Y, spellLevel.MinRange, range)
                       .Union(Shaper.ShapeStar(mp.X, mp.Y, spellLevel.MinRange, range)));
            }
            else if (spellLevel.CastInDiagonal)
            {
                return(Shaper.ShapeStar(mp.X, mp.Y, spellLevel.MinRange, range));
            }
            else if (spellLevel.CastInLine)
            {
                return(Shaper.ShapeCross(mp.X, mp.Y, spellLevel.MinRange, range));
            }
            else
            {
                return(Shaper.ShapeRing(mp.X, mp.Y, spellLevel.MinRange, range));
            }
        }