Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature] Wonder Room #3394

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/data/arena-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,31 @@ export class TrickRoomTag extends ArenaTag {
}
}

/**
* Arena Tag class for {@link https://bulbapedia.bulbagarden.net/wiki/Wonder_Room_(move) Wonder Room}.
* Swaps the Defense and Special Defense stats for all Pokémon on the field as long as this arena tag is up,
* also reversing the turn order for all Pokémon on the field as well.
*/
export class WonderRoomTag extends ArenaTag {
constructor(turnCount: integer) {
super(ArenaTagType.WONDER_ROOM, turnCount, Moves.WONDER_ROOM);
}

apply(arena: Arena, args: any[]): boolean {
const isWonderRoom = args[0] as Utils.BooleanHolder;
isWonderRoom.value = !isWonderRoom.value;
return true;
}

onAdd(arena: Arena): void {
arena.scene.queueMessage(i18next.t("arenaTag:wonderRoomOnAdd"));
}

onRemove(arena: Arena): void {
arena.scene.queueMessage(i18next.t("arenaTag:wonderRoomOnRemove"));
}
}

/**
* Arena Tag class for {@link https://bulbapedia.bulbagarden.net/wiki/Gravity_(move) Gravity}.
* Grounds all Pokémon on the field, including Flying-types and those with
Expand Down Expand Up @@ -965,6 +990,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov
return new TailwindTag(turnCount, sourceId, side);
case ArenaTagType.HAPPY_HOUR:
return new HappyHourTag(turnCount, sourceId, side);
case ArenaTagType.WONDER_ROOM:
return new WonderRoomTag(turnCount);
case ArenaTagType.SAFEGUARD:
return new SafeguardTag(turnCount, sourceId, side);
default:
Expand Down
3 changes: 2 additions & 1 deletion src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8100,9 +8100,10 @@ export function initMoves() {
new StatusMove(Moves.POWER_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
.attr(AverageStatsAttr, [ Stat.ATK, Stat.SPATK ], "moveTriggers:sharedPower"),
new StatusMove(Moves.WONDER_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5)
.attr(AddArenaTagAttr, ArenaTagType.WONDER_ROOM, 5)
.ignoresProtect()
.target(MoveTarget.BOTH_SIDES)
.unimplemented(),
.partial(),
new AttackMove(Moves.PSYSHOCK, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 5)
.attr(DefDefAttr),
new AttackMove(Moves.VENOSHOCK, Type.POISON, MoveCategory.SPECIAL, 65, 100, 10, -1, 0, 5)
Expand Down
3 changes: 2 additions & 1 deletion src/enums/arena-tag-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export enum ArenaTagType {
TAILWIND = "TAILWIND",
HAPPY_HOUR = "HAPPY_HOUR",
SAFEGUARD = "SAFEGUARD",
NO_CRIT = "NO_CRIT"
NO_CRIT = "NO_CRIT",
WONDER_ROOM = "WONDER_ROOM"
}
8 changes: 6 additions & 2 deletions src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEv
import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from "../data/tms";
import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, SubstituteTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, CritBoostTag, TrappedTag, TarShotTag, AutotomizedTag } from "../data/battler-tags";
import { WeatherType } from "../data/weather";
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "../data/arena-tag";
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag, WonderRoomTag } from "../data/arena-tag";
import { Ability, AbAttr, StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr, PostSetStatusAbAttr, applyPostSetStatusAbAttrs } from "../data/ability";
import PokemonData from "../system/pokemon-data";
import { BattlerIndex } from "../battle";
Expand Down Expand Up @@ -769,7 +769,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!bypassSummonData && this.summonData?.stats) {
return this.summonData.stats;
}
return this.stats;
const isWonderRoom = new Utils.BooleanHolder(false);
this.scene.arena.applyTags(WonderRoomTag, isWonderRoom);
return isWonderRoom.value
? [this.stats[Stat.HP], this.stats[Stat.ATK], this.stats[Stat.SPDEF], this.stats[Stat.SPATK], this.stats[Stat.DEF], this.stats[Stat.SPD]]
: this.stats;
}

/**
Expand Down
Loading