private static void HandleMineRock(Creature c) { int currentFloor = c.CurrentFloor; Point worldIndex = c.WorldIndex; Block[] blocks = currentFloor >= 0 ? Program.WorldMap[worldIndex.X, worldIndex.Y].Dungeon.Floors[currentFloor].Blocks : Program.WorldMap[worldIndex.X, worldIndex.Y].Blocks; int width = Program.WorldMap.TileWidth, height = Program.WorldMap.TileHeight; Point closestStoneWall = blocks.GetClosestOfBlockTypeToPos(c.Position, new Point(width, height), BlockType.Wall, Material.Stone); bool nextToStoneWall = c.Position.NextToPoint(closestStoneWall); if (!nextToStoneWall) { PathToPoint(c, closestStoneWall); } else { for (int i = 0; i < c.Inventory.Count; i++) { Item I = c.Inventory[i]; if (I is Axe axe && axe.Name == "pickaxe") { c.Wield(i, true); } } if (c.Body.MainHand is MeleeWeapon mWeapon && (mWeapon is Axe || mWeapon is Sword)) { c.PickWall(( Wall)blocks[closestStoneWall.X * width + closestStoneWall.Y]); }
public override void Activate(Creature user) { user.PickWall(this); }