This small page describes how the items available in the mining mini-game are defined. This information will also help you to change which items are available.
All graphics relating to the mining mini-game are in the "Graphics/Pictures/Mining" folder.
Mining item images
The graphics of all the available items are stored in a single image, called "items.png". This image is on the right, modified to show how the items align to the grid that the mining mini-game uses (each square is 32x32 pixels at their full size, which is double 16x16 pixels).
Each item occupies a number of squares in the mining area. In the image, an item should occupy a rectangle, and rectangles should not overlap, even if there is blank space in some parts of those rectangles (e.g. Revive only occupies a + shape of squares, yet its image is a full 3x3 square shape).
There is no limit on the width or height of the items graphic. To add new items, simply extend the image and add them in. Make sure they line up properly to the grid.
Defining the mining items
Adding pictures to the items graphic isn't enough. You also need to tell the game that it's a new game, where it is in the items graphic, and what shape it is for the sake of fully uncovering it (you can fully uncover a Revive by revealing the + shape, not the whole 3x3 square its image occupies). You also need to tell the game how rare the item is.
These definitions are in the script section PokemonMinigameMining, at the top of class
MiningGameScene. There is a long list of items here, which begins as follows:
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]],
Each line is an item. Actually, each row is a single image in the items graphic; some items have multiple images of themselves (e.g. Helix Fossil has four images, each rotated a different way). The line contains all the information about that image/item.
Let's consider the Dome Fossil:
[: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]],
The first part is the item represented by this image. It is the internal name of that item, preceded by a colon.
The second part (first number,
20) is the probability that this item will be chosen to be put into a mining area. These numbers are just relative to the equivalent numbers in other lines; they do not add up to a specific value. The smaller the number, the rarer the item is. Note that there are four Helix Fossil graphics, and that the lines describing them each have a probability of 5. 4x5=20, so a Helix Fossil is just as likely to be found as a Dome Fossil. By default, the most common items are the Hard Stone and Heart Scale, each with a rarity of 200.
These next four numbers are the location of the item's image in the big graphic. The first two are the coordinates of the top left square occupied by that image, and the second two are the width and height of the image in squares. The Dome Fossil can be found on the far left nearly at the top of the image (0 squares from the left, 3 squares from the top), and is 5 squares wide and 4 squares tall.
This last piece of information is an array of digits. These indicate which parts of the image are occupied by the image itself, and which parts are empty space. A 1 indicates part of the item in a square, and a 0 indicates empty space. Only parts of the item need to be uncovered in order to obtain that item; empty space does not. The numbers themselves go from the top left to bottom right of the image, going horizontally first (i.e. in the same direction you read).
The Dome Fossil is mostly 1s, and has just two 0s. The image on the right shows how these numbers correspond to the image itself. You can see that the two 0s correspond to empty space in the image.
Choosing the items for a mining area
Each mining area is generated randomly when it appears. It can have between 2 and 4 items, and between 4 and 6 pieces of iron (which hinder your mining).
The items to be put into a mining area are chosen randomly. However, there cannot be more than one Fossil in a given mining area, nor can there be more than one Plate. Also, there cannot be two of the same item. All of these restrictions apply to the actual item, not to the images used to represent them (i.e. the Leaf Stone has two images, but it is impossible to have more than one Leaf Stone in a given mining area).
These restrictions are enforced in the def