Skip to content

Commit ce98794

Browse files
committed
AI test and bug fix
1 parent 62fb047 commit ce98794

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/field/pokemon.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3740,7 +3740,7 @@ export class EnemyPokemon extends Pokemon {
37403740
if ((move.name.endsWith(" (N)") || !move.applyConditions(this, target, move)) && ![Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP].includes(move.id)) {
37413741
targetScore = -20;
37423742
} else if (move instanceof AttackMove) {
3743-
const effectiveness = target.getAttackMoveEffectiveness(this, pokemonMove, true);
3743+
const effectiveness = target.getAttackMoveEffectiveness(this, pokemonMove, false, true);
37443744
if (target.isPlayer() !== this.isPlayer()) {
37453745
targetScore *= effectiveness;
37463746
if (this.isOfType(move.type)) {

src/test/abilities/illusion.test.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
22
import Phaser from "phaser";
33
import GameManager from "#app/test/utils/gameManager";
4-
import * as overrides from "#app/overrides";
4+
import overrides from "#app/overrides";
55
import { Species } from "#enums/species";
66
import {
77
TurnEndPhase,
@@ -60,4 +60,17 @@ describe("Abilities - Illusion", () => {
6060
expect(zorua.illusion.active).equals(false);
6161
expect(zoroark.illusion.active).equals(false);
6262
});
63+
64+
it("trick the enemy", async () => {
65+
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE]);
66+
await game.startBattle([Species.ZOROARK, Species.AXEW]);
67+
68+
const enemy = game.scene.getEnemyPokemon();
69+
const zoroark = game.scene.getPlayerPokemon();
70+
71+
const flameThwowerEffectiveness = zoroark.getAttackMoveEffectiveness(enemy, enemy.getMoveset()[0], false, true);
72+
const psychicEffectiveness = zoroark.getAttackMoveEffectiveness(enemy, enemy.getMoveset()[1], false, true);
73+
74+
expect(psychicEffectiveness).above(flameThwowerEffectiveness);
75+
});
6376
});

0 commit comments

Comments
 (0)