Skip to content

Commit

Permalink
[Bug][Hotfix] Fix fusion with dual type + monotype with shared primar…
Browse files Browse the repository at this point in the history
…y type. (#5322)

* Fix fusion with dual type + monotype with shared primary type.

* Update version number

* Add test case
  • Loading branch information
Xavion3 authored Feb 14, 2025
1 parent 727bf0d commit 77fbcc7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.6.2",
"version": "1.6.3",
"type": "module",
"scripts": {
"start": "vite",
Expand Down
6 changes: 6 additions & 0 deletions src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} else if (fusionType1 !== types[0]) {
secondType = fusionType1;
}


if (secondType === Type.UNKNOWN && Utils.isNullOrUndefined(fusionType2)) { // If second pokemon was monotype and shared its primary type
secondType = (customTypes && this.customPokemonData.types.length > 1 && this.customPokemonData.types[1] !== Type.UNKNOWN)
? this.customPokemonData.types[1] : (speciesForm.type2 ?? Type.UNKNOWN);
}
} else {
// If not a fusion, just get the second type from the species, checking for permanent changes from ME
secondType = (customTypes && this.customPokemonData.types.length > 1 && this.customPokemonData.types[1] !== Type.UNKNOWN)
Expand Down
11 changes: 11 additions & 0 deletions src/test/field/pokemon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ describe("Spec - Pokemon", () => {
expect(types[1]).toBe(Type.DARK);
});

it("Fusing mons with two and one types", async () => {
game.override.starterSpecies(Species.NUMEL);
game.override.starterFusionSpecies(Species.CHARMANDER);
await game.classicMode.startBattle();
const pokemon = scene.getPlayerParty()[0];

const types = pokemon.getTypes();
expect(types[0]).toBe(Type.FIRE);
expect(types[1]).toBe(Type.GROUND);
});

it("Fusing two mons with two types", async () => {
game.override.starterSpecies(Species.NATU);
game.override.starterFusionSpecies(Species.HOUNDOUR);
Expand Down

0 comments on commit 77fbcc7

Please sign in to comment.