Skip to content

Commit

Permalink
Replace "Standard GBU" with "Flat Rules"
Browse files Browse the repository at this point in the history
Instead of the weirdly named "Standard GBU", we have a new ruleset
called "Flat Rules" which exactly matches the in-game ruleset of the
same name.
  • Loading branch information
Zarel committed May 5, 2021
1 parent b06d761 commit 398f08f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 95 deletions.
46 changes: 20 additions & 26 deletions config/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const Formats: FormatList = [
],

mod: 'gen8',
ruleset: ['Standard GBU', '!! Adjust Level = 50', 'Picked Team Size = 3'],
ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 8'],
},
{
name: "[Gen 8] Custom Game",
Expand Down Expand Up @@ -341,21 +341,15 @@ export const Formats: FormatList = [

mod: 'gen8',
gameType: 'doubles',
ruleset: [
'Picked Team Size = 4',
'Standard GBU', '!! Adjust Level = 50', 'VGC Timer',
],
ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 8', 'VGC Timer'],
},
{
name: "[Gen 8] VGC 2020",

mod: 'gen8dlc1',
gameType: 'doubles',
searchShow: false,
ruleset: [
'Picked Team Size = 4',
'Standard GBU', '!! Adjust Level = 50', 'VGC Timer',
],
ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 8', 'VGC Timer'],
},
{
name: "[Gen 8] 2v2 Doubles",
Expand Down Expand Up @@ -1595,7 +1589,7 @@ export const Formats: FormatList = [
],

team: 'randomBSSFactory',
ruleset: ['Obtainable', 'Standard GBU', 'Picked Team Size = 3'],
ruleset: ['Flat Rules'],
},
{
name: "[Gen 8] Super Staff Bros 4",
Expand Down Expand Up @@ -1670,7 +1664,7 @@ export const Formats: FormatList = [
team: 'randomCC',
gameType: 'doubles',
searchShow: false,
ruleset: ['[Gen 8] Challenge Cup 1v1', '!Picked Team Size', 'Picked Team Size = 2'],
ruleset: ['[Gen 8] Challenge Cup 1v1', '!! Picked Team Size = 2'],
},
{
name: "[Gen 8] Hackmons Cup",
Expand Down Expand Up @@ -1743,7 +1737,7 @@ export const Formats: FormatList = [
mod: 'gen7',
team: 'randomBSSFactory',
searchShow: false,
ruleset: ['Obtainable', 'Standard GBU', 'Picked Team Size = 3'],
ruleset: ['Flat Rules'],
},
{
name: "[Gen 7] Hackmons Cup",
Expand Down Expand Up @@ -2262,7 +2256,7 @@ export const Formats: FormatList = [

mod: 'gen7',
searchShow: false,
ruleset: ['Standard GBU', 'Picked Team Size = 3', '!Min Source Gen', 'Min Source Gen = 6'],
ruleset: ['Flat Rules', 'Min Source Gen = 6'],
},
{
name: "[Gen 7 Let's Go] OU",
Expand Down Expand Up @@ -2328,7 +2322,8 @@ export const Formats: FormatList = [
mod: 'gen7',
gameType: 'doubles',
searchShow: false,
ruleset: ['Minimal GBU', '!! Adjust Level = 50', 'VGC Timer', 'Picked Team Size = 4'],
ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 7', 'VGC Timer', 'Limit Two Restricted'],
restricted: ['Restricted Legendary'],
banlist: ['Unown'],
},
{
Expand All @@ -2351,10 +2346,7 @@ export const Formats: FormatList = [
timeoutAutoChoose: true,
dcTimerBank: false,
},
ruleset: [
'Picked Team Size = 4',
'Standard GBU', '!! Adjust Level = 50',
],
ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 7'],
banlist: ['Oranguru + Symbiosis', 'Passimian + Defiant', 'Unown', 'Custap Berry', 'Enigma Berry', 'Jaboca Berry', 'Micle Berry', 'Rowap Berry'],
},
{
Expand Down Expand Up @@ -2397,7 +2389,7 @@ export const Formats: FormatList = [
mod: 'gen7',
gameType: 'doubles',
searchShow: false,
ruleset: ['Picked Team Size = 4', 'Standard GBU', '!Min Source Gen', 'Min Source Gen = 6'],
ruleset: ['Flat Rules', 'Min Source Gen = 6'],
},
{
name: "[Gen 7] Doubles Custom Game",
Expand Down Expand Up @@ -2550,7 +2542,8 @@ export const Formats: FormatList = [

mod: 'gen6',
searchShow: false,
ruleset: ['Obtainable', 'Standard GBU', 'Picked Team Size = 3'],
ruleset: ['Flat Rules', 'Min Source Gen = 6'],
banlist: ['Soul Dew'],
},
{
name: "[Gen 6] Custom Game",
Expand Down Expand Up @@ -2623,7 +2616,8 @@ export const Formats: FormatList = [
mod: 'gen6',
gameType: 'doubles',
searchShow: false,
ruleset: ['Standard GBU', 'Picked Team Size = 4'],
ruleset: ['Flat Rules', 'Min Source Gen = 6'],
banlist: ['Soul Dew'],
},
{
name: "[Gen 6] Doubles Custom Game",
Expand All @@ -2646,7 +2640,7 @@ export const Formats: FormatList = [
mod: 'gen6',
gameType: 'triples',
searchShow: false,
ruleset: ['Standard GBU', 'Min Team Size = 6'],
ruleset: ['Flat Rules', 'Min Source Gen = 6'],
},
{
name: "[Gen 6] Triples Custom Game",
Expand Down Expand Up @@ -2771,8 +2765,8 @@ export const Formats: FormatList = [

mod: 'gen5',
searchShow: false,
ruleset: ['Standard GBU', 'Picked Team Size = 3'],
banlist: ['Dark Void', 'Sky Drop'],
ruleset: ['Flat Rules'],
banlist: ['Dark Void', 'Sky Drop', 'Soul Dew'],
},
{
name: "[Gen 5] Custom Game",
Expand Down Expand Up @@ -2812,8 +2806,8 @@ export const Formats: FormatList = [
mod: 'gen5',
gameType: 'doubles',
searchShow: false,
ruleset: ['Standard GBU', 'Picked Team Size = 4'],
banlist: ['Dark Void', 'Sky Drop'],
ruleset: ['Flat Rules'],
banlist: ['Dark Void', 'Sky Drop', 'Soul Dew'],
},
{
name: "[Gen 5] Doubles Custom Game",
Expand Down
78 changes: 12 additions & 66 deletions data/rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,79 +22,25 @@ export const Rulesets: {[k: string]: FormatData} = {
],
banlist: ['Soul Dew'],
},
standardgbu: {
flatrules: {
effectType: 'ValidatorRule',
name: 'Standard GBU',
desc: "The standard ruleset for all official in-game Pokémon tournaments and Battle Spot",
ruleset: [
'Min Source Gen = Current Gen', 'Adjust Level Down = 50',
'Obtainable', 'Team Preview', 'Species Clause', 'Nickname Clause', 'Item Clause', 'Cancel Mod',
],
banlist: [
'Battle Bond',
'Restricted Legendary', 'Mythical',
],
onValidateSet(set, format) {
if (this.gen < 7 && this.toID(set.item) === 'souldew') {
return [`${set.name || set.species} has Soul Dew, which is banned in ${format.name}.`];
}
},
name: 'Flat Rules',
desc: "The in-game Flat Rules: Adjust Level Down 50, Species Clause, Item Clause, -Mythical, -Restricted Legendary, Bring 6 Pick 3-6 depending on game type.",
ruleset: ['Obtainable', 'Team Preview', 'Species Clause', 'Nickname Clause', 'Item Clause', 'Adjust Level Down = 50', 'Picked Team Size = Flat Rules Team Size'],
banlist: ['Mythical', 'Restricted Legendary'],
},
minimalgbu: {
limittworestricted: {
effectType: 'ValidatorRule',
name: 'Minimal GBU',
desc: "The standard ruleset for official tournaments, but two Restricted Legendaries are allowed",
ruleset: [
'Min Source Gen = Current Gen', 'Adjust Level Down = 50',
'Obtainable', 'Species Clause', 'Nickname Clause', 'Item Clause', 'Team Preview', 'Cancel Mod',
],
banlist: [
'Battle Bond',
'Mythical',
],
restricted: [
'Restricted Legendary',
],
onValidateSet(set, format) {
if (this.gen < 7 && this.toID(set.item) === 'souldew') {
return [`${set.name || set.species} has Soul Dew, which is banned in ${format.name}.`];
}
},
name: 'Limit Two Restricted',
desc: "Limit two restricted Pokémon (flagged with * in the rules list)",
onValidateTeam(team) {
let n = 0;
const restrictedSpecies = [];
for (const set of team) {
const species = this.dex.species.get(set.species);
if (this.ruleTable.isRestrictedSpecies(species)) n++;
if (n > 2) return [`You can only use up to two restricted legendary Pok\u00E9mon.`];
if (this.ruleTable.isRestrictedSpecies(species)) restrictedSpecies.push(species.name);
}
},
},
singlerestrictedgbu: {
effectType: 'ValidatorRule',
name: 'Single Restricted GBU',
desc: "The standard ruleset for official tournaments, but one Restricted Legendary is allowed",
ruleset: [
'Min Source Gen = 8',
'Obtainable', 'Species Clause', 'Nickname Clause', 'Item Clause', 'Team Preview', 'Cancel Mod',
],
banlist: [
'Battle Bond',
'Mythical',
],
restricted: [
'Restricted Legendary',
],
onValidateSet(set, format) {
if (this.gen < 7 && this.toID(set.item) === 'souldew') {
return [`${set.name || set.species} has Soul Dew, which is banned in ${format.name}.`];
}
},
onValidateTeam(team) {
let n = 0;
for (const set of team) {
const species = this.dex.species.get(set.species);
if (this.ruleTable.isRestrictedSpecies(species)) n++;
if (n > 1) return [`You can only use up to one restricted legendary Pok\u00E9mon.`];
if (restrictedSpecies.length > 2) {
return [`You can only use up to two restricted Pok\u00E9mon (you have: ${restrictedSpecies.join(', ')})`];
}
},
},
Expand Down
13 changes: 10 additions & 3 deletions sim/dex-formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,16 @@ export class DexFormats {
repeals.set(subformat.id, -Math.abs(repeals.get(subformat.id)!));
continue;
}
if (ruleTable.has(subformat.id)) {
throw new Error(`Rule "${rule}" in "${format.name}" already exists in "${ruleTable.get(subformat.id) || format.name}"`);
}
if (subformat.hasValue) {
if (value === undefined) throw new Error(`Rule "${ruleSpec}" should have a value (like "${ruleSpec} = something")`);
if (value === 'Current Gen') value = `${this.dex.gen}`;
if (value === 'Flat Rules Team Size') {
value = String(
['doubles', 'rotation'].includes(format.gameType) ? 4 :
format.gameType === 'triples' ? 6 :
3
);
}
if (subformat.hasValue === 'integer' || subformat.hasValue === 'positive-integer') {
const intValue = parseInt(value);
if (isNaN(intValue) || value !== `${intValue}`) {
Expand Down Expand Up @@ -592,6 +596,9 @@ export class DexFormats {
} else {
if (value !== undefined) throw new Error(`Rule "${ruleSpec}" should not have a value (no equals sign)`);
if (repealAndReplace) throw new Error(`"!!" is not supported for this rule`);
if (ruleTable.has(subformat.id) && !repealAndReplace) {
throw new Error(`Rule "${rule}" in "${format.name}" already exists in "${ruleTable.get(subformat.id) || format.name}"`);
}
}
ruleTable.set(subformat.id, '');
if (depth > 16) {
Expand Down

0 comments on commit 398f08f

Please sign in to comment.