mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Fixed embarassing bug thing
This commit is contained in:
parent
6605ffc2aa
commit
52c9e4717c
@ -2624,13 +2624,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
if (fixedDamage.value) {
|
||||
const lensCount = source.getHeldItems().find(i => i instanceof PokemonMultiHitModifier)?.getStackCount() ?? 0;
|
||||
// Apply damage fixing for hp cutting moves on multi lens hits (NOT PARENTAL BOND)
|
||||
if (move.hasAttr(TargetHalfHpDamageAttr)
|
||||
if (lensCount > 0
|
||||
&& move.hasAttr(TargetHalfHpDamageAttr)
|
||||
&& (source.turnData.hitCount === source.turnData.hitsLeft
|
||||
|| source.turnData.hitCount - source.turnData.hitsLeft !== lensCount + 1)) {
|
||||
// Do some unholy math to make the moves' damage values add up to 50%
|
||||
// Values obtained courtesy of WolframAlpha and Desmos Graphing Calculator
|
||||
// (https://www.desmos.com/calculator/wdngrksdfz)
|
||||
let damageMulti = 0;
|
||||
let damageMulti = 1;
|
||||
// NOTE: If multi lens ever gets updated (again) this switch case will NEED to be updated alongside it!
|
||||
switch (lensCount) {
|
||||
case 1:
|
||||
@ -2639,8 +2640,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
case 2:
|
||||
damageMulti = 0.60875846088;
|
||||
break;
|
||||
case 3:
|
||||
damageMulti = 0.636414338985;
|
||||
default:
|
||||
damageMulti = 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,26 +170,8 @@ describe("Items - Multi Lens", () => {
|
||||
await game.phaseInterceptor.to("MoveEndPhase");
|
||||
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.5, 8); // unrealistically high level of precision
|
||||
});
|
||||
|
||||
it("should result in correct damage for hp% attacks with 3 lenses", async () => {
|
||||
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 3 }])
|
||||
.moveset(Moves.SUPER_FANG)
|
||||
.ability(Abilities.COMPOUND_EYES)
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.enemyLevel(100000)
|
||||
.enemySpecies(Species.BLISSEY); // allows for unrealistically high levels of accuracy
|
||||
|
||||
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
||||
game.move.select(Moves.SUPER_FANG);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("MoveEndPhase");
|
||||
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.5, 8);
|
||||
});
|
||||
it("should result in correct damage for hp% attacks with 3 lenses + Parental Bond", async () => {
|
||||
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 3 },
|
||||
it("should result in correct damage for hp% attacks with 2 lenses + Parental Bond", async () => {
|
||||
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 },
|
||||
{ name: "WIDE_LENS", count: 2 }]) // ensures move always hits
|
||||
.moveset(Moves.SUPER_FANG)
|
||||
.ability(Abilities.PARENTAL_BOND)
|
||||
|
Loading…
Reference in New Issue
Block a user