[Bug] Add Neutralizing Gas Message for each user (#5527)

Add message to onOverlap

Co-authored-by: damocleas <damocleas25@gmail.com>
This commit is contained in:
Dean 2025-03-18 13:19:37 -07:00 committed by GitHub
parent a5ed9c5191
commit d9288a7908
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 9 deletions

View File

@ -64,7 +64,7 @@ export abstract class ArenaTag {
} }
} }
onOverlap(_arena: Arena): void {} onOverlap(_arena: Arena, _source: Pokemon | null): void {}
lapse(_arena: Arena): boolean { lapse(_arena: Arena): boolean {
return this.turnCount < 1 || !!--this.turnCount; return this.turnCount < 1 || !!--this.turnCount;
@ -706,7 +706,7 @@ export class ArenaTrapTag extends ArenaTag {
this.maxLayers = maxLayers; this.maxLayers = maxLayers;
} }
onOverlap(arena: Arena): void { onOverlap(arena: Arena, _source: Pokemon | null): void {
if (this.layers < this.maxLayers) { if (this.layers < this.maxLayers) {
this.layers++; this.layers++;
@ -1427,11 +1427,7 @@ export class SuppressAbilitiesTag extends ArenaTag {
public override onAdd(_arena: Arena): void { public override onAdd(_arena: Arena): void {
const pokemon = this.getSourcePokemon(); const pokemon = this.getSourcePokemon();
if (pokemon) { if (pokemon) {
globalScene.queueMessage( this.playActivationMessage(pokemon);
i18next.t("arenaTag:neutralizingGasOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
}),
);
for (const fieldPokemon of globalScene.getField(true)) { for (const fieldPokemon of globalScene.getField(true)) {
if (fieldPokemon && fieldPokemon.id !== pokemon.id) { if (fieldPokemon && fieldPokemon.id !== pokemon.id) {
@ -1441,8 +1437,9 @@ export class SuppressAbilitiesTag extends ArenaTag {
} }
} }
public override onOverlap(_arena: Arena): void { public override onOverlap(_arena: Arena, source: Pokemon | null): void {
this.sourceCount++; this.sourceCount++;
this.playActivationMessage(source);
} }
public onSourceLeave(arena: Arena): void { public onSourceLeave(arena: Arena): void {
@ -1481,6 +1478,16 @@ export class SuppressAbilitiesTag extends ArenaTag {
public isBeingRemoved() { public isBeingRemoved() {
return this.beingRemoved; return this.beingRemoved;
} }
private playActivationMessage(pokemon: Pokemon | null) {
if (pokemon) {
globalScene.queueMessage(
i18next.t("arenaTag:neutralizingGasOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
}),
);
}
}
} }
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter // TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter

View File

@ -673,7 +673,7 @@ export class Arena {
): boolean { ): boolean {
const existingTag = this.getTagOnSide(tagType, side); const existingTag = this.getTagOnSide(tagType, side);
if (existingTag) { if (existingTag) {
existingTag.onOverlap(this); existingTag.onOverlap(this, globalScene.getPokemonById(sourceId));
if (existingTag instanceof ArenaTrapTag) { if (existingTag instanceof ArenaTrapTag) {
const { tagType, side, turnCount, layers, maxLayers } = existingTag as ArenaTrapTag; const { tagType, side, turnCount, layers, maxLayers } = existingTag as ArenaTrapTag;