Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
keldaan-ag committed Apr 1, 2023
1 parent d7058c9 commit adb7262
Show file tree
Hide file tree
Showing 8 changed files with 490 additions and 478 deletions.
28 changes: 17 additions & 11 deletions app/core/simulation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-extra-semi */
import Board from "./board"
import { Schema, MapSchema, type } from "@colyseus/schema"
import { Schema, MapSchema, type, ArraySchema } from "@colyseus/schema"
import PokemonEntity from "./pokemon-entity"
import PokemonFactory from "../models/pokemon-factory"
import { Pokemon } from "../models/colyseus-models/pokemon"
Expand Down Expand Up @@ -290,7 +290,7 @@ export default class Simulation extends Schema implements ISimulation {
}

pokemon.items.forEach((item) => {
if(ItemStats[item]){
if (ItemStats[item]) {
Object.entries(ItemStats[item]).forEach(([stat, value]) =>
this.applyStat(pokemon, stat as Stat, value)
)
Expand Down Expand Up @@ -359,7 +359,9 @@ export default class Simulation extends Schema implements ISimulation {
}
})

const ironDefenseCandidates = Array.from(team.values()).filter((p) => p.effects.includes(Effect.IRON_DEFENSE))
const ironDefenseCandidates = Array.from(team.values()).filter((p) =>
p.effects.includes(Effect.IRON_DEFENSE)
)
if (ironDefenseCandidates.length > 0) {
ironDefenseCandidates.forEach((pokemon) => {
pokemon.effects.splice(
Expand Down Expand Up @@ -465,7 +467,11 @@ export default class Simulation extends Schema implements ISimulation {
})
}

applyEffects(pokemon: PokemonEntity, types: string[], allyEffects: Effect[]) {
applyEffects(
pokemon: PokemonEntity,
types: ArraySchema<Synergy>,
allyEffects: Effect[]
) {
allyEffects.forEach((effect) => {
switch (effect) {
case Effect.HONE_CLAWS:
Expand Down Expand Up @@ -1032,27 +1038,27 @@ export default class Simulation extends Schema implements ISimulation {

this.blueTeam.forEach((pkm, key) => {
this.blueDpsMeter
.get(key)
?.changeDamage(pkm.physicalDamage, pkm.specialDamage, pkm.trueDamage)
this.blueHealDpsMeter.get(key)?.changeHeal(pkm.healDone, pkm.shieldDone)
.get(key)
?.changeDamage(pkm.physicalDamage, pkm.specialDamage, pkm.trueDamage)
this.blueHealDpsMeter.get(key)?.changeHeal(pkm.healDone, pkm.shieldDone)

if (!pkm.life || pkm.life <= 0) {
this.blueTeam.delete(key)
} else {
pkm.update(dt, this.board, this.climate)
pkm.update(dt, this.board, this.climate)
}
})

this.redTeam.forEach((pkm, key) => {
this.redDpsMeter
.get(key)
?.changeDamage(pkm.physicalDamage, pkm.specialDamage, pkm.trueDamage)
.get(key)
?.changeDamage(pkm.physicalDamage, pkm.specialDamage, pkm.trueDamage)
this.redHealDpsMeter.get(key)?.changeHeal(pkm.healDone, pkm.shieldDone)

if (!pkm.life || pkm.life <= 0) {
this.redTeam.delete(key)
} else {
pkm.update(dt, this.board, this.climate)
pkm.update(dt, this.board, this.climate)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions app/models/pokemon-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ import {
OriginGiratina
} from "./colyseus-models/pokemon"
import { MapSchema } from "@colyseus/schema"
import { Emotion } from "../types"
import { Emotion, IPokemon } from "../types"
import { PokemonActionState, Rarity } from "../types/enum/Game"
import { IPokemonConfig } from "./mongo-models/user-metadata"
import PRECOMPUTED_TYPE_POKEMONS from "./precomputed/type-pokemons.json"
Expand Down Expand Up @@ -760,7 +760,7 @@ export default class PokemonFactory {
}
}

static createPokemonFromName(name: Pkm, config?: IPokemonConfig) {
static createPokemonFromName(name: Pkm, config?: IPokemonConfig): Pokemon {
const s = config && config.selectedShiny ? true : false
const e =
config && config.selectedEmotion ? config.selectedEmotion : Emotion.NORMAL
Expand Down
921 changes: 463 additions & 458 deletions app/models/precomputed/pokemons-data.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/models/precomputed/type-pokemons.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"NORMAL":{"pokemons":["cleffa","pidgey","starly","wygglytuff","eevee","togepi","whismur","slakoth","porygon","buneary","happiny"],"mythicalPokemons":["regigigas","meloetta","castform","castform-sun","castform-rain","castform-hail","tauros","farfetch-d"],"additionalPokemons":["poochyena","sandshrew","hisui-zorua","meowth","munchlax","snubull"]},"GRASS":{"pokemons":["caterpie","hoppip","seedot","chikorita","treecko","leafeon","bellsprout","bulbasaur","turtwig","lotad","budew","bounsweet","snover","oddish","snivy","rowlet"],"mythicalPokemons":["virizion","celebi","shaymin","tapu-bulu"],"additionalPokemons":["pumpkaboo","shroomish","lileep","cacnea","applin"]},"FIRE":{"pokemons":["charmander","chimchar","fennekin","cyndaquil","torchic","flareon","magby","alolan-marowak","houndour","numel","scorbunny"],"mythicalPokemons":["moltres","entei","groudon","volcarona","reshiram","victini","heatran","ho-Oh","primal-Groudon","castform-sun","blacephalon","volcanion"],"additionalPokemons":["growlithe","salandit","slugma","vulpix","ponyta"]},"WATER":{"pokemons":["squirtle","azurill","mudkip","poliwag","totodile","piplup","horsea","vaporeon","lotad","oshawott","popplio","froakie"],"mythicalPokemons":["palkia","suicune","kyogre","keldeo","manaphy","lapras","primal-Kyogre","castform-rain","relicanth","volcanion","tapu-fini"],"additionalPokemons":["omanyte","tentacool","corphish","chinchou","carvanha","kabuto","clamperl","buizel","wailmer"]},"ELECTRIC":{"pokemons":["mareep","pichu","magnemite","jolteon","shinx","elekid","electrike","alolan-geodude"],"mythicalPokemons":["zapdos","raikou","thundurus","rotom","zekrom","primal-Kyogre","regieleki","tapu-koko"],"additionalPokemons":["voltorb","chinchou","joltik"]},"FIGHTING":{"pokemons":["chimchar","poliwag","torchic","machop","bounsweet","oshawott","riolu","meditite","buneary","scorbunny"],"mythicalPokemons":["keldeo","virizion","cobalion","tyrogue","hitmonlee","hitmonchan","hitmontop"],"additionalPokemons":["shroomish","makuhita","croagunk"]},"PSYCHIC":{"pokemons":["fennekin","espeon","slowpoke","hatenna","abra","ralts","beldum","porygon","meditite","solosis","gothita"],"mythicalPokemons":["lugia","latias","latios","mesprit","azelf","uxie","mewtwo","celebi","victini","jirachi","deoxys","cresselia","tapu-lele","mew"],"additionalPokemons":["smoochum","venonat","bronzor","vulpix","mime-jr"]},"DARK":{"pokemons":["seedot","duskull","umbreon","larvitar","houndour","shuppet","gothita","froakie"],"mythicalPokemons":["darkrai","spiritomb","absol","guzzlord"],"additionalPokemons":["poochyena","alolan-grimer","corphish","zorua","carvanha","ekans","cacnea","sneasel"]},"STEEL":{"pokemons":["aron","piplup","magnemite","honedge","beldum","onix","scizor","riolu"],"mythicalPokemons":["dialga","registeel","cobalion","jirachi","heatran","genesect","stakataka","mawile"],"additionalPokemons":["pineco","shieldon","bronzor"]},"GROUND":{"pokemons":["geodude","mudkip","swinub","nidoranF","nidoranM","turtwig","trapinch","rhyhorn","gible","cubone","onix","numel"],"mythicalPokemons":["groudon","landorus","primal-Groudon"],"additionalPokemons":["sandshrew","diglett"]},"POISON":{"pokemons":["zubat","weedle","nidoranF","nidoranM","bellsprout","bulbasaur","budew","gastly","oddish"],"mythicalPokemons":["eternatus","seviper"],"additionalPokemons":["tentacool","grimer","alolan-grimer","ekans","salandit","croagunk"]},"DRAGON":{"pokemons":["charmander","horsea","vibrava","dratini","bagon","gible","goomy","swablu","dreepy"],"mythicalPokemons":["giratina","dialga","palkia","rayquaza","latias","latios","kyurem","reshiram","zekrom","mega-Rayquaza","regidrago","guzzlord","eternatus"],"additionalPokemons":["noibat","applin"]},"FIELD":{"pokemons":["squirtle","mareep","swinub","cyndaquil","nidoranF","nidoranM","eevee","vaporeon","jolteon","flareon","espeon","umbreon","leafeon","sylveon","glaceon","shinx","slakoth","numel","electrike","snivy"],"mythicalPokemons":["raikou","entei","absol","tauros","mew"],"additionalPokemons":["poochyena","growlithe","zorua","meowth","ponyta","snubull","buizel"]},"MONSTER":{"pokemons":["aron","totodile","treecko","rhyhorn","bagon","larvitar","gible","goomy","oshawott","gastly"],"mythicalPokemons":["regigigas","tornadus","mewtwo","seviper","mawile"],"additionalPokemons":["grimer","cranidos","makuhita","sneasel"]},"HUMAN":{"pokemons":["fennekin","machop","abra","magby","ralts","meditite","happiny","scorbunny"],"mythicalPokemons":["regice","regirock","registeel","regigigas","tornadus","deoxys","regieleki","regidrago","tyrogue","hitmonlee","hitmonchan","hitmontop"],"additionalPokemons":["munchlax"]},"AQUATIC":{"pokemons":["totodile","spheal","vaporeon","slowpoke","dratini","goomy"],"mythicalPokemons":["lugia","kyogre","primal-Kyogre","volcanion"],"additionalPokemons":["anorith","seel","croagunk","clamperl","buizel"]},"BUG":{"pokemons":["caterpie","weedle","trapinch","scyther","nincada"],"mythicalPokemons":["volcarona","manaphy","genesect"],"additionalPokemons":["anorith","venonat","pineco","joltik","snom"]},"FLYING":{"pokemons":["zubat","butterfree","beedrill","pidgey","hoppip","starly","torchic","piplup","togetic","dratini","salamence","scyther","nincada","rowlet"],"mythicalPokemons":["lugia","zapdos","moltres","articuno","rayquaza","landorus","thundurus","tornadus","ho-Oh","aerodactyl","mega-Rayquaza","chatot","farfetch-d"],"additionalPokemons":["noibat","venonat","archen","drifloon"]},"FLORA":{"pokemons":["hoppip","chikorita","leafeon","bellsprout","flabebe","bulbasaur","turtwig","roselia"],"mythicalPokemons":["shaymin"],"additionalPokemons":["lileep"]},"ROCK":{"pokemons":["geodude","aron","rhyhorn","larvitar","cubone","onix","alolan-geodude"],"mythicalPokemons":["regirock","aerodactyl","relicanth","stakataka"],"additionalPokemons":["diglett","archen","slugma","carbink"]},"GHOST":{"pokemons":["duskull","honedge","snorunt","alolan-marowak","gastly","shuppet","shedninja","dreepy","rowlet"],"mythicalPokemons":["giratina","darkrai","rotom","spiritomb","blacephalon","mimikyu"],"additionalPokemons":["pumpkaboo","hisui-zorua","drifloon"]},"FAIRY":{"pokemons":["azurill","cleffa","pichu","igglybuff","sylveon","flabebe","hatenna","togepi","vanillite","ralts","swablu","popplio"],"mythicalPokemons":["mesprit","azelf","uxie","cresselia","tapu-koko","tapu-lele","mawile","tapu-fini","tapu-bulu","mimikyu"],"additionalPokemons":["alolan-vulpix","mime-jr","snubull","carbink"]},"ICE":{"pokemons":["swinub","spheal","glaceon","vanillite","snorunt","snover"],"mythicalPokemons":["articuno","suicune","regice","lapras","kyurem","castform-hail"],"additionalPokemons":["smoochum","seel","alolan-vulpix","snom","amaura","sneasel"]},"FOSSIL":{"pokemons":[],"mythicalPokemons":["aerodactyl","relicanth"],"additionalPokemons":["anorith","omanyte","cranidos","archen","shieldon","lileep","kabuto","amaura","clamperl","carbink"]},"SOUND":{"pokemons":["zubat","igglybuff","sylveon","flabebe","whismur","swablu","popplio"],"mythicalPokemons":["meloetta","chatot"],"additionalPokemons":["noibat","wailmer"]},"ARTIFICIAL":{"pokemons":["vanillite","honedge","beldum","elekid","porygon"],"mythicalPokemons":["mewtwo","deoxys","castform","castform-sun","castform-rain","castform-hail","genesect"],"additionalPokemons":["voltorb"]},"BABY":{"pokemons":["azurill","cleffa","pichu","igglybuff","togepi","magby","elekid","budew","riolu","happiny"],"mythicalPokemons":[],"additionalPokemons":["smoochum","mime-jr","munchlax"]}}
{"NORMAL":{"pokemons":["cleffa","pidgey","starly","wygglytuff","eevee","togepi","whismur","slakoth","porygon","buneary","happiny"],"mythicalPokemons":["regigigas","meloetta","castform","castform-sun","castform-rain","castform-hail","tauros","farfetch-d"],"additionalPokemons":["poochyena","sandshrew","hisui-zorua","meowth","munchlax","snubull"]},"GRASS":{"pokemons":["caterpie","hoppip","seedot","chikorita","treecko","leafeon","bellsprout","bulbasaur","turtwig","lotad","budew","bounsweet","snover","oddish","snivy","rowlet"],"mythicalPokemons":["virizion","celebi","shaymin","tapu-bulu"],"additionalPokemons":["pumpkaboo","shroomish","lileep","cacnea","applin"]},"FIRE":{"pokemons":["charmander","chimchar","fennekin","cyndaquil","torchic","flareon","magby","alolan-marowak","houndour","numel","scorbunny"],"mythicalPokemons":["moltres","entei","groudon","volcarona","reshiram","victini","heatran","ho-Oh","primal-Groudon","castform-sun","blacephalon","volcanion"],"additionalPokemons":["growlithe","salandit","slugma","vulpix","ponyta"]},"WATER":{"pokemons":["squirtle","azurill","mudkip","poliwag","totodile","piplup","horsea","vaporeon","lotad","oshawott","popplio","froakie"],"mythicalPokemons":["palkia","suicune","kyogre","keldeo","manaphy","lapras","primal-Kyogre","castform-rain","relicanth","volcanion","tapu-fini"],"additionalPokemons":["omanyte","tentacool","corphish","chinchou","carvanha","kabuto","clamperl","buizel","wailmer"]},"ELECTRIC":{"pokemons":["mareep","pichu","magnemite","jolteon","shinx","elekid","electrike","alolan-geodude"],"mythicalPokemons":["zapdos","raikou","thundurus","rotom","zekrom","primal-Kyogre","regieleki","tapu-koko"],"additionalPokemons":["voltorb","chinchou","joltik"]},"FIGHTING":{"pokemons":["chimchar","poliwag","torchic","machop","bounsweet","oshawott","riolu","meditite","buneary","scorbunny"],"mythicalPokemons":["keldeo","virizion","cobalion","tyrogue","hitmonlee","hitmonchan","hitmontop"],"additionalPokemons":["shroomish","makuhita","croagunk"]},"PSYCHIC":{"pokemons":["fennekin","espeon","slowpoke","hatenna","abra","ralts","beldum","porygon","meditite","solosis","gothita"],"mythicalPokemons":["lugia","latias","latios","mesprit","azelf","uxie","mewtwo","celebi","victini","jirachi","deoxys","cresselia","tapu-lele","mew"],"additionalPokemons":["smoochum","venonat","bronzor","vulpix","mime-jr"]},"DARK":{"pokemons":["seedot","duskull","umbreon","larvitar","houndour","shuppet","gothita","froakie"],"mythicalPokemons":["darkrai","spiritomb","absol","guzzlord"],"additionalPokemons":["poochyena","alolan-grimer","corphish","zorua","carvanha","ekans","cacnea","sneasel"]},"STEEL":{"pokemons":["aron","piplup","magnemite","honedge","beldum","onix","scizor","riolu"],"mythicalPokemons":["dialga","registeel","cobalion","jirachi","heatran","genesect","stakataka","mawile"],"additionalPokemons":["pineco","shieldon","bronzor"]},"GROUND":{"pokemons":["geodude","mudkip","swinub","nidoranF","nidoranM","turtwig","trapinch","rhyhorn","gible","cubone","onix","numel"],"mythicalPokemons":["groudon","landorus","primal-Groudon"],"additionalPokemons":["sandshrew","diglett"]},"POISON":{"pokemons":["zubat","weedle","nidoranF","nidoranM","bellsprout","bulbasaur","budew","gastly","oddish"],"mythicalPokemons":["eternatus","seviper"],"additionalPokemons":["tentacool","grimer","alolan-grimer","ekans","salandit","croagunk"]},"DRAGON":{"pokemons":["charmander","horsea","vibrava","dratini","bagon","gible","goomy","swablu","dreepy"],"mythicalPokemons":["giratina","dialga","palkia","rayquaza","latias","latios","kyurem","reshiram","zekrom","mega-Rayquaza","regidrago","guzzlord","eternatus","origin-giratina"],"additionalPokemons":["noibat","applin"]},"FIELD":{"pokemons":["squirtle","mareep","swinub","cyndaquil","nidoranF","nidoranM","eevee","vaporeon","jolteon","flareon","espeon","umbreon","leafeon","sylveon","glaceon","shinx","slakoth","numel","electrike","snivy"],"mythicalPokemons":["raikou","entei","absol","tauros","mew"],"additionalPokemons":["poochyena","growlithe","zorua","meowth","ponyta","snubull","buizel"]},"MONSTER":{"pokemons":["aron","totodile","treecko","rhyhorn","bagon","larvitar","gible","goomy","oshawott","gastly"],"mythicalPokemons":["regigigas","tornadus","mewtwo","seviper","mawile"],"additionalPokemons":["grimer","cranidos","makuhita","sneasel"]},"HUMAN":{"pokemons":["fennekin","machop","abra","magby","ralts","meditite","happiny","scorbunny"],"mythicalPokemons":["regice","regirock","registeel","regigigas","tornadus","deoxys","regieleki","regidrago","tyrogue","hitmonlee","hitmonchan","hitmontop"],"additionalPokemons":["munchlax"]},"AQUATIC":{"pokemons":["totodile","spheal","vaporeon","slowpoke","dratini","goomy"],"mythicalPokemons":["lugia","kyogre","primal-Kyogre","volcanion"],"additionalPokemons":["anorith","seel","croagunk","clamperl","buizel"]},"BUG":{"pokemons":["caterpie","weedle","trapinch","scyther","nincada"],"mythicalPokemons":["volcarona","manaphy","genesect"],"additionalPokemons":["anorith","venonat","pineco","joltik","snom"]},"FLYING":{"pokemons":["zubat","butterfree","beedrill","pidgey","hoppip","starly","torchic","piplup","togetic","dratini","salamence","scyther","nincada","rowlet"],"mythicalPokemons":["lugia","zapdos","moltres","articuno","rayquaza","landorus","thundurus","tornadus","ho-Oh","aerodactyl","mega-Rayquaza","chatot","farfetch-d"],"additionalPokemons":["noibat","venonat","archen","drifloon"]},"FLORA":{"pokemons":["hoppip","chikorita","leafeon","bellsprout","flabebe","bulbasaur","turtwig","roselia"],"mythicalPokemons":["shaymin"],"additionalPokemons":["lileep"]},"ROCK":{"pokemons":["geodude","aron","rhyhorn","larvitar","cubone","onix","alolan-geodude"],"mythicalPokemons":["regirock","aerodactyl","relicanth","stakataka"],"additionalPokemons":["diglett","archen","slugma","carbink"]},"GHOST":{"pokemons":["duskull","honedge","snorunt","alolan-marowak","gastly","shuppet","shedninja","dreepy","rowlet"],"mythicalPokemons":["giratina","darkrai","rotom","spiritomb","blacephalon","mimikyu","origin-giratina"],"additionalPokemons":["pumpkaboo","hisui-zorua","drifloon"]},"FAIRY":{"pokemons":["azurill","cleffa","pichu","igglybuff","sylveon","flabebe","hatenna","togepi","vanillite","ralts","swablu","popplio"],"mythicalPokemons":["mesprit","azelf","uxie","cresselia","tapu-koko","tapu-lele","mawile","tapu-fini","tapu-bulu","mimikyu"],"additionalPokemons":["alolan-vulpix","mime-jr","snubull","carbink"]},"ICE":{"pokemons":["swinub","spheal","glaceon","vanillite","snorunt","snover"],"mythicalPokemons":["articuno","suicune","regice","lapras","kyurem","castform-hail"],"additionalPokemons":["smoochum","seel","alolan-vulpix","snom","amaura","sneasel"]},"FOSSIL":{"pokemons":[],"mythicalPokemons":["aerodactyl","relicanth"],"additionalPokemons":["anorith","omanyte","cranidos","archen","shieldon","lileep","kabuto","amaura","clamperl","carbink"]},"SOUND":{"pokemons":["zubat","igglybuff","sylveon","flabebe","whismur","swablu","popplio"],"mythicalPokemons":["meloetta","chatot"],"additionalPokemons":["noibat","wailmer"]},"ARTIFICIAL":{"pokemons":["vanillite","honedge","beldum","elekid","porygon"],"mythicalPokemons":["mewtwo","deoxys","castform","castform-sun","castform-rain","castform-hail","genesect"],"additionalPokemons":["voltorb"]},"BABY":{"pokemons":["azurill","cleffa","pichu","igglybuff","togepi","magby","elekid","budew","riolu","happiny"],"mythicalPokemons":[],"additionalPokemons":["smoochum","mime-jr","munchlax"]}}
3 changes: 2 additions & 1 deletion app/models/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Rarity } from "../types/enum/Game"
import { pickRandomIn, shuffleArray } from "../utils/random"
import { clamp } from "../utils/number"
import { removeInArray } from "../utils/array"
import { Pokemon } from "./colyseus-models/pokemon"

export const PoolSize: { [key in Rarity]: [number, number, number] } = {
[Rarity.COMMON]: [1, 14, 29],
Expand Down Expand Up @@ -369,7 +370,7 @@ export default class Shop {
let threshold = 0
const finals = new Array<Pkm>()

player.board.forEach((pokemon: IPokemon) => {
player.board.forEach((pokemon: Pokemon) => {
if (pokemon.final) {
finals.push(PkmFamily[pokemon.name])
}
Expand Down
Loading

0 comments on commit adb7262

Please sign in to comment.