Skip to content

Commit

Permalink
Add Force Monocolor rule (#9931)
Browse files Browse the repository at this point in the history
* Rules: Add forcemonocolor

* update

* Update data/rulesets.ts

Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>

* Update data/rulesets.ts

Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>

* Update rulesets.ts

* Update rulesets.ts

* Update data/rulesets.ts

---------

Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 7, 2024
1 parent 437c476 commit 3c31c0f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions data/rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,29 @@ export const Rulesets: {[k: string]: FormatData} = {
}
},
},
forcemonocolor: {
effectType: 'ValidatorRule',
name: 'Force Monocolor',
desc: `Forces all teams to have Pok&eacute;mon of the same color. Usage: Force Monocolor = [Color], e.g. "Force Monocolor = Blue"`,
hasValue: true,
onValidateRule(value) {
const validColors = ["Black", "Blue", "Brown", "Gray", "Green", "Pink", "Purple", "Red", "White", "Yellow"];
if (!validColors.map(this.dex.toID).includes(this.dex.toID(value))) {
throw new Error(`Invalid color "${value}"`);
}
},
onValidateSet(set) {
const color = this.toID(this.ruleTable.valueRules.get('forcemonocolor'));
let dex = this.dex;
if (dex.gen < 5) {
dex = dex.forGen(5);
}
const species = dex.species.get(set.species);
if (this.toID(species.color) !== color) {
return [`${set.species} must be the color ${color}.`];
}
},
},
forceteratype: {
effectType: 'ValidatorRule',
name: 'Force Tera Type',
Expand Down

0 comments on commit 3c31c0f

Please sign in to comment.