mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Basculin uses modifier too
This commit is contained in:
parent
b69e01406a
commit
698762b066
@ -3274,6 +3274,13 @@ export default class BattleScene extends SceneBase {
|
||||
) {
|
||||
modifiers.splice(m--, 1);
|
||||
}
|
||||
if (
|
||||
modifier instanceof PokemonHeldItemModifier &&
|
||||
!isNullOrUndefined(modifier.getSpecies()) &&
|
||||
!this.getPokemonById((modifier as PokemonHeldItemModifier).pokemonId)?.hasSpecies(modifier.getSpecies()!)
|
||||
) {
|
||||
modifiers.splice(m--, 1);
|
||||
}
|
||||
}
|
||||
for (const modifier of modifiers) {
|
||||
if (modifier instanceof PersistentModifier) {
|
||||
|
@ -10,11 +10,10 @@ import { Biome } from "#enums/biome";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
import { DamageMoneyRewardModifier, EvoTrackerModifier, EvoTrackerMoveUseModifier, ExtraModifierModifier, MoneyMultiplierModifier, PersistentModifier, TempExtraModifierModifier } from "#app/modifier/modifier";
|
||||
import { EvoTrackerModifier, EvoTrackerMoveUseModifier, EvoTrackerRecoilModifier, PersistentModifier} from "#app/modifier/modifier";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import { speciesStarterCosts } from "./starters";
|
||||
import i18next from "i18next";
|
||||
import { initI18n } from "#app/plugins/i18n";
|
||||
import { allMoves } from "../moves/move";
|
||||
import { getPokemonSpecies } from "../pokemon-species";
|
||||
|
||||
@ -246,25 +245,7 @@ export class SpeciesEvolutionCondition {
|
||||
m.shouldApply(pokemon, this.data.move!) &&
|
||||
m.getStackCount() >= this.data.evoCount!);
|
||||
case EvoCondKey.RECOIL_DAMAGE_COUNT:
|
||||
return pokemon.evoCounter >= this.data.evoCount!;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public postEvolve(pokemon: Pokemon): void {
|
||||
const keys = Array.isArray(this.data.key) ? this.data.key : [this.data.key];
|
||||
keys.map(cond => {
|
||||
let modifier: PersistentModifier | undefined;
|
||||
switch (cond) {
|
||||
case EvoCondKey.EVO_TREASURE_TRACKER:
|
||||
modifier = globalScene.findModifier(m => m instanceof EvoTrackerModifier && m.pokemonId === pokemon.id);
|
||||
break;
|
||||
case EvoCondKey.MOVE_USE_COUNT:
|
||||
modifier = globalScene.findModifier(m => m instanceof EvoTrackerMoveUseModifier && m.shouldApply(pokemon, this.data.move!));
|
||||
break;
|
||||
}
|
||||
if (!isNullOrUndefined(modifier)) {
|
||||
globalScene.removeModifier(modifier);
|
||||
return pokemon.getHeldItems().some(m => m instanceof EvoTrackerRecoilModifier && m.getStackCount() >= this.data.evoCount!);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -346,12 +327,6 @@ export class SpeciesFormEvolution {
|
||||
);
|
||||
}
|
||||
|
||||
public postEvolve(pokemon: Pokemon): void {
|
||||
if (!isNullOrUndefined(this.condition)) {
|
||||
this.condition.postEvolve(pokemon);
|
||||
}
|
||||
}
|
||||
|
||||
public get evoItem(): EvolutionItem {
|
||||
return this.item ?? EvolutionItem.NONE;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ import { allAbilities } from "../data-lists";
|
||||
import {
|
||||
AttackTypeBoosterModifier,
|
||||
BerryModifier,
|
||||
EvoTrackerRecoilModifier,
|
||||
PokemonHeldItemModifier,
|
||||
PokemonMoveAccuracyBoosterModifier,
|
||||
PokemonMultiHitModifier,
|
||||
@ -78,7 +79,7 @@ import {
|
||||
import type { BattlerIndex } from "../../battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { TerrainType } from "../terrain";
|
||||
import { ModifierPoolType } from "#app/modifier/modifier-type";
|
||||
import { ModifierPoolType, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { Command } from "../../ui/command-ui-handler";
|
||||
import i18next from "i18next";
|
||||
import type { Localizable } from "#app/interfaces/locales";
|
||||
@ -1680,12 +1681,10 @@ export class RecoilAttr extends MoveEffectAttr {
|
||||
globalScene.queueMessage(i18next.t("moveTriggers:hitWithRecoil", { pokemonName: getPokemonNameWithAffix(user) }));
|
||||
user.turnData.damageTaken += recoilDamage;
|
||||
if (!user.isFainted() && user.hasSpecies(Species.BASCULIN, "white-striped")) {
|
||||
if (isNullOrUndefined(user.evoCounter)) {
|
||||
user.evoCounter = recoilDamage;
|
||||
}
|
||||
else {
|
||||
user.evoCounter += recoilDamage;
|
||||
}
|
||||
const modifier = modifierTypes.EVOLUTION_TRACKER_BASCULIN()
|
||||
.withIdFromFunc(modifierTypes.EVOLUTION_TRACKER_BASCULIN)
|
||||
.newModifier(user, recoilDamage) as EvoTrackerRecoilModifier;
|
||||
globalScene.addModifier(modifier);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -99,6 +99,7 @@ import {
|
||||
CriticalCatchChanceBoosterModifier,
|
||||
FieldEffectModifier,
|
||||
EvoTrackerMoveUseModifier,
|
||||
EvoTrackerRecoilModifier,
|
||||
} from "#app/modifier/modifier";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import Overrides from "#app/overrides";
|
||||
@ -1914,6 +1915,13 @@ export const modifierTypes = {
|
||||
(type, args) => new EvoTrackerMoveUseModifier(type, (args[0] as Pokemon).id, Species.STANTLER, Moves.PSYSHIELD_BASH, 10)
|
||||
),
|
||||
|
||||
EVOLUTION_TRACKER_BASCULIN: () =>
|
||||
new PokemonHeldItemModifierType(
|
||||
"modifierType:ModifierType.EVOLUTION_TRACKER_BASCULIN",
|
||||
"tm_water",
|
||||
(type, args) => new EvoTrackerRecoilModifier(type, (args[0] as Pokemon).id, Species.BASCULIN, 294, (args[1] as number ?? 1))
|
||||
),
|
||||
|
||||
MEGA_BRACELET: () =>
|
||||
new ModifierType(
|
||||
"modifierType:ModifierType.MEGA_BRACELET",
|
||||
|
@ -748,6 +748,10 @@ export abstract class PokemonHeldItemModifier extends PersistentModifier {
|
||||
return this.getMaxHeldItemCount(pokemon);
|
||||
}
|
||||
|
||||
getSpecies(): Species | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
abstract getMaxHeldItemCount(pokemon?: Pokemon): number;
|
||||
}
|
||||
|
||||
@ -920,6 +924,10 @@ export class EvoTrackerModifier extends PokemonHeldItemModifier {
|
||||
getMaxHeldItemCount(pokemon: Pokemon): number {
|
||||
return 999;
|
||||
}
|
||||
|
||||
override getSpecies(): Species {
|
||||
return this.species;
|
||||
}
|
||||
}
|
||||
|
||||
export class EvoTrackerMoveUseModifier extends PokemonHeldItemModifier {
|
||||
@ -978,6 +986,64 @@ export class EvoTrackerMoveUseModifier extends PokemonHeldItemModifier {
|
||||
getMaxHeldItemCount(pokemon: Pokemon): number {
|
||||
return 999;
|
||||
}
|
||||
|
||||
override getSpecies(): Species {
|
||||
return this.species;
|
||||
}
|
||||
}
|
||||
|
||||
export class EvoTrackerRecoilModifier extends PokemonHeldItemModifier {
|
||||
protected species: Species;
|
||||
protected required: number;
|
||||
public isTransferable = false;
|
||||
|
||||
constructor(type: ModifierType, pokemonId: number, species: Species, required: number, stackCount?: number) {
|
||||
super(type, pokemonId, stackCount);
|
||||
this.species = species;
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
matchType(modifier: Modifier): boolean {
|
||||
return (
|
||||
modifier instanceof EvoTrackerRecoilModifier && modifier.species === this.species && modifier.required === this.required
|
||||
);
|
||||
}
|
||||
|
||||
clone(): PersistentModifier {
|
||||
return new EvoTrackerRecoilModifier(this.type, this.pokemonId, this.species, this.required, this.stackCount);
|
||||
}
|
||||
|
||||
getArgs(): any[] {
|
||||
return super.getArgs().concat([this.species, this.required]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the {@linkcode EvoTrackerModifier}
|
||||
* @returns always `true`
|
||||
*/
|
||||
override apply(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
getIconStackText(virtual?: boolean): Phaser.GameObjects.BitmapText | null {
|
||||
const text = globalScene.add.bitmapText(10, 15, "item-count", (this.getStackCount()).toString(), 11);
|
||||
text.letterSpacing = -0.5;
|
||||
if (this.getStackCount() >= this.required) {
|
||||
text.setTint(0xf89890);
|
||||
}
|
||||
text.setOrigin(0, 0);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
getMaxHeldItemCount(pokemon: Pokemon): number {
|
||||
return 9999;
|
||||
}
|
||||
|
||||
override getSpecies(): Species {
|
||||
return this.species;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -343,7 +343,6 @@ export class EvolutionPhase extends Phase {
|
||||
this.evolutionHandler.canCancel = false;
|
||||
|
||||
this.pokemon.evolve(this.evolution, this.pokemon.species).then(() => {
|
||||
this.evolution?.postEvolve(this.pokemon);
|
||||
const learnSituation: LearnMoveSituation = this.fusionSpeciesEvolved
|
||||
? LearnMoveSituation.EVOLUTION_FUSED
|
||||
: this.pokemon.fusionSpecies
|
||||
|
@ -19,7 +19,7 @@ import type { EnemyPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { HitResult, PlayerPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { PokemonInstantReviveModifier } from "#app/modifier/modifier";
|
||||
import { EvoTrackerRecoilModifier, PokemonInstantReviveModifier } from "#app/modifier/modifier";
|
||||
import { SwitchType } from "#enums/switch-type";
|
||||
import i18next from "i18next";
|
||||
import { DamageAnimPhase } from "./damage-anim-phase";
|
||||
@ -32,6 +32,7 @@ import { VictoryPhase } from "./victory-phase";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
export class FaintPhase extends PokemonPhase {
|
||||
/**
|
||||
@ -116,6 +117,13 @@ export class FaintPhase extends PokemonPhase {
|
||||
);
|
||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);
|
||||
|
||||
if (pokemon.isPlayer() && pokemon.hasSpecies(Species.BASCULIN, "white-striped")) { // Reset counter
|
||||
const modifier = globalScene.findModifier(m => m instanceof EvoTrackerRecoilModifier && m.pokemonId === pokemon.id);
|
||||
if (!isNullOrUndefined(modifier)) {
|
||||
globalScene.removeModifier(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
pokemon.resetTera();
|
||||
|
||||
if (pokemon.turnData?.attacksReceived?.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user