This commit is contained in:
Deukhoofd 2016-02-27 18:24:26 +01:00
parent 9d2b1d0c32
commit 1fc7b2ecbf
4 changed files with 54 additions and 7 deletions

View File

@ -609,7 +609,7 @@
}).call(this);
(function() {
var EventPokemon, INT_TO_GENERATION, checkMove, getGenerationFromInt, getMinimumGeneration, loopLearnsets, mustLearnMove, self, switchableFormes, unportableGenerations, unsketchableMoves, _, _ref,
var EventPokemon, INT_TO_GENERATION, checkMove, eeveelutions, getGenerationFromInt, getMinimumGeneration, loopLearnsets, mustLearnMove, self, switchableFormes, unportableGenerations, unsketchableMoves, _, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
self = (typeof module !== "undefined" && module !== null ? module.exports : void 0) || window;
@ -661,9 +661,10 @@
};
loopLearnsets = function(Generations, pokemon, forGeneration, iterator) {
var FormeData, SpeciesData, ability, finalForme, forme, formeName, generation, hasHiddenAbility, learnset, minimumGeneration, species, theFormes, thePokemon, _i, _j, _k, _len, _len1, _ref1;
var FormeData, SpeciesData, ability, finalForme, forme, formeName, generation, hasHiddenAbility, learnset, minimumGeneration, origspecies, species, theFormes, thePokemon, _i, _j, _k, _len, _len1, _ref1;
minimumGeneration = getMinimumGeneration(forGeneration);
species = pokemon.species, forme = pokemon.forme, ability = pokemon.ability;
origspecies = species;
formeName = forme || "default";
thePokemon = [];
theFormes = [formeName];
@ -719,8 +720,10 @@
return false;
};
eeveelutions = ['Vaporeon', 'Jolteon', 'Flareon', 'Espeon', 'Umbreon', 'Leafeon', 'Glaceon', 'Sylveon'];
self.learnableMoves = function(Generations, pokemon, forGeneration) {
var learnable;
var ele, index, learnable, remindex, _i, _len, _ref1;
learnable = [];
loopLearnsets(Generations, pokemon, forGeneration, function(learnset, pokemonSpecies, formeName) {
var event, events, method, moveName, moves, _i, _len, _ref1, _results;
@ -757,6 +760,17 @@
return _results;
}
});
if ((_ref1 = pokemon.species, __indexOf.call(eeveelutions, _ref1) >= 0) && forGeneration === 7) {
remindex = -1;
for (index = _i = 0, _len = learnable.length; _i < _len; index = ++_i) {
ele = learnable[index];
if (__indexOf.call(ele, "Hydro Pump") >= 0 && __indexOf.call(ele, "Flare Blitz") >= 0 && __indexOf.call(ele, "Psychic") >= 0 && pokemon.species !== 'Eevee') {
remindex = index;
}
}
learnable.splice(remindex, 1);
console.log(learnable);
}
return _.chain(learnable).flatten().sort().unique().value();
};

File diff suppressed because one or more lines are too long

View File

@ -609,7 +609,7 @@
}).call(this);
(function() {
var EventPokemon, INT_TO_GENERATION, checkMove, getGenerationFromInt, getMinimumGeneration, loopLearnsets, mustLearnMove, self, switchableFormes, unportableGenerations, unsketchableMoves, _, _ref,
var EventPokemon, INT_TO_GENERATION, checkMove, eeveelutions, getGenerationFromInt, getMinimumGeneration, loopLearnsets, mustLearnMove, self, switchableFormes, unportableGenerations, unsketchableMoves, _, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
self = (typeof module !== "undefined" && module !== null ? module.exports : void 0) || window;
@ -661,9 +661,10 @@
};
loopLearnsets = function(Generations, pokemon, forGeneration, iterator) {
var FormeData, SpeciesData, ability, finalForme, forme, formeName, generation, hasHiddenAbility, learnset, minimumGeneration, species, theFormes, thePokemon, _i, _j, _k, _len, _len1, _ref1;
var FormeData, SpeciesData, ability, finalForme, forme, formeName, generation, hasHiddenAbility, learnset, minimumGeneration, origspecies, species, theFormes, thePokemon, _i, _j, _k, _len, _len1, _ref1;
minimumGeneration = getMinimumGeneration(forGeneration);
species = pokemon.species, forme = pokemon.forme, ability = pokemon.ability;
origspecies = species;
formeName = forme || "default";
thePokemon = [];
theFormes = [formeName];
@ -719,8 +720,10 @@
return false;
};
eeveelutions = ['Vaporeon', 'Jolteon', 'Flareon', 'Espeon', 'Umbreon', 'Leafeon', 'Glaceon', 'Sylveon'];
self.learnableMoves = function(Generations, pokemon, forGeneration) {
var learnable;
var ele, index, learnable, remindex, _i, _len, _ref1;
learnable = [];
loopLearnsets(Generations, pokemon, forGeneration, function(learnset, pokemonSpecies, formeName) {
var event, events, method, moveName, moves, _i, _len, _ref1, _results;
@ -757,6 +760,17 @@
return _results;
}
});
if ((_ref1 = pokemon.species, __indexOf.call(eeveelutions, _ref1) >= 0) && forGeneration === 7) {
remindex = -1;
for (index = _i = 0, _len = learnable.length; _i < _len; index = ++_i) {
ele = learnable[index];
if (__indexOf.call(ele, "Hydro Pump") >= 0 && __indexOf.call(ele, "Flare Blitz") >= 0 && __indexOf.call(ele, "Psychic") >= 0 && pokemon.species !== 'Eevee') {
remindex = index;
}
}
learnable.splice(remindex, 1);
console.log(learnable);
}
return _.chain(learnable).flatten().sort().unique().value();
};

View File

@ -58,6 +58,7 @@ getGenerationFromInt = (generationInteger) ->
loopLearnsets = (Generations, pokemon, forGeneration, iterator) ->
minimumGeneration = getMinimumGeneration(forGeneration)
{species, forme, ability} = pokemon
origspecies = species
formeName = forme || "default"
# Find pre-evolutions and formes
thePokemon = []
@ -100,6 +101,17 @@ loopLearnsets = (Generations, pokemon, forGeneration, iterator) ->
return true if iterator(learnset, species, formeName, generation) == true
return false
eeveelutions = [
'Vaporeon'
'Jolteon'
'Flareon'
'Espeon'
'Umbreon'
'Leafeon'
'Glaceon'
'Sylveon'
]
# Returns an array of moves that this Pokemon can learn for a given generation.
self.learnableMoves = (Generations, pokemon, forGeneration) ->
learnable = []
@ -121,6 +133,13 @@ self.learnableMoves = (Generations, pokemon, forGeneration) ->
for moveName of Generations[getGenerationFromInt(forGeneration)].MoveData
if moveName not in unsketchableMoves
learnable.push(moveName)
if pokemon.species in eeveelutions and forGeneration is 7
remindex = -1
for ele, index in learnable
if "Hydro Pump" in ele and "Flare Blitz" in ele and "Psychic" in ele and pokemon.species != 'Eevee'
remindex = index
learnable.splice(remindex, 1)
console.log(learnable)
_.chain(learnable).flatten().sort().unique().value()