internal void FilterNavHazards(MapTileSet maybeTiles) { // filter tiles containing wall maybeTiles = maybeTiles.Where(t => t.clear).ToMapTileSet(); // don't move directly onto player maybeTiles = maybeTiles.Where(t => t.loc != Refs.p.loc).ToMapTileSet(); // or right next to the player! Loc playerLoc = Refs.p.loc; MapTile playerTile = Refs.m.TileByLoc(playerLoc); var grabRange = playerTile.GetPossibleMoves(Dir.Cardinals); foreach (MapTile g in grabRange) { maybeTiles = maybeTiles.Where(t => t.loc != g.loc).ToMapTileSet(); } // don't move directly onto another cubi foreach (Cubi c in Refs.h.roster) { maybeTiles = maybeTiles.Where(t => t.loc != c.loc).ToMapTileSet(); } // and don't move directly onto a pent! foreach (Loc pent in Refs.m.pents) { maybeTiles = maybeTiles.Where(t => t.loc != pent).ToMapTileSet(); } }
internal void MakeClearArea(Loc point1, Loc point2) { // todo note clears the area inside, not including the boundary MapTileSet workingList = TileList(); workingList = workingList.Where(t => t.loc.X > point1.X && t.loc.X < point2.X).ToMapTileSet(); workingList = workingList.Where(t => t.loc.Y > point1.Y && t.loc.Y < point2.Y).ToMapTileSet(); foreach (MapTile t in workingList) { t.clear = true; } }
} // end healwalls internal void SpreadNectar() { // todo : see final nectar spreading goals txt foreach (MapTile t in tiles) { if (t.clear && (t.TotalNectar() > 8 || t.StackedNectar())) { //Console.WriteLine("Nectar heavy tile (drips>8) detected, spreading..."); MapTileSet spreadArea = t.GetPossibleMoves(Dir.AllAround); spreadArea = spreadArea.Where(x => x.clear).ToMapTileSet(); spreadArea = spreadArea.Where(x => !x.StackedNectar()).ToMapTileSet(); spreadArea = spreadArea.Where(x => x.TotalNectar() <= t.TotalNectar()).ToMapTileSet(); int lightestLevel = -1; int lightestAmt = 99; for (int nLoop = 0; nLoop < t.nectarLevel.Length; nLoop++) { if ((t.nectarLevel[nLoop] > 0) && (t.nectarLevel[nLoop] < lightestAmt)) { lightestAmt = t.nectarLevel[nLoop]; lightestLevel = nLoop; } } // todo : note this will bias spread direction but okay for now foreach (MapTile spreadTo in spreadArea) { if ((spreadTo.nectarLevel[lightestLevel] < t.nectarLevel[lightestLevel]) && (t.nectarLevel[lightestLevel] > 0)) { spreadTo.nectarLevel[lightestLevel]++; t.nectarLevel[lightestLevel]--; } } } } }
public static MapTileSet Tunnelable(MapTileSet ts) { return(ts.Where(t => t.noTunnel == false).ToMapTileSet()); }
public static MapTileSet FilterOutClear(MapTileSet ts) { return(ts.Where(t => !t.clear).ToMapTileSet()); }