Make type changing moves change type after abilities but before ion deluge/electrify

This commit is contained in:
Sirz Benjie 2025-04-15 12:11:19 -05:00
parent 8eeec9511b
commit cd093c908a
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
3 changed files with 33 additions and 11 deletions

View File

@ -14,7 +14,6 @@ import {
SelfStatusMove, SelfStatusMove,
VariablePowerAttr, VariablePowerAttr,
applyMoveAttrs, applyMoveAttrs,
VariableMoveTypeAttr,
RandomMovesetMoveAttr, RandomMovesetMoveAttr,
RandomMoveAttr, RandomMoveAttr,
NaturePowerAttr, NaturePowerAttr,
@ -6896,7 +6895,7 @@ export function initAbilities() {
new Ability(Abilities.STRONG_JAW, 6) new Ability(Abilities.STRONG_JAW, 6)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.BITING_MOVE), 1.5), .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.BITING_MOVE), 1.5),
new Ability(Abilities.REFRIGERATE, 6) new Ability(Abilities.REFRIGERATE, 6)
.attr(MoveTypeChangeAbAttr, PokemonType.ICE, 1.2, (user, target, move) => move.type === PokemonType.NORMAL && !move.hasAttr(VariableMoveTypeAttr)), .attr(MoveTypeChangeAbAttr, PokemonType.ICE, 1.2, (user, target, move) => move.type === PokemonType.NORMAL),
new Ability(Abilities.SWEET_VEIL, 6) new Ability(Abilities.SWEET_VEIL, 6)
.attr(UserFieldStatusEffectImmunityAbAttr, StatusEffect.SLEEP) .attr(UserFieldStatusEffectImmunityAbAttr, StatusEffect.SLEEP)
.attr(PostSummonUserFieldRemoveStatusEffectAbAttr, StatusEffect.SLEEP) .attr(PostSummonUserFieldRemoveStatusEffectAbAttr, StatusEffect.SLEEP)
@ -6920,11 +6919,11 @@ export function initAbilities() {
new Ability(Abilities.TOUGH_CLAWS, 6) new Ability(Abilities.TOUGH_CLAWS, 6)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), 1.3), .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), 1.3),
new Ability(Abilities.PIXILATE, 6) new Ability(Abilities.PIXILATE, 6)
.attr(MoveTypeChangeAbAttr, PokemonType.FAIRY, 1.2, (user, target, move) => move.type === PokemonType.NORMAL && !move.hasAttr(VariableMoveTypeAttr)), .attr(MoveTypeChangeAbAttr, PokemonType.FAIRY, 1.2, (user, target, move) => move.type === PokemonType.NORMAL),
new Ability(Abilities.GOOEY, 6) new Ability(Abilities.GOOEY, 6)
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false), .attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false),
new Ability(Abilities.AERILATE, 6) new Ability(Abilities.AERILATE, 6)
.attr(MoveTypeChangeAbAttr, PokemonType.FLYING, 1.2, (user, target, move) => move.type === PokemonType.NORMAL && !move.hasAttr(VariableMoveTypeAttr)), .attr(MoveTypeChangeAbAttr, PokemonType.FLYING, 1.2, (user, target, move) => move.type === PokemonType.NORMAL),
new Ability(Abilities.PARENTAL_BOND, 6) new Ability(Abilities.PARENTAL_BOND, 6)
.attr(AddSecondStrikeAbAttr, 0.25), .attr(AddSecondStrikeAbAttr, 0.25),
new Ability(Abilities.DARK_AURA, 6) new Ability(Abilities.DARK_AURA, 6)
@ -7001,7 +7000,7 @@ export function initAbilities() {
new Ability(Abilities.TRIAGE, 7) new Ability(Abilities.TRIAGE, 7)
.attr(ChangeMovePriorityAbAttr, (pokemon, move) => move.hasFlag(MoveFlags.TRIAGE_MOVE), 3), .attr(ChangeMovePriorityAbAttr, (pokemon, move) => move.hasFlag(MoveFlags.TRIAGE_MOVE), 3),
new Ability(Abilities.GALVANIZE, 7) new Ability(Abilities.GALVANIZE, 7)
.attr(MoveTypeChangeAbAttr, PokemonType.ELECTRIC, 1.2, (user, target, move) => move.type === PokemonType.NORMAL && !move.hasAttr(VariableMoveTypeAttr)), .attr(MoveTypeChangeAbAttr, PokemonType.ELECTRIC, 1.2, (user, target, move) => move.type === PokemonType.NORMAL),
new Ability(Abilities.SURGE_SURFER, 7) new Ability(Abilities.SURGE_SURFER, 7)
.conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), StatMultiplierAbAttr, Stat.SPD, 2), .conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), StatMultiplierAbAttr, Stat.SPD, 2),
new Ability(Abilities.SCHOOLING, 7) new Ability(Abilities.SCHOOLING, 7)

View File

@ -13,7 +13,7 @@ import {
} from "../battler-tags"; } from "../battler-tags";
import { getPokemonNameWithAffix } from "../../messages"; import { getPokemonNameWithAffix } from "../../messages";
import type { AttackMoveResult, TurnMove } from "../../field/pokemon"; import type { AttackMoveResult, TurnMove } from "../../field/pokemon";
import type Pokemon from "../../field/pokemon"; import Pokemon from "../../field/pokemon";
import { import {
EnemyPokemon, EnemyPokemon,
FieldPosition, FieldPosition,
@ -4826,7 +4826,12 @@ export class FormChangeItemTypeAttr extends VariableMoveTypeAttr {
return true; return true;
} }
return false; // Force move to have its original typing if it changed
if (moveType.value === move.type) {
return false;
}
moveType.value = move.type
return true;
} }
} }
@ -4977,7 +4982,11 @@ export class WeatherBallTypeAttr extends VariableMoveTypeAttr {
moveType.value = PokemonType.ICE; moveType.value = PokemonType.ICE;
break; break;
default: default:
return false; if (moveType.value === move.type) {
return false;
}
moveType.value = move.type;
break;
} }
return true; return true;
} }
@ -5025,7 +5034,12 @@ export class TerrainPulseTypeAttr extends VariableMoveTypeAttr {
moveType.value = PokemonType.PSYCHIC; moveType.value = PokemonType.PSYCHIC;
break; break;
default: default:
return false; if (moveType.value === move.type) {
return false;
}
// force move to have its original typing if it was changed
moveType.value = move.type;
break;
} }
return true; return true;
} }

View File

@ -9,7 +9,7 @@ import BattleInfo, {
PlayerBattleInfo, PlayerBattleInfo,
EnemyBattleInfo, EnemyBattleInfo,
} from "#app/ui/battle-info"; } from "#app/ui/battle-info";
import type Move from "#app/data/moves/move"; import Move from "#app/data/moves/move";
import { import {
HighCritAttr, HighCritAttr,
HitsTagAttr, HitsTagAttr,
@ -2583,8 +2583,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
*/ */
public getMoveType(move: Move, simulated = true): PokemonType { public getMoveType(move: Move, simulated = true): PokemonType {
const moveTypeHolder = new NumberHolder(move.type); const moveTypeHolder = new NumberHolder(move.type);
// If the user is terastallized and the move is tera blast, then the move type is the tera type
applyMoveAttrs(VariableMoveTypeAttr, this, null, move, moveTypeHolder); // Abilities that change the move type go first
applyPreAttackAbAttrs( applyPreAttackAbAttrs(
MoveTypeChangeAbAttr, MoveTypeChangeAbAttr,
this, this,
@ -2593,6 +2594,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
simulated, simulated,
moveTypeHolder, moveTypeHolder,
); );
// And then moves that change the move type go
applyMoveAttrs(VariableMoveTypeAttr, this, null, move, moveTypeHolder);
// If the user is terastallized and the move is tera blast, or tera starstorm that is stellar type,
// then bypass the check for ion deluge
if (this.isTerastallized && (move.id === Moves.TERA_BLAST || move.id === Moves.TERA_STARSTORM && moveTypeHolder.value === PokemonType.STELLAR)) {
return moveTypeHolder.value as PokemonType;
}
globalScene.arena.applyTags( globalScene.arena.applyTags(
ArenaTagType.ION_DELUGE, ArenaTagType.ION_DELUGE,