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