-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More botcoins #68
Merged
Merged
More botcoins #68
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c081fd2
2 new questions
RedzepR 66c815e
Two more bandages for missing image problem
RedzepR cfc6e6b
Disallow Arceus/Silvally but allow normal form of them
RedzepR 8faf4cc
lower weight because whoops
RedzepR 8d88b52
clarification
RedzepR 5f45dd1
Merge branch 'v14' into MoreBotcoins
RedzepR File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ const evolutionsNormalized = (evolution) => evolution.replace(/\W|_/g, '.?').rep | |
const pokemonNameAnswer = (name) => new RegExp(`^\\W*${pokemonNameNormalized(name)}\\b`, 'i'); | ||
const berryList = Object.keys(berryType).filter(b => isNaN(b) && b != 'None'); | ||
|
||
const regionListWithoutFinalAndNone = enumStrings(GameConstants.Region).filter(t => t != 'final' && t != 'none'); | ||
const pokemonListWithEvolution = pokemonList.filter(p => p.evolutions && p.evolutions.length); | ||
const badgeList = Object.keys(BadgeEnums).filter(b => isNaN(b) && !b.startsWith('Elite')); | ||
const gymsWithBadges = Object.keys(GymList).filter(t => badgeList.includes(BadgeEnums[GymList[t].badgeReward])); | ||
|
@@ -510,6 +511,7 @@ const fossilPokemon = () => { | |
const shiny = isShiny(); | ||
|
||
const description = ['What Pokémon comes from this fossil?']; | ||
description.push(`||${fossil}||`); | ||
description.push(`**+${amount} ${serverIcons.money}**`); | ||
|
||
// If shiny award more coins | ||
|
@@ -550,6 +552,7 @@ const pokemonFossil = () => { | |
const shiny = isShiny(); | ||
|
||
const description = ['What fossil does this Pokémon come from?']; | ||
description.push(`||${pokemonName}||`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
description.push(`**+${amount} ${serverIcons.money}**`); | ||
|
||
// If shiny award more coins | ||
|
@@ -882,6 +885,98 @@ const gymLeaderType = () => { | |
}; | ||
}; | ||
|
||
const typeRegionPokemon = () => { | ||
const randomRegionIndex = Math.floor(Math.random() * regionListWithoutFinalAndNone.length); | ||
const selectedRegion = regionListWithoutFinalAndNone[randomRegionIndex].replace(/^[a-z]/, match => match.toUpperCase()); | ||
const pokemonInRegion = pokemonList.filter(pokemon => pokemon.nativeRegion === randomRegionIndex); | ||
const randomTypeIndex = randomFromArray(randomFromArray(pokemonInRegion).type); | ||
const selectedType = enumStrings(PokemonType).filter(type => type !== 'None')[randomTypeIndex]; | ||
const eligiblePokemon = pokemonList.filter(pokemon => | ||
pokemon.type.includes(randomTypeIndex) && | ||
pokemon.nativeRegion === randomRegionIndex && | ||
(!pokemon.name.includes('Arceus') || pokemon.name == 'Arceus (Normal)') && | ||
(!pokemon.name.includes('Silvally') || pokemon.name == 'Silvally (Normal)') | ||
); | ||
const answer = new RegExp(`^\\W*(${eligiblePokemon.map(p => pokemonNameNormalized(p.name)).join('|')})\\b`, 'i'); | ||
|
||
let amount = getAmount(); | ||
|
||
const description = [`Name a ${pokemonTypeIcons[selectedType]} ${selectedType} Type Pokémon from ${selectedRegion}`]; | ||
description.push(`**+${amount} ${serverIcons.money}**`); | ||
const shiny = isShiny(); | ||
|
||
|
||
// If shiny award more coins | ||
if (shiny) { | ||
const shiny_amount = getShinyAmount(); | ||
description.push(`**+${shiny_amount}** ✨ *(shiny)*`); | ||
amount += shiny_amount; | ||
} | ||
|
||
const pokemonData = randomFromArray(eligiblePokemon); | ||
const female = isFemale(pokemonData); | ||
const pokemonImage = `${website}assets/images/${shiny ? 'shiny' : ''}pokemon/${pokemonData.id}${female ? '-f' : ''}.png`; | ||
|
||
const eligibleNames = eligiblePokemon.map(p => p.name); | ||
|
||
const embed = new EmbedBuilder() | ||
.setTitle('Name a Pokémon!') | ||
.setDescription(description.join('\n')) | ||
.setColor('#7b21a9'); | ||
|
||
return { | ||
embed, | ||
answer, | ||
amount, | ||
shiny, | ||
end: defaultEndFunction('The Pokémon are', pokemonImage, `${eligibleNames.splice(0, 10).join('\n')}${eligibleNames.length ? '\nand more..' : '!'}`), | ||
}; | ||
}; | ||
|
||
|
||
const dualTypePokemon = () => { | ||
const selectedPokemon = randomFromArray(pokemonList.filter(p => p.type.length > 1)); | ||
|
||
const types = selectedPokemon.type.map(t => enumStrings(PokemonType).filter(type => type !== 'None')[t]); | ||
const eligiblePokemon = pokemonList.filter(pokemon => | ||
pokemon.type.every(t => selectedPokemon.type.includes(t)) && pokemon.type.length == selectedPokemon.type.length); | ||
|
||
const answer = new RegExp(`^\\W*(${eligiblePokemon.map(p => pokemonNameNormalized(p.name)).join('|')})\\b`, 'i'); | ||
|
||
let amount = getAmount(); | ||
|
||
const description = [`Name a Pokémon that is both ${pokemonTypeIcons[types[0]]} ${types[0]} Type & ${pokemonTypeIcons[types[1]]} ${types[1]} Type`]; | ||
description.push(`**+${amount} ${serverIcons.money}**`); | ||
const shiny = isShiny(); | ||
|
||
|
||
// If shiny award more coins | ||
if (shiny) { | ||
const shiny_amount = getShinyAmount(); | ||
description.push(`**+${shiny_amount}** ✨ *(shiny)*`); | ||
amount += shiny_amount; | ||
} | ||
|
||
const pokemonData = randomFromArray(eligiblePokemon); | ||
const female = isFemale(pokemonData); | ||
const pokemonImage = `${website}assets/images/${shiny ? 'shiny' : ''}pokemon/${pokemonData.id}${female ? '-f' : ''}.png`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot about this, now I need to check if we have it on the other images 🤔 |
||
|
||
const eligibleNames = eligiblePokemon.map(p => p.name); | ||
|
||
const embed = new EmbedBuilder() | ||
.setTitle('Name a Dual Type Pokémon!') | ||
.setDescription(description.join('\n')) | ||
.setColor('#b8791d'); | ||
|
||
return { | ||
embed, | ||
answer, | ||
amount, | ||
shiny, | ||
end: defaultEndFunction('The Pokémon are', pokemonImage, `${eligibleNames.splice(0, 10).join('\n')}${eligibleNames.length ? '\nand more..' : '!'}`), | ||
}; | ||
}; | ||
|
||
class WeightedOption { | ||
constructor(option, weight) { | ||
this.option = option; | ||
|
@@ -906,6 +1001,8 @@ const quizTypes = [ | |
new WeightedOption(whosThePokemonEvolution, 80), | ||
new WeightedOption(whosThePokemonPrevolution, 80), | ||
new WeightedOption(pokemonRegion, 45), | ||
new WeightedOption(typeRegionPokemon, 45), | ||
new WeightedOption(dualTypePokemon, 60), | ||
new WeightedOption(pokemonID, 60), | ||
new WeightedOption(fossilPokemon, 5), | ||
new WeightedOption(pokemonFossil, 5), | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️