Mining mini-game

The **mining mini-game** is a mini-game from the Gen 4 games. The player digs into a wall to uncover items, but each hit into the wall brings it one step closer to collapsing.

## Mining mini-game

The mining field is laid out in a grid of squares, where a square is 32x32 pixels. By default, the field is 13x10 squares in size. Each buried item occupies a number of squares in the field.

In each game, 2-4 items are randomly chosen and buried in the field. Duplicate items are not allowed, except for Heart Scales, and there can only be up to 1 of any kind of fossil and up to 1 of any kind of Plate. 4-6 pieces of iron are also buried. Each square of the field has a random thickness of rock, and the items/iron pieces are beneath all that rock.

The graphics for the mining mini-game are in the folder "Graphics\Pictures\Mining".

## Items and iron pieces

In the folder "Graphics\Pictures\Mining" are two graphics which depict iron pieces (which hinder excavation) and items that can be found.

Every iron piece and item occupies a rectangular part of their graphic, even the empty squares within them that are not counted as part of that object. Two iron pieces/items should not overlap their rectangles.

The available items are listed in `class MiningGameScene` in the array `ITEMS`. Here is a sample of these items:

```
ITEMS = [   # Item, probability, graphic x, graphic y, width, height, pattern
  [:DOMEFOSSIL, 20, 0, 3, 5, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]],
  [:HELIXFOSSIL, 5, 5, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
  [:HELIXFOSSIL, 5, 9, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
  [:HELIXFOSSIL, 5, 13, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
  [:HELIXFOSSIL, 5, 17, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
  [:OLDAMBER, 10, 21, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]],
  [:OLDAMBER, 10, 25, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]],
  [:HEARTSCALE, 200, 8, 24, 2, 2, [1, 0, 1, 1]],
  [:IRONBALL, 100, 9, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]],
  [:ODDKEYSTONE, 100, 10, 20, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
  [:HEATROCK, 50, 12, 17, 4, 3, [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]],
  [:ZAPPLATE, 10, 12, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
  [:FISTPLATE, 10, 16, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
  [:FLAMEPLATE, 10, 20, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]],
]

```

The comment in the first line is a brief explanation of what each value is. Below is a more detailed explanation of them:

 Probability
 Graphic x/y
 Width, height
 Pattern
The pattern makes use of the item's width in squares to decide which square each number refers to. For example, the Dome Fossil is 5 squares wide, so its pattern wraps around to the next line every 5th number like this:

```
[1, 1, 1, 1, 1,
 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1,
 0, 1, 1, 1, 0]

```

The bottom left and bottom right squares in the graphic are not part of the item itself, but the rest are.

Although there are graphics for spheres in "items.png", they do not appear in the `ITEMS` array in Essentials. This is because they are not actual items in Essentials (they act as a currency in the Underground, which Essentials does not have).

There is a similar array describing iron pieces, but they do not have associated items or relative probabilities (each iron piece has n equal chance of being used).

## Tips

* Since spheres cannot be found in the mining mini-game (because they are not real items in Essentials), all other items are far more common. This makes the mining mini-game quite profitable, so you may want to restrict how much the player can go mining in order to limit how many items they can acquire from this mini-game.