Rance X Gacha Algorithm

The basic algorithm is:

Most cards are added probabilistically to the pool by running the probability function described below. Some cards will not be added to the pool until certain conditions are met, and some cards are always added to the pool.

When doing a mission in a particular country, the cards for that country are considered three times for addition to the pool. In other words, there can be up to three copies of each card from that country in the pool at once.

If Kesselring’s maids are availiable, they are considered twice for addition to the pool. If the second probability check succeeds, 4 copies of the card are added to the pool. In other words, there can be up to 5 copies of each maid in the gacha pool at once.

Probability Function

Non-generic cards are checked against a probability function before being added to the gacha pool. If this function returns 0, the card will not appear; if it returns 1, the card is added to the pool.

Nude Rance and Richelle Passive Abilities

The nude Rance and Richelle cards have passives that affect the probability of certain cards appearing in the gacha pool. Nude Rance increases the chance of nude cards appearing, while Richelle reduces the probability of duplicate cards appearing.

These passives are implemented by discarding 4 out of every 5 non-nude/duplicate cards before the normal probability calculation is performed. The code implementing these passives looks like this.

if (nude_rance_passive && not_a_nude_card) {
    nude_rance_discard_counter++;
    if (nude_rance_discard_counter < 5)
        return 0;
    nude_rance_discard_counter = 0;
}

Chest Level

There are 3 levels of chest:

There is a base 5% chance that the chest level will be upgraded to the next highest level. This chance is calculated each time the probability function runs, i.e. for every card being considered for inclusion to the gacha pool. This probability can be upgraded to a maximum of 35% with various bonuses:

Additionally, there is code in the game for an additional level of chest which guarantees super rare drops. I believe this was used for testing purposes as the flag which enables this chest level does not appear to be set at any point in the game.

Card conditions

Some cards require you to already have another card of the same character, or to have a character at a certain star rank (20, 40 or 80). These conditions are checked by the probability function. If the conditions for the card are not met, the function returns 0.

Card Rank

Every non-generic card has a rank, which can be one of the following values:

This breaks down into three tiers (common, rare, super rare) plus some additional restrictions that apply to certain cards within the common and rare tiers.