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

Custom DVs ignored #664

Open
ctl2 opened this issue Nov 2, 2024 · 0 comments
Open

Custom DVs ignored #664

ctl2 opened this issue Nov 2, 2024 · 0 comments

Comments

@ctl2
Copy link

ctl2 commented Nov 2, 2024

Problem

In the gens that use DVs, DV spreads may only be either 15 in everything or a default hidden power spread. Custom spreads can be achieved by editing after selection, but they can not appear initially.

The only built-in set where this is relevant is the gen 1 Mewtwo "Ubers Staller" set, which should have 13 special DVs (to avoid overflow when boosted to +4) but gets 15 instead.

Cause

Custom DVs get ignored here. Instead of reading from "ivs", where custom spreads are stored, the "dvs" entry is used. Since "dvs" isn't generally defined, the fallback value of 15 gets used.

Any set with hidden power gets its DVs maxed, then corrected to a default spread by the move change listener. The issue is with custom spreads getting ignored; the correction code is working perfectly.

Solution

I think the best solution would be to remove all references to the "dvs" property in setdex entries and, instead, always calculate DVs from IVs. As far as I can tell, the only place that assigns a dvs entry is correctHiddenPower and it's only read here and here.

If the dvs property needs to be kept, another solution would be to change

(set.dvs && set.dvs[LEGACY_STATS[gen][i]] !== undefined) ? set.dvs[LEGACY_STATS[gen][i]] : 15);

to something like
set.dvs?.[LEGACY_STATS[gen][i]] ?? calc.Stats.IVToDV(set.ivs?.[LEGACY_STATS[gen][i]] ?? 31);

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

No branches or pull requests

1 participant