PokéRogue
    Preparing search index...

    Class that represents egg hatching

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    canSkip: boolean
    egg: Egg

    The egg that is hatching

    eggContainer: Container

    The phaser container that holds the egg

    eggCounterContainer: EggCounterContainer

    The container that lists how many eggs are hatching

    eggCrackSprite: Sprite

    The phaser sprite of the cracks in an egg

    eggHatchBg: Image

    The phaser image that is the background

    eggHatchContainer: Container

    The phaser gameobject container that holds everything

    eggHatchData: EggHatchData

    The new EggHatchData for the egg/pokemon that hatches

    eggHatchHandler: EggHatchSceneUiHandler

    The scene handler for egg hatching

    eggHatchOverlay: Rectangle

    The phaser rectangle that overlays during the scene

    eggLapsePhase: EggLapsePhase
    eggLightraysOverlay: Sprite

    The phaser sprite that represents the overlaid light rays

    eggMoveIndex: number

    The index of which egg move is unlocked. 0-2 is common, 3 is rare

    eggSprite: Sprite

    The phaser sprite of the egg

    eggsToHatchCount: number

    The number of eggs that are hatching

    evolutionBgm: null | AnySound

    The sound effect being played when the egg is hatched

    hatched: boolean

    Internal booleans representing if the egg is hatched, able to be skipped, or skipped

    infoContainer: PokemonInfoContainer

    The PokemonInfoContainer of the newly hatched Pokemon

    phaseName: "EggHatchPhase"

    The string name of the phase, used to identify the phase type for is

    pokemon: PlayerPokemon

    The newly hatched PlayerPokemon

    pokemonShinySparkle: Sprite

    The phaser sprite for shiny sparkles

    pokemonSprite: Sprite

    The phaser sprite of the hatched Pokemon

    skipped: boolean

    Methods

    • Function that animates egg shaking

      Parameters

      • intensity: number

        of horizontal shaking. Doubled on the first call (where count is 0)

      • OptionalrepeatCount: number

        the number of times this function should be called (asynchronous recursion?!?)

      • Optionalcount: number

        the current number of times this function has been called.

      Returns Promise<void>

      nothing since it's a Promise

    • Animates spraying

      Parameters

      • intensity: number

        number of times this is repeated (this is a badly named variable)

      • OptionaloffsetY: number

        how much to offset the Y coordinates

      Returns void

    • Animates a particle used in the spray animation

      Parameters

      • trigIndex: number

        Used to modify the particle's vertical speed, is a random number from 0-7

      • offsetY: number

        how much to offset the Y coordinate

      Returns void

    • Check if the phase is of the given type without requiring instanceof.

      Type Parameters

      • K extends
            | "AddEnemyBuffModifierPhase"
            | "AttemptCapturePhase"
            | "AttemptRunPhase"
            | "BattleEndPhase"
            | "BerryPhase"
            | "CheckInterludePhase"
            | "CheckStatusEffectPhase"
            | "CheckSwitchPhase"
            | "CommandPhase"
            | "CommonAnimPhase"
            | "DamageAnimPhase"
            | "DynamicPhaseMarker"
            | "EggHatchPhase"
            | "EggLapsePhase"
            | "EggSummaryPhase"
            | "EncounterPhase"
            | "EndCardPhase"
            | "EndEvolutionPhase"
            | "EnemyCommandPhase"
            | "EvolutionPhase"
            | "ExpPhase"
            | "FaintPhase"
            | "FormChangePhase"
            | "GameOverPhase"
            | "GameOverModifierRewardPhase"
            | "HideAbilityPhase"
            | "HidePartyExpBarPhase"
            | "InitEncounterPhase"
            | "LearnMovePhase"
            | "LevelCapPhase"
            | "LevelUpPhase"
            | "LoadMoveAnimPhase"
            | "LoginPhase"
            | "MessagePhase"
            | "ModifierRewardPhase"
            | "MoneyRewardPhase"
            | "MoveAnimPhase"
            | "MoveChargePhase"
            | "MoveEffectPhase"
            | "MoveEndPhase"
            | "MoveHeaderPhase"
            | "MovePhase"
            | "MysteryEncounterPhase"
            | "MysteryEncounterOptionSelectedPhase"
            | "MysteryEncounterBattlePhase"
            | "MysteryEncounterBattleStartCleanupPhase"
            | "MysteryEncounterRewardsPhase"
            | "PostMysteryEncounterPhase"
            | "NewBattlePhase"
            | "NewBiomeEncounterPhase"
            | "NextEncounterPhase"
            | "ObtainStatusEffectPhase"
            | "PartyExpPhase"
            | "PartyHealPhase"
            | "PokemonAnimPhase"
            | "PokemonHealPhase"
            | "PokemonTransformPhase"
            | "PositionalTagPhase"
            | "PostGameOverPhase"
            | "PostSummonPhase"
            | "PostTurnStatusEffectPhase"
            | "QuietFormChangePhase"
            | "ReloadSessionPhase"
            | "ResetStatusPhase"
            | "ReturnPhase"
            | "RevivalBlessingPhase"
            | "RibbonModifierRewardPhase"
            | "ScanIvsPhase"
            | "SelectBiomePhase"
            | "SelectChallengePhase"
            | "SelectGenderPhase"
            | "SelectModifierPhase"
            | "SelectStarterPhase"
            | "SelectTargetPhase"
            | "ShinySparklePhase"
            | "ShowAbilityPhase"
            | "ShowPartyExpBarPhase"
            | "ShowTrainerPhase"
            | "StatStageChangePhase"
            | "SummonMissingPhase"
            | "SummonPhase"
            | "SwitchBiomePhase"
            | "SwitchPhase"
            | "SwitchSummonPhase"
            | "TeraPhase"
            | "TitlePhase"
            | "ToggleDoublePositionPhase"
            | "TrainerVictoryPhase"
            | "TurnEndPhase"
            | "TurnInitPhase"
            | "TurnStartPhase"
            | "UnavailablePhase"
            | "UnlockPhase"
            | "VictoryPhase"
            | "WeatherEffectPhase"

      Parameters

      • phase: K

        The string name of the phase to check.

      Returns this is PhaseMap[K]

      Whether this phase is of the provided type.

      This does not check for subclasses! It only checks if the phase is exactly the given type. This method exists to avoid circular import issues, as using instanceof would require importing each phase.

    • Helper function to generate sine. (Why is this not a Utils?!?)

      Parameters

      • index: number

        random number from 0-7 being passed in to scale pi/128

      • amplitude: number

        Scaling

      Returns number

      a number

    • Tries to skip the hatching animation

      Returns boolean

      false if cannot be skipped or already skipped. True otherwise