[Move] Some more implementation for Tera Blast (#3469)

* terablast updated

* terablast update

* terablast

* fix trailing spaces

* fixed misspelling in a comment

* split tera blast dmg calc and type calc into different classes

* terablastpowerattr update

removed dupe code and added user terastallized check to conditional

* Update src/data/move.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/data/move.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* removed spaces and added missing semicolon

* added tsdocs for tera blast

* deleted extra spaces

* tsdoc update

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* tsdoc update

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* tsdoc update

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Add files via upload

* Update src/test/moves/tera_blast.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/tera_blast.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/tera_blast.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/tera_blast.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/tera_blast.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* remove trailing spaces

* The style police are here

* Fixed conflict resolution issues

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
Co-authored-by: innerthunder <brandonerickson98@gmail.com>
This commit is contained in:
cgyu7 2024-08-21 18:33:33 -05:00 committed by GitHub
parent 0241a0a086
commit 1487d7f51c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 156 additions and 1 deletions

View File

@ -3784,6 +3784,30 @@ export class TeraBlastCategoryAttr extends VariableMoveCategoryAttr {
}
}
/**
* Increases the power of Tera Blast if the user is Terastallized into Stellar type
* @extends VariablePowerAttr
*/
export class TeraBlastPowerAttr extends VariablePowerAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
/**
* @param user {@linkcode Pokemon} Pokemon using the move
* @param target {@linkcode Pokemon} N/A
* @param move {@linkcode Move} {@linkcode Move.TERA_BLAST}
* @param {any[]} args N/A
* @returns true or false
*/
const power = args[0] as Utils.NumberHolder;
if (user.isTerastallized() && move.type === Type.STELLAR) {
//200 instead of 100 to reflect lack of stellar being 2x dmg on any type
power.value = 200;
return true;
}
return false;
}
}
/**
* Change the move category to status when used on the ally
* @extends VariableMoveCategoryAttr
@ -4037,6 +4061,28 @@ export class HiddenPowerTypeAttr extends VariableMoveTypeAttr {
}
}
/**
* Changes the type of Tera Blast to match the user's tera type
* @extends VariableMoveTypeAttr
*/
export class TeraBlastTypeAttr extends VariableMoveTypeAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
/**
* @param user {@linkcode Pokemon} the user's type is checked
* @param target {@linkcode Pokemon} N/A
* @param move {@linkcode Move} {@linkcode Move.TeraBlastTypeAttr}
* @param {any[]} args N/A
* @returns true or false
*/
if (user.isTerastallized()) {
move.type = user.getTeraType(); //changes move type to tera type
return true;
}
return false;
}
}
export class MatchUserTypeAttr extends VariableMoveTypeAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const userTypes = user.getTypes(true);
@ -8791,7 +8837,10 @@ export function initMoves() {
End Unused */
new AttackMove(Moves.TERA_BLAST, Type.NORMAL, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9)
.attr(TeraBlastCategoryAttr)
.unimplemented(),
.attr(TeraBlastTypeAttr)
.attr(TeraBlastPowerAttr)
.attr(StatChangeAttr, [ BattleStat.ATK, BattleStat.SPATK ], -1, true, (user, target, move) => user.isTerastallized() && user.isOfType(Type.STELLAR))
.partial(),
new SelfStatusMove(Moves.SILK_TRAP, Type.BUG, -1, 10, -1, 4, 9)
.attr(ProtectAttr, BattlerTagType.SILK_TRAP),
new AttackMove(Moves.AXE_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, 120, 90, 10, 30, 0, 9)

View File

@ -0,0 +1,106 @@
import { allMoves } from "#app/data/move";
import GameManager from "#test/utils/gameManager";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { Abilities } from "#app/enums/abilities";
import { SPLASH_ONLY } from "../utils/testUtils";
import { Type } from "#app/data/type";
import { getMovePosition } from "../utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat";
import { Stat } from "#app/enums/stat";
import { BattlerIndex } from "#app/battle";
import { HitResult } from "#app/field/pokemon";
describe("Moves - Tera Blast", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const moveToCheck = allMoves[Moves.TERA_BLAST];
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("single")
.disableCrits()
.starterSpecies(Species.FEEBAS)
.moveset([Moves.TERA_BLAST])
.ability(Abilities.BALL_FETCH)
.startingHeldItems([{name: "TERA_SHARD", type: Type.FIRE}])
.enemySpecies(Species.MAGIKARP)
.enemyMoveset(SPLASH_ONLY)
.enemyAbility(Abilities.BALL_FETCH)
.enemyLevel(20);
vi.spyOn(moveToCheck, "calculateBattlePower");
});
it("changes type to match user's tera type", async() => {
game.override
.enemySpecies(Species.FURRET)
.startingHeldItems([{name: "TERA_SHARD", type: Type.FIGHTING}]);
await game.startBattle();
const enemyPokemon = game.scene.getEnemyPokemon()!;
vi.spyOn(enemyPokemon, "apply");
game.doAttack(getMovePosition(game.scene, 0, Moves.TERA_BLAST));
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(enemyPokemon.apply).toHaveReturnedWith(HitResult.SUPER_EFFECTIVE);
}, 20000);
it("increases power if user is Stellar tera type", async() => {
game.override.startingHeldItems([{name: "TERA_SHARD", type: Type.STELLAR}]);
const stellarTypeMultiplier = 2;
const stellarTypeDmgBonus = 20;
const basePower = moveToCheck.power;
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.TERA_BLAST));
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith((basePower + stellarTypeDmgBonus) * stellarTypeMultiplier);
}, 20000);
// 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);
await game.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
playerPokemon.stats[Stat.ATK] = 100;
playerPokemon.stats[Stat.SPATK] = 1;
game.doAttack(getMovePosition(game.scene, 0, Moves.TERA_BLAST));
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getEnemyPokemon()!.battleData.abilityRevealed).toBe(true);
}, 20000);
it("causes stat drops if user is Stellar tera type", async() => {
game.override.startingHeldItems([{name: "TERA_SHARD", type: Type.STELLAR}]);
await game.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.TERA_BLAST));
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("MoveEndPhase");
expect(playerPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(-1);
expect(playerPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, 20000);
});