public void AttackRange(BoardManager bm, Actor currentActor) { bool[,] range = bm.pathfinding.ValidBFS( skillToUse.GetMaxRange(currentActor), skillToUse.GetMinRange(currentActor), moveTarget.data.posX, moveTarget.data.posY, ((Skill)skillToUse).targetType.immpassableTiles, ((Skill)skillToUse).targetType.stopOnOccupied); //run range through a tilenode graph // we could just move this to skill // and pass a tilenode as the parameter if (skillToUse.GetTargetFiltering() != null) { for (int x = 0; x < range.GetLength(0); x++) { for (int y = 0; y < range.GetLength(1); y++) { if (range[x, y]) { TileNode node = bm.pathfinding.GetTileNode(x, y); if (skillToUse.FilterTileNode(currentActor, node) == true) { range[x, y] = false; } } } } } bm.tileSelection.PopulateAttackRange(range); }
public bool[,] GetSkillRange(IUseable skil, Actor d, int startX, int startY) { // List<TileNode> nodes = new List<TileNode>(); bool[,] validMap = ValidBFS( skil.GetMaxRange(d), skil.GetMinRange(d), startX, startY, (skil).GetTargetType().immpassableTiles, (skil).GetTargetType().stopOnOccupied); if (skil.GetTargetFiltering() != null) { for (int x = 0; x < validMap.GetLength(0); x++) { for (int y = 0; y < validMap.GetLength(1); y++) { if (validMap[x, y]) { TileNode node = GetTileNode(x, y); if (skil.FilterTileNode(d, node) == true) { validMap[x, y] = false; } else { // nodes.Add(node); } } } } } return(validMap); }