From a52b8c6b4b462d2220cb38ab84d924e55f53cd74 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 17 Mar 2024 00:12:57 -0400 Subject: [PATCH] Tweak for daily run final boss --- src/battle-scene.ts | 19 +++++++++++++------ src/data/move.ts | 2 +- src/modifier/modifier-type.ts | 12 +++++++----- src/modifier/modifier.ts | 1 - src/ui/battle-info.ts | 12 +++++++----- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 6f5765c09..f97b00247 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1690,11 +1690,11 @@ export default class BattleScene extends Phaser.Scene { return new Promise(resolve => { if (this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS) return resolve(); - const waveIndex = this.currentBattle.waveIndex; - const chances = Math.ceil(waveIndex / 10); - const isBoss = !(waveIndex % 10) || (this.currentBattle.battleType === BattleType.TRAINER && this.currentBattle.trainer.config.isBoss); - - const modifierChance = this.gameMode.getEnemyModifierChance(isBoss); + const difficultyWaveIndex = this.gameMode.getWaveForDifficulty(this.currentBattle.waveIndex); + const isFinalBoss = this.gameMode.isWaveFinal(this.currentBattle.waveIndex); + let chances = Math.ceil(difficultyWaveIndex / 10); + if (isFinalBoss) + chances = Math.ceil(chances * 2.5); const party = this.getEnemyParty(); @@ -1705,6 +1705,13 @@ export default class BattleScene extends Phaser.Scene { } party.forEach((enemyPokemon: EnemyPokemon, i: integer) => { + const isBoss = enemyPokemon.isBoss() || (this.currentBattle.battleType === BattleType.TRAINER && this.currentBattle.trainer.config.isBoss); + let upgradeChance = 32; + if (isBoss) + upgradeChance /= 2; + if (isFinalBoss) + upgradeChance /= 8; + const modifierChance = this.gameMode.getEnemyModifierChance(isBoss); let pokemonModifierChance = modifierChance; if (this.currentBattle.battleType === BattleType.TRAINER) pokemonModifierChance = Math.ceil(pokemonModifierChance * this.currentBattle.trainer.getPartyMemberModifierChanceMultiplier(i)); @@ -1715,7 +1722,7 @@ export default class BattleScene extends Phaser.Scene { } if (isBoss) count = Math.max(count, Math.floor(chances / 2)); - getEnemyModifierTypesForWave(waveIndex, count, [ enemyPokemon ], this.currentBattle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD) + getEnemyModifierTypesForWave(difficultyWaveIndex, count, [ enemyPokemon ], this.currentBattle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD, upgradeChance) .map(mt => mt.newModifier(enemyPokemon).add(this.enemyModifiers, false, this)); }); diff --git a/src/data/move.ts b/src/data/move.ts index 95bc6dce3..1b890091d 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3392,7 +3392,7 @@ export function initMoves() { new AttackMove(Moves.SHEER_COLD, "Sheer Cold", Type.ICE, MoveCategory.SPECIAL, -1, 30, 5, -1, "The target faints instantly. It's less likely to hit the target if it's used by Pokémon other than Ice types.", -1, 0, 3) .attr(OneHitKOAttr) .attr(OneHitKOAccuracyAttr), - new AttackMove(Moves.MUDDY_WATER, "Muddy Water", Type.WATER, MoveCategory.SPECIAL, 90, 85, 10, -1, "The user attacks by shooting muddy water at opposing Pokémon. This may also lower their accuracy.", 30, 0, 3) + new AttackMove(Moves.MUDDY_WATER, "Muddy Water", Type.WATER, MoveCategory.SPECIAL, 110, 85, 10, -1, "The user attacks by shooting muddy water at opposing Pokémon. This may also lower their accuracy.", 30, 0, 3) .attr(StatChangeAttr, BattleStat.ACC, -1) .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.BULLET_SEED, "Bullet Seed", Type.GRASS, MoveCategory.PHYSICAL, 25, 100, 30, 56, "The user forcefully shoots seeds at the target two to five times in a row.", -1, 0, 3) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 5e971c397..0e1bf66d4 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1304,8 +1304,8 @@ export function getEnemyBuffModifierForWave(tier: ModifierTier, enemyModifiers: return modifier; } -export function getEnemyModifierTypesForWave(waveIndex: integer, count: integer, party: EnemyPokemon[], poolType: ModifierPoolType.WILD | ModifierPoolType.TRAINER): PokemonHeldItemModifierType[] { - const ret = new Array(count).fill(0).map(() => getNewModifierTypeOption(party, poolType).type as PokemonHeldItemModifierType); +export function getEnemyModifierTypesForWave(waveIndex: integer, count: integer, party: EnemyPokemon[], poolType: ModifierPoolType.WILD | ModifierPoolType.TRAINER, upgradeChance: integer = 0): PokemonHeldItemModifierType[] { + const ret = new Array(count).fill(0).map(() => getNewModifierTypeOption(party, poolType, undefined, upgradeChance && !Utils.randSeedInt(upgradeChance) ? 1 : 0).type as PokemonHeldItemModifierType); if (!(waveIndex % 1000)) ret.push(getModifierType(modifierTypes.MINI_BLACK_HOLE) as PokemonHeldItemModifierType); return ret; @@ -1353,7 +1353,8 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, } if (tier === undefined) { const tierValue = Utils.randSeedInt(1024); - upgradeCount = 0; + if (!upgradeCount) + upgradeCount = 0; if (player && tierValue) { const partyShinyCount = party.filter(p => p.isShiny() && !p.isFainted()).length; const upgradeOdds = Math.floor(32 / ((partyShinyCount + 2) / 2)); @@ -1365,7 +1366,8 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, } while (upgraded); } tier = tierValue > 255 ? ModifierTier.COMMON : tierValue > 60 ? ModifierTier.GREAT : tierValue > 12 ? ModifierTier.ULTRA : tierValue ? ModifierTier.ROGUE : ModifierTier.MASTER; - upgradeCount = Math.min(upgradeCount, ModifierTier.MASTER - tier); + if (!upgradeCount) + upgradeCount = Math.min(upgradeCount, ModifierTier.MASTER - tier); tier += upgradeCount; while (tier && (!modifierPool.hasOwnProperty(tier) || !modifierPool[tier].length)) { tier--; @@ -1373,7 +1375,7 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, upgradeCount--; } } - + const tierThresholds = Object.keys(thresholds[tier]); const totalWeight = parseInt(tierThresholds[tierThresholds.length - 1]); const value = Utils.randSeedInt(totalWeight); diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 0652d123d..db4351afb 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1260,7 +1260,6 @@ export class ExpBoosterModifier extends PersistentModifier { } apply(args: any[]): boolean { - console.log(this.boostMultiplier); (args[0] as Utils.NumberHolder).value = Math.floor((args[0] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier))); return true; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 56e0cc6ff..218d5d2ed 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -392,6 +392,13 @@ export default class BattleInfo extends Phaser.GameObjects.Container { } const durationMultiplier = Phaser.Tweens.Builders.GetEaseFunction('Sine.easeIn')(1 - (Math.max(this.lastLevel - 100, 0) / 150)); let duration = this.visible && !instant ? (((levelExp - this.lastLevelExp) / relLevelExp) * 1650) * durationMultiplier * levelDurationMultiplier : 0; + if (ratio === 1) { + this.lastLevelExp = 0; + this.lastLevel++; + } else { + this.lastExp = pokemon.exp; + this.lastLevelExp = pokemon.levelExp; + } if (duration) (this.scene as BattleScene).playSound('exp'); this.scene.tweens.add({ @@ -405,8 +412,6 @@ export default class BattleInfo extends Phaser.GameObjects.Container { if (duration) this.scene.sound.stopByKey('exp'); if (ratio === 1) { - this.lastLevelExp = 0; - this.lastLevel++; (this.scene as BattleScene).playSound('level_up'); this.setLevel(this.lastLevel); this.scene.time.delayedCall(500 * levelDurationMultiplier, () => { @@ -414,9 +419,6 @@ export default class BattleInfo extends Phaser.GameObjects.Container { this.updateInfo(pokemon, instant).then(() => resolve()); }); return; - } else { - this.lastExp = pokemon.exp; - this.lastLevelExp = pokemon.levelExp; } resolve(); }