diff --git a/src/data/exp.ts b/src/data/exp.ts index 9c8dccf04..06c70d414 100644 --- a/src/data/exp.ts +++ b/src/data/exp.ts @@ -16,24 +16,34 @@ const expLevels = [ [ 0, 4, 13, 32, 65, 112, 178, 276, 393, 540, 745, 967, 1230, 1591, 1957, 2457, 3046, 3732, 4526, 5440, 6482, 7666, 9003, 10506, 12187, 14060, 16140, 18439, 20974, 23760, 26811, 30146, 33780, 37731, 42017, 46656, 50653, 55969, 60505, 66560, 71677, 78533, 84277, 91998, 98415, 107069, 114205, 123863, 131766, 142500, 151222, 163105, 172697, 185807, 196322, 210739, 222231, 238036, 250562, 267840, 281456, 300293, 315059, 335544, 351520, 373744, 390991, 415050, 433631, 459620, 479600, 507617, 529063, 559209, 582187, 614566, 639146, 673863, 700115, 737280, 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000 ] ]; -export function getLevelTotalExp(level: integer, growthRate: GrowthRate): number { +export function getLevelTotalExp(level: integer, growthRate: GrowthRate): integer { if (level < 100) return expLevels[growthRate][level - 1]; + let ret: integer; + switch (growthRate) { case GrowthRate.ERRATIC: - return (Math.pow(level, 4) + (Math.pow(level, 3) * 2000)) / 3500; + ret = (Math.pow(level, 4) + (Math.pow(level, 3) * 2000)) / 3500; + break; case GrowthRate.FAST: - return Math.pow(level, 3) * 4 / 5; + ret = Math.pow(level, 3) * 4 / 5; + break; case GrowthRate.MEDIUM_FAST: - return Math.pow(level, 3); + ret = Math.pow(level, 3); + break; case GrowthRate.MEDIUM_SLOW: - return (Math.pow(level, 3) * 6 / 5) - (15 * Math.pow(level, 2)) + (100 * level) - 140; + ret = (Math.pow(level, 3) * 6 / 5) - (15 * Math.pow(level, 2)) + (100 * level) - 140; + break; case GrowthRate.SLOW: - return Math.pow(level, 3) * 5 / 4; + ret = Math.pow(level, 3) * 5 / 4; + break; case GrowthRate.FLUCTUATING: - return (Math.pow(level, 3) + ((level / 2) + 32)) * 4 / (100 + level); + ret = (Math.pow(level, 3) + ((level / 2) + 32)) * 4 / (100 + level); + break; } + + return Math.floor(ret); }; export function getLevelRelExp(level: integer, growthRate: GrowthRate): number { diff --git a/src/data/move.ts b/src/data/move.ts index 351396ab4..dc67c19c6 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2158,7 +2158,9 @@ export function getMoveTargets(user: Pokemon, move: Moves): MoveTargetSet { set = [ opponents[Utils.randInt(opponents.length)].getBattlerIndex() ]; break; case MoveTarget.ATTACKER: - set = [ user.scene.getPokemonById(user.turnData.attacksReceived[0].sourceId).getBattlerIndex() ]; + set = user.turnData.attacksReceived.length + ? [ user.scene.getPokemonById(user.turnData.attacksReceived[0].sourceId).getBattlerIndex() ] + : []; break; case MoveTarget.NEAR_ALLY: case MoveTarget.ALLY: @@ -3278,7 +3280,7 @@ export function initMoves() { new AttackMove(Moves.CIRCLE_THROW, "Circle Throw (N)", Type.FIGHTING, MoveCategory.PHYSICAL, 60, 90, 10, -1, "In battles, the opponent switches. In the wild, the Pokémon runs.", -1, -6, 5), new AttackMove(Moves.INCINERATE, "Incinerate (N)", Type.FIRE, MoveCategory.SPECIAL, 60, 100, 15, -1, "Destroys the target's held berry.", -1, 0, 5) .target(MoveTarget.ALL_NEAR_ENEMIES), - new StatusMove(Moves.QUASH, "Quash", Type.DARK, 100, 15, -1, "Makes the target act last this turn.", -1, 0, 5), + new StatusMove(Moves.QUASH, "Quash (N)", Type.DARK, 100, 15, -1, "Makes the target act last this turn.", -1, 0, 5), new AttackMove(Moves.ACROBATICS, "Acrobatics (N)", Type.FLYING, MoveCategory.PHYSICAL, 55, 100, 15, 14, "Stronger when the user does not have a held item.", -1, 0, 5) .target(MoveTarget.OTHER), new StatusMove(Moves.REFLECT_TYPE, "Reflect Type", Type.NORMAL, -1, 15, -1, "User becomes the target's type.", -1, 0, 5) diff --git a/src/pokemon.ts b/src/pokemon.ts index 4032ac844..bc6b99db0 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -1212,6 +1212,9 @@ export class EnemyPokemon extends Pokemon { // TODO: Add some randomness + if (!sortedBenefitScores.length) + return []; + return [ sortedBenefitScores[0][0] ]; }