implement fairy lock

This commit is contained in:
muscode13 2024-10-27 01:49:39 -06:00
parent dce3e1a7d2
commit b5a529ea92
3 changed files with 12 additions and 10 deletions

@ -1 +1 @@
Subproject commit 87615556d8a2bd7eef7abac818f84423a8a13b03 Subproject commit 71390cba88f4103d0d2273d59a6dd8340a4fa54f

View File

@ -9044,11 +9044,7 @@ export function initMoves() {
.ignoresSubstitute() .ignoresSubstitute()
.ignoresProtect() .ignoresProtect()
.target(MoveTarget.BOTH_SIDES) .target(MoveTarget.BOTH_SIDES)
.attr(AddArenaTagAttr, ArenaTagType.FAIRY_LOCK, 2, true) .attr(AddArenaTagAttr, ArenaTagType.FAIRY_LOCK, 2, true),
.condition((user, target, move) => {
const turnMove = user.getLastXMoves(1);
return !turnMove.length || turnMove[0].move !== move.id || turnMove[0].result !== MoveResult.SUCCESS;
}),
new SelfStatusMove(Moves.KINGS_SHIELD, Type.STEEL, -1, 10, -1, 4, 6) new SelfStatusMove(Moves.KINGS_SHIELD, Type.STEEL, -1, 10, -1, 4, 6)
.attr(ProtectAttr, BattlerTagType.KINGS_SHIELD) .attr(ProtectAttr, BattlerTagType.KINGS_SHIELD)
.condition(failIfLastCondition), .condition(failIfLastCondition),

View File

@ -17,6 +17,8 @@ import { FieldPhase } from "./field-phase";
import { SelectTargetPhase } from "./select-target-phase"; import { SelectTargetPhase } from "./select-target-phase";
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode"; import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import { isNullOrUndefined } from "#app/utils"; import { isNullOrUndefined } from "#app/utils";
import { ArenaTagSide } from "#app/data/arena-tag";
import { ArenaTagType } from "#app/enums/arena-tag-type";
export class CommandPhase extends FieldPhase { export class CommandPhase extends FieldPhase {
protected fieldIndex: integer; protected fieldIndex: integer;
@ -228,23 +230,27 @@ export class CommandPhase extends FieldPhase {
}, null, true); }, null, true);
} else { } else {
const trapTag = playerPokemon.getTag(TrappedTag); const trapTag = playerPokemon.getTag(TrappedTag);
const fairyLockTag = playerPokemon.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER);
// trapTag should be defined at this point, but just in case... // trapTag should be defined at this point, but just in case...
if (!trapTag) { if (!trapTag && !fairyLockTag) {
currentBattle.turnCommands[this.fieldIndex] = isSwitch currentBattle.turnCommands[this.fieldIndex] = isSwitch
? { command: Command.POKEMON, cursor: cursor, args: args } ? { command: Command.POKEMON, cursor: cursor, args: args }
: { command: Command.RUN }; : { command: Command.RUN };
break; break;
} }
if (!isSwitch) { if (!isSwitch) {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
} }
this.scene.ui.showText( this.scene.ui.showText(
i18next.t("battle:noEscapePokemon", { i18next.t("battle:noEscapePokemon", {
pokemonName: trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) : "", pokemonName: trapTag && trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId)
moveName: trapTag.getMoveName(), ? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!)
: fairyLockTag && fairyLockTag.sourceId && this.scene.getPokemonById(fairyLockTag.sourceId)
? getPokemonNameWithAffix(this.scene.getPokemonById(fairyLockTag.sourceId)!)
: "",
moveName: trapTag ? trapTag.getMoveName() : fairyLockTag ? fairyLockTag.getMoveName() : "",
escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee") escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee")
}), }),
null, null,