Defines and manages the usage of field psynergy. Classes that inherit this one, are expected to at least:

  • call FieldAbilities.set_bootstrap_method on construction;
  • call FieldAbilities.close_field_psynergy_window in an appropriate time.
  • call FieldAbilities.stop_casting and FieldAbilities.return_to_idle_anim possibly on cast finish.
  • implement FieldAbilities.update abstract method, even if empty.

This class already do initial checks, search for target, init casting aura and colorize the map automatically.

Hierarchy (view full)

Constructors

Properties

cast_direction: number

The direction that the controllable char is casting thie psynergy.

caster: MainChar

The main char that it casting the psynergy.

cloud_sprite: Sprite
controllable_char: ControllableChar

The controllable char that's casting this psynergy.

data: GoldenSun

The GoldenSun object.

game: Game

The Phaser.Game object.

is_custom_psynergy: boolean
reset_map: (() => void)

Resets the map to default colors.

Type declaration

    • (): void
    • Returns void

stop_casting: ((reset_casting_psy_flag?, reset_map_tint?) => Promise<void>)

If called, the casting aura is destroyed.

Type declaration

    • (reset_casting_psy_flag?, reset_map_tint?): Promise<void>
    • Parameters

      • Optional reset_casting_psy_flag: boolean
      • Optional reset_map_tint: boolean

      Returns Promise<void>

target_object: InteractableObjects

The target object of this psynergy. Might not be necessary depending on the psynergy.

ABILITY_KEY_NAME: "douse" = "douse"
ACTION_KEY_NAME: CAST = base_actions.CAST
CLOUD_ANIM_KEY_NAME: "cloud" = "cloud"
CLOUD_KEY_NAME: "douse" = "douse"
DOUSE_HEIGHT: 45 = 45
DOUSE_MAX_RANGE: 12 = 12

Methods

  • Generic funcion that can be overriden. When calling this, the psynergy effect should be finished.

    Parameters

    • force: boolean = false

      for the psynergy to finish.

    • stop_char: boolean = true

      stops the char current animation.

    • Optional finish_callback: (() => void)

      the callback method to be called on psynergy end finish.

        • (): void
        • Returns void

    Returns void

  • Adds an extra check for this psynergy to be casted. The given function is tested on this psynergy cast initialization. If the given function call returns false, this psynergy won't be casted.

    Parameters

    • method: (() => boolean)

      the method to be tested.

        • (): boolean
        • Returns boolean

    Returns void

  • Colorizes the map for psynergy casting.

    Parameters

    • game: Game

      the Phaser.Game object.

    • map: Map

      the current map.

    • Optional options: {
          after_colorize?: (() => void);
          after_destroy?: (() => void);
          color?: number;
          intensity?: number;
          map_colors_sequence?: boolean;
      }

      some options.

      • Optional after_colorize?: (() => void)

        after the map gets colorized callback.

          • (): void
          • Returns void

      • Optional after_destroy?: (() => void)

        after colorize filter destruction callback.

          • (): void
          • Returns void

      • Optional color?: number

        the color to colorize the map. In the RGB spectre, values between 0 and 1. Default is random.

      • Optional intensity?: number

        the colorize intensity.

      • Optional map_colors_sequence?: boolean

        if true, it will keep changing colorization color over time.

    Returns (() => void)

    returns a function that if called, it will return the map colors to normal.

      • (): void
      • Returns void

  • Initializes a casting aura around the caster.

    Parameters

    • game: Game

      the Phase.Game object.

    • data: GoldenSun

      the GoldenSun object.

    • char: ControllableChar

      the caster controllable char.

    • Optional after_init: (() => void)

      after the aura is initialized callback.

        • (): void
        • Returns void

    • Optional after_destroy: ((reset_casting_psy_flag) => void)

      after the aura is completely destroyed callback.

        • (reset_casting_psy_flag): void
        • Parameters

          • reset_casting_psy_flag: boolean

          Returns void

    • Optional before_destroy: ((reset_map_tint) => void)

      on aura destruction init callback.

        • (reset_map_tint): void
        • Parameters

          • reset_map_tint: boolean

          Returns void

    Returns ((reset_casting_psy_flag?, reset_map_tint?) => Promise<void>)

    returns a function that when called, will stop the casting aura.

      • (reset_casting_psy_flag?, reset_map_tint?): Promise<void>
      • Parameters

        • Optional reset_casting_psy_flag: boolean
        • Optional reset_map_tint: boolean

        Returns Promise<void>