Make "All Pokemon" rules more convenient (#10932)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run

* Make "All Pokemon" rules more convenient

Previously, "+All Pokemon" did nothing except override "-All Pokemon",
which switched from a default-allow to default-deny system.

They still do that, but they now also override all previous pokemon
bans/unbans. This makes it easier to replace a banlist/whitelist
from an inherited ruleset without needing to reverse every previous
ban/unban.

This also adds an error if you use `+All Pokemon` in a ruleset where
it doesn't do anything.

Fixes #10772
This commit is contained in:
Guangcong Luo
2025-03-02 14:47:30 -08:00
committed by GitHub
parent 7b32d0f8c7
commit 0cb51158aa
9 changed files with 162 additions and 53 deletions

View File

@@ -47,8 +47,11 @@ assert.atMost = function (value, threshold, message) {
});
};
assert.legalTeam = function (team, format, message) {
const actual = require('../dist/sim/team-validator').TeamValidator.get(format).validateTeam(team);
assert.legalTeam = function (team, formatName, message) {
require('../dist/sim/dex').Dex.formats.validate(formatName);
const format = require('../dist/sim/team-validator').TeamValidator.get(formatName);
// console.log(`${formatName}: ${[...format.ruleTable.keys()].join(', ')}`);
const actual = format.validateTeam(team);
if (actual === null) return;
throw new AssertionError({
message: message || "Expected team to be valid, but it was rejected because:\n" + actual.join("\n"),