Add full heal modifier

pull/1/head
Flashfyre 2023-04-18 22:23:06 -04:00
parent d2d2f956ef
commit 89356fbfda
2 changed files with 30 additions and 0 deletions

View File

@ -99,6 +99,18 @@ export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
} }
} }
export class PokemonStatusHealModifierType extends PokemonModifierType {
constructor(name: string) {
super(name, `Heal any status ailment for one POKéMON`,
((_type, args) => new Modifiers.PokemonStatusHealModifier(this, (args[0] as PlayerPokemon).id)),
((pokemon: PlayerPokemon) => {
if (!pokemon.hp || !pokemon.status)
return PartyUiHandler.NoEffectMessage;
return null;
}));
}
}
export abstract class PokemonMoveModifierType extends PokemonModifierType { export abstract class PokemonMoveModifierType extends PokemonModifierType {
public moveSelectFilter: PokemonMoveSelectFilter; public moveSelectFilter: PokemonMoveSelectFilter;
@ -481,6 +493,10 @@ const modifierPool = {
].map(m => { m.setTier(ModifierTier.COMMON); return m; }), ].map(m => { m.setTier(ModifierTier.COMMON); return m; }),
[ModifierTier.GREAT]: [ [ModifierTier.GREAT]: [
new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 12), new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 12),
new WeightedModifierType(new PokemonStatusHealModifierType('FULL HEAL'), (party: PlayerPokemon[]) => {
const statusEffectPartyMemberCount = party.filter(p => p.hp && !!p.status).length;
return statusEffectPartyMemberCount * 8;
}),
new WeightedModifierType(new PokemonReviveModifierType('REVIVE', 50), (party: PlayerPokemon[]) => { new WeightedModifierType(new PokemonReviveModifierType('REVIVE', 50), (party: PlayerPokemon[]) => {
const faintedPartyMemberCount = party.filter(p => !p.hp).length; const faintedPartyMemberCount = party.filter(p => !p.hp).length;
return faintedPartyMemberCount * 6; return faintedPartyMemberCount * 6;

View File

@ -409,6 +409,20 @@ export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
} }
} }
export class PokemonStatusHealModifier extends ConsumablePokemonModifier {
constructor(type: ModifierType, pokemonId: integer) {
super(type, pokemonId);
}
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
pokemon.resetStatus();
return true;
}
}
export abstract class ConsumablePokemonMoveModifier extends ConsumablePokemonModifier { export abstract class ConsumablePokemonMoveModifier extends ConsumablePokemonModifier {
public moveIndex: integer; public moveIndex: integer;