Essentials Docs Wiki
Advertisement

Mining for items.

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:

Value Description
Item The ID of the item given to the player when fully revealing this buried item.
Probability The relative probability of this item being chosen to be buried in a particular game.

Note that, in the sample above, the Helix Fossil has four lines each with a probability of 5, while the Dome Fossil has one line with a probability of 20. The Helix Fossil can be found in four different rotations, and each of its lines are for a different rotation. Overall, the probability of choosing a Helix Fossil for burial is the same as choosing a Dome Fossil (because 4x5 = 1x20).

Graphic x/y These are the coordinates of the top right square of the item's graphic in "items.png", in squares. A square is 32x32 pixels.
Width, height These are the width and height of the item's graphic in "items.png", in squares. A square is 32x32 pixels.
Pattern This is an array of numbers indicating which squares within the item's graphic count as part of that item. In other words, the pattern is the item's shape. A "1" is a square that is part of the item (and needs to be uncovered to excavate the item), while "0" is a square that is not part of the item (and doesn't need to be uncovered).

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.
Advertisement