Done Breaking up the "Obtainable Misc." Rule when using /tour rules

Isaiah

Here today, gone tomorrow
is a Site Content Manageris an official Team Rateris a Battle Simulator Administratoris a Top Social Media Contributoris a Member of Senior Staffis a Community Contributoris a Top Tiering Contributoris a Top Contributor
UM/OM Leader
I hope to be corrected if there's information I'm not aware of, but to my knowledge currently the "Obtainable Misc" validator rule includes multiple things: "...allow only legal EVs, IVs, levels, genders, and Hidden Power types."

It would be nice if there was a way to break this up to only allow/disallow certain parts of it--for example, making roomtours with just the 510 ev limit removed and none of the other parts included as "misc".



tagging alaserdolphin because why not
 
Programmers: I repeat, this is really easy. Just Ctrl+Shift+F "obtainablemisc" and replace it with individual rules.
I looked into this a bit and it's not going to be difficult per se but a lot of the validation is actually hardcoded over here, rather than in rulesets.ts.

Should all of that code be broken down (or moved elsewhere) as smaller methods within team-validator.ts? A ton of it is niche stuff like Battle Bond Greninja getting checked to be male, etc. and I don't know what the code etiquette is.
 

Zarel

Not a Yuyuko fan
is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Pokemon Researcheris an Administrator
Creator of PS
I looked into this a bit and it's not going to be difficult per se but a lot of the validation is actually hardcoded over here, rather than in rulesets.ts.

Should all of that code be broken down (or moved elsewhere) as smaller methods within team-validator.ts? A ton of it is niche stuff like Battle Bond Greninja getting checked to be male, etc. and I don't know what the code etiquette is.
All the hardcodes are inside something like if (ruleTable.has('obtainablemisc')). You simply rename obtainablemisc to the new rule name, and that's enough. All you need to do is break it up, not un-hardcode it.

You can refactor (un-hardcode) it if you'd like, but we may or may not accept the change. You probably want to talk it over with us first, at https://psim.us/devdiscord
 
Last edited:
All the hardcodes are inside something like if (ruleTable.has('obtainablemisc')). You simply rename obtainablemisc to the new rule name, and that's enough. All you need to do is break it up, not un-hardcode it.

You can refactor it if you'd like, but we may or may not accept the change. You probably want to talk it over with us first, at https://psim.us/devdiscord
Yeah I just wasn't sure if that'd be considered too patchwork of a way to handle the issue - I saw you guys were making a lot of code-optimization commits the past few weeks and I didn't want to even try anything without at least asking first, you know?

I'll see if I can take another look at it when I can find an opportunity but if someone wants to do it in the mean time then it's still all theirs.
 

Zarel

Not a Yuyuko fan
is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Pokemon Researcheris an Administrator
Creator of PS
Are there specific aspects other than the EV limit that people want to have split out?

I split out a numeric rule: EV Limit = 510. In addition to setting whatever limit you want, you can also either remove the limit with ! EV Limit (allowing all EVs to be 252) or disallow EVs entirely with EV Limit = 0.

The other thing in Obtainable Misc is a move limit, which can't be removed because of this: https://www.smogon.com/forums/threa...one-copy-of-a-move-with-custom-rules.3684790/

I considered breaking out the level validation, but you nearly always want to bypass it with Adjust Level in practice.
 

Isaiah

Here today, gone tomorrow
is a Site Content Manageris an official Team Rateris a Battle Simulator Administratoris a Top Social Media Contributoris a Member of Senior Staffis a Community Contributoris a Top Tiering Contributoris a Top Contributor
UM/OM Leader
Are there specific aspects other than the EV limit that people want to have split out?

I split out a numeric rule: EV Limit = 510. In addition to setting whatever limit you want, you can also either remove the limit with ! EV Limit (allowing all EVs to be 252) or disallow EVs entirely with EV Limit = 0.

The other thing in Obtainable Misc is a move limit, which can't be removed because of this: https://www.smogon.com/forums/threa...one-copy-of-a-move-with-custom-rules.3684790/

I considered breaking out the level validation, but you nearly always want to bypass it with Adjust Level in practice.
Nope! I initially put up this suggestion because of EV Limits to begin with, so this is genuinely a near-ideal solution as is! Thanks so much
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top