[Beta][Bug] Fixing Trapped ability messages (#3928)

* always update your repo

* enemy command phase changed too

* typedocs

* Typedocs part 2

* Added simulation boolean back

* restored simulated

* Remove `console.log()` statements

---------

Co-authored-by: frutescens <info@laptop>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Mumble 2024-08-30 19:07:27 -07:00 committed by GitHub
parent dd0e820893
commit dd0b6464d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View File

@ -4498,7 +4498,7 @@ async function applyAbAttrsInternal<TAttr extends AbAttr>(
applyFunc: AbAttrApplyFunc<TAttr>, applyFunc: AbAttrApplyFunc<TAttr>,
args: any[], args: any[],
showAbilityInstant: boolean = false, showAbilityInstant: boolean = false,
quiet: boolean = false, simulated: boolean = false,
messages: string[] = [], messages: string[] = [],
) { ) {
for (const passive of [false, true]) { for (const passive of [false, true]) {
@ -4520,33 +4520,29 @@ async function applyAbAttrsInternal<TAttr extends AbAttr>(
if (result instanceof Promise) { if (result instanceof Promise) {
result = await result; result = await result;
} }
if (result) { if (result) {
if (pokemon.summonData && !pokemon.summonData.abilitiesApplied.includes(ability.id)) { if (pokemon.summonData && !pokemon.summonData.abilitiesApplied.includes(ability.id)) {
pokemon.summonData.abilitiesApplied.push(ability.id); pokemon.summonData.abilitiesApplied.push(ability.id);
} }
if (pokemon.battleData && !quiet && !pokemon.battleData.abilitiesApplied.includes(ability.id)) { if (pokemon.battleData && !simulated && !pokemon.battleData.abilitiesApplied.includes(ability.id)) {
pokemon.battleData.abilitiesApplied.push(ability.id); pokemon.battleData.abilitiesApplied.push(ability.id);
} }
if (attr.showAbility && !simulated) {
if (attr.showAbility && !quiet) {
if (showAbilityInstant) { if (showAbilityInstant) {
pokemon.scene.abilityBar.showAbility(pokemon, passive); pokemon.scene.abilityBar.showAbility(pokemon, passive);
} else { } else {
queueShowAbility(pokemon, passive); queueShowAbility(pokemon, passive);
} }
} }
const message = attr.getTriggerMessage(pokemon, ability.name, args);
if (!quiet) { if (message) {
const message = attr.getTriggerMessage(pokemon, ability.name, args); if (!simulated) {
if (message) {
pokemon.scene.queueMessage(message); pokemon.scene.queueMessage(message);
messages.push(message);
} }
} }
messages.push(message!);
} }
} }
pokemon.scene.clearPhaseQueueSplice(); pokemon.scene.clearPhaseQueueSplice();
} }
} }

View File

@ -47,7 +47,7 @@ export class EnemyCommandPhase extends FieldPhase {
const trapTag = enemyPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag; const trapTag = enemyPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag;
const trapped = new Utils.BooleanHolder(false); const trapped = new Utils.BooleanHolder(false);
opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, trapped, enemyPokemon, [], true)); opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, trapped, enemyPokemon, [""], true));
if (!trapTag && !trapped.value) { if (!trapTag && !trapped.value) {
const partyMemberScores = trainer.getPartyMemberMatchupScores(enemyPokemon.trainerSlot, true); const partyMemberScores = trainer.getPartyMemberMatchupScores(enemyPokemon.trainerSlot, true);