protected override ActionResult OnProcess() { foreach (Item item in Dungeon.Items) { Dungeon.SetTileExplored(item.Position); } Log(LogType.Message, "{subject} sense[s] the treasures of the dungeon."); return(ActionResult.Done); }
/// <summary> /// Updates the explored flag of any tiles newly visible based on an FOV centered /// around the given position. This should only be called after the lighting /// information has been refreshed. /// </summary> public static void RefreshExplored(Vec position, Dungeon dungeon) { // figure out which ones need to be looked at Rect bounds = new Rect(position - MaxDistance, new Vec(MaxDistance * 2 + 1, MaxDistance * 2 + 1)); // stay in bounds bounds = bounds.Intersect(dungeon.Bounds); foreach (Vec pos in bounds) { Tile tile = dungeon.Tiles[pos]; if (tile.IsVisible && tile.IsLit && !tile.IsExplored) { dungeon.SetTileExplored(pos); } } }
protected override ActionResult OnProcess() { foreach (Vec pos in Dungeon.Bounds) { switch (Dungeon.Tiles[pos].Type) { case TileType.DoorClosed: case TileType.DoorOpen: case TileType.StairsDown: case TileType.StairsUp: case TileType.TownPortal: Dungeon.SetTileExplored(pos); break; } } Log(LogType.Message, "{subject} sense[s] the details of the dungeon."); return(ActionResult.Done); }
protected override ActionResult OnProcess() { Vec newPos = Entity.Position + mDirection; TileType tileType = Dungeon.Tiles[newPos].Type; // if walking into a closed door, open it if (tileType == TileType.DoorClosed) { return(new OpenDoorAction(Entity, newPos)); } // if there is something in the tile we are moving to, attack it Entity occupier = Dungeon.Entities.GetAt(newPos); if ((occupier != null) && (occupier != Entity)) { return(new AttackAction(Entity, occupier)); } // fail if the tile is not occupiable if (!Entity.CanMove(mDirection)) { // not occupyable tile if (Entity is Hero) { // you know it's a wall now Dungeon.SetTileExplored(newPos); } return(Fail("{subject} can't walk there.")); } // move the entity Entity.Position = newPos; // enter a store switch (tileType) { case TileType.DoorStore1: case TileType.DoorStore2: case TileType.DoorStore3: case TileType.DoorStore4: case TileType.DoorStore5: case TileType.DoorStore6: Hero hero = Entity as Hero; if (hero != null) { AddAction(new EnterStoreAction(hero, tileType)); } break; } if (mCheckForCancel) { return(ActionResult.CheckForCancel); } else { return(ActionResult.Done); } }