mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-08 09:15:44 +00:00
Merge branch 'beta' into sheerForceImp
This commit is contained in:
commit
82454d2ef1
@ -2622,6 +2622,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const fixedDamage = new Utils.IntegerHolder(0);
|
const fixedDamage = new Utils.IntegerHolder(0);
|
||||||
applyMoveAttrs(FixedDamageAttr, source, this, move, fixedDamage);
|
applyMoveAttrs(FixedDamageAttr, source, this, move, fixedDamage);
|
||||||
if (fixedDamage.value) {
|
if (fixedDamage.value) {
|
||||||
|
const multiLensMultiplier = new Utils.NumberHolder(1);
|
||||||
|
source.scene.applyModifiers(PokemonMultiHitModifier, source.isPlayer(), source, move.id, null, multiLensMultiplier);
|
||||||
|
fixedDamage.value = Utils.toDmgValue(fixedDamage.value * multiLensMultiplier.value);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cancelled: false,
|
cancelled: false,
|
||||||
result: HitResult.EFFECTIVE,
|
result: HitResult.EFFECTIVE,
|
||||||
|
@ -2757,10 +2757,18 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
|||||||
* Additional strikes beyond that are given a 0.25x damage multiplier
|
* Additional strikes beyond that are given a 0.25x damage multiplier
|
||||||
*/
|
*/
|
||||||
private applyDamageModifier(pokemon: Pokemon, damageMultiplier: NumberHolder): boolean {
|
private applyDamageModifier(pokemon: Pokemon, damageMultiplier: NumberHolder): boolean {
|
||||||
damageMultiplier.value = (pokemon.turnData.hitsLeft === pokemon.turnData.hitCount)
|
if (pokemon.turnData.hitsLeft === pokemon.turnData.hitCount) {
|
||||||
? (1 - (0.25 * this.getStackCount()))
|
// Reduce first hit by 25% for each stack count
|
||||||
: 0.25;
|
damageMultiplier.value *= 1 - 0.25 * this.getStackCount();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (pokemon.turnData.hitCount - pokemon.turnData.hitsLeft !== this.getStackCount() + 1) {
|
||||||
|
// Deal 25% damage for each remaining Multi Lens hit
|
||||||
|
damageMultiplier.value *= 0.25;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// An extra hit not caused by Multi Lens -- assume it is Parental Bond
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxHeldItemCount(pokemon: Pokemon): number {
|
getMaxHeldItemCount(pokemon: Pokemon): number {
|
||||||
|
@ -129,7 +129,7 @@ class SessionVersionConverter extends VersionConverter {
|
|||||||
|
|
||||||
if (curMajor === 1) {
|
if (curMajor === 1) {
|
||||||
if (curMinor === 0) {
|
if (curMinor === 0) {
|
||||||
if (curPatch <= 4) {
|
if (curPatch <= 5) {
|
||||||
console.log("Applying v1.0.4 session data migration!");
|
console.log("Applying v1.0.4 session data migration!");
|
||||||
this.callMigrators(data, v1_0_4.sessionMigrators);
|
this.callMigrators(data, v1_0_4.sessionMigrators);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { SettingKeys } from "#app/system/settings/settings";
|
import { SettingKeys } from "#app/system/settings/settings";
|
||||||
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "#app/system/game-data";
|
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "#app/system/game-data";
|
||||||
import { allSpecies } from "#app/data/pokemon-species";
|
import { allSpecies } from "#app/data/pokemon-species";
|
||||||
|
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||||
import { isNullOrUndefined } from "#app/utils";
|
import { isNullOrUndefined } from "#app/utils";
|
||||||
|
|
||||||
export const systemMigrators = [
|
export const systemMigrators = [
|
||||||
@ -134,5 +135,28 @@ export const sessionMigrators = [
|
|||||||
m.className = "ResetNegativeStatStageModifier";
|
m.className = "ResetNegativeStatStageModifier";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Converts old Pokemon natureOverride and mysteryEncounterData
|
||||||
|
* to use the new conjoined {@linkcode Pokemon.customPokemonData} structure instead.
|
||||||
|
* @param data {@linkcode SessionSaveData}
|
||||||
|
*/
|
||||||
|
function migrateCustomPokemonDataAndNatureOverrides(data: SessionSaveData) {
|
||||||
|
// Fix Pokemon nature overrides and custom data migration
|
||||||
|
data.party.forEach(pokemon => {
|
||||||
|
if (pokemon["mysteryEncounterPokemonData"]) {
|
||||||
|
pokemon.customPokemonData = new CustomPokemonData(pokemon["mysteryEncounterPokemonData"]);
|
||||||
|
pokemon["mysteryEncounterPokemonData"] = null;
|
||||||
|
}
|
||||||
|
if (pokemon["fusionMysteryEncounterPokemonData"]) {
|
||||||
|
pokemon.fusionCustomPokemonData = new CustomPokemonData(pokemon["fusionMysteryEncounterPokemonData"]);
|
||||||
|
pokemon["fusionMysteryEncounterPokemonData"] = null;
|
||||||
|
}
|
||||||
|
pokemon.customPokemonData = pokemon.customPokemonData ?? new CustomPokemonData();
|
||||||
|
if (!isNullOrUndefined(pokemon["natureOverride"]) && pokemon["natureOverride"] >= 0) {
|
||||||
|
pokemon.customPokemonData.nature = pokemon["natureOverride"];
|
||||||
|
pokemon["natureOverride"] = -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
] as const;
|
] as const;
|
||||||
|
@ -1,32 +1,5 @@
|
|||||||
import { SessionSaveData } from "../../game-data";
|
|
||||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
|
||||||
|
|
||||||
export const systemMigrators = [] as const;
|
export const systemMigrators = [] as const;
|
||||||
|
|
||||||
export const settingsMigrators = [] as const;
|
export const settingsMigrators = [] as const;
|
||||||
|
|
||||||
export const sessionMigrators = [
|
export const sessionMigrators = [] as const;
|
||||||
/**
|
|
||||||
* Converts old Pokemon natureOverride and mysteryEncounterData
|
|
||||||
* to use the new conjoined {@linkcode Pokemon.customPokemonData} structure instead.
|
|
||||||
* @param data {@linkcode SessionSaveData}
|
|
||||||
*/
|
|
||||||
function migrateCustomPokemonDataAndNatureOverrides(data: SessionSaveData) {
|
|
||||||
// Fix Pokemon nature overrides and custom data migration
|
|
||||||
data.party.forEach(pokemon => {
|
|
||||||
if (pokemon["mysteryEncounterPokemonData"]) {
|
|
||||||
pokemon.customPokemonData = new CustomPokemonData(pokemon["mysteryEncounterPokemonData"]);
|
|
||||||
pokemon["mysteryEncounterPokemonData"] = null;
|
|
||||||
}
|
|
||||||
if (pokemon["fusionMysteryEncounterPokemonData"]) {
|
|
||||||
pokemon.fusionCustomPokemonData = new CustomPokemonData(pokemon["fusionMysteryEncounterPokemonData"]);
|
|
||||||
pokemon["fusionMysteryEncounterPokemonData"] = null;
|
|
||||||
}
|
|
||||||
pokemon.customPokemonData = pokemon.customPokemonData ?? new CustomPokemonData();
|
|
||||||
if (pokemon["natureOverride"] && pokemon["natureOverride"] >= 0) {
|
|
||||||
pokemon.customPokemonData.nature = pokemon["natureOverride"];
|
|
||||||
pokemon["natureOverride"] = -1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
] as const;
|
|
||||||
|
@ -313,7 +313,7 @@ describe("Abilities - Parental Bond", () => {
|
|||||||
|
|
||||||
await game.phaseInterceptor.to("MoveEndPhase", false);
|
await game.phaseInterceptor.to("MoveEndPhase", false);
|
||||||
|
|
||||||
expect(enemyPokemon.hp).toBe(enemyStartingHp - 300);
|
expect(enemyPokemon.hp).toBe(enemyStartingHp - 200);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ describe("Items - Multi Lens", () => {
|
|||||||
.enemySpecies(Species.SNORLAX)
|
.enemySpecies(Species.SNORLAX)
|
||||||
.enemyAbility(Abilities.BALL_FETCH)
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
.enemyMoveset(Moves.SPLASH)
|
.enemyMoveset(Moves.SPLASH)
|
||||||
.startingLevel(100)
|
.startingLevel(99) // Check for proper rounding on Seismic Toss damage reduction
|
||||||
.enemyLevel(100);
|
.enemyLevel(99);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
@ -114,4 +114,25 @@ describe("Items - Multi Lens", () => {
|
|||||||
|
|
||||||
expect(magikarp.turnData.hitCount).toBe(2);
|
expect(magikarp.turnData.hitCount).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should enhance fixed-damage moves while also applying damage reduction", async () => {
|
||||||
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }])
|
||||||
|
.moveset(Moves.SEISMIC_TOSS);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
const spy = vi.spyOn(enemyPokemon, "getAttackDamage");
|
||||||
|
|
||||||
|
game.move.select(Moves.SEISMIC_TOSS);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
const damageResults = spy.mock.results.map(result => result.value?.damage);
|
||||||
|
|
||||||
|
expect(damageResults).toHaveLength(2);
|
||||||
|
expect(damageResults[0]).toBe(Math.floor(playerPokemon.level * 0.75));
|
||||||
|
expect(damageResults[1]).toBe(Math.floor(playerPokemon.level * 0.25));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user