From cedc1fb3b2ed062fff30aa8896d3bcfe7cd5c59b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 28 Mar 2024 10:28:05 -0400 Subject: [PATCH] Fix the way ignore flying tag works --- src/data/pokemon-evolutions.ts | 2 +- src/field/pokemon.ts | 10 +++++----- src/modifier/modifier-type.ts | 2 +- src/phases.ts | 2 +- src/ui/summary-ui-handler.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/data/pokemon-evolutions.ts b/src/data/pokemon-evolutions.ts index 283094956..ad4285cf1 100644 --- a/src/data/pokemon-evolutions.ts +++ b/src/data/pokemon-evolutions.ts @@ -841,7 +841,7 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.GOGOAT, 32, null, null) ], [Species.PANCHAM]: [ - new SpeciesEvolution(Species.PANGORO, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.getParty().find(p => p.getTypes(false, true).indexOf(Type.DARK) > -1)), SpeciesWildEvolutionDelay.MEDIUM) + new SpeciesEvolution(Species.PANGORO, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.getParty().find(p => p.getTypes(false, false, true).indexOf(Type.DARK) > -1)), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.ESPURR]: [ new SpeciesFormEvolution(Species.MEOWSTIC, '', '', 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE)), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index ad2ca877d..0e65c4005 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -629,7 +629,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return this.getLevelMoves(1, true).map(lm => lm[1]).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i); } - getTypes(includeTeraType = false, ignoreOverride?: boolean): Type[] { + getTypes(includeTeraType = false, forDefend: boolean = false, ignoreOverride?: boolean): Type[] { const types = []; if (includeTeraType) { @@ -659,7 +659,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } } - if (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY)) { + if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY))) { const flyingIndex = types.indexOf(Type.FLYING); if (flyingIndex > -1) types.splice(flyingIndex, 1); @@ -735,13 +735,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { getAttackTypeEffectiveness(moveType: Type): TypeDamageMultiplier { if (moveType === Type.STELLAR) return this.isTerastallized() ? 2 : 1; - const types = this.getTypes(true); + const types = this.getTypes(true, true); return getTypeDamageMultiplier(moveType, types[0]) * (types.length > 1 ? getTypeDamageMultiplier(moveType, types[1]) : 1) as TypeDamageMultiplier; } getMatchupScore(pokemon: Pokemon): number { const types = this.getTypes(true); - const enemyTypes = pokemon.getTypes(true); + const enemyTypes = pokemon.getTypes(true, true); const outspeed = (this.isActive(true) ? this.getBattleStat(Stat.SPD, pokemon) : this.getStat(Stat.SPD)) <= pokemon.getBattleStat(Stat.SPD, this); let atkScore = pokemon.getAttackTypeEffectiveness(types[0]) * (outspeed ? 1.25 : 1); let defScore = 1 / Math.max(this.getAttackTypeEffectiveness(enemyTypes[0]), 0.25); @@ -1045,7 +1045,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const cancelled = new Utils.BooleanHolder(false); const typeless = !!move.getAttrs(TypelessAttr).length; - const types = this.getTypes(true); + const types = this.getTypes(true, true); const typeMultiplier = new Utils.NumberHolder(!typeless && (moveCategory !== MoveCategory.STATUS || move.getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === move.type)) ? getTypeDamageMultiplier(move.type, types[0]) * (types.length > 1 ? getTypeDamageMultiplier(move.type, types[1]) : 1) : 1); diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index acd35a44b..d466b70c0 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -776,7 +776,7 @@ export const modifierTypes = { return null; let type: Type; if (!Utils.randSeedInt(3)) { - const partyMemberTypes = party.map(p => p.getTypes(false, true)).flat(); + const partyMemberTypes = party.map(p => p.getTypes(false, false, true)).flat(); type = Utils.randSeedItem(partyMemberTypes); } else type = Utils.randSeedInt(64) ? Utils.randSeedInt(18) as Type : Type.STELLAR; diff --git a/src/phases.ts b/src/phases.ts index fe1c36caa..d6b802a0a 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2573,7 +2573,7 @@ export class WeatherEffectPhase extends CommonAnimPhase { }; this.executeForAll((pokemon: Pokemon) => { - const immune = !pokemon || !!pokemon.getTypes(true).filter(t => this.weather.isTypeDamageImmune(t)).length; + const immune = !pokemon || !!pokemon.getTypes(true, true).filter(t => this.weather.isTypeDamageImmune(t)).length; if (!immune) inflictDamage(pokemon); }); diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index a54d8e892..71babf9f9 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -533,7 +533,7 @@ export default class SummaryUiHandler extends UiHandler { return typeIcon; }; - const types = this.pokemon.getTypes(false, true); + const types = this.pokemon.getTypes(false, false, true); profileContainer.add(getTypeIcon(0, types[0])); if (types.length > 1) profileContainer.add(getTypeIcon(1, types[1]));