mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-18 10:17:56 +00:00
Implements Supreme Overlord and fixes Last Respects (#1219)
* Implements Supreme Overlord Also fixes count for Last Respects * Add comments
This commit is contained in:
parent
2fcde2907d
commit
1b7b539d68
@ -63,6 +63,8 @@ export default class Battle {
|
|||||||
private battleSeedState: string;
|
private battleSeedState: string;
|
||||||
public moneyScattered: number;
|
public moneyScattered: number;
|
||||||
public lastUsedPokeball: PokeballType;
|
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
|
||||||
|
|
||||||
private rngCounter: integer = 0;
|
private rngCounter: integer = 0;
|
||||||
|
|
||||||
@ -89,6 +91,8 @@ export default class Battle {
|
|||||||
this.battleSeedState = null;
|
this.battleSeedState = null;
|
||||||
this.moneyScattered = 0;
|
this.moneyScattered = 0;
|
||||||
this.lastUsedPokeball = null;
|
this.lastUsedPokeball = null;
|
||||||
|
this.playerFaints = 0;
|
||||||
|
this.enemyFaints = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private initBattleSpec(): void {
|
private initBattleSpec(): void {
|
||||||
|
@ -1083,6 +1083,37 @@ export class LowHpMoveTypePowerBoostAbAttr extends MoveTypePowerBoostAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abilities which cause a variable amount of power increase.
|
||||||
|
* @extends VariableMovePowerAbAttr
|
||||||
|
* @see {@link applyPreAttack}
|
||||||
|
*/
|
||||||
|
export class VariableMovePowerBoostAbAttr extends VariableMovePowerAbAttr {
|
||||||
|
private mult: (user: Pokemon, target: Pokemon, move: Move) => number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mult A function which takes the user, target, and move, and returns the power multiplier. 1 means no multiplier.
|
||||||
|
* @param {boolean} showAbility Whether to show the ability when it activates.
|
||||||
|
*/
|
||||||
|
constructor(mult: (user: Pokemon, target: Pokemon, move: Move) => number, showAbility: boolean = true) {
|
||||||
|
super(showAbility);
|
||||||
|
this.mult = mult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
applyPreAttack(pokemon: Pokemon, passive: boolean, defender: Pokemon, move: PokemonMove, args: any[]): boolean {
|
||||||
|
const multiplier = this.mult(pokemon, defender, move.getMove());
|
||||||
|
if (multiplier !== 1) {
|
||||||
|
(args[0] as Utils.NumberHolder).value *= multiplier;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class FieldVariableMovePowerAbAttr extends AbAttr {
|
export class FieldVariableMovePowerAbAttr extends AbAttr {
|
||||||
applyPreAttack(pokemon: Pokemon, passive: boolean, defender: Pokemon, move: PokemonMove, args: any[]): boolean {
|
applyPreAttack(pokemon: Pokemon, passive: boolean, defender: Pokemon, move: PokemonMove, args: any[]): boolean {
|
||||||
//const power = args[0] as Utils.NumberHolder;
|
//const power = args[0] as Utils.NumberHolder;
|
||||||
@ -4251,7 +4282,8 @@ export function initAbilities() {
|
|||||||
new Ability(Abilities.SHARPNESS, 9)
|
new Ability(Abilities.SHARPNESS, 9)
|
||||||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
||||||
new Ability(Abilities.SUPREME_OVERLORD, 9)
|
new Ability(Abilities.SUPREME_OVERLORD, 9)
|
||||||
.unimplemented(),
|
.attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 5))
|
||||||
|
.partial(),
|
||||||
new Ability(Abilities.COSTAR, 9)
|
new Ability(Abilities.COSTAR, 9)
|
||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new Ability(Abilities.TOXIC_DEBRIS, 9)
|
new Ability(Abilities.TOXIC_DEBRIS, 9)
|
||||||
|
@ -7508,10 +7508,7 @@ export function initMoves() {
|
|||||||
.attr(ConfuseAttr)
|
.attr(ConfuseAttr)
|
||||||
.recklessMove(),
|
.recklessMove(),
|
||||||
new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
|
||||||
.attr(MovePowerMultiplierAttr, (user, target, move) => {
|
.attr(MovePowerMultiplierAttr, (user, target, move) => 1 + Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 100))
|
||||||
return user.scene.getParty().reduce((acc, pokemonInParty) => acc + (pokemonInParty.status?.effect === StatusEffect.FAINT ? 1 : 0),
|
|
||||||
1,);
|
|
||||||
})
|
|
||||||
.makesContact(false),
|
.makesContact(false),
|
||||||
new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
||||||
.attr(StatChangeAttr, BattleStat.SPDEF, -2),
|
.attr(StatChangeAttr, BattleStat.SPDEF, -2),
|
||||||
|
@ -3491,6 +3491,13 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
doFaint(): void {
|
doFaint(): void {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
|
// Track total times pokemon have been KO'd for supreme overlord/last respects
|
||||||
|
if (pokemon.isPlayer()) {
|
||||||
|
this.scene.currentBattle.playerFaints += 1;
|
||||||
|
} else {
|
||||||
|
this.scene.currentBattle.enemyFaints += 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.scene.queueMessage(getPokemonMessage(pokemon, " fainted!"), null, true);
|
this.scene.queueMessage(getPokemonMessage(pokemon, " fainted!"), null, true);
|
||||||
|
|
||||||
if (pokemon.turnData?.attacksReceived?.length) {
|
if (pokemon.turnData?.attacksReceived?.length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user