Commit Graph

265 Commits

Author SHA1 Message Date
Guangcong Luo
156325d44c Fix past-gen event validator
Future-gen events were previously allowed in past gens.
2017-03-01 02:13:08 -05:00
Guangcong Luo
1daa700434 Validator: Validate incomplete teams
In VGC and Battle Spot, the validator wouldn't do any validation at all
if you didn't bring the minimum number of Pokemon. Now, it still gives
other error messages in addition to "You need at least X Pokemon".

This is mostly nice for validating a single Pokemon for VGC etc without
needing to fill the rest of the team with junk.
2017-03-01 02:13:08 -05:00
Guangcong Luo
e8b60c1e90 Fix Gen 1-2 DV/EV/shiny/gender validation
The old code tried to validate by changing incorrect values to correct
values, but had lots of bugs. Even if it didn't have bugs, it would have
various flaws like stats being different from what you would expect from
the teambuilder, so the new code just tells you when your HP DV,
shininess, gender, and Hidden Power type are inconsistent with your
other DVs.

(The one exception is SD Thick Club Marowak, which still automatically
fixes its Atk IV, since we still don't have teambuilder UI for that.)
2017-03-01 02:13:08 -05:00
Quinton Lee
01a029172d Tournaments: support rulesets in /tour banlist (#3300)
* Validator: fully support overriding rulesets

* Tournaments: support rulesets in /tour banlist
2017-02-27 02:32:01 -04:00
Guangcong Luo
c2ae5c5354 Fix validator crashes 2017-02-25 02:36:00 -05:00
Guangcong Luo
220d9cf7d9 Add more useful errors for Validator#validateSource 2017-02-24 06:55:11 -06:00
Guangcong Luo
2bc476d9a2 Fix crash in validator 2017-02-24 04:57:52 -05:00
Guangcong Luo
d9b431b7c2 Stop converting set values to names
Because of the way fastUnpackTeam works, it's currently a reasonable
assumption that all the values in a `set` are IDs, and various parts
of the code have started to rely on that assumption.

Removing some old code to try to guarantee that the values in a `set`
are names allow us to work towards a new guarantee that `set` values
are IDs.

Closes #2553
2017-02-24 01:38:45 -06:00
Guangcong Luo
5a95f6f247 Remove unnecessary code
The Diancie check is now implemented in Diancie's event data.
2017-02-24 00:41:48 -06:00
Guangcong Luo
4052b28cec Refactor event validator
This is a huge refactor that consolidates many different places event,
DW, and VC moves are validated, so that they're now validated in the
single place Validator#validateEvent. DW and VC moves are now treated
as special cases of events.

Validator#checkLearnset now does zero validation of event, DW, and VC
moves; it now simply passes the list of possible sources back to
Validator#validateSet, and it's validateSet's job to determine if the
Pokemon meets the requirements for any of those sources.

(In addition to simplifying checkLearnset, this also means more
useful error messages if you fail to meet the requirements for an
event move or DW move.)

validateSet should also be a decent margin simpler, due to a lot of
its code being folded into validateEvent.
2017-02-24 00:38:47 -06:00
Guangcong Luo
e7e3520d99 Fix Virtual Console validation
Virtual Console validation wasn't happening for Pokemon who learn a
move from Virtual Console from multiple Pokemon in its evo family.

This is most relevant for No Guard Fissure Machamp, which shouldn't
be legal.
2017-02-23 17:32:32 -06:00
Guangcong Luo
4d2e36e30c Fix crash in validator 2017-02-23 17:23:54 -06:00
Guangcong Luo
f2319da74e Fix Hidden Power Dark validation 2017-02-23 18:31:13 -05:00
Guangcong Luo
54df5c857d Validator: Support Gen 1 Virtual Console moves
This adds validator support for Gen 1 Virtual Console moves.

Fixes #3208

If anyone wants the quick-and-dirty eval script I used to update
Learnsets:

```
Object.entries(Tools.mod('gen1').data.Learnsets).forEach(([speciesid, lset]) => {
	Object.entries(lset.learnset).forEach(([moveid, sources]) => {
		if (sources.some(s => s.startsWith('1L') || s.startsWith('1M'))) {
			let newLset = Tools.data.Learnsets[speciesid].learnset;
			if (!newLset[moveid]) newLset[moveid] = [];
			let i = 0;
			while (i < newLset[moveid].length && newLset[moveid][i].startsWith('7')) i++;
			newLset[moveid].splice(i, 0, '7V');
		}
	})
})
```
2017-02-23 05:23:14 -06:00
Guangcong Luo
151bbf5b41 Slightly refactor event validation
Now with slightly less redundant code!
2017-02-22 05:06:39 -06:00
Guangcong Luo
2d6bd87c0b Improve Hidden Power validator
Now that we now store Hidden Power type separately from IVs, we can
make some major changes to how Hidden Power is validated.

Instead of Hidden Power type being calculated from the IVs, it's now
sent separately as part of the set. This allows us to warn in the
validator if the Hidden Power type specified by the moveset is
different from the one calculated from the IVs, and give a validation
error if so.

This also allows us to validate the Hidden Power type (pre-bottle-cap
IVs) separately from the set IVs (post-bottle-cap IVs) when doing
event validation, which fixes some validation issues relating to
Hidden Power.
2017-02-22 04:39:03 -06:00
Guangcong Luo
2b75907975 Validator: Allow Gen 6 Pokemon in Battle Spot
Previously, "requirePentagon" meant "only allow current-gen Pokemon".

Now, "requirePentagon" means "allow Gen 6 Pokemon and later", and
"requirePlus" means "allow Gen 7 Pokemon and later".
2017-02-16 01:17:54 -06:00
Guangcong Luo
0bcad8de6c Validator: Refactor and comment validator flags 2017-02-16 01:17:54 -06:00
Guangcong Luo
6423c3f1e4 Validator: Pokebank has been released 2017-02-16 01:17:54 -06:00
Guangcong Luo
bcebbf1e7b Validator: Revert Pokebank changes
The last 7 commits to team-validator take the code in the wrong
direction. While it's possible that the latest one fixes the validation
issues for VGC, they misuse variable names and in general need to be
redone from scratch.
2017-02-16 01:17:54 -06:00
The Immortal
b8c56f0ffc Fix egg validation 2017-02-12 04:32:36 +04:00
The Immortal
31291ee957 Fix Mergemons 2017-02-06 15:00:39 +04:00
The Immortal
3cd71a105e Validator: Fix crash 2017-02-02 17:50:43 +04:00
The Immortal
642b916b9f Fix Mergemons crash 2017-02-01 23:05:36 +04:00
The Immortal
28ed21a143 Fix VGC '17 validation 2017-01-30 23:30:34 +04:00
The Immortal
c9700f32f4 Validator: Update pentagon 2017-01-25 23:24:19 +04:00
The Immortal
812fb317c6 Validator: Bank is released 2017-01-25 09:01:32 +04:00
urkerab
2301b962a6 Only switch to Ash Greninja if we're not already using a custom template (#3087) 2017-01-17 15:50:27 -06:00
The Immortal
9288e75284 Remove STABmons hack 2017-01-01 18:59:14 +04:00
Guangcong Luo
e250d21983 Hardcode prebank no-hidden pokemon in validator 2016-12-31 02:31:09 -05:00
The Immortal
7e70e67836 AAA: Fix event Pokemon compatibility 2016-12-28 03:29:08 +04:00
The Immortal
a32a958c45 STABmons: Ban Belly Drum 2016-12-20 17:15:03 +04:00
The Immortal
8213dd3974 Validator: Island scan Pokemon can't have hidden abilities 2016-12-15 15:29:51 +04:00
Guangcong Luo
4384c369a4 Implement HP Fighting legality check 2016-12-15 00:31:03 -05:00
asgdf
b19fab8501 Make learnset searching check for event levels (#3001) 2016-12-07 10:41:42 -06:00
The Immortal
a26d982443 Sketchmons: Fix typo 2016-12-07 20:07:41 +04:00
Guangcong Luo
badbc1f193 Fix Gen 7 breeding mechanics
It was incorrectly treating Gen 7 as having past gen breeding
mechanics.
2016-12-06 21:22:58 -06:00
Guangcong Luo
1f772eafae Make validator code more readable
The main change here is a rename dexEntry -> father in the breeding
code.
2016-12-06 15:02:24 -05:00
João Silva
eed37b63b2 Fix validation of unavailable egg moves (#2983) 2016-12-06 12:28:07 -06:00
Guangcong Luo
076069772b Validator: Fix evo egg move detection 2016-12-05 16:30:43 -05:00
The Immortal
dca870039e Add new STABmons bans 2016-12-05 20:26:23 +04:00
The Immortal
c2b96f3eeb Update Sketchmons 2016-12-05 20:22:33 +04:00
urkerab
573c1f523d Sketch itself should count towards Necturna's single Sketch limit (#2987) 2016-12-04 10:16:43 -06:00
Guangcong Luo
416c7e038f Banning a base form bans all forms
Base forms can still be banned with e.g. "Zygarde-Base", but if you ban
"Zygarde" in a format, that bans all Zygarde forms.
2016-12-01 13:22:36 -06:00
The Immortal
fd8f69575b Update SM island scan list 2016-12-01 23:10:15 +04:00
The Immortal
f4a38d461a Prevent Z-moves in STABmons 2016-12-01 10:09:50 +04:00
The Immortal
6bc9f9a3b0 Fix STABmons 2016-12-01 09:02:29 +04:00
The Immortal
4bcef0cdaf Update OMs 2016-12-01 06:19:35 +04:00
Guangcong Luo
29b8101cdb Validator: Massively improve event compatibility errors
Event-only Pokemon now receive detailed event compatibility
error messages, like we do for event moves.

Event move/ability information is now fixed, so the validator now
explicitly specifies whether it's a move or ability that a move is
incompatible with.

Related: We no longer warn about event IV compatibility for level 100
Pokemon in Gen 7.
2016-11-29 23:41:32 -06:00
Guangcong Luo
d45414f2ec Fix Battle Bond Greninja
This introduces a new ability slot 'S' which corresponds to Battle
Bond only.

There's also a little bit of a hack to consider Battle Bond Greninja
Ash-Greninja for the purposes of move and event validation.
2016-11-29 23:17:20 -06:00