mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-26 02:02:20 +02:00
added tera_blast changes and tests
This commit is contained in:
parent
46075a4c2b
commit
303e121d14
@ -4559,7 +4559,8 @@ export class TeraMoveCategoryAttr extends VariableMoveCategoryAttr {
|
|||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
const category = (args[0] as Utils.NumberHolder);
|
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;
|
category.value = MoveCategory.PHYSICAL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -10905,8 +10906,7 @@ export function initMoves() {
|
|||||||
.attr(TeraMoveCategoryAttr)
|
.attr(TeraMoveCategoryAttr)
|
||||||
.attr(TeraBlastTypeAttr)
|
.attr(TeraBlastTypeAttr)
|
||||||
.attr(TeraBlastPowerAttr)
|
.attr(TeraBlastPowerAttr)
|
||||||
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1, true, { condition: (user, target, move) => user.isTerastallized() && user.isOfType(Type.STELLAR) })
|
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1, true, { condition: (user, target, move) => user.isTerastallized() && user.isOfType(Type.STELLAR) }),
|
||||||
.partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */
|
|
||||||
new SelfStatusMove(Moves.SILK_TRAP, Type.BUG, -1, 10, -1, 4, 9)
|
new SelfStatusMove(Moves.SILK_TRAP, Type.BUG, -1, 10, -1, 4, 9)
|
||||||
.attr(ProtectAttr, BattlerTagType.SILK_TRAP)
|
.attr(ProtectAttr, BattlerTagType.SILK_TRAP)
|
||||||
.condition(failIfLastCondition),
|
.condition(failIfLastCondition),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { allMoves } from "#app/data/move";
|
import { allMoves, TeraMoveCategoryAttr } from "#app/data/move";
|
||||||
import { Type } from "#enums/type";
|
import { Type } from "#enums/type";
|
||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import { HitResult } from "#app/field/pokemon";
|
import { HitResult } from "#app/field/pokemon";
|
||||||
@ -14,6 +14,7 @@ describe("Moves - Tera Blast", () => {
|
|||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
const moveToCheck = allMoves[Moves.TERA_BLAST];
|
const moveToCheck = allMoves[Moves.TERA_BLAST];
|
||||||
|
const teraBlastAttr = moveToCheck.getAttrs(TeraMoveCategoryAttr)[0];
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
@ -86,19 +87,86 @@ describe("Moves - Tera Blast", () => {
|
|||||||
expect(enemyPokemon.apply).toHaveReturnedWith(HitResult.SUPER_EFFECTIVE);
|
expect(enemyPokemon.apply).toHaveReturnedWith(HitResult.SUPER_EFFECTIVE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Currently abilities are bugged and can't see when a move's category is changed
|
it("uses the higher ATK for damage calculation", async () => {
|
||||||
it.todo("uses the higher stat of the user's Atk and SpAtk for damage calculation", async () => {
|
|
||||||
game.override.enemyAbility(Abilities.TOXIC_DEBRIS);
|
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
|
|
||||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
playerPokemon.stats[Stat.ATK] = 100;
|
playerPokemon.stats[Stat.ATK] = 100;
|
||||||
playerPokemon.stats[Stat.SPATK] = 1;
|
playerPokemon.stats[Stat.SPATK] = 1;
|
||||||
|
|
||||||
|
vi.spyOn(teraBlastAttr, "apply");
|
||||||
|
|
||||||
game.move.select(Moves.TERA_BLAST);
|
game.move.select(Moves.TERA_BLAST);
|
||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.toNextTurn();
|
||||||
expect(game.scene.getEnemyPokemon()!.battleData.abilityRevealed).toBe(true);
|
expect(teraBlastAttr.apply).toHaveLastReturnedWith(true);
|
||||||
}, 20000);
|
});
|
||||||
|
|
||||||
|
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.ability(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 () => {
|
it("causes stat drops if user is Stellar tera type", async () => {
|
||||||
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
|
game.override.startingHeldItems([{ name: "TERA_SHARD", type: Type.STELLAR }]);
|
||||||
|
Loading…
Reference in New Issue
Block a user