Skip to content

Commit

Permalink
[P3] Added failIfSingleBattle condtion to Doubles-only moves and di…
Browse files Browse the repository at this point in the history
…splay failure message when used in singles (#4839)

* Added failIfSingleBattle condtion to Helping Hand

* Added failIfSingleBattle conditions to Doubles-Only moves

* Adjusted canMove failure condition.

* Updated moves that failIfSingleBattle

* Fixed condtional.

---------

Co-authored-by: frutescens <info@laptop>
  • Loading branch information
frutescens and frutescens authored Nov 11, 2024
1 parent 6799594 commit 6feb634
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
11 changes: 8 additions & 3 deletions src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8480,7 +8480,8 @@ export function initMoves() {
new StatusMove(Moves.HELPING_HAND, Type.NORMAL, -1, 20, -1, 5, 3)
.attr(AddBattlerTagAttr, BattlerTagType.HELPING_HAND)
.ignoresSubstitute()
.target(MoveTarget.NEAR_ALLY),
.target(MoveTarget.NEAR_ALLY)
.condition(failIfSingleBattle),
new StatusMove(Moves.TRICK, Type.PSYCHIC, 100, 10, -1, 0, 3)
.unimplemented(),
new StatusMove(Moves.ROLE_PLAY, Type.PSYCHIC, -1, 10, -1, 0, 3)
Expand Down Expand Up @@ -9172,6 +9173,7 @@ export function initMoves() {
.target(MoveTarget.ALL_NEAR_ENEMIES)
.attr(RemoveHeldItemAttr, true),
new StatusMove(Moves.QUASH, Type.DARK, 100, 15, -1, 0, 5)
.condition(failIfSingleBattle)
.unimplemented(),
new AttackMove(Moves.ACROBATICS, Type.FLYING, MoveCategory.PHYSICAL, 55, 100, 15, -1, 0, 5)
.attr(MovePowerMultiplierAttr, (user, target, move) => Math.max(1, 2 - 0.2 * user.getHeldItems().filter(i => i.isTransferable).reduce((v, m) => v + m.stackCount, 0))),
Expand Down Expand Up @@ -9459,6 +9461,7 @@ export function initMoves() {
new StatusMove(Moves.AROMATIC_MIST, Type.FAIRY, -1, 20, -1, 0, 6)
.attr(StatStageChangeAttr, [ Stat.SPDEF ], 1)
.ignoresSubstitute()
.condition(failIfSingleBattle)
.target(MoveTarget.NEAR_ALLY),
new StatusMove(Moves.EERIE_IMPULSE, Type.ELECTRIC, 100, 15, -1, 0, 6)
.attr(StatStageChangeAttr, [ Stat.SPATK ], -2),
Expand Down Expand Up @@ -9687,7 +9690,8 @@ export function initMoves() {
new AttackMove(Moves.LEAFAGE, Type.GRASS, MoveCategory.PHYSICAL, 40, 100, 40, -1, 0, 7)
.makesContact(false),
new StatusMove(Moves.SPOTLIGHT, Type.NORMAL, -1, 15, -1, 3, 7)
.attr(AddBattlerTagAttr, BattlerTagType.CENTER_OF_ATTENTION, false),
.attr(AddBattlerTagAttr, BattlerTagType.CENTER_OF_ATTENTION, false)
.condition(failIfSingleBattle),
new StatusMove(Moves.TOXIC_THREAD, Type.POISON, 100, 20, -1, 0, 7)
.attr(StatusEffectAttr, StatusEffect.POISON)
.attr(StatStageChangeAttr, [ Stat.SPD ], -1),
Expand Down Expand Up @@ -10144,7 +10148,8 @@ export function initMoves() {
.unimplemented(),
new StatusMove(Moves.COACHING, Type.FIGHTING, -1, 10, -1, 0, 8)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.DEF ], 1)
.target(MoveTarget.NEAR_ALLY),
.target(MoveTarget.NEAR_ALLY)
.condition(failIfSingleBattle),
new AttackMove(Moves.FLIP_TURN, Type.WATER, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 8)
.attr(ForceSwitchOutAttr, true),
new AttackMove(Moves.TRIPLE_AXEL, Type.ICE, MoveCategory.PHYSICAL, 20, 90, 10, -1, 0, 8)
Expand Down
19 changes: 6 additions & 13 deletions src/phases/move-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,10 @@ export class MovePhase extends BattlePhase {
console.log(Moves[this.move.moveId]);

// Check if move is unusable (e.g. because it's out of PP due to a mid-turn Spite).
if (!this.canMove(true)) {
if (this.pokemon.isActive(true) && this.move.ppUsed >= this.move.getMovePp()) {
this.fail();
this.showMoveText();
this.showFailedText();
}

if (!this.canMove(true) && (this.pokemon.isActive(true) || this.move.ppUsed >= this.move.getMovePp())) {
this.fail();
this.showMoveText();
this.showFailedText();
return this.end();
}

Expand Down Expand Up @@ -378,16 +375,12 @@ export class MovePhase extends BattlePhase {
} else {
this.pokemon.pushMoveHistory({ move: this.move.moveId, targets: this.targets, result: MoveResult.FAIL, virtual: this.move.virtual });

let failedText: string | undefined;
const failureMessage = move.getFailedText(this.pokemon, targets[0], move, new BooleanHolder(false));

if (failureMessage) {
failedText = failureMessage;
this.showMoveText();
this.showFailedText(failureMessage);
}

this.showMoveText();
this.showFailedText(failedText);

// Remove the user from its semi-invulnerable state (if applicable)
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);
}
Expand Down

0 comments on commit 6feb634

Please sign in to comment.