mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 03:32:24 +02:00
added ignoreHeldItems to getEffectiveStat and added tera blast tests
This commit is contained in:
parent
5db3074e2c
commit
d5c9a02fab
@ -4544,7 +4544,7 @@ export class TeraMoveCategoryAttr extends VariableMoveCategoryAttr {
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const category = (args[0] as Utils.NumberHolder);
|
||||
|
||||
if (user.isTerastallized() && user.getEffectiveStat(Stat.ATK, target, move) > user.getEffectiveStat(Stat.SPATK, target, move)) {
|
||||
if (user.isTerastallized() && user.getEffectiveStat(Stat.ATK, target, move, true, true, false, false, true) > user.getEffectiveStat(Stat.SPATK, target, move, true, true, false, false, true)) {
|
||||
category.value = MoveCategory.PHYSICAL;
|
||||
return true;
|
||||
}
|
||||
|
@ -935,11 +935,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param ignoreOppAbility during an attack, determines whether the opposing Pokemon's abilities should be ignored during the stat calculation.
|
||||
* @param isCritical determines whether a critical hit has occurred or not (`false` by default)
|
||||
* @param simulated if `true`, nullifies any effects that produce any changes to game state from triggering
|
||||
* @param ignoreHeldItems determines whether this Pokemon's held items should be ignored during the stat calculation, default `false`
|
||||
* @returns the final in-battle value of a stat
|
||||
*/
|
||||
getEffectiveStat(stat: EffectiveStat, opponent?: Pokemon, move?: Move, ignoreAbility: boolean = false, ignoreOppAbility: boolean = false, isCritical: boolean = false, simulated: boolean = true): integer {
|
||||
getEffectiveStat(stat: EffectiveStat, opponent?: Pokemon, move?: Move, ignoreAbility: boolean = false, ignoreOppAbility: boolean = false, isCritical: boolean = false, simulated: boolean = true, ignoreHeldItems: boolean = false): integer {
|
||||
const statValue = new Utils.NumberHolder(this.getStat(stat, false));
|
||||
this.scene.applyModifiers(StatBoosterModifier, this.isPlayer(), this, stat, statValue);
|
||||
if (!ignoreHeldItems) {
|
||||
this.scene.applyModifiers(StatBoosterModifier, this.isPlayer(), this, stat, statValue);
|
||||
}
|
||||
|
||||
// The Ruin abilities here are never ignored, but they reveal themselves on summon anyway
|
||||
const fieldApplied = new Utils.BooleanHolder(false);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { allMoves, TeraMoveCategoryAttr } from "#app/data/move";
|
||||
import { Type } from "#enums/type";
|
||||
import { Abilities } from "#app/enums/abilities";
|
||||
import { HitResult } from "#app/field/pokemon";
|
||||
@ -14,6 +14,7 @@ describe("Moves - Tera Blast", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
const moveToCheck = allMoves[Moves.TERA_BLAST];
|
||||
const teraBlastAttr = moveToCheck.getAttrs(TeraMoveCategoryAttr)[0];
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
@ -86,19 +87,86 @@ describe("Moves - Tera Blast", () => {
|
||||
expect(enemyPokemon.apply).toHaveReturnedWith(HitResult.SUPER_EFFECTIVE);
|
||||
});
|
||||
|
||||
// Currently abilities are bugged and can't see when a move's category is changed
|
||||
it.skip("uses the higher stat of the user's Atk and SpAtk for damage calculation", async () => {
|
||||
game.override.enemyAbility(Abilities.TOXIC_DEBRIS);
|
||||
it("uses the higher ATK for damage calculation", async () => {
|
||||
await game.startBattle();
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
playerPokemon.stats[Stat.ATK] = 100;
|
||||
playerPokemon.stats[Stat.SPATK] = 1;
|
||||
|
||||
vi.spyOn(teraBlastAttr, "apply");
|
||||
|
||||
game.move.select(Moves.TERA_BLAST);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(game.scene.getEnemyPokemon()!.battleData.abilityRevealed).toBe(true);
|
||||
}, 20000);
|
||||
await game.toNextTurn();
|
||||
expect(teraBlastAttr.apply).toHaveLastReturnedWith(true);
|
||||
});
|
||||
|
||||
it("uses the higher SPATK for damage calculation", async () => {
|
||||
await game.startBattle();
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
playerPokemon.stats[Stat.ATK] = 1;
|
||||
playerPokemon.stats[Stat.SPATK] = 100;
|
||||
|
||||
vi.spyOn(teraBlastAttr, "apply");
|
||||
|
||||
game.move.select(Moves.TERA_BLAST);
|
||||
await game.toNextTurn();
|
||||
expect(teraBlastAttr.apply).toHaveLastReturnedWith(false);
|
||||
});
|
||||
|
||||
it("should stay as a special move if ATK turns lower than SPATK mid-turn", async () => {
|
||||
game.override.enemyMoveset([ Moves.CHARM ]);
|
||||
await game.startBattle();
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
playerPokemon.stats[Stat.ATK] = 51;
|
||||
playerPokemon.stats[Stat.SPATK] = 50;
|
||||
|
||||
vi.spyOn(teraBlastAttr, "apply");
|
||||
|
||||
game.move.select(Moves.TERA_BLAST);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.toNextTurn();
|
||||
expect(teraBlastAttr.apply).toHaveLastReturnedWith(false);
|
||||
});
|
||||
|
||||
it("does not change its move category from stat changes due to held items", async () => {
|
||||
game.override
|
||||
.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }])
|
||||
.starterSpecies(Species.CUBONE);
|
||||
await game.startBattle();
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
playerPokemon.stats[Stat.ATK] = 50;
|
||||
playerPokemon.stats[Stat.SPATK] = 51;
|
||||
|
||||
vi.spyOn(teraBlastAttr, "apply");
|
||||
|
||||
game.move.select(Moves.TERA_BLAST);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(teraBlastAttr.apply).toHaveLastReturnedWith(false);
|
||||
});
|
||||
|
||||
it("does not change its move category from stat changes due to abilities", async () => {
|
||||
game.override.enemyAbility(Abilities.HUGE_POWER);
|
||||
await game.startBattle();
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
playerPokemon.stats[Stat.ATK] = 50;
|
||||
playerPokemon.stats[Stat.SPATK] = 51;
|
||||
|
||||
vi.spyOn(teraBlastAttr, "apply");
|
||||
|
||||
game.move.select(Moves.TERA_BLAST);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.toNextTurn();
|
||||
expect(teraBlastAttr.apply).toHaveLastReturnedWith(false);
|
||||
});
|
||||
|
||||
|
||||
it("causes stat drops if user is Stellar tera type", async () => {
|
||||
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
|
||||
|
Loading…
Reference in New Issue
Block a user