[Bug][Hotfix] Fix fusion with dual type + monotype with shared primary type. ()

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

* Update version number

* Add test case
This commit is contained in:
Xavion3 2025-02-14 18:40:13 +11:00 committed by GitHub
parent 727bf0d74d
commit 77fbcc70ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 3 deletions

4
package-lock.json generated

@ -1,12 +1,12 @@
{ {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.6.2", "version": "1.6.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.5.4", "version": "1.6.3",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@material/material-color-utilities": "^0.2.7", "@material/material-color-utilities": "^0.2.7",

@ -1,7 +1,7 @@
{ {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"private": true, "private": true,
"version": "1.6.2", "version": "1.6.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "vite", "start": "vite",

@ -1322,6 +1322,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} else if (fusionType1 !== types[0]) { } else if (fusionType1 !== types[0]) {
secondType = fusionType1; 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 { } else {
// If not a fusion, just get the second type from the species, checking for permanent changes from ME // 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) secondType = (customTypes && this.customPokemonData.types.length > 1 && this.customPokemonData.types[1] !== Type.UNKNOWN)

@ -150,6 +150,17 @@ describe("Spec - Pokemon", () => {
expect(types[1]).toBe(Type.DARK); 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 () => { it("Fusing two mons with two types", async () => {
game.override.starterSpecies(Species.NATU); game.override.starterSpecies(Species.NATU);
game.override.starterFusionSpecies(Species.HOUNDOUR); game.override.starterFusionSpecies(Species.HOUNDOUR);