Skip to content

Custom DVs ignored #664

@ctl2

Description

@ctl2

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions