Re-apply Biome after merge

This commit is contained in:
NightKev 2025-05-21 00:13:01 -07:00
parent 43367483a7
commit 7b259f4453
4 changed files with 80 additions and 79 deletions

View File

@ -88,7 +88,7 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
const r = randSeedInt(SHINY_MAGIKARP_WEIGHT); const r = randSeedInt(SHINY_MAGIKARP_WEIGHT);
let validEventEncounters = timedEventManager const validEventEncounters = timedEventManager
.getEventEncounters() .getEventEncounters()
.filter( .filter(
s => s =>
@ -116,8 +116,7 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
// If you roll 1%, give shiny Magikarp with random variant // If you roll 1%, give shiny Magikarp with random variant
species = getPokemonSpecies(Species.MAGIKARP); species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true); pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
} } else if (
else if (
validEventEncounters.length > 0 && validEventEncounters.length > 0 &&
(r <= EVENT_THRESHOLD || isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) (r <= EVENT_THRESHOLD || isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE)
) { ) {
@ -126,7 +125,12 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
// If you roll 20%, give event encounter with 3 extra shiny rolls and its HA, if it has one // If you roll 20%, give event encounter with 3 extra shiny rolls and its HA, if it has one
const enc = randSeedItem(validEventEncounters); const enc = randSeedItem(validEventEncounters);
species = getPokemonSpecies(enc.species); species = getPokemonSpecies(enc.species);
pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex); pokemon = new PlayerPokemon(
species,
5,
species.abilityHidden === Abilities.NONE ? undefined : 2,
enc.formIndex,
);
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
@ -145,15 +149,13 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
} } else {
else {
// If there's, and this would never happen, no eligible event encounters with a hidden ability, just do Magikarp // If there's, and this would never happen, no eligible event encounters with a hidden ability, just do Magikarp
species = getPokemonSpecies(Species.MAGIKARP); species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true); pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
} }
} }
} } else {
else {
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex); pokemon = new PlayerPokemon(species, 5, 2, species.formIndex);
} }
pokemon.generateAndPopulateMoveset(); pokemon.generateAndPopulateMoveset();

View File

@ -1058,46 +1058,62 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return this.getFusionBattleSpriteId(back, ignoreOverride).replace(/\_{2}/g, "/"); return this.getFusionBattleSpriteId(back, ignoreOverride).replace(/\_{2}/g, "/");
} }
getIconAtlasKey(ignoreOverride: boolean = false, useIllusion: boolean = true): string { getIconAtlasKey(ignoreOverride = false, useIllusion = true): string {
// TODO: confirm the correct behavior here (is it intentional that the check fails if `illusion.formIndex` is `0`?) // TODO: confirm the correct behavior here (is it intentional that the check fails if `illusion.formIndex` is `0`?)
const formIndex = useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion.formIndex : this.formIndex; const formIndex =
const variant = !useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.variant : this.variant; useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion.formIndex : this.formIndex;
const variant =
!useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.variant : this.variant;
return this.getSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey( return this.getSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey(
formIndex, formIndex,
this.isBaseShiny(useIllusion), this.isBaseShiny(useIllusion),
variant variant,
); );
} }
getFusionIconAtlasKey(ignoreOverride: boolean = false, useIllusion: boolean = true): string { getFusionIconAtlasKey(ignoreOverride = false, useIllusion = true): string {
const fusionFormIndex = useIllusion && this.summonData.illusion?.fusionFormIndex ? this.summonData.illusion.fusionFormIndex : this.fusionFormIndex; const fusionFormIndex =
const fusionVariant = !useIllusion && this.summonData.illusion ? this.summonData.illusion.basePokemon.fusionVariant : this.fusionVariant; useIllusion && this.summonData.illusion?.fusionFormIndex
? this.summonData.illusion.fusionFormIndex
: this.fusionFormIndex;
const fusionVariant =
!useIllusion && this.summonData.illusion
? this.summonData.illusion.basePokemon.fusionVariant
: this.fusionVariant;
return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey( return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconAtlasKey(
fusionFormIndex, fusionFormIndex,
this.isFusionShiny(), this.isFusionShiny(),
fusionVariant fusionVariant,
); );
} }
getIconId(ignoreOverride?: boolean, useIllusion: boolean = true): string { getIconId(ignoreOverride?: boolean, useIllusion = true): string {
const formIndex = useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion?.formIndex : this.formIndex; const formIndex =
const variant = !useIllusion && !!this.summonData.illusion ? this.summonData.illusion?.basePokemon.variant : this.variant; useIllusion && this.summonData.illusion?.formIndex ? this.summonData.illusion?.formIndex : this.formIndex;
const variant =
!useIllusion && !!this.summonData.illusion ? this.summonData.illusion?.basePokemon.variant : this.variant;
return this.getSpeciesForm(ignoreOverride, useIllusion).getIconId( return this.getSpeciesForm(ignoreOverride, useIllusion).getIconId(
this.getGender(ignoreOverride, useIllusion) === Gender.FEMALE, this.getGender(ignoreOverride, useIllusion) === Gender.FEMALE,
formIndex, formIndex,
this.isBaseShiny(), this.isBaseShiny(),
variant variant,
); );
} }
getFusionIconId(ignoreOverride?: boolean, useIllusion: boolean = true): string { getFusionIconId(ignoreOverride?: boolean, useIllusion = true): string {
const fusionFormIndex = useIllusion && this.summonData.illusion?.fusionFormIndex ? this.summonData.illusion?.fusionFormIndex : this.fusionFormIndex; const fusionFormIndex =
const fusionVariant = !useIllusion && !!this.summonData.illusion ? this.summonData.illusion?.basePokemon.fusionVariant : this.fusionVariant; useIllusion && this.summonData.illusion?.fusionFormIndex
? this.summonData.illusion?.fusionFormIndex
: this.fusionFormIndex;
const fusionVariant =
!useIllusion && !!this.summonData.illusion
? this.summonData.illusion?.basePokemon.fusionVariant
: this.fusionVariant;
return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconId( return this.getFusionSpeciesForm(ignoreOverride, useIllusion).getIconId(
this.getFusionGender(ignoreOverride, useIllusion) === Gender.FEMALE, this.getFusionGender(ignoreOverride, useIllusion) === Gender.FEMALE,
fusionFormIndex, fusionFormIndex,
this.isFusionShiny(), this.isFusionShiny(),
fusionVariant fusionVariant,
); );
} }
@ -1727,7 +1743,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny); return this.shiny || (this.isFusion(useIllusion) && this.fusionShiny);
} }
isBaseShiny(useIllusion: boolean = false){ isBaseShiny(useIllusion = false) {
if (!useIllusion && this.summonData.illusion) { if (!useIllusion && this.summonData.illusion) {
return !!this.summonData.illusion.basePokemon?.shiny; return !!this.summonData.illusion.basePokemon?.shiny;
} else { } else {
@ -1735,7 +1751,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
isFusionShiny(useIllusion: boolean = false){ isFusionShiny(useIllusion = false) {
if (!useIllusion && this.summonData.illusion) { if (!useIllusion && this.summonData.illusion) {
return !!this.summonData.illusion.basePokemon?.fusionShiny; return !!this.summonData.illusion.basePokemon?.fusionShiny;
} else { } else {
@ -1902,8 +1918,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public getTypes( public getTypes(
includeTeraType = false, includeTeraType = false,
forDefend = false, forDefend = false,
ignoreOverride: boolean = false, ignoreOverride = false,
useIllusion: boolean = false useIllusion = false,
): PokemonType[] { ): PokemonType[] {
const types: PokemonType[] = []; const types: PokemonType[] = [];
@ -1918,7 +1934,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
if (!types.length || !includeTeraType) { if (!types.length || !includeTeraType) {
if ( if (
!ignoreOverride && !ignoreOverride &&
this.summonData.types && this.summonData.types &&
@ -2193,22 +2208,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.summonData.abilitySuppressed && ability.isSuppressable) { if (this.summonData.abilitySuppressed && ability.isSuppressable) {
return false; return false;
} }
const suppressAbilitiesTag = arena.getTag( const suppressAbilitiesTag = arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag;
ArenaTagType.NEUTRALIZING_GAS,
) as SuppressAbilitiesTag;
const suppressOffField = ability.hasAttr(PreSummonAbAttr); const suppressOffField = ability.hasAttr(PreSummonAbAttr);
if ( if ((this.isOnField() || suppressOffField) && suppressAbilitiesTag && !suppressAbilitiesTag.isBeingRemoved()) {
(this.isOnField() || suppressOffField) && const thisAbilitySuppressing = ability.hasAttr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr);
suppressAbilitiesTag && const hasSuppressingAbility = this.hasAbilityWithAttr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr, false);
!suppressAbilitiesTag.isBeingRemoved()
) {
const thisAbilitySuppressing = ability.hasAttr(
PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr,
);
const hasSuppressingAbility = this.hasAbilityWithAttr(
PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr,
false,
);
// Neutralizing gas is up - suppress abilities unless they are unsuppressable or this pokemon is responsible for the gas // Neutralizing gas is up - suppress abilities unless they are unsuppressable or this pokemon is responsible for the gas
// (Balance decided that the other ability of a neutralizing gas pokemon should not be neutralized) // (Balance decided that the other ability of a neutralizing gas pokemon should not be neutralized)
// If the ability itself is neutralizing gas, don't suppress it (handled through arena tag) // If the ability itself is neutralizing gas, don't suppress it (handled through arena tag)
@ -3062,7 +3066,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
weight = 50; weight = 50;
} }
// Assume level 1 moves with 80+ BP are "move reminder" moves and bump their weight. Trainers use actual relearn moves. // Assume level 1 moves with 80+ BP are "move reminder" moves and bump their weight. Trainers use actual relearn moves.
if (weight === 1 && allMoves[levelMove[1]].power >= 80 || weight === RELEARN_MOVE && this.hasTrainer()) { if ((weight === 1 && allMoves[levelMove[1]].power >= 80) || (weight === RELEARN_MOVE && this.hasTrainer())) {
weight = 40; weight = 40;
} }
if (!movePool.some(m => m[0] === levelMove[1]) && !allMoves[levelMove[1]].name.endsWith(" (N)")) { if (!movePool.some(m => m[0] === levelMove[1]) && !allMoves[levelMove[1]].name.endsWith(" (N)")) {
@ -3146,17 +3150,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
movePool = movePool.filter(m => !allMoves[m[0]].hasAttr(SacrificialAttr) && !allMoves[m[0]].hasAttr(HpSplitAttr)); movePool = movePool.filter(m => !allMoves[m[0]].hasAttr(SacrificialAttr) && !allMoves[m[0]].hasAttr(HpSplitAttr));
} }
// No one gets Memento or Final Gambit // No one gets Memento or Final Gambit
movePool = movePool.filter( movePool = movePool.filter(m => !allMoves[m[0]].hasAttr(SacrificialAttrOnHit));
m => !allMoves[m[0]].hasAttr(SacrificialAttrOnHit),
);
if (this.hasTrainer()) { if (this.hasTrainer()) {
// Trainers never get OHKO moves // Trainers never get OHKO moves
movePool = movePool.filter(m => !allMoves[m[0]].hasAttr(OneHitKOAttr)); movePool = movePool.filter(m => !allMoves[m[0]].hasAttr(OneHitKOAttr));
// Half the weight of self KO moves // Half the weight of self KO moves
movePool = movePool.map(m => [ movePool = movePool.map(m => [m[0], m[1] * (allMoves[m[0]].hasAttr(SacrificialAttr) ? 0.5 : 1)]);
m[0],
m[1] * (allMoves[m[0]].hasAttr(SacrificialAttr) ? 0.5 : 1),
]);
// Trainers get a weight bump to stat buffing moves // Trainers get a weight bump to stat buffing moves
movePool = movePool.map(m => [ movePool = movePool.map(m => [
m[0], m[0],
@ -3205,9 +3204,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
// All Pokemon force a STAB move first // All Pokemon force a STAB move first
const stabMovePool = baseWeights.filter( const stabMovePool = baseWeights.filter(
m => m => allMoves[m[0]].category !== MoveCategory.STATUS && this.isOfType(allMoves[m[0]].type),
allMoves[m[0]].category !== MoveCategory.STATUS &&
this.isOfType(allMoves[m[0]].type),
); );
if (stabMovePool.length) { if (stabMovePool.length) {
@ -3226,11 +3223,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
// Other damaging moves 2x weight if 0-1 damaging moves, 0.5x if 2, 0.125x if 3. These weights get 20x if STAB. // Other damaging moves 2x weight if 0-1 damaging moves, 0.5x if 2, 0.125x if 3. These weights get 20x if STAB.
// Status moves remain unchanged on weight, this encourages 1-2 // Status moves remain unchanged on weight, this encourages 1-2
movePool = baseWeights movePool = baseWeights
.filter(m => !this.moveset.some( .filter(
m =>
!this.moveset.some(
mo => mo =>
m[0] === mo.moveId || m[0] === mo.moveId ||
(allMoves[m[0]].hasAttr(SacrificialAttr) && mo.getMove().hasAttr(SacrificialAttr)) // Only one self-KO move allowed (allMoves[m[0]].hasAttr(SacrificialAttr) && mo.getMove().hasAttr(SacrificialAttr)), // Only one self-KO move allowed
)) ),
)
.map(m => { .map(m => {
let ret: number; let ret: number;
if ( if (
@ -3252,11 +3252,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}); });
} else { } else {
// Non-trainer pokemon just use normal weights // Non-trainer pokemon just use normal weights
movePool = baseWeights.filter(m => !this.moveset.some( movePool = baseWeights.filter(
m =>
!this.moveset.some(
mo => mo =>
m[0] === mo.moveId || m[0] === mo.moveId ||
(allMoves[m[0]].hasAttr(SacrificialAttr) && mo.getMove().hasAttr(SacrificialAttr)) // Only one self-KO move allowed (allMoves[m[0]].hasAttr(SacrificialAttr) && mo.getMove().hasAttr(SacrificialAttr)), // Only one self-KO move allowed
)); ),
);
} }
const totalWeight = movePool.reduce((v, m) => v + m[1], 0); const totalWeight = movePool.reduce((v, m) => v + m[1], 0);
let rand = randSeedInt(totalWeight); let rand = randSeedInt(totalWeight);
@ -3826,9 +3829,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* A multiplier for random damage spread in the range [0.85, 1] * A multiplier for random damage spread in the range [0.85, 1]
* This is always 1 for simulated calls. * This is always 1 for simulated calls.
*/ */
const randomMultiplier = simulated const randomMultiplier = simulated ? 1 : this.randBattleSeedIntRange(85, 100) / 100;
? 1
: this.randBattleSeedIntRange(85, 100) / 100;
/** A damage multiplier for when the attack is of the attacker's type and/or Tera type. */ /** A damage multiplier for when the attack is of the attacker's type and/or Tera type. */
const stabMultiplier = this.calculateStabMultiplier(source, move, ignoreSourceAbility, simulated); const stabMultiplier = this.calculateStabMultiplier(source, move, ignoreSourceAbility, simulated);
@ -4930,7 +4931,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.summonData = new PokemonSummonData(); this.summonData = new PokemonSummonData();
this.tempSummonData = new PokemonTempSummonData(); this.tempSummonData = new PokemonTempSummonData();
this.summonData.illusion = illusion this.summonData.illusion = illusion;
this.updateInfo(); this.updateInfo();
} }
@ -5405,9 +5406,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @returns a random integer between {@linkcode min} and {@linkcode max} inclusive * @returns a random integer between {@linkcode min} and {@linkcode max} inclusive
*/ */
randBattleSeedIntRange(min: number, max: number): number { randBattleSeedIntRange(min: number, max: number): number {
return globalScene.currentBattle return globalScene.currentBattle ? globalScene.randBattleSeedInt(max - min + 1, min) : randSeedIntRange(min, max);
? globalScene.randBattleSeedInt(max - min + 1, min)
: randSeedIntRange(min, max);
} }
/** /**