public abstract void TargetSelect(GridCell origin, int level, int bonusRange, Ability_new ability);
public override void TargetSelect(GridCell origin, int level, int bonusRange, Ability_new ability) { Reset(); int maxRange = ability.adjustableRange ? ability.maxRangePerLvl [level - 1] + bonusRange : ability.maxRangePerLvl[level - 1]; if (maxRange < ability.minRange) { maxRange = ability.minRange; } bool requiresLoS = ability.requiresLoS; //non linear if (!ability.isLinear) { foreach (GridCell c in grid.Values) { if (origin.CalcDistance(c) <= maxRange && origin.CalcDistance(c) >= ability.minRange) { if (!targetable.Contains(c) && !untargetable.Contains(c)) { if (!untargetable.Contains(c)) { untargetable.Add(c); } if (requiresLoS) { GridCell hit = CheckLoS(origin.gridPos.x, origin.gridPos.y, c.gridPos.x, c.gridPos.y); if (!targetable.Contains(hit)) { targetable.Add(hit); } } else { if (!targetable.Contains(c)) { targetable.Add(c); } } } } } } else { //linear for (int x = -maxRange; x <= maxRange; x++) { GridPos pos = new GridPos(origin.gridPos.x - x, origin.gridPos.y); if (grid.ContainsKey(pos)) { GridCell c = grid [pos]; if (c.CalcDistance(origin) <= maxRange && c.CalcDistance(origin) >= ability.minRange) { if (!targetable.Contains(c) && !untargetable.Contains(c)) { if (!untargetable.Contains(c)) { untargetable.Add(c); } if (requiresLoS) { GridCell hit = CheckLoS(origin.gridPos.x, origin.gridPos.y, c.gridPos.x, c.gridPos.y); if (!targetable.Contains(hit)) { targetable.Add(hit); } } else { if (!targetable.Contains(c)) { targetable.Add(c); } } } } } } for (int y = -maxRange; y <= maxRange; y++) { GridPos pos = new GridPos(origin.gridPos.x, origin.gridPos.y - y); if (grid.ContainsKey(pos)) { GridCell c = grid [pos]; if (c.CalcDistance(origin) <= maxRange && c.CalcDistance(origin) >= ability.minRange) { if (!targetable.Contains(c) && !untargetable.Contains(c)) { if (!untargetable.Contains(c)) { untargetable.Add(c); } if (requiresLoS) { GridCell hit = CheckLoS(origin.gridPos.x, origin.gridPos.y, c.gridPos.x, c.gridPos.y); if (!targetable.Contains(hit)) { targetable.Add(hit); } } else { if (!targetable.Contains(c)) { targetable.Add(c); } } } } } } } }