mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Resetting modifiers.ts
This commit is contained in:
parent
0fd7e2eed5
commit
caba8ca5c1
@ -732,10 +732,11 @@ export abstract class PokemonHeldItemModifier extends PersistentModifier {
|
|||||||
if (!pokemon.getLastXMoves()[0]) {
|
if (!pokemon.getLastXMoves()[0]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const sheerForceAffected = pokemon.hasAbility(Abilities.SHEER_FORCE, true);
|
const sheerForceAffected = allMoves[pokemon.getLastXMoves()[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE);
|
||||||
|
|
||||||
if (sheerForceAffected) {
|
if (sheerForceAffected) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (pokemon.hasAbility(Abilities.SERENE_GRACE, true)) {
|
} else if (pokemon.hasAbility(Abilities.SERENE_GRACE)) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -1367,7 +1368,6 @@ export class SpeciesStatBoosterModifier extends StatBoosterModifier {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifier used for held items that apply critical-hit stage boost(s).
|
* Modifier used for held items that apply critical-hit stage boost(s).
|
||||||
* Example: Scope Lens
|
|
||||||
* @extends PokemonHeldItemModifier
|
* @extends PokemonHeldItemModifier
|
||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
@ -1403,10 +1403,7 @@ export class CritBoosterModifier extends PokemonHeldItemModifier {
|
|||||||
* @param critStage {@linkcode NumberHolder} that holds the resulting critical-hit level
|
* @param critStage {@linkcode NumberHolder} that holds the resulting critical-hit level
|
||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon, critStage: NumberHolder): boolean {
|
override apply(_pokemon: Pokemon, critStage: NumberHolder): boolean {
|
||||||
if (super.getSecondaryChanceMultiplier(pokemon) === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
critStage.value += this.stageIncrement;
|
critStage.value += this.stageIncrement;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1419,7 +1416,6 @@ export class CritBoosterModifier extends PokemonHeldItemModifier {
|
|||||||
/**
|
/**
|
||||||
* Modifier used for held items that apply critical-hit stage boost(s)
|
* Modifier used for held items that apply critical-hit stage boost(s)
|
||||||
* if the holder is of a specific {@linkcode Species}.
|
* if the holder is of a specific {@linkcode Species}.
|
||||||
* Example: Leek-FarFetch'd line
|
|
||||||
* @extends CritBoosterModifier
|
* @extends CritBoosterModifier
|
||||||
* @see {@linkcode shouldApply}
|
* @see {@linkcode shouldApply}
|
||||||
*/
|
*/
|
||||||
@ -1453,7 +1449,7 @@ export class SpeciesCritBoosterModifier extends CritBoosterModifier {
|
|||||||
* @returns `true` if the critical-hit level can be incremented, false otherwise
|
* @returns `true` if the critical-hit level can be incremented, false otherwise
|
||||||
*/
|
*/
|
||||||
override shouldApply(pokemon: Pokemon, critStage: NumberHolder): boolean {
|
override shouldApply(pokemon: Pokemon, critStage: NumberHolder): boolean {
|
||||||
return super.shouldApply(pokemon, critStage) && super.getSecondaryChanceMultiplier(pokemon) !== 0 && (this.species.includes(pokemon.getSpeciesForm(true).speciesId) || (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId)));
|
return super.shouldApply(pokemon, critStage) && (this.species.includes(pokemon.getSpeciesForm(true).speciesId) || (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1754,9 +1750,6 @@ export class TurnStatusEffectModifier extends PokemonHeldItemModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Modifier class associated with items like Shell Bell
|
|
||||||
*/
|
|
||||||
export class HitHealModifier extends PokemonHeldItemModifier {
|
export class HitHealModifier extends PokemonHeldItemModifier {
|
||||||
constructor(type: ModifierType, pokemonId: number, stackCount?: number) {
|
constructor(type: ModifierType, pokemonId: number, stackCount?: number) {
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
@ -1776,14 +1769,12 @@ export class HitHealModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns `true` if the {@linkcode Pokemon} was healed
|
* @returns `true` if the {@linkcode Pokemon} was healed
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
if (this.getSecondaryChanceMultiplier(pokemon) === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) {
|
if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) {
|
||||||
const scene = pokemon.scene;
|
const scene = pokemon.scene;
|
||||||
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(),
|
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(),
|
||||||
toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount, i18next.t("modifier:hitHealApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), true));
|
toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount, i18next.t("modifier:hitHealApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2625,9 +2616,6 @@ export class PokemonNatureWeightModifier extends PokemonHeldItemModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is associated with accuracy-boosting held items such as Wide Lens.
|
|
||||||
*/
|
|
||||||
export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier {
|
export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier {
|
||||||
public override type: PokemonMoveAccuracyBoosterModifierType;
|
public override type: PokemonMoveAccuracyBoosterModifierType;
|
||||||
private accuracyAmount: number;
|
private accuracyAmount: number;
|
||||||
@ -2669,10 +2657,7 @@ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier
|
|||||||
* @param moveAccuracy {@linkcode NumberHolder} holding the move accuracy boost
|
* @param moveAccuracy {@linkcode NumberHolder} holding the move accuracy boost
|
||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon, moveAccuracy: NumberHolder): boolean {
|
override apply(_pokemon: Pokemon, moveAccuracy: NumberHolder): boolean {
|
||||||
if (super.getSecondaryChanceMultiplier(pokemon)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
moveAccuracy.value = Math.min(moveAccuracy.value + this.accuracyAmount * this.getStackCount(), 100);
|
moveAccuracy.value = Math.min(moveAccuracy.value + this.accuracyAmount * this.getStackCount(), 100);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2683,9 +2668,6 @@ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is associated with items like Multi-Lens
|
|
||||||
*/
|
|
||||||
export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
||||||
public override type: PokemonMultiHitModifierType;
|
public override type: PokemonMultiHitModifierType;
|
||||||
|
|
||||||
@ -2710,9 +2692,6 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon, moveId: Moves, count: NumberHolder | null = null, damageMultiplier: NumberHolder | null = null): boolean {
|
override apply(pokemon: Pokemon, moveId: Moves, count: NumberHolder | null = null, damageMultiplier: NumberHolder | null = null): boolean {
|
||||||
if (super.getSecondaryChanceMultiplier(pokemon) === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const move = allMoves[moveId];
|
const move = allMoves[moveId];
|
||||||
/**
|
/**
|
||||||
* The move must meet Parental Bond's restrictions for this item
|
* The move must meet Parental Bond's restrictions for this item
|
||||||
@ -2880,9 +2859,6 @@ export class MoneyMultiplierModifier extends PersistentModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Class associated with items like Golden Punch
|
|
||||||
*/
|
|
||||||
export class DamageMoneyRewardModifier extends PokemonHeldItemModifier {
|
export class DamageMoneyRewardModifier extends PokemonHeldItemModifier {
|
||||||
constructor(type: ModifierType, pokemonId: number, stackCount?: number) {
|
constructor(type: ModifierType, pokemonId: number, stackCount?: number) {
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
@ -2903,9 +2879,6 @@ export class DamageMoneyRewardModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon, multiplier: NumberHolder): boolean {
|
override apply(pokemon: Pokemon, multiplier: NumberHolder): boolean {
|
||||||
if (super.getSecondaryChanceMultiplier(pokemon) === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const battleScene = pokemon.scene;
|
const battleScene = pokemon.scene;
|
||||||
const moneyAmount = new NumberHolder(Math.floor(multiplier.value * (0.5 * this.getStackCount())));
|
const moneyAmount = new NumberHolder(Math.floor(multiplier.value * (0.5 * this.getStackCount())));
|
||||||
battleScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
battleScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
||||||
|
@ -153,23 +153,5 @@ describe("Abilities - Sheer Force", () => {
|
|||||||
expect(formKeyStart).toBe(playerPokemon?.getFormKey());
|
expect(formKeyStart).toBe(playerPokemon?.getFormKey());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Sheer Force should disable healing from Shell Bell", async () => {
|
|
||||||
game.override
|
|
||||||
.ability(Abilities.SHEER_FORCE)
|
|
||||||
.moveset([ Moves.TACKLE ])
|
|
||||||
.enemySpecies(Species.GEODUDE)
|
|
||||||
.enemyMoveset([ Moves.TACKLE ])
|
|
||||||
.startingHeldItems([{ name: "SHELL_BELL", count: 1 }]);
|
|
||||||
|
|
||||||
await game.classicMode.startBattle([ Species.SHUCKLE ]);
|
|
||||||
const playerPokemon = game.scene.getPlayerPokemon();
|
|
||||||
game.move.select(Moves.TACKLE);
|
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
|
||||||
await game.phaseInterceptor.to("MoveEndPhase");
|
|
||||||
const postAttackHp = playerPokemon?.hp;
|
|
||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
|
||||||
expect(playerPokemon?.hp).toBe(postAttackHp);
|
|
||||||
});
|
|
||||||
|
|
||||||
//TODO King's Rock Interaction Unit Test
|
//TODO King's Rock Interaction Unit Test
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user