mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-17 22:02:18 +02:00
Fix torment resetting between battles
This commit is contained in:
parent
32c2d526fa
commit
6d099cde96
@ -3299,9 +3299,10 @@ export class TormentAttr extends MoveEffectAttr {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copied from disable
|
// modified from disable, score of -5 is target is not already tormented
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||||
return -5;
|
const isTormented = target.summonData.tormented && (target.findTag(t => t instanceof TormentTag) !== undefined);
|
||||||
|
return isTormented ? 0 : -5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3388,6 +3388,7 @@ export class PokemonSummonData {
|
|||||||
public disabledMove: Moves = Moves.NONE;
|
public disabledMove: Moves = Moves.NONE;
|
||||||
public disabledTurns: integer = 0;
|
public disabledTurns: integer = 0;
|
||||||
public tormented = false;
|
public tormented = false;
|
||||||
|
public prevMove: Moves = undefined; // for torment, carry over between battles while summoned
|
||||||
public justTaunted: boolean = false;
|
public justTaunted: boolean = false;
|
||||||
public taunted: boolean = false;
|
public taunted: boolean = false;
|
||||||
public tauntedTurns: integer = 0;
|
public tauntedTurns: integer = 0;
|
||||||
@ -3477,7 +3478,7 @@ export class PokemonMove {
|
|||||||
const isMoveDisabledTaunt = this.moveId && pokemon.summonData.taunted && this.getMove().category === MoveCategory.STATUS;
|
const isMoveDisabledTaunt = this.moveId && pokemon.summonData.taunted && this.getMove().category === MoveCategory.STATUS;
|
||||||
|
|
||||||
// for torment: check valid move, pokemon is tormented, pokemon has moved this summon, and selected move is the same as previous move
|
// for torment: check valid move, pokemon is tormented, pokemon has moved this summon, and selected move is the same as previous move
|
||||||
const isMoveDisabledTorment = this.moveId && pokemon.summonData.tormented && pokemon.getLastXMoves(1)[0] && pokemon.getLastXMoves(1)[0].move === this.moveId;
|
const isMoveDisabledTorment = this.moveId && pokemon.summonData.tormented && pokemon.summonData.prevMove === this.moveId;
|
||||||
|
|
||||||
if (isMoveDisabled || isMoveDisabledTaunt || isMoveDisabledTorment)
|
if (isMoveDisabled || isMoveDisabledTaunt || isMoveDisabledTorment)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1740,7 +1740,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
errorMessage = 'battle:moveDisabled';
|
errorMessage = 'battle:moveDisabled';
|
||||||
else if (move.getName().endsWith(' (N)'))
|
else if (move.getName().endsWith(' (N)'))
|
||||||
errorMessage = 'battle:moveNotImplemented';
|
errorMessage = 'battle:moveNotImplemented';
|
||||||
else if (playerPokemon.summonData.tormented && playerPokemon.getLastXMoves(1)[0] && playerPokemon.getLastXMoves(1)[0].move === move.moveId) {
|
else if (playerPokemon.summonData.tormented && playerPokemon.summonData.prevMove === move.moveId) {
|
||||||
errorMessage = getPokemonMessage(playerPokemon, ' can\'t use the same move twice in a row due to the torment!');
|
errorMessage = getPokemonMessage(playerPokemon, ' can\'t use the same move twice in a row due to the torment!');
|
||||||
canTranslate = false;
|
canTranslate = false;
|
||||||
} else if (playerPokemon.summonData.taunted && move.getMove().category === MoveCategory.STATUS) {
|
} else if (playerPokemon.summonData.taunted && move.getMove().category === MoveCategory.STATUS) {
|
||||||
@ -2110,6 +2110,9 @@ export class TurnEndPhase extends FieldPhase {
|
|||||||
const handlePokemon = (pokemon: Pokemon) => {
|
const handlePokemon = (pokemon: Pokemon) => {
|
||||||
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
||||||
|
|
||||||
|
// For torment, keep track of last used move. This remains between battles while the pokemon is still on the field.
|
||||||
|
pokemon.summonData.prevMove = pokemon.getLastXMoves(1)[0].move;
|
||||||
|
|
||||||
if (pokemon.summonData.justTaunted) {
|
if (pokemon.summonData.justTaunted) {
|
||||||
pokemon.summonData.justTaunted = false;
|
pokemon.summonData.justTaunted = false;
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ export default class PokemonData {
|
|||||||
this.summonData.disabledTurns = source.summonData.disabledTurns;
|
this.summonData.disabledTurns = source.summonData.disabledTurns;
|
||||||
this.summonData.abilitySuppressed = source.summonData.abilitySuppressed;
|
this.summonData.abilitySuppressed = source.summonData.abilitySuppressed;
|
||||||
this.summonData.tormented = source.summonData.tormented;
|
this.summonData.tormented = source.summonData.tormented;
|
||||||
|
this.summonData.prevMove = source.summonData.prevMove;
|
||||||
this.summonData.justTaunted = source.summonData.justTaunted;
|
this.summonData.justTaunted = source.summonData.justTaunted;
|
||||||
this.summonData.taunted = source.summonData.taunted;
|
this.summonData.taunted = source.summonData.taunted;
|
||||||
this.summonData.tauntedTurns = source.summonData.tauntedTurns;
|
this.summonData.tauntedTurns = source.summonData.tauntedTurns;
|
||||||
|
Loading…
Reference in New Issue
Block a user