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. |
| 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:checkHealth(swoon: boolean?)
Checks whether the battler's down state needs to be changed based on its current health
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?, color: number, [2]? }?)
Makes the battler flash once.
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? | |
| color: number, [2]? }? | The color used to draw the flash, defaulting to white |
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?, playsound: boolean?)
Heals the Battler by amount health and does healing effects
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 |
| playsound: boolean? | Whether to play a sound when healed |
PartyBattler:hideTarget()
Hide the battler's target sprite.
PartyBattler:hurt(amount: number, exact: boolean?, color: number, [2]? }?, options: (table|"all"|"swoon")?)
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: number, [2]? }? | 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:recruitMessage(...: unknown)
An override of Battler:recruitMessage()
Arguments:
| ...: unknown |
Returns:
| 1: RecruitMessage |
PartyBattler:removeHealth(amount: number, swoon: boolean?)
Removes health from the character and sets their downed HP value if necessary
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)
Arguments:
| amount: number | |
| swoon: boolean? | Whether to swoon rather than down |
PartyBattler:resetSprite()
Sets the PartyBattler'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:setSprite(sprite: string?, speed: number?, loop: boolean?, after: fun( any)?)
Shorthand for ActorSprite:setSprite() and ActorSprite:play()
Arguments:
| sprite: string? | |
| speed: number? | |
| loop: boolean? | |
| after: fun( any)? |
PartyBattler:showTarget()
Show the battler's target sprite to indicate they're being targeted (as long as the target system is enabled.) This is not needed to be called manually in most cases!
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.
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