How to use Trainer Party Pools
Trainer Party Pools (TPP) is a way to introduce a bit of unpredictability to trainer battles by allowing trainer to generate parties from pools defined by the user.
The maximum number of mons that can be in a single trainer's pool is 255.
Turning on TPP with trainer.sparty
To use TPP with trainers.party, all that's needed is to define a Party Size that's smaller than than the number of defined mons for the trainer.
Turning on TPP with trainers.h
To use TPP with trainers.h, the trainer need to have the .poolSize field set to a value that's larger than the .partySize and equal to the number of mons defined in the trainer.
How the pool works
When generating a party for a trainer with a pool, the party is picked from the pool randomly according to rules set for the pool and tags assigned to individual mons in the pool.
Pool Rules
Pool rules are defined in src/data/battle_pool_rules.h. To begin with some default pools are defined, defaultPoolRules which any trainer that doesn't otherwise have a specified pool ruleset uses, and some custom rules for common scenarios.
POOL_RULESET_BASIC, a ruleset that will pick a mon from the pool with the tagMON_POOL_TAG_LEADif possible to put in the first slot andMON_POOL_TAG_ACEin the last slot, and not pick mons with those tags for any other position.POOL_RULESET_DOUBLES, a ruleset that will pick up to two mons from the pool with the tagMON_POOL_TAG_LEADif possible to put in the first two slots andMON_POOL_TAG_ACEin the last two slots, and not pick mons with those tags for any other position.POOL_RULESET_WEATHER_SINGLES, a ruleset that will pick at most one mon with the tagMON_POOL_TAG_WEATHER_SETTERif possible, and at least one mon with the tagMON_POOL_TAG_WEATHER_ABUSERif possible, in addition to the same conditions asPOOL_RULESET_BASIC.POOL_RULESET_WEATHER_DOUBLES, a ruleset that will pick at most one mon with the tagMON_POOL_TAG_WEATHER_SETTERif possible, and at least one mon with the tagMON_POOL_TAG_WEATHER_ABUSERif possible, in addition to the same conditions asPOOL_RULESET_DOUBLES.POOL_RULESET_SUPPORT_DOUBLES, a ruleset that will pick at most one mon with the tagMON_POOL_TAG_SUPPORTif possible, in addition to the same conditions asPOOL_RULESET_DOUBLES.
All these pools also have the options .speciesClause, .excludeForms, .itemClause and .itemClauseExclusions set to the values defined in include/config/battle.h under B_POOL_RULE_<rule>.
.speciesClauseif set toTRUEmeans that the same exact species as defined by.speciescan't be picked twice for the party from the pool..excludeFormsif set toFALSEmeans that the same exact species as defined by NetDex number can't be picked twice for the party from the pool..itemClauseif set toTRUEmeans that pokemon with the same held item can't be picked twice for the party from the pool..itemClauseExclusionsif set toTRUEmeans that multiple pokemon with the same item can be picked for the party if the item is listed inpoolItemClauseExclusions. By defaultITEM_ORAN_BERRYandITEM_SITRUS_BERRYare the only items in the list of exclusions.
Individual tags can have rules which change how they're included.
By setting the .tagMaxMembers[POOL_TAG_<tag>] field to a number, only that many mons with that tag will at max be part of the party, or if set to POOL_MEMBER_COUNT_NONE no mons with this tag will be included, and if set to POOL_MEMBER_COUNT_UNLIMITED no restrictions on the number of mons with the tag will apply.
By setting .tagRequired[POOL_TAG_<tag>] option field to TRUE, this tag will be picked before any tags that are not required, after the tag has been picked for the pool it will be set to FALSE for that tag.
The tags Lead and Ace has special handling where they will be picked for the first or last party position respectively.
Tags
There are currently 8 tags specified in the TPP implementation, Lead, Ace, Weather Setter, Weather Abuser, Support, Tag 5, Tag 6 and Tag 7.
If using trainers.party, these tags are applied to mons with the field Tags: , separated by /. Example Tags: Lead / Weather Setter
If using trainers.h, these tags are applied to mons with the field .tags, separated by |. Example: .tags = MON_POOL_TAG_LEAD | MON_POOL_TAG_WEATHER_SETTER
Pokemon can have up to 32 different tags, but anything beyond the 8 initial tags has to be implemented. The numbered tags can be renamed too to better signify their purpose for developers.
Trainer options
A few more trainer options are introduced in order to further customize how the pool picking process works.
Pool Pick Functions(.poolPickIndex) controls which functons are used to pick mons from the pool, they're split into Lead, Ace, and Other. By default, onlyDefault<position>PickFunctionandPickLowestare implemented. Must be anenumvalue inenum PoolPickFunctions.Pool Prune(.poolPruneIndex) controls if members in the pool should be removed before party members are picked from the pool. By default, onlyPOOL_PRUNE_NONE, which doesn't remove anything from the pool, andPOOL_PRUNE_TEST, which removes Wobbuffet from the pool, are implemented. Must be anenumvalue inenum PoolPruneOptions.
Pool copy
The Copy Pool option can be used to have the trainer use the party or pool from a different trainer.
If you for example want some other trainer to have the same team/pool as Tiana, you'd use Copy Pool: TRAINER_TIANA.
If Party Size isn't defined for the current trainer, it will inherit from the copied trainer.
Example pool
=== TRAINER_TIANA ===
Name: TIANA
Class: Lass
Pic: Lass
Gender: Female
Music: Female
Double Battle: Yes
AI: Check Bad Move
Party Size: 4
Pool Rules: Weather Doubles
Pool Pick Index: Default
Zigzagoon
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Shroomish
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Psyduck
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Shellder
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Mew
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Tags: Ace
Giratina
Level: 4
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Tags: Ace
Vulpix
Ability: Drought
Level: 4
Tags: Lead / Weather Setter
Torkoal
Ability: Drought
Level: 4
Tags: Lead / Weather Setter
Bulbasaur
Ability: Chlorophyll
Level: 4
Tags: Lead / Weather Abuser
Cherrim
Level: 4
Tags: Lead / Weather Abuser
Here Tiana has been given a pool that's set up for a double battle with weather. Using the default pool rule Weather Doubles it will only pick one of each of the weather setters and abusers which Tiana will lead with. Tiana will also pick either Mew or Giratina as her Ace mon, and the last slot will be filled with one of Zigzagoon, Shroomish, Psyduck or Shellder.
Pool settings
If no pool rule is specified in the trainer, the default rules will be used, which sets rules according to some defaults from include/config/battle.h.
This file also has settings for other pool options.
B_POOL_SETTING_CONSISTENT_RNG,TRUEorFALSE, the party generated will always be the same on a particular save (RNG dependant on trainerId and encountered trainer).B_POOL_SETTING_USE_FIXED_SEED,TRUEorFALSE, the party generated will always be the same on a particular compiled ROM (RNG dependant on a chosen seed and encountered trainer).B_POOL_SETTING_FIXED_SEED, seed to use for fixed seed, does nothing ifB_POOL_SETTING_USE_FIXED_SEEDisFALSE.