Skip to content

Commit

Permalink
Fix old gen moves not working on newer gens
Browse files Browse the repository at this point in the history
This commit pulls move behaviour up to be consistent with abilities and items, as was intended before.
  • Loading branch information
Glazelf committed Jun 18, 2024
1 parent 671ac8b commit 6efaa04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions commands/api/pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,15 @@ export default async (client, interaction, ephemeral) => {
// Moves
case "move":
let moveGen = genData.moves.get(moveSearch);
let moveIsAvailable = true;
if (!moveGen) {
moveGen = move;
moveIsAvailable = false;
};
let moveIsFuture = (move.gen > generation);
let moveFailString = `I could not find that move in generation ${generation}.`;
if (moveIsFuture) moveFailString += `\n\`${move.name}\` was introduced in generation ${move.gen}.`;
if (!moveExists || !moveGen) {
if (!moveExists || moveIsFuture) {
pokemonEmbed
.setTitle("Error")
.setDescription(moveFailString);
Expand All @@ -158,7 +163,7 @@ export default async (client, interaction, ephemeral) => {
let description = moveGen.desc;
if (move.flags.contact) description += " Makes contact with the target.";
if (move.flags.bypasssub) description += " Bypasses Substitute.";
if (move.isNonstandard == "Past") description += `\nThis move is not usable in generation ${generation}.`;
if (!moveIsAvailable) description += `\nThis move is not usable in generation ${generation}.`;

let type = getTypeEmotes({ type: move.type, emotes: emotesAllowed });
let category = move.category;
Expand Down

0 comments on commit 6efaa04

Please sign in to comment.