Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Force Monocolor rule #9931

Merged
merged 8 commits into from
Feb 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions data/rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,30 @@ export const Rulesets: {[k: string]: FormatData} = {
}
},
},
forcemonocolor: {
effectType: 'ValidatorRule',
name: 'Force Monocolor',
desc: `Forces all teams to have Pokémon of the same color. Usage: Force Monocolor = [Color], e.g. "Force Monocolor = Blue"`,
hasValue: true,
onValidateRule(value) {
const color = value.toLowerCase();
const validColors = ['red', 'blue', 'green', 'yellow', 'pink', 'brown', 'purple', 'gray', 'white', 'black'];
if (this.dex.gen <= 4) {
throw new Error(`The "Force Monocolor" rule is not supported in Generation ${this.dex.gen}.`);
}
Distrib-ps marked this conversation as resolved.
Show resolved Hide resolved
if (!validColors.includes(color)) {
throw new Error(`Invalid color "${value}"`);
}
},
onValidateSet(set) {
const ruleColor = this.ruleTable.valueRules.get('forcemonocolor')!.toLowerCase();
const species = this.dex.species.get(set.species);
const color = species.color.toLowerCase();
if (color !== ruleColor) {
return [`${set.species} must have the ${ruleColor} color.`];
}
Distrib-ps marked this conversation as resolved.
Show resolved Hide resolved
},
},
forceselect: {
effectType: 'ValidatorRule',
name: 'Force Select',
Expand Down