[P1] Transform and Imposter will now fail when either Pokemon is fused (#4824)
* Transform and Imposter will now fail when either Pokemon is fused * Prevent Ditto from being randomly generated as part of a fusion
This commit is contained in:
parent
b3a94e6a6b
commit
2968059814
|
@ -2463,12 +2463,15 @@ export class PostSummonCopyAllyStatsAbAttr extends PostSummonAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by Imposter
|
||||
*/
|
||||
export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
async applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): Promise<boolean> {
|
||||
async applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): Promise<boolean> {
|
||||
const targets = pokemon.getOpponents();
|
||||
if (simulated || !targets.length) {
|
||||
return simulated;
|
||||
|
@ -2477,17 +2480,31 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
|||
|
||||
let target: Pokemon;
|
||||
if (targets.length > 1) {
|
||||
pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);
|
||||
pokemon.scene.executeWithSeedOffset(() => {
|
||||
// in a double battle, if one of the opposing pokemon is fused the other one will be chosen
|
||||
// if both are fused, then Imposter will fail below
|
||||
if (targets[0].fusionSpecies) {
|
||||
target = targets[1];
|
||||
return;
|
||||
} else if (targets[1].fusionSpecies) {
|
||||
target = targets[0];
|
||||
return;
|
||||
}
|
||||
target = Utils.randSeedItem(targets);
|
||||
}, pokemon.scene.currentBattle.waveIndex);
|
||||
} else {
|
||||
target = targets[0];
|
||||
}
|
||||
|
||||
target = target!;
|
||||
|
||||
// transforming from or into fusion pokemon causes various problems (including crashes and save corruption)
|
||||
if (target.fusionSpecies || pokemon.fusionSpecies) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
||||
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
|
||||
pokemon.summonData.ability = target.getAbility().id;
|
||||
pokemon.summonData.gender = target.getGender();
|
||||
pokemon.summonData.fusionGender = target.getFusionGender();
|
||||
|
||||
// Copy all stats (except HP)
|
||||
for (const s of EFFECTIVE_STATS) {
|
||||
|
|
|
@ -6995,6 +6995,9 @@ export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by Transform
|
||||
*/
|
||||
export class TransformAttr extends MoveEffectAttr {
|
||||
async apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||
if (!super.apply(user, target, move, args)) {
|
||||
|
@ -7003,10 +7006,8 @@ export class TransformAttr extends MoveEffectAttr {
|
|||
|
||||
const promises: Promise<void>[] = [];
|
||||
user.summonData.speciesForm = target.getSpeciesForm();
|
||||
user.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
|
||||
user.summonData.ability = target.getAbility().id;
|
||||
user.summonData.gender = target.getGender();
|
||||
user.summonData.fusionGender = target.getFusionGender();
|
||||
|
||||
// Power Trick's effect will not preserved after using Transform
|
||||
user.removeTag(BattlerTagType.POWER_TRICK);
|
||||
|
@ -8077,7 +8078,8 @@ export function initMoves() {
|
|||
.ignoresVirtual(),
|
||||
new StatusMove(Moves.TRANSFORM, Type.NORMAL, -1, 10, -1, 0, 1)
|
||||
.attr(TransformAttr)
|
||||
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE))
|
||||
// transforming from or into fusion pokemon causes various problems (such as crashes)
|
||||
.condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE) && !user.fusionSpecies && !target.fusionSpecies)
|
||||
.ignoresProtect(),
|
||||
new AttackMove(Moves.BUBBLE, Type.WATER, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1)
|
||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
||||
|
|
|
@ -888,17 +888,24 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
getCompatibleFusionSpeciesFilter(): PokemonSpeciesFilter {
|
||||
const hasEvolution = pokemonEvolutions.hasOwnProperty(this.speciesId);
|
||||
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(this.speciesId);
|
||||
const pseudoLegendary = this.subLegendary;
|
||||
const subLegendary = this.subLegendary;
|
||||
const legendary = this.legendary;
|
||||
const mythical = this.mythical;
|
||||
return species => {
|
||||
return (pseudoLegendary || legendary || mythical ||
|
||||
(pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
||||
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution))
|
||||
&& species.subLegendary === pseudoLegendary
|
||||
return (
|
||||
subLegendary
|
||||
|| legendary
|
||||
|| mythical
|
||||
|| (
|
||||
pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
||||
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution
|
||||
)
|
||||
)
|
||||
&& species.subLegendary === subLegendary
|
||||
&& species.legendary === legendary
|
||||
&& species.mythical === mythical
|
||||
&& (this.isTrainerForbidden() || !species.isTrainerForbidden());
|
||||
&& (this.isTrainerForbidden() || !species.isTrainerForbidden())
|
||||
&& species.speciesId !== Species.DITTO;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2030,15 +2030,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value);
|
||||
const randAbilityIndex = Utils.randSeedInt(2);
|
||||
|
||||
const filter = !forStarter ? this.species.getCompatibleFusionSpeciesFilter()
|
||||
: species => {
|
||||
const filter = !forStarter ?
|
||||
this.species.getCompatibleFusionSpeciesFilter()
|
||||
: (species: PokemonSpecies) => {
|
||||
return pokemonEvolutions.hasOwnProperty(species.speciesId)
|
||||
&& !pokemonPrevolutions.hasOwnProperty(species.speciesId)
|
||||
&& !species.pseudoLegendary
|
||||
&& !species.legendary
|
||||
&& !species.mythical
|
||||
&& !species.isTrainerForbidden()
|
||||
&& species.speciesId !== this.species.speciesId;
|
||||
&& !pokemonPrevolutions.hasOwnProperty(species.speciesId)
|
||||
&& !species.subLegendary
|
||||
&& !species.legendary
|
||||
&& !species.mythical
|
||||
&& !species.isTrainerForbidden()
|
||||
&& species.speciesId !== this.species.speciesId
|
||||
&& species.speciesId !== Species.DITTO;
|
||||
};
|
||||
|
||||
let fusionOverride: PokemonSpecies | undefined = undefined;
|
||||
|
|
Loading…
Reference in New Issue