mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Merge branch 'beta' into candy-friendship-changes
This commit is contained in:
commit
05398cb85b
@ -3008,7 +3008,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateAchv(achv: Achv, args?: unknown[]): boolean {
|
validateAchv(achv: Achv, args?: unknown[]): boolean {
|
||||||
if (!this.gameData.achvUnlocks.hasOwnProperty(achv.id) && achv.validate(this, args)) {
|
if ((!this.gameData.achvUnlocks.hasOwnProperty(achv.id) || Overrides.ACHIEVEMENTS_REUNLOCK_OVERRIDE)
|
||||||
|
&& achv.validate(this, args)) {
|
||||||
this.gameData.achvUnlocks[achv.id] = new Date().getTime();
|
this.gameData.achvUnlocks[achv.id] = new Date().getTime();
|
||||||
this.ui.achvBar.showAchv(achv);
|
this.ui.achvBar.showAchv(achv);
|
||||||
if (vouchers.hasOwnProperty(achv.id)) {
|
if (vouchers.hasOwnProperty(achv.id)) {
|
||||||
|
@ -5779,9 +5779,10 @@ export function initAbilities() {
|
|||||||
.attr(WonderSkinAbAttr)
|
.attr(WonderSkinAbAttr)
|
||||||
.ignorable(),
|
.ignorable(),
|
||||||
new Ability(Abilities.ANALYTIC, 5)
|
new Ability(Abilities.ANALYTIC, 5)
|
||||||
.attr(MovePowerBoostAbAttr, (user, target, move) =>
|
.attr(MovePowerBoostAbAttr, (user, target, move) => {
|
||||||
!!target?.getLastXMoves(1).find(m => m.turn === target?.scene.currentBattle.turn)
|
const movePhase = user?.scene.findPhase((phase) => phase instanceof MovePhase && phase.pokemon.id !== user.id);
|
||||||
|| user?.scene.currentBattle.turnCommands[target?.getBattlerIndex() ?? BattlerIndex.ATTACKER]?.command !== Command.FIGHT, 1.3),
|
return Utils.isNullOrUndefined(movePhase);
|
||||||
|
}, 1.3),
|
||||||
new Ability(Abilities.ILLUSION, 5)
|
new Ability(Abilities.ILLUSION, 5)
|
||||||
.attr(UncopiableAbilityAbAttr)
|
.attr(UncopiableAbilityAbAttr)
|
||||||
.attr(UnswappableAbilityAbAttr)
|
.attr(UnswappableAbilityAbAttr)
|
||||||
|
@ -10554,6 +10554,7 @@ export function initMoves() {
|
|||||||
new AttackMove(Moves.TWIN_BEAM, Type.PSYCHIC, MoveCategory.SPECIAL, 40, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.TWIN_BEAM, Type.PSYCHIC, MoveCategory.SPECIAL, 40, 100, 10, -1, 0, 9)
|
||||||
.attr(MultiHitAttr, MultiHitType._2),
|
.attr(MultiHitAttr, MultiHitType._2),
|
||||||
new AttackMove(Moves.RAGE_FIST, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.RAGE_FIST, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
|
||||||
|
.partial() // Counter resets every wave instead of on arena reset
|
||||||
.attr(HitCountPowerAttr)
|
.attr(HitCountPowerAttr)
|
||||||
.punchingMove(),
|
.punchingMove(),
|
||||||
new AttackMove(Moves.ARMOR_CANNON, Type.FIRE, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9)
|
new AttackMove(Moves.ARMOR_CANNON, Type.FIRE, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9)
|
||||||
|
@ -21,7 +21,6 @@ import { EggSourceType } from "#enums/egg-source-types";
|
|||||||
import { EggTier } from "#enums/egg-type";
|
import { EggTier } from "#enums/egg-type";
|
||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { achvs } from "#app/system/achv";
|
|
||||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||||
import { Type } from "#enums/type";
|
import { Type } from "#enums/type";
|
||||||
import { getPokeballTintColor } from "#app/data/pokeball";
|
import { getPokeballTintColor } from "#app/data/pokeball";
|
||||||
@ -520,12 +519,6 @@ function removePokemonFromPartyAndStoreHeldItems(scene: BattleScene, encounter:
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAchievement(scene: BattleScene) {
|
|
||||||
if (scene.arena.biomeType === Biome.SPACE) {
|
|
||||||
scene.validateAchv(achvs.BREEDERS_IN_SPACE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function restorePartyAndHeldItems(scene: BattleScene) {
|
function restorePartyAndHeldItems(scene: BattleScene) {
|
||||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||||
// Restore original party
|
// Restore original party
|
||||||
@ -617,8 +610,6 @@ function onGameOver(scene: BattleScene) {
|
|||||||
function doPostEncounterCleanup(scene: BattleScene) {
|
function doPostEncounterCleanup(scene: BattleScene) {
|
||||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||||
if (!encounter.misc.encounterFailed) {
|
if (!encounter.misc.encounterFailed) {
|
||||||
// Give achievement if in Space biome
|
|
||||||
checkAchievement(scene);
|
|
||||||
// Give 20 friendship to the chosen pokemon
|
// Give 20 friendship to the chosen pokemon
|
||||||
encounter.misc.chosenPokemon.addFriendship(FRIENDSHIP_ADDED);
|
encounter.misc.chosenPokemon.addFriendship(FRIENDSHIP_ADDED);
|
||||||
restorePartyAndHeldItems(scene);
|
restorePartyAndHeldItems(scene);
|
||||||
|
@ -86,6 +86,8 @@ class DefaultOverrides {
|
|||||||
readonly ITEM_UNLOCK_OVERRIDE: Unlockables[] = [];
|
readonly ITEM_UNLOCK_OVERRIDE: Unlockables[] = [];
|
||||||
/** Set to `true` to show all tutorials */
|
/** Set to `true` to show all tutorials */
|
||||||
readonly BYPASS_TUTORIAL_SKIP_OVERRIDE: boolean = false;
|
readonly BYPASS_TUTORIAL_SKIP_OVERRIDE: boolean = false;
|
||||||
|
/** Set to `true` to be able to re-earn already unlocked achievements */
|
||||||
|
readonly ACHIEVEMENTS_REUNLOCK_OVERRIDE: boolean = false;
|
||||||
/** Set to `true` to force Paralysis and Freeze to always activate, or `false` to force them to not activate */
|
/** Set to `true` to force Paralysis and Freeze to always activate, or `false` to force them to not activate */
|
||||||
readonly STATUS_ACTIVATION_OVERRIDE: boolean | null = null;
|
readonly STATUS_ACTIVATION_OVERRIDE: boolean | null = null;
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ import { BattlePhase } from "./battle-phase";
|
|||||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||||
import { MoneyRewardPhase } from "./money-reward-phase";
|
import { MoneyRewardPhase } from "./money-reward-phase";
|
||||||
import { TrainerSlot } from "#app/data/trainer-config";
|
import { TrainerSlot } from "#app/data/trainer-config";
|
||||||
|
import { Biome } from "#app/enums/biome";
|
||||||
|
import { achvs } from "#app/system/achv";
|
||||||
|
|
||||||
export class TrainerVictoryPhase extends BattlePhase {
|
export class TrainerVictoryPhase extends BattlePhase {
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
@ -34,11 +36,17 @@ export class TrainerVictoryPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const trainerType = this.scene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct?
|
const trainerType = this.scene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct?
|
||||||
|
// Validate Voucher for boss trainers
|
||||||
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
|
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
|
||||||
if (!this.scene.validateVoucher(vouchers[TrainerType[trainerType]]) && this.scene.currentBattle.trainer?.config.isBoss) {
|
if (!this.scene.validateVoucher(vouchers[TrainerType[trainerType]]) && this.scene.currentBattle.trainer?.config.isBoss) {
|
||||||
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Breeders in Space achievement
|
||||||
|
if (this.scene.arena.biomeType === Biome.SPACE
|
||||||
|
&& (trainerType === TrainerType.BREEDER || trainerType === TrainerType.EXPERT_POKEMON_BREEDER)) {
|
||||||
|
this.scene.validateAchv(achvs.BREEDERS_IN_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer?.getName(TrainerSlot.NONE, true) }), null, () => {
|
||||||
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
const victoryMessages = this.scene.currentBattle.trainer?.getVictoryMessages()!; // TODO: is this bang correct?
|
||||||
|
@ -358,7 +358,7 @@ export const achvs = {
|
|||||||
MONO_FAIRY: new ChallengeAchv("MONO_FAIRY", "", "MONO_FAIRY.description", "fairy_feather", 100, (c, scene) => c instanceof SingleTypeChallenge && c.value === 18 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
MONO_FAIRY: new ChallengeAchv("MONO_FAIRY", "", "MONO_FAIRY.description", "fairy_feather", 100, (c, scene) => c instanceof SingleTypeChallenge && c.value === 18 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
||||||
FRESH_START: new ChallengeAchv("FRESH_START", "", "FRESH_START.description", "reviver_seed", 100, (c, scene) => c instanceof FreshStartChallenge && c.value > 0 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
FRESH_START: new ChallengeAchv("FRESH_START", "", "FRESH_START.description", "reviver_seed", 100, (c, scene) => c instanceof FreshStartChallenge && c.value > 0 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
||||||
INVERSE_BATTLE: new ChallengeAchv("INVERSE_BATTLE", "", "INVERSE_BATTLE.description", "inverse", 100, c => c instanceof InverseBattleChallenge && c.value > 0),
|
INVERSE_BATTLE: new ChallengeAchv("INVERSE_BATTLE", "", "INVERSE_BATTLE.description", "inverse", 100, c => c instanceof InverseBattleChallenge && c.value > 0),
|
||||||
BREEDERS_IN_SPACE: new Achv("BREEDERS_IN_SPACE", "", "BREEDERS_IN_SPACE.description", "moon_stone", 100).setSecret(),
|
BREEDERS_IN_SPACE: new Achv("BREEDERS_IN_SPACE", "", "BREEDERS_IN_SPACE.description", "moon_stone", 50).setSecret(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export function initAchievements() {
|
export function initAchievements() {
|
||||||
|
81
src/test/abilities/analytic.test.ts
Normal file
81
src/test/abilities/analytic.test.ts
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { isBetween, toDmgValue } from "#app/utils";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Analytic", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.SPLASH, Moves.TACKLE ])
|
||||||
|
.ability(Abilities.ANALYTIC)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.startingLevel(200)
|
||||||
|
.enemyLevel(200)
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should increase damage if the user moves last", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.ARCEUS ]);
|
||||||
|
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
const damage1 = enemy.getInverseHp();
|
||||||
|
enemy.hp = enemy.getMaxHp();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(isBetween(enemy.getInverseHp(), toDmgValue(damage1 * 1.3) - 3, toDmgValue(damage1 * 1.3) + 3)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should increase damage only if the user moves last in doubles", async () => {
|
||||||
|
game.override.battleType("double");
|
||||||
|
await game.classicMode.startBattle([ Species.GENGAR, Species.SHUCKLE ]);
|
||||||
|
|
||||||
|
const [ enemy, ] = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE, 0, BattlerIndex.ENEMY);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
const damage1 = enemy.getInverseHp();
|
||||||
|
enemy.hp = enemy.getMaxHp();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE, 0, BattlerIndex.ENEMY);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(isBetween(enemy.getInverseHp(), toDmgValue(damage1 * 1.3) - 3, toDmgValue(damage1 * 1.3) + 3)).toBe(true);
|
||||||
|
enemy.hp = enemy.getMaxHp();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE, 0, BattlerIndex.ENEMY);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(enemy.getInverseHp()).toBe(damage1);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user