Spell
┗> Class
Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).
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 |
|
| target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[] |
Recruit data is separate to enemies, see |
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 |
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 |
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 |
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 |
|
| target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[] |
Recruit data is separate to enemies, see |
Returns:
| finish_action: boolean? | Whether the spell action finishes automatically, when |
Spell:onDeselect(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])
(Override) Called whenever the spell use is undone in battle
Arguments:
| user: PartyBattler |
|
| target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[] |
Recruit data is separate to enemies, see |
Spell:onSelect(user: PartyBattler, target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[])
(Override) Called whenever the spell is selected for use in battle
Arguments:
| user: PartyBattler |
|
| target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[] |
Recruit data is separate to enemies, see |
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 |
|
| target: Battler[]|EnemyBattler|EnemyBattler[]|PartyBattler|PartyBattler[] |
Recruit data is separate to enemies, see |
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. |
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.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