Changed resetStatus to have a condition whether to include confusion or not, defaults to false so you manually have to add

This commit is contained in:
Ethan 2024-05-19 12:47:41 -04:00
parent a6eb739b1a
commit 99c5654db5
3 changed files with 10 additions and 9 deletions

View File

@ -2147,9 +2147,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
/**
* Resets the status of a pokemon
* @param revive whether revive should be cured, defaults to true
* @param {boolean} revive Whether revive should be cured; defaults to true.
* @param {boolean} confusion Whether resetStatus should include confusion or not; defaults to false.
*/
resetStatus(revive: boolean = true): void {
resetStatus(revive: boolean = true, confusion: boolean = false): void {
const lastStatus = this.status?.effect;
if (!revive && lastStatus === StatusEffect.FAINT) {
return;
@ -2160,8 +2161,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.getTag(BattlerTagType.NIGHTMARE))
this.lapseTag(BattlerTagType.NIGHTMARE);
}
if (this.getTag(BattlerTagType.CONFUSED))
this.lapseTag(BattlerTagType.CONFUSED);
if(confusion) {
if (this.getTag(BattlerTagType.CONFUSED))
this.lapseTag(BattlerTagType.CONFUSED);
}
}
primeSummonData(summonDataPrimer: PokemonSummonData): void {

View File

@ -225,7 +225,7 @@ export class PokemonHpRestoreModifierType extends PokemonModifierType {
constructor(localeKey: string, iconImage: string, restorePoints: integer, restorePercent: integer, healStatus: boolean = false, newModifierFunc?: NewModifierFunc, selectFilter?: PokemonSelectFilter, group?: string) {
super(localeKey, iconImage, newModifierFunc || ((_type, args) => new Modifiers.PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints, this.restorePercent, this.healStatus, false)),
selectFilter || ((pokemon: PlayerPokemon) => {
if (!pokemon.hp || (pokemon.hp >= pokemon.getMaxHp() && (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED))))
if (!pokemon.hp || (pokemon.hp >= pokemon.getMaxHp() && (!this.healStatus || (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED)))))
return PartyUiHandler.NoEffectMessage;
return null;
}), group || 'potion');

View File

@ -1035,9 +1035,8 @@ export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
if (!this.fainted)
restorePoints = Math.floor(restorePoints * (args[1] as number));
if (this.fainted || this.healStatus)
pokemon.resetStatus();
pokemon.resetStatus(true, true)
pokemon.hp = Math.min(pokemon.hp + Math.max(Math.ceil(Math.max(Math.floor((this.restorePercent * 0.01) * pokemon.getMaxHp()), restorePoints)), 1), pokemon.getMaxHp());
return true;
}
@ -1052,8 +1051,7 @@ export class PokemonStatusHealModifier extends ConsumablePokemonModifier {
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
pokemon.resetStatus();
pokemon.resetStatus(true, true);
return true;
}
}