mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-13 21:28:39 +01:00
[Bug] Fix endless tokens allowing attacks to deal 0 damage (#5347)
This commit is contained in:
parent
ed8d162125
commit
5072460f4c
@ -1404,7 +1404,7 @@ export class DamageBoostAbAttr extends PreAttackAbAttr {
|
||||
applyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean {
|
||||
if (this.condition(pokemon, defender, move)) {
|
||||
const power = args[0] as Utils.NumberHolder;
|
||||
power.value = Math.floor(power.value * this.damageMultiplier);
|
||||
power.value = Utils.toDmgValue(power.value * this.damageMultiplier);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3390,7 +3390,7 @@ abstract class EnemyDamageMultiplierModifier extends EnemyPersistentModifier {
|
||||
* @returns always `true`
|
||||
*/
|
||||
override apply(multiplier: NumberHolder): boolean {
|
||||
multiplier.value = Math.floor(multiplier.value * Math.pow(this.damageMultiplier, this.getStackCount()));
|
||||
multiplier.value = toDmgValue(multiplier.value * Math.pow(this.damageMultiplier, this.getStackCount()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { allMoves } from "#app/data/move";
|
||||
import type { EnemyPersistentModifier } from "#app/modifier/modifier";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
@ -65,6 +67,28 @@ describe("Battle Mechanics - Damage Calculation", () => {
|
||||
expect(aggron.hp).toBe(aggron.getMaxHp() - 1);
|
||||
});
|
||||
|
||||
it("Attacks deal 1 damage at minimum even with many tokens", async () => {
|
||||
game.override
|
||||
.startingLevel(1)
|
||||
.enemySpecies(Species.AGGRON)
|
||||
.enemyAbility(Abilities.STURDY)
|
||||
.enemyLevel(10000);
|
||||
|
||||
await game.classicMode.startBattle([ Species.SHUCKLE ]);
|
||||
|
||||
const dmg_redux_modifier = modifierTypes.ENEMY_DAMAGE_REDUCTION().newModifier() as EnemyPersistentModifier;
|
||||
dmg_redux_modifier.stackCount = 1000;
|
||||
await game.scene.addEnemyModifier(modifierTypes.ENEMY_DAMAGE_REDUCTION().newModifier() as EnemyPersistentModifier);
|
||||
|
||||
const aggron = game.scene.getEnemyPokemon()!;
|
||||
|
||||
game.move.select(Moves.TACKLE);
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
|
||||
expect(aggron.hp).toBe(aggron.getMaxHp() - 1);
|
||||
});
|
||||
|
||||
it("Fixed-damage moves ignore damage multipliers", async () => {
|
||||
game.override
|
||||
.enemySpecies(Species.DRAGONITE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user