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

/ds: Add comparing stats #10984

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

WifiLatency
Copy link
Contributor

Implements the suggestion Allow Dexsearch to compare stats

Lets users compare one stat category to another of the same pokemon using >, >=, <, <=, and =. For instance, /ds fairy, atk > spatk would return all fairy types with a greater attack than special attack.

@WifiLatency WifiLatency requested a review from KrisXV as a code owner March 21, 2025 03:42
@pyuk-bot
Copy link
Contributor

I was going to suggest having a check for something like /ds atk > spa, spa > atk, but we currently allow /ds atk > 100, atk < 100 (which returns no results instead of an error) and /ds 90 > atk > 100 (which simply returns all Pokémon with less than 90 base Attack). I don’t understand how to trigger the “invalid stat range” message that’s already there.

@WifiLatency
Copy link
Contributor Author

WifiLatency commented Mar 21, 2025

I was going to suggest having a check for something like /ds atk > spa, spa > atk, but we currently allow /ds atk > 100, atk < 100 (which returns no results instead of an error) and /ds 90 > atk > 100 (which simply returns all Pokémon with less than 90 base Attack). I don’t understand how to trigger the “invalid stat range” message that’s already there.

Looks like this gets triggered when you make an OR query which uses the same stat and direction. so /ds atk > 90 | atk > 100 triggers it. This is problematic behaviour since /ds atk > spatk | spe > spatk is a valid query. So I will need to fix that since I overlooked it. Thanks for pointing it out.

@pyuk-bot
Copy link
Contributor

/ds atk > 90 | atk > 100 is a more valid range than /ds atk > 90, atk > 100 which is an allowed query. You could probably just drop that check entirely.

@WifiLatency
Copy link
Contributor Author

WifiLatency commented Mar 21, 2025

/ds atk > 90 | atk > 100 is a more valid range than /ds atk > 90, atk > 100 which is an allowed query. You could probably just drop that check entirely.

Dropping the check as it is would result in the earlier values in the orgroup getting overwritten which would be misleading to users. To keep that behaviour from occuring the check will need to be rewritten to allow one each of hp/atk/def/spatk/spdef/spe/numeric for each stat and direction. /ds atk > spatk | atk > spe | atk > 100 would be valid but /ds atk > spatk | atk > spatk or /ds atk > 100 | atk > 90 should get errored due to having duplicate direction and stat types. Admittedly all this does is prevent duplicates when you're comparing one stat against another, but its still important for clarity with the numeric values.

The invalid ranges you're describing when ANDing together stat searches would probably get implemented in validParameter as this is what non flag searches like abilities or moves use. I could look at adding support for that after fixing the other error case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants