mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
add death history and bug fix where retaliate didn't work after 10 turns
This commit is contained in:
parent
4fa1524e75
commit
705e82c95e
@ -1,5 +1,4 @@
|
||||
import BattleScene from "./battle-scene";
|
||||
import { EnemyPokemon, PlayerPokemon, QueuedMove } from "./field/pokemon";
|
||||
import { Command } from "./ui/command-ui-handler";
|
||||
import * as Utils from "./utils";
|
||||
import Trainer, { TrainerVariant } from "./field/trainer";
|
||||
@ -12,6 +11,7 @@ import { PlayerGender } from "./system/game-data";
|
||||
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "./data/pokeball";
|
||||
import {trainerConfigs} from "#app/data/trainer-config";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon, QueuedMove } from "field/pokemon";
|
||||
|
||||
export enum BattleType {
|
||||
WILD,
|
||||
@ -36,6 +36,11 @@ export interface TurnCommand {
|
||||
args?: any[];
|
||||
}
|
||||
|
||||
export interface FaintLogEntry {
|
||||
pokemon: Pokemon,
|
||||
turn: number
|
||||
}
|
||||
|
||||
interface TurnCommands {
|
||||
[key: integer]: TurnCommand
|
||||
}
|
||||
@ -65,8 +70,8 @@ export default class Battle {
|
||||
public lastUsedPokeball: PokeballType;
|
||||
public playerFaints: number; // The amount of times pokemon on the players side have fainted
|
||||
public enemyFaints: number; // The amount of times pokemon on the enemies side have fainted
|
||||
public turnsSincePlayerFaints: number; // The amount of turns after pokemon on the players side have fainted
|
||||
public turnsSinceEnemyFaints: number; // The amount of turns after pokemon on the players side have fainted
|
||||
public playerFaintsHistory: FaintLogEntry[];
|
||||
public enemyFaintsHistory: FaintLogEntry[];
|
||||
|
||||
private rngCounter: integer = 0;
|
||||
|
||||
@ -95,8 +100,8 @@ export default class Battle {
|
||||
this.lastUsedPokeball = null;
|
||||
this.playerFaints = 0;
|
||||
this.enemyFaints = 0;
|
||||
this.turnsSincePlayerFaints = -1;
|
||||
this.turnsSinceEnemyFaints = -1;
|
||||
this.playerFaintsHistory = [];
|
||||
this.enemyFaintsHistory = [];
|
||||
}
|
||||
|
||||
private initBattleSpec(): void {
|
||||
@ -148,13 +153,6 @@ export default class Battle {
|
||||
this.turn++;
|
||||
this.turnCommands = Object.fromEntries(Utils.getEnumValues(BattlerIndex).map(bt => [ bt, null ]));
|
||||
this.battleSeedState = null;
|
||||
|
||||
if (this.turnsSincePlayerFaints > -1 && this.turnsSincePlayerFaints < 10) {
|
||||
this.turnsSincePlayerFaints++;
|
||||
}
|
||||
if (this.turnsSinceEnemyFaints > -1 && this.turnsSinceEnemyFaints < 10) {
|
||||
this.turnsSinceEnemyFaints++;
|
||||
}
|
||||
}
|
||||
|
||||
addParticipant(playerPokemon: PlayerPokemon): void {
|
||||
|
@ -184,6 +184,8 @@ export default class Move implements Localizable {
|
||||
return this;
|
||||
}
|
||||
|
||||
isRetaliate = () => {};
|
||||
|
||||
addAttr(attr: MoveAttr): this {
|
||||
this.attrs.push(attr);
|
||||
let attrCondition = attr.getCondition();
|
||||
@ -6546,7 +6548,14 @@ export function initMoves() {
|
||||
new StatusMove(Moves.REFLECT_TYPE, Type.NORMAL, -1, 15, -1, 0, 5)
|
||||
.attr(CopyTypeAttr),
|
||||
new AttackMove(Moves.RETALIATE, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 5, -1, 0, 5)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => (user.scene.currentBattle.turnsSincePlayerFaints === 1 && user instanceof PlayerPokemon || user.scene.currentBattle.turnsSinceEnemyFaints === 1 && user instanceof EnemyPokemon) ? 2 : 1),
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => {
|
||||
console.log(user.scene.currentBattle.playerFaintsHistory.slice(-1)[0].turn - user.scene.currentBattle.turn);
|
||||
return (
|
||||
user.scene.currentBattle.turn - user.scene.currentBattle.playerFaintsHistory.slice(-1)[0].turn === 1 &&
|
||||
user instanceof PlayerPokemon ||
|
||||
user.scene.currentBattle.turn - user.scene.currentBattle.enemyFaintsHistory.slice(-1)[0].turn === 1 &&
|
||||
user instanceof EnemyPokemon) ? 2 : 1;
|
||||
}),
|
||||
new AttackMove(Moves.FINAL_GAMBIT, Type.FIGHTING, MoveCategory.SPECIAL, -1, 100, 5, -1, 0, 5)
|
||||
.attr(UserHpDamageAttr)
|
||||
.attr(SacrificialAttrOnHit),
|
||||
|
@ -3518,10 +3518,10 @@ export class FaintPhase extends PokemonPhase {
|
||||
// Track total times pokemon have been KO'd for supreme overlord/last respects
|
||||
if (pokemon.isPlayer()) {
|
||||
this.scene.currentBattle.playerFaints += 1;
|
||||
this.scene.currentBattle.turnsSincePlayerFaints = 0;
|
||||
this.scene.currentBattle.playerFaintsHistory = [...this.scene.currentBattle.playerFaintsHistory, {pokemon, turn: this.scene.currentBattle.turn}];
|
||||
} else {
|
||||
this.scene.currentBattle.enemyFaints += 1;
|
||||
this.scene.currentBattle.turnsSinceEnemyFaints = 0;
|
||||
this.scene.currentBattle.enemyFaintsHistory = [...this.scene.currentBattle.enemyFaintsHistory, {pokemon, turn: this.scene.currentBattle.turn}];
|
||||
}
|
||||
|
||||
this.scene.queueMessage(getPokemonMessage(pokemon, " fainted!"), null, true);
|
||||
|
Loading…
Reference in New Issue
Block a user