From 4d655ccc603e286cd6c1d28d767d56993476a791 Mon Sep 17 00:00:00 2001 From: DustinLin Date: Mon, 13 May 2024 17:07:50 -0400 Subject: [PATCH] adding comments and FaintPhase setPhaseQueueSplice bug, fixing overrides merge conflict --- src/field/pokemon.ts | 33 ++++++++++++++++++++------------- src/overrides.ts | 11 ++++++----- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index db87f44a2..211350924 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1646,28 +1646,35 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (source.isPlayer() && !this.isPlayer()) this.scene.applyModifiers(DamageMoneyRewardModifier, true, source, damage) - // case when multi hit move killed early, then queue how many hits were made before - // eg: bullet seed 1 shots, double-slap 1 shots, - // note that simply looking at this.turnData.attacksReceived doesn't work for double battles - if (this.isFainted() && source.turnData.hitsLeft > 1){ - console.log(`${this.name} fainted: they received this many hits: ${this.turnData.attacksReceived.length}`); - // off by one from decrement, test more - const hitsTotal = source.turnData.hitCount - Math.max(source.turnData.hitsLeft, 0) + 1; - this.scene.queueMessage(i18next.t('battle:attackHitsCount', { count: hitsTotal})); - } - - // not sure what this set function is accomplishing, perhaps for the faint phase? it messes up with the queueMessage() - this.scene.setPhaseQueueSplice(); // finally checks and adds Fainted scene if (this.isFainted()) { + /** + * when adding the FaintPhase, want to toggle future unshiftPhase() and queueMessage() calls + * to appear before the FaintPhase (as FaintPhase will potentially end the encounter and add Phases such as + * GameOverPhase, VictoryPhase, etc.. that will interfere with anything else that happens during this MoveEffectPhase) + * + * once the MoveEffectPhase is over (and calls it's .end() function, shiftPhase() will reset the PhaseQueueSplice via clearPhaseQueueSplice() ) + */ + this.scene.setPhaseQueueSplice(); this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), oneHitKo)); this.resetSummonData(); } + } - if (damage) + /** + * since damage is an object, I don't see how this would ever by false? + * i think the motivation was to have this here to counter setPhaseQueueSplice() + * not sure the original motivation + * + * It would be bad to run both the top if block and the one below commented out without changing the later's condition + */ + /* + if (damage){ this.scene.clearPhaseQueueSplice(); + } + */ } break; case MoveCategory.STATUS: diff --git a/src/overrides.ts b/src/overrides.ts index 704019a1d..d7975868c 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -47,12 +47,13 @@ export const POKEBALL_OVERRIDE: { active: boolean, pokeballs: PokeballCounts } = // forms can be found in pokemon-species.ts export const STARTER_FORM_OVERRIDE: integer = 0; // default 5 or 20 for Daily -export const STARTING_LEVEL_OVERRIDE: integer = 0; +export const STARTING_LEVEL_OVERRIDE: integer = 10; export const ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; -export const MOVESET_OVERRIDE: Array = []; export const SHINY_OVERRIDE: boolean = false; export const VARIANT_OVERRIDE: Variant = 0; +// eg: Moves.TACKLE +export const MOVESET_OVERRIDE: Array = [] /** * OPPONENT / ENEMY OVERRIDES @@ -60,7 +61,7 @@ export const VARIANT_OVERRIDE: Variant = 0; export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE; -export const OPP_MOVESET_OVERRIDE: Array = []; +export const OPP_MOVESET_OVERRIDE: Array = [] export const OPP_SHINY_OVERRIDE: boolean = false; export const OPP_VARIANT_OVERRIDE: Variant = 0; @@ -70,8 +71,8 @@ export const OPP_VARIANT_OVERRIDE: Variant = 0; * default is 0 to not override * @example SPECIES_OVERRIDE = Species.Bulbasaur; */ -export const STARTER_SPECIES_OVERRIDE: Species | integer = 0; -export const OPP_SPECIES_OVERRIDE: Species | integer = 0; +export const STARTER_SPECIES_OVERRIDE: Species | integer = 0 +export const OPP_SPECIES_OVERRIDE: Species | integer = 0 /** * MODIFIER / ITEM OVERRIDES