Add reviver seed item (untested)

This commit is contained in:
Flashfyre 2023-06-06 08:16:07 -04:00
parent 59c63234a5
commit ffa4c60011
6 changed files with 1197 additions and 1136 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

View File

@ -5,7 +5,7 @@ import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMov
import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler";
import { Stat } from "./data/pokemon-stat";
import { BerryModifier, ContactHeldItemTransferChanceModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, MultipleParticipantExpBonusModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
import { BerryModifier, ContactHeldItemTransferChanceModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, MultipleParticipantExpBonusModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballName, getPokeballTintColor, PokeballType } from "./data/pokeball";
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
@ -1729,7 +1729,19 @@ export class FaintPhase extends PokemonPhase {
start() {
super.start();
this.scene.queueMessage(getPokemonMessage(this.getPokemon(), ' fainted!'), null, true);
const pokemon = this.getPokemon();
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
if (instantReviveModifier) {
if (!--instantReviveModifier.stackCount)
this.scene.removeModifier(instantReviveModifier);
this.scene.updateModifiers(this.player);
this.end();
return;
}
this.scene.queueMessage(getPokemonMessage(pokemon, ' fainted!'), null, true);
if (this.player) {
const nonFaintedPartyMemberCount = this.scene.getParty().filter(p => !p.isFainted()).length;
@ -1740,8 +1752,6 @@ export class FaintPhase extends PokemonPhase {
} else
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
const pokemon = this.getPokemon();
pokemon.lapseTags(BattlerTagLapseType.FAINT);
this.scene.getField().filter(p => p && p !== pokemon).forEach(p => p.removeTagsBySourceId(pokemon.id));

View File

@ -561,6 +561,9 @@ const modifierTypes = {
SACRED_ASH: () => new AllPokemonFullReviveModifierType('SACRED ASH'),
REVIVER_SEED: () => new PokemonHeldItemModifierType('REVIVER SEED', 'Revives the holder for 1/2 HP upon fainting',
(type, args) => new Modifiers.PokemonInstantReviveModifier(type, (args[0] as Pokemon).id)),
ETHER: () => new PokemonPpRestoreModifierType('ETHER', 10),
MAX_ETHER: () => new PokemonPpRestoreModifierType('MAX ETHER', -1),
@ -723,6 +726,7 @@ const modifierPool = {
new WeightedModifierType(modifierTypes.MAX_LURE, 4),
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 4),
new WeightedModifierType(modifierTypes.TM_ULTRA, 5),
new WeightedModifierType(modifierTypes.REVIVER_SEED, 3),
new WeightedModifierType(modifierTypes.CANDY_JAR, 3),
new WeightedModifierType(modifierTypes.GRIP_CLAW, 2),
new WeightedModifierType(modifierTypes.HEALING_CHARM, 1),

View File

@ -666,6 +666,32 @@ export class PreserveBerryModifier extends PersistentModifier {
}
}
export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
super(type, pokemonId, stackCount);
}
matchType(modifier: Modifier) {
return modifier instanceof PokemonInstantReviveModifier;
}
clone() {
return new PokemonInstantReviveModifier(this.type, this.pokemonId, this.stackCount);
}
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(), Math.max(Math.floor(pokemon.getMaxHp() / 2)), getPokemonMessage(pokemon, ` was revived\nby its ${this.type.name}!`), false));
return true;
}
getMaxStackCount(): integer {
return 10;
}
}
export abstract class ConsumablePokemonModifier extends ConsumableModifier {
public pokemonId: integer;