Restore move history entry for charge phases

This commit is contained in:
innerthunder 2024-10-06 18:05:16 -07:00
parent 97806d7d4d
commit 185f7f2656
4 changed files with 88 additions and 84 deletions

View File

@ -6132,6 +6132,10 @@ const targetMoveCopiableCondition: MoveConditionFunc = (user, target, move) => {
return false;
}
if (allMoves[copiableMove.move].isChargingMove() && copiableMove.result === MoveResult.OTHER) {
return false;
}
// TODO: Add last turn of Bide
return true;

View File

@ -2,7 +2,7 @@ import BattleScene from "#app/battle-scene";
import { BattlerIndex } from "#app/battle";
import { MoveChargeAnim } from "#app/data/battle-anims";
import { applyMoveChargeAttrs, MoveEffectAttr, InstantChargeAttr } from "#app/data/move";
import Pokemon, { PokemonMove } from "#app/field/pokemon";
import Pokemon, { MoveResult, PokemonMove } from "#app/field/pokemon";
import { BooleanHolder } from "#app/utils";
import { MovePhase } from "#app/phases/move-phase";
import { PokemonPhase } from "#app/phases/pokemon-phase";
@ -26,13 +26,10 @@ export class MoveChargePhase extends PokemonPhase {
const user = this.getUserPokemon();
const target = this.getTargetPokemon();
if (!target) {
return this.end();
}
const move = this.move.getMove();
if (!(move.isChargingMove())) {
return this.end();
if (!target || !(move.isChargingMove())) {
return super.end();
}
new MoveChargeAnim(move.chargeAnim, move.id, user).play(this.scene, false, () => {
@ -61,6 +58,9 @@ export class MoveChargePhase extends PokemonPhase {
} else {
user.getMoveQueue().push({ move: move.id, targets: [ this.targetIndex ]});
}
// Add this move's charging phase to the user's move history
user.pushMoveHistory({ move: this.move.moveId, targets: [ this.targetIndex ], result: MoveResult.OTHER });
}
super.end();
}

View File

@ -107,7 +107,6 @@ export class MoveEffectPhase extends PokemonPhase {
* (and not random target) and failed the hit check against its target (MISS), log the move
* as FAILed or MISSed (depending on the conditions above) and end this phase.
*/
if (!hasActiveTargets || (!move.hasAttr(VariableTargetAttr) && !move.isMultiTarget() && !targetHitChecks[this.targets[0]] && !targets[0].getTag(ProtectedTag) && !isImmune)) {
this.stopMultiHit();
if (hasActiveTargets) {

View File

@ -303,6 +303,7 @@ export class MovePhase extends BattlePhase {
// Protean and Libero apply on the charging turn of charge moves
applyPreAttackAbAttrs(PokemonTypeChangeAbAttr, this.pokemon, null, this.move.getMove());
this.showMoveText();
this.scene.unshiftPhase(new MoveChargePhase(this.scene, this.pokemon.getBattlerIndex(), this.targets[0], this.move));
}