Cleaned up GROUNDED code

This commit is contained in:
Ishan Patel 2024-04-15 19:10:57 -04:00
parent 080081a8fb
commit fa844952f4

View File

@ -28,7 +28,7 @@ import { Biome } from "../data/enums/biome";
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from '../data/ability';
import { Abilities } from "#app/data/enums/abilities";
import PokemonData from '../system/pokemon-data';
import { BattlerIndex } from '../battle';
import Battle, { BattlerIndex } from '../battle';
import { BattleSpec } from "../enums/battle-spec";
import { Mode } from '../ui/ui';
import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler';
@ -692,13 +692,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
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);
}
if (forDefend && (this.getTag(BattlerTagType.GROUNDED) || this.scene.arena.getTag(ArenaTagType.GRAVITY))) {
if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY) || this.getTag(BattlerTagType.GROUNDED))) {
const flyingIndex = types.indexOf(Type.FLYING);
if (flyingIndex > -1)
types.splice(flyingIndex, 1);