Merge branch 'beta' into linger-arena-trap-fix
This commit is contained in:
commit
bf4fffb5d0
|
@ -1367,7 +1367,7 @@ export class AddSecondStrikeAbAttr extends PreAttackAbAttr {
|
||||||
const hitCount = args[0] as Utils.NumberHolder;
|
const hitCount = args[0] as Utils.NumberHolder;
|
||||||
const multiplier = args[1] as Utils.NumberHolder;
|
const multiplier = args[1] as Utils.NumberHolder;
|
||||||
|
|
||||||
if (move.canBeMultiStrikeEnhanced(pokemon)) {
|
if (move.canBeMultiStrikeEnhanced(pokemon, true)) {
|
||||||
this.showAbility = !!hitCount?.value;
|
this.showAbility = !!hitCount?.value;
|
||||||
if (hitCount?.value) {
|
if (hitCount?.value) {
|
||||||
hitCount.value += 1;
|
hitCount.value += 1;
|
||||||
|
|
|
@ -818,8 +818,6 @@ export default class Move implements Localizable {
|
||||||
|
|
||||||
applyMoveAttrs(VariablePowerAttr, source, target, this, power);
|
applyMoveAttrs(VariablePowerAttr, source, target, this, power);
|
||||||
|
|
||||||
source.scene.applyModifiers(PokemonMultiHitModifier, source.isPlayer(), source, this.id, null, power);
|
|
||||||
|
|
||||||
if (!this.hasAttr(TypelessAttr)) {
|
if (!this.hasAttr(TypelessAttr)) {
|
||||||
source.scene.arena.applyTags(WeakenMoveTypeTag, simulated, this.type, power);
|
source.scene.arena.applyTags(WeakenMoveTypeTag, simulated, this.type, power);
|
||||||
source.scene.applyModifiers(AttackTypeBoosterModifier, source.isPlayer(), source, this.type, power);
|
source.scene.applyModifiers(AttackTypeBoosterModifier, source.isPlayer(), source, this.type, power);
|
||||||
|
@ -846,8 +844,11 @@ export default class Move implements Localizable {
|
||||||
* by enhancing effects.
|
* by enhancing effects.
|
||||||
* Currently used for {@link https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability) | Parental Bond}
|
* Currently used for {@link https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability) | Parental Bond}
|
||||||
* and {@linkcode PokemonMultiHitModifier | Multi-Lens}.
|
* and {@linkcode PokemonMultiHitModifier | Multi-Lens}.
|
||||||
|
* @param user The {@linkcode Pokemon} using the move
|
||||||
|
* @param restrictSpread `true` if the enhancing effect
|
||||||
|
* should not affect multi-target moves (default `false`)
|
||||||
*/
|
*/
|
||||||
canBeMultiStrikeEnhanced(user: Pokemon): boolean {
|
canBeMultiStrikeEnhanced(user: Pokemon, restrictSpread: boolean = false): boolean {
|
||||||
// Multi-strike enhancers...
|
// Multi-strike enhancers...
|
||||||
|
|
||||||
// ...cannot enhance moves that hit multiple targets
|
// ...cannot enhance moves that hit multiple targets
|
||||||
|
@ -870,7 +871,7 @@ export default class Move implements Localizable {
|
||||||
Moves.ENDEAVOR
|
Moves.ENDEAVOR
|
||||||
];
|
];
|
||||||
|
|
||||||
return !isMultiTarget
|
return (!restrictSpread || !isMultiTarget)
|
||||||
&& !this.isChargingMove()
|
&& !this.isChargingMove()
|
||||||
&& !exceptAttrs.some(attr => this.hasAttr(attr))
|
&& !exceptAttrs.some(attr => this.hasAttr(attr))
|
||||||
&& !exceptMoves.some(id => this.id === id)
|
&& !exceptMoves.some(id => this.id === id)
|
||||||
|
|
|
@ -2715,7 +2715,7 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
||||||
if (!isNullOrUndefined(count)) {
|
if (!isNullOrUndefined(count)) {
|
||||||
return this.applyHitCountBoost(count);
|
return this.applyHitCountBoost(count);
|
||||||
} else if (!isNullOrUndefined(damageMultiplier)) {
|
} else if (!isNullOrUndefined(damageMultiplier)) {
|
||||||
return this.applyPowerModifier(pokemon, damageMultiplier);
|
return this.applyDamageModifier(pokemon, damageMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2732,7 +2732,7 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
||||||
* equal to (1 - the number of stacked Multi-Lenses).
|
* equal to (1 - the number of stacked Multi-Lenses).
|
||||||
* Additional strikes beyond that are given a 0.25x damage multiplier
|
* Additional strikes beyond that are given a 0.25x damage multiplier
|
||||||
*/
|
*/
|
||||||
private applyPowerModifier(pokemon: Pokemon, damageMultiplier: NumberHolder): boolean {
|
private applyDamageModifier(pokemon: Pokemon, damageMultiplier: NumberHolder): boolean {
|
||||||
damageMultiplier.value = (pokemon.turnData.hitsLeft === pokemon.turnData.hitCount)
|
damageMultiplier.value = (pokemon.turnData.hitsLeft === pokemon.turnData.hitCount)
|
||||||
? (1 - (0.25 * this.getStackCount()))
|
? (1 - (0.25 * this.getStackCount()))
|
||||||
: 0.25;
|
: 0.25;
|
||||||
|
|
|
@ -95,4 +95,23 @@ describe("Items - Multi Lens", () => {
|
||||||
await game.phaseInterceptor.to("BerryPhase", false);
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
expect(playerPokemon.turnData.hitCount).toBe(2);
|
expect(playerPokemon.turnData.hitCount).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should enhance multi-target moves", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("double")
|
||||||
|
.moveset([ Moves.SWIFT, Moves.SPLASH ]);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const [ magikarp, ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
game.move.select(Moves.SWIFT, 0);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
|
expect(magikarp.turnData.hitCount).toBe(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue