PartyBattler

┗> Battler > Object > Class


PartyBattlers are a type of Battler that represent PartyMembers when they are in battle.
The set of PartyBattlers in the current battle are stored in Game.battle.party.
Unlike EnemyBattler, party members do not need to define a PartyBattler in a file as their PartyMember file defines everything necessary and is utilised by PartyBattler.


Constructor


PartyBattler(chara: PartyMember, x: number?, y: number?)

Arguments:

chara: PartyMember

The PartyMember class is a type of data class that stores information about a member of the party.
PartyMembers are stored in scripts/data/party, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().

x: number?
y: number?




Methods


PartyBattler:calculateDamage(amount: number)

Calculates the damage the battler should take after defense reductions

Arguments:

amount: number

Returns:

1: number


PartyBattler:calculateDamageSimple(amount: number)

Less complex damage calculation than PartyBattler:calculateDamage()
(unused?)

Arguments:

amount: number

Returns:

1: integer


PartyBattler:canTarget()

(Override)

Returns:

1: boolean


PartyBattler:checkHealth(swoon: boolean?)

Checks whether the battler's down state needs to be changed based on its current health

@param swoon — Whether the battler should be swooned instead of downed if their health is 0 or below

Arguments:

swoon: boolean?

Whether the battler should be swooned instead of downed if their health is 0 or below







PartyBattler:flash(sprite: Sprite?, offset_x: number?, offset_y: number?, layer: number?)

Makes the battler flash once.

@param sprite — An optional sprite to use for the flash instead of the battler's default sprite.

Arguments:

sprite: Sprite?

An optional sprite to use for the flash instead of the battler's default sprite.

offset_x: number?
offset_y: number?
layer: number?

Returns:

1: FlashFade


PartyBattler:getElementReduction(element: number)

Gets the damage reduction multiplier for damage of a particular element

Arguments:

element: number

Returns:

multiplier: integer


PartyBattler:getHeadIcon()

Gets the icon that should display in the Battler's head slot on their action box

Returns:

texture: string


PartyBattler:heal(amount: number, sparkle_color: table?, show_up: boolean?)

Heals the Battler by amount health and does healing effects

@param amount — The amount of health to restore

@param sparkle_color — The color of the heal sparkles (defaults to the standard green) or false to not show sparkles

@param show_up — Whether the "UP" status message should show if the battler is revived by the heal

Arguments:

amount: number

The amount of health to restore

sparkle_color: table?

The color of the heal sparkles (defaults to the standard green) or false to not show sparkles

show_up: boolean?

Whether the "UP" status message should show if the battler is revived by the heal



PartyBattler:hurt(amount: number, exact: boolean?, color: table?, options: (table|"all"|"swoon")?)

@param amount — The damage of the incoming hit

@param exact — Whether the damage should be treated as exact damage instead of applying defense and element modifiers

@param color — The color of the damage number

@param options — A table defining additional properties to control the way damage is taken

options:
    | "all" -- Whether the damage being taken comes from a strike targeting the whole party
    | "swoon" -- Whether the damage should swoon the battler instead of downing them

Arguments:

amount: number

The damage of the incoming hit

exact: boolean?

Whether the damage should be treated as exact damage instead of applying defense and element modifiers

color: table?

The color of the damage number

options: (table|"all"|"swoon")?

A table defining additional properties to control the way damage is taken



PartyBattler:isActive()

Whether the party member is in a state where they can take their turn (not sleeping or downed)

Returns:

1: boolean






PartyBattler:removeHealth(amount: number, swoon: boolean?)

Removes health from the character and sets their downed HP value if necessary

@param swoon — Whether to swoon rather than down

Arguments:

amount: number
swoon: boolean?

Whether to swoon rather than down



PartyBattler:removeHealthBroken(amount: number, swoon: boolean?)

A variant of PartyBattler:removeHealth() that uses Kris' (or the first party member)'s HP for downed hp values (used for deltarune accuracy)

@param swoon — Whether to swoon rather than down

Arguments:

amount: number
swoon: boolean?

Whether to swoon rather than down



PartyBattler:resetSprite()

Sets the Battler's sprite back to their default (battle/idle)





PartyBattler:setActSprite(sprite: string?, ox: number?, oy: number?, speed: number?, loop: boolean?, after: fun( any)?)

Sets the battler's sprite for performing ACTs, including the additional flash effect Acts as a shorthand of ActorSprite:setCustomSprite() and ActorSprite:play()

Arguments:

sprite: string?
ox: number?
oy: number?
speed: number?
loop: boolean?
after: fun( any)?


PartyBattler:setSleeping(sleeping: boolean?)

Arguments:

sleeping: boolean?


PartyBattler:setSprite(sprite: string?, speed: number?, loop: boolean?, after: fun( any)?)

Arguments:

sprite: string?
speed: number?
loop: boolean?
after: fun( any)?


PartyBattler:statusMessage(: unknown)

An override of Battler:statusMessage() that positions the message for this PartyBattler

Arguments:

: unknown

Returns:

1: DamageNumber




PartyBattler:toggleOverlay(overlay: boolean?)

Toggles the visibility of the overlay sprite versus main sprite.

@param overlay — Whether the overlay should be visible. If unset, will invert whatever the current visibility state is.

Arguments:

overlay: boolean?

Whether the overlay should be visible. If unset, will invert whatever the current visibility state is.






Fields


PartyBattler.action: table

The current action the battler has queued up


PartyBattler.actor: Actor

The actor this battler uses


PartyBattler.chara: PartyMember

The PartyMember this battler uses


PartyBattler.darken_fx: RecolorFX

(Used internally) A RecolorFX used for darkening the battler's sprite during waves


PartyBattler.darken_timer: number

(Used internally) A timer for the darkening of the battler's sprite during the wave transition


PartyBattler.defending: boolean

Whether the battler is currently defending


PartyBattler.hurt_timer: number

How long this battler's hurt sprite should be displayed for when hit


PartyBattler.hurting: boolean

Whether the battler is currently hurting (showing their hurt sprite)


PartyBattler.is_down: boolean

Whether the battler is downed


PartyBattler.should_darken: boolean

(Used internally) Whether the battler's sprite should be darkened during waves


PartyBattler.sleeping: boolean

Whether the battler is sleeping




Undocumented