[Hotfix] Fix Gimmighoul evolution (#4473)
* Fix Gimmighoul evolution * Fix counter * Stack text fix * Fix Treasure tracker not saving * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
a69da4bc06
commit
7bb49a3199
|
@ -11,6 +11,7 @@ import { Biome } from "#enums/biome";
|
|||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
import { DamageMoneyRewardModifier, ExtraModifierModifier, MoneyMultiplierModifier } from "#app/modifier/modifier";
|
||||
|
||||
export enum SpeciesWildEvolutionDelay {
|
||||
NONE,
|
||||
|
@ -1647,8 +1648,14 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
|||
new SpeciesEvolution(Species.FROSMOTH, 1, null, new SpeciesFriendshipEvolutionCondition(90, p => p.scene.arena.getTimeOfDay() === TimeOfDay.DUSK || p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.MEDIUM)
|
||||
],
|
||||
[Species.GIMMIGHOUL]: [
|
||||
new SpeciesFormEvolution(Species.GHOLDENGO, "chest", "", 1, null, new SpeciesEvolutionCondition( p => p.evoCounter > 9 ), SpeciesWildEvolutionDelay.VERY_LONG),
|
||||
new SpeciesFormEvolution(Species.GHOLDENGO, "roaming", "", 1, null, new SpeciesEvolutionCondition( p => p.evoCounter > 9 ), SpeciesWildEvolutionDelay.VERY_LONG)
|
||||
new SpeciesFormEvolution(Species.GHOLDENGO, "chest", "", 1, null, new SpeciesEvolutionCondition(p => p.evoCounter
|
||||
+ p.getHeldItems().filter(m => m instanceof DamageMoneyRewardModifier).length
|
||||
+ p.scene.findModifiers(m => m instanceof MoneyMultiplierModifier
|
||||
|| m instanceof ExtraModifierModifier).length > 9), SpeciesWildEvolutionDelay.VERY_LONG),
|
||||
new SpeciesFormEvolution(Species.GHOLDENGO, "roaming", "", 1, null, new SpeciesEvolutionCondition(p => p.evoCounter
|
||||
+ p.getHeldItems().filter(m => m instanceof DamageMoneyRewardModifier).length
|
||||
+ p.scene.findModifiers(m => m instanceof MoneyMultiplierModifier
|
||||
|| m instanceof ExtraModifierModifier).length > 9), SpeciesWildEvolutionDelay.VERY_LONG)
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -1387,7 +1387,8 @@ export const modifierTypes = {
|
|||
FORM_CHANGE_ITEM: () => new FormChangeItemModifierTypeGenerator(false),
|
||||
RARE_FORM_CHANGE_ITEM: () => new FormChangeItemModifierTypeGenerator(true),
|
||||
|
||||
EVOLUTION_TRACKER_GIMMIGHOUL: () => new PokemonHeldItemModifierType("modifierType:ModifierType.EVOLUTION_TRACKER_GIMMIGHOUL", "relic_gold", (type, _args) => new Modifiers.EvoTrackerModifier(type, (_args[0] as Pokemon).id, Species.GIMMIGHOUL, 10)),
|
||||
EVOLUTION_TRACKER_GIMMIGHOUL: () => new PokemonHeldItemModifierType("modifierType:ModifierType.EVOLUTION_TRACKER_GIMMIGHOUL", "relic_gold",
|
||||
(type, args) => new Modifiers.EvoTrackerModifier(type, (args[0] as Pokemon).id, Species.GIMMIGHOUL, 10)),
|
||||
|
||||
MEGA_BRACELET: () => new ModifierType("modifierType:ModifierType.MEGA_BRACELET", "mega_bracelet", (type, _args) => new Modifiers.MegaEvolutionAccessModifier(type)),
|
||||
DYNAMAX_BAND: () => new ModifierType("modifierType:ModifierType.DYNAMAX_BAND", "dynamax_band", (type, _args) => new Modifiers.GigantamaxAccessModifier(type)),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as ModifierTypes from "./modifier-type";
|
||||
import { ModifierType, modifierTypes } from "./modifier-type";
|
||||
import { getModifierType, ModifierType, modifierTypes } from "./modifier-type";
|
||||
import BattleScene from "../battle-scene";
|
||||
import { getLevelTotalExp } from "../data/exp";
|
||||
import { MAX_PER_TYPE_POKEBALLS, PokeballType } from "../data/pokeball";
|
||||
|
@ -852,26 +852,47 @@ export class EvoTrackerModifier extends PokemonHeldItemModifier {
|
|||
}
|
||||
|
||||
matchType(modifier: Modifier): boolean {
|
||||
if (modifier instanceof EvoTrackerModifier) {
|
||||
return (modifier as EvoTrackerModifier).species === this.species;
|
||||
}
|
||||
return false;
|
||||
return modifier instanceof EvoTrackerModifier && modifier.species === this.species && modifier.required === this.required;
|
||||
}
|
||||
|
||||
clone(): PersistentModifier {
|
||||
return new EvoTrackerModifier(this.type, this.pokemonId, this.species, this.stackCount);
|
||||
return new EvoTrackerModifier(this.type, this.pokemonId, this.species, this.required, this.stackCount);
|
||||
}
|
||||
|
||||
getArgs(): any[] {
|
||||
return super.getArgs().concat(this.species);
|
||||
return super.getArgs().concat([this.species, this.required]);
|
||||
}
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxHeldItemCount(_pokemon: Pokemon): integer {
|
||||
return this.required;
|
||||
getIconStackText(scene: BattleScene, virtual?: boolean): Phaser.GameObjects.BitmapText | null {
|
||||
if (this.getMaxStackCount(scene) === 1 || (virtual && !this.virtualStackCount)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const pokemon = scene.getPokemonById(this.pokemonId);
|
||||
|
||||
this.stackCount = pokemon
|
||||
? pokemon.evoCounter + pokemon.getHeldItems().filter(m => m instanceof DamageMoneyRewardModifier).length
|
||||
+ pokemon.scene.findModifiers(m => m instanceof MoneyMultiplierModifier || m instanceof ExtraModifierModifier).length
|
||||
: this.stackCount;
|
||||
|
||||
const text = scene.add.bitmapText(10, 15, "item-count", this.stackCount.toString(), 11);
|
||||
text.letterSpacing = -0.5;
|
||||
if (this.getStackCount() >= this.required) {
|
||||
text.setTint(0xf89890);
|
||||
}
|
||||
text.setOrigin(0, 0);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
getMaxHeldItemCount(pokemon: Pokemon): integer {
|
||||
this.stackCount = pokemon.evoCounter + pokemon.getHeldItems().filter(m => m instanceof DamageMoneyRewardModifier).length
|
||||
+ pokemon.scene.findModifiers(m => m instanceof MoneyMultiplierModifier || m instanceof ExtraModifierModifier).length;
|
||||
return 999;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2414,9 +2435,8 @@ export class MoneyRewardModifier extends ConsumableModifier {
|
|||
|
||||
scene.getParty().map(p => {
|
||||
if (p.species?.speciesId === Species.GIMMIGHOUL || p.fusionSpecies?.speciesId === Species.GIMMIGHOUL) {
|
||||
p.evoCounter++;
|
||||
const modifierType: ModifierType = modifierTypes.EVOLUTION_TRACKER_GIMMIGHOUL();
|
||||
const modifier = modifierType!.newModifier(p);
|
||||
p.evoCounter ? p.evoCounter++ : p.evoCounter = 1;
|
||||
const modifier = getModifierType(modifierTypes.EVOLUTION_TRACKER_GIMMIGHOUL).newModifier(p) as EvoTrackerModifier;
|
||||
scene.addModifier(modifier);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue