Constructor






Methods




Spell:getCastAnimation()

(Override) Gets the animation that is set when this spell is cast in battle

Returns:

1: string


Spell:getCastMessage(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])

(Override) Gets the message that appears when this spell is cast in battle

Arguments:

user: PartyBattler

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.

target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[]

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.

Returns:

1: string






Spell:getName()

Returns:

1: string


Spell:getSelectAnimation()

(Override) Gets the animation that is set when this spell is selected in battle

Returns:

1: string


Spell:getTPCost(chara: PartyMember)

Gets the TP required to cast this spell

@param chara — The PartyMember that is casting the spell

Arguments:

chara: PartyMember

The PartyMember that is casting the spell

Returns:

1: number


Spell:hasTag(tag: string)

Checks whether the spell has a specific tag attached to it

Arguments:

tag: string

Returns:

1: boolean


Spell:hasWorldUsage(chara: PartyMember)

(Override) Gets whether the spell can be cast in the world
(Always false by default)

@param chara — The PartyMember the check is being run for

Arguments:

chara: PartyMember

The PartyMember the check is being run for

Returns:

1: boolean


Spell:isUsable(chara: PartyMember)

(Override) Gets whether the spell is currently castable

@param chara — The PartyMember the check is being run for

Arguments:

chara: PartyMember

The PartyMember the check is being run for

Returns:

1: boolean


Spell:onCast(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])

(Override) Called when the spell is cast
The code for the effects of the spell (such as damage or healing) should go into this function

@return finish_action — Whether the spell action finishes automatically, when false the action can be manually ended with Game.battle:finishActionBy(user) (defaults to true)

Arguments:

user: PartyBattler

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.

target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[]

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.

Returns:

finish_action: boolean?

Whether the spell action finishes automatically, when false the action can be manually ended with Game.battle:finishActionBy(user) (defaults to true)



Spell:onDeselect(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])

(Override) Called whenever the spell use is undone in battle

Arguments:

user: PartyBattler

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.

target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[]

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.



Spell:onSelect(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])

(Override) Called whenever the spell is selected for use in battle

Arguments:

user: PartyBattler

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.

target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[]

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.



Spell:onStart(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])

Called at the start of a spell cast, manages internal functionality
Don't use this function for spell effects - see Spell:onCast() instead

Arguments:

user: PartyBattler

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.

target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[]

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.



Spell:onWorldCast(chara: PartyMember)

(Override) Called whenever the spell is cast in the overworld
Code that controls the effect of the spell when cast in the overworld goes here

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().




Fields


Spell.cast_anim: string

The name of the animation set when the spell is cast - defaults to "battle/spell"


Spell.cast_name: string?

The display name of the spell when cast (optional)


Spell.cost: number

The TP cost of the spell


Spell.description: string

The overworld menu description of the spell


Spell.effect: string

The battle description of the spell


Spell.name: string

The display name of the spell


Spell.select_anim: string

The name of the animation set when the spell is selected - defaults to "battle/spell_ready"


Spell.tags: string[]

Tags that apply to this spell
Tags are used to identify properties of the spell that can be checked by other pieces of code for certain effects, For example:
The built in tag spare_tired will cause the spell to be highlighted if an enemy is TIRED


Spell.target: string

The target mode of the spell - valid options are "ally", "party", "enemy", "enemies", and "none"


Spell.usable: boolean

Whether the spell can be cast



Undocumented