Skip to content

Commit

Permalink
hopefully last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pkmnbumba committed Feb 22, 2017
1 parent c309320 commit 2436ba3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/checks/hyper-training-31.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
description: 'A maxed IV (31) cannot be hypertrained.',
field: 'iv',
test (pkmn) {
return !(
pkmn.ivHp === 31 && pkmn.hyperTrainedHp ||
pkmn.ivAtk === 31 && pkmn.hyperTrainedAtk ||
pkmn.ivDef === 31 && pkmn.hyperTrainedDef ||
pkmn.ivSpAtk === 31 && pkmn.hyperTrainedSpAtk ||
pkmn.ivSpDef === 31 && pkmn.hyperTrainedSpDef ||
pkmn.ivSpe === 31 && pkmn.hyperTrainedSpe
);
}
};
12 changes: 12 additions & 0 deletions src/checks/hyper-training.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
description: 'A Pokémon from SuMo can only be hyper trained if level 100.',
filter (pkmn) {
return pkmn.level !== 100;
},
field: 'level',
test (pkmn) {
return !(pkmn.hyperTrainedHp || pkmn.hyperTrainedAtk ||
pkmn.hyperTrainedDef || pkmn.hyperTrainedSpAtk ||
pkmn.hyperTrainedSpDef || pkmn.hyperTrainedSpe);
}
};
7 changes: 6 additions & 1 deletion src/helpers/gameId.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const genMap = {
1: 3, 2: 3, 3: 3, 4: 3, 5: 3, 15: 3, /* S, R, E, FR, LG, XD/Colo */
7: 4, 8: 4, 10: 4, 11: 4, 12: 4, /* HG, SS, D, P, Pt */
20: 5, 21: 5, 22: 5, 23: 5, /* W, B, W2, B2 */
24: 6, 25: 6, 26: 6, 27: 6 /* X, Y, OR, AS */
24: 6, 25: 6, 26: 6, 27: 6, /* X, Y, OR, AS */
28: 7, 29: 7 /* Su, Mo */
};

exports.isFromXY = function (gameId) {
Expand All @@ -13,6 +14,10 @@ exports.isFromORAS = function (gameId) {
return [26, 27].indexOf(gameId) > -1;
};

exports.isFromSuMo = function (gameId) {
return [28, 29].indexOf(gameId) > -1;
};

exports.originGen = function (gameId) {
return genMap[gameId];
};
Binary file added test/pk7/illegal/6iv-hypertrained.pk7
Binary file not shown.
Binary file added test/pk7/illegal/underleveled-hypertrained.pk7
Binary file not shown.
Binary file added test/pk7/legal/sumo-hyper-trained.pk7
Binary file not shown.

0 comments on commit 2436ba3

Please sign in to comment.