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 65294f408e
commit 15bdea161b
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,
VariablePowerAttr,
applyMoveAttrs,
VariableMoveTypeAttr,
RandomMovesetMoveAttr,
RandomMoveAttr,
NaturePowerAttr,
@ -6881,7 +6880,7 @@ export function initAbilities() {
new Ability(Abilities.STRONG_JAW, 6)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.BITING_MOVE), 1.5),
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)
.attr(UserFieldStatusEffectImmunityAbAttr, StatusEffect.SLEEP)
.attr(PostSummonUserFieldRemoveStatusEffectAbAttr, StatusEffect.SLEEP)
@ -6905,11 +6904,11 @@ export function initAbilities() {
new Ability(Abilities.TOUGH_CLAWS, 6)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), 1.3),
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)
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false),
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)
.attr(AddSecondStrikeAbAttr, 0.25),
new Ability(Abilities.DARK_AURA, 6)
@ -6986,7 +6985,7 @@ export function initAbilities() {
new Ability(Abilities.TRIAGE, 7)
.attr(ChangeMovePriorityAbAttr, (pokemon, move) => move.hasFlag(MoveFlags.TRIAGE_MOVE), 3),
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)
.conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), StatMultiplierAbAttr, Stat.SPD, 2),
new Ability(Abilities.SCHOOLING, 7)

View File

@ -13,7 +13,7 @@ import {
} from "../battler-tags";
import { getPokemonNameWithAffix } from "../../messages";
import type { AttackMoveResult, TurnMove } from "../../field/pokemon";
import type Pokemon from "../../field/pokemon";
import Pokemon from "../../field/pokemon";
import {
EnemyPokemon,
FieldPosition,
@ -4845,7 +4845,12 @@ export class FormChangeItemTypeAttr extends VariableMoveTypeAttr {
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;
}
}
@ -4996,7 +5001,11 @@ export class WeatherBallTypeAttr extends VariableMoveTypeAttr {
moveType.value = PokemonType.ICE;
break;
default:
return false;
if (moveType.value === move.type) {
return false;
}
moveType.value = move.type;
break;
}
return true;
}
@ -5044,7 +5053,12 @@ export class TerrainPulseTypeAttr extends VariableMoveTypeAttr {
moveType.value = PokemonType.PSYCHIC;
break;
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;
}

View File

@ -9,7 +9,7 @@ import BattleInfo, {
PlayerBattleInfo,
EnemyBattleInfo,
} from "#app/ui/battle-info";
import type Move from "#app/data/moves/move";
import Move from "#app/data/moves/move";
import {
HighCritAttr,
StatChangeBeforeDmgCalcAttr,
@ -2552,8 +2552,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
*/
public getMoveType(move: Move, simulated = true): PokemonType {
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(
MoveTypeChangeAbAttr,
this,
@ -2562,6 +2563,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
simulated,
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(
ArenaTagType.ION_DELUGE,