public Tiles.Loot GetLootTile(Point point) { if (Loot.ContainsKey(point)) { return(Loot[point]); } return(null); }
public bool RemoveLoot(Point point) { if (Loot.ContainsKey(point)) { Loot.Remove(point); return(true); } return(false); }
public override bool SetTile ( Tile tile, Point point, bool resetOldTile = true, bool revealReseted = true, bool autoSetTileDungeonIndex = true, bool reportError = true ) { if (tile is IApproachableByHero) { var abh = tile as IApproachableByHero; if (!ApproachableByHero.Contains(abh)) { ApproachableByHero.Add(abh); } } if (tile is ILootSource) { var ls = tile as ILootSource; if (ls.Level <= 0) { //TODO some UT needed it ls.SetLevel(Index + 1, Difficulty.Normal);//TODO Normal, pass Settings here } } if (tile is Hero) { var tileAtPoint = GetTile(point); if (tileAtPoint == tile) { return(true); } if (tileAtPoint is Stairs) { Debug.Assert(false); } } else if (tile is Loot loot) { if (Loot.ContainsKey(point)) { if (Logger != null) { Logger.LogError("loot already at point: " + Loot[point] + ", trying to add: " + tile + " point:" + point); } Debug.Assert(false); return(false); } //Logger.LogInfo("Adding Loot "+ tile + " at "+ point + " Loot.Count:"+ Loot.Count); tile.point = point; var baseTile = base.GetTile(point); if (baseTile != null) { loot.tag2 = baseTile.tag2; } Loot[point] = loot; return(true); } else if (tile is Surface sur) { if (Surfaces.ContainsKey(point) && Surfaces[point].Kind != sur.Kind) { if (Logger != null) { Logger.LogError("Surface already at point: " + Surfaces[point] + ", trying to add: " + tile + " point:" + point); Debug.Assert(false); return(false); } } //Logger.LogInfo("Adding Loot "+ tile + " at "+ point + " Loot.Count:"+ Loot.Count); tile.point = point; Surfaces[point] = sur; return(true); } Point?prevPos = tile?.point; var res = base.SetTile(tile, point, resetOldTile, revealReseted, autoSetTileDungeonIndex, reportError); if (res && tile is LivingEntity && prevPos != null) { (tile as LivingEntity).PrevPoint = prevPos.Value; } return(res); }