Represents a game reset.

Constructors

  • Creates a new instance of the game reset.

    Parameters

    • currenciesToReset: GameCurrency<string, [], []> | GameCurrency<string, [], []>[]

      The currencies to reset.

    • Optionalextender: GameReset | GameReset[]

      The extender for the game reset.

    • OptionalonReset: ((resetContext: GameReset) => void)

      Function to run during reset.

        • (resetContext): void
        • Function to run after reset is called but BEFORE the currencies are reset

          Parameters

          • resetContext: GameReset

            The reset context that the reset is called in.

          Returns void

    • Optionalcondition: boolean | ((resetContext: GameReset) => boolean)

      A condition that must be met for the reset to occur.

    Returns GameReset

Properties

condition?: boolean | ((resetContext: GameReset) => boolean)

A condition that must be met for the reset to occur. Can be a function or a boolean / getter.

currenciesToReset: GameCurrency<string, [], []>[]

The currencies to reset.

extender: GameReset[]

The extender for the game reset.

onReset?: ((resetContext: GameReset) => void)

Function to run after reset is called but BEFORE the currencies are reset

Type declaration

    • (resetContext): void
    • Parameters

      • resetContext: GameReset

        The reset context that the reset is called in.

      Returns void

Methods

  • Resets the extenders (if any), then runs onReset and resets the currencies and upgrades.

    Parameters

    • force: boolean = false

      Whether to force the reset. Defaults to false.

    • forceExtenders: boolean = true

      Whether to force the reset of the extenders. Defaults to true.

    • cached: Set<symbol> = ...

      The set of cached symbols to prevent infinite loops.

    Returns void

  • Creates a new instance of the game reset from an object.

    Parameters

    • object: GameResetFromObject

      The object to create the game reset from.

    Returns GameReset

    The newly created game reset.