Spellforce-Spell-framework
Loading...
Searching...
No Matches
SpellFunctions Struct Reference

Represents a collection of function pointers for managing spell-related operations. More...

#include <sf_spell_functions.h>

Collaboration diagram for SpellFunctions:

Data Fields

setXData_ptr setXData
 This function is used to assign specific value to an XData key of a given spell.
 
initializeSpellData_ptr initializeSpellData
 Initializes spell-related data for a given entity.
 
setEffectDone_ptr setEffectDone
 Stops a spell effect handler for a given spell.
 
addToXData_ptr addToXData
 Adds a value to a specific XData entry for the given spell.
 
getChanceToResistSpell_ptr getChanceToResistSpell
 Returns target's resistance to a primary magic school that a specified spell belongs in. In case the spell has requirements for more than one magic school, the school with the highest requirement is regarded as primary.
 
getRandom_ptr getRandom
 Generates a random value up to the specified maximum value.
 
getResourceSpellData_ptr getResourceSpellData
 
addVisualEffect_ptr addVisualEffect
 spawn a visual effect.
 
figureAggro_ptr figureAggro
 Used to trigger aggressive behavior for a figure.
 
getXData_ptr getXData
 Retrieves the XData value for a specific spell.
 
getTargetsRectangle_ptr getTargetsRectangle
 This function is used to calculate area of effect for a spell.
 
removeDLLNode_ptr removeDLLNode
 Used to remove a spell from the list of active spells over the target.
 
spellClearFigureFlag_ptr spellClearFigureFlag
 Clears a specific flag on the spell object.
 
addSpell_ptr addSpell
 Creates a new spell of a given spell type.
 
getSpellLine_ptr getSpellLine
 Retrieves the spell type ID of a given spell.
 
onSpellRemove_ptr onSpellRemove
 This function is triggered when a spell stops.
 
getSpellID_ptr getSpellID
 Retrieves the Spell Effect ID for a given spell index. The spell effect ID can be used to obtain spell parameters (such as damage, radius, duration, etc.) from GameData.cff.
 
checkCanApply_ptr checkCanApply
 Calls the Refresh handler for a specified spell type.
 
getSpellTags_ptr getSpellTags
 Retrieves the tags associated with a spell.
 
hasSpellTag_ptr hasSpellTag
 Checks if a spell has a specific tag.
 
figClrChkSplBfrChkBattle_ptr figClrChkSplBfrChkBattle
 Clears the CHECK_SPELLS_BEFORE_CHECK_BATTLE flag.
 
figTryClrCHkSPlBfrJob2_ptr figTryClrCHkSPlBfrJob2
 clears the CHECK_SPELLS_BEFORE_JOB2 flag
 
figTryUnfreeze_ptr figTryUnfreeze
 clears the UNFREEZE flag
 
spellEffectCallback_ptr spellEffectCallback
 callback that iterates through spells on a target, checks a condition then executes the callback.
 
getLeveledSpellID_ptr getLeveledSpellID
 

Detailed Description

Represents a collection of function pointers for managing spell-related operations.

Definition at line 327 of file sf_spell_functions.h.

Field Documentation

◆ addSpell

addSpell_ptr SpellFunctions::addSpell

Creates a new spell of a given spell type.

This function creates a new spell of the specified spell type and associates it with a source and target entity. The spell will be active during the game, and the time it appears is determined by the internal game tick.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Type ID of the spell to create.
game_tickThe internal game tick when the spell should appear. This value can be determined via the opaque class in the global spell object.
sourceThe index of the spell caster (source entity).
targetThe Spell Target entity index.
param5The purpose of this parameter is currently unknown. For safe use, it is recommended to pass it as 0.

Definition at line 474 of file sf_spell_functions.h.

◆ addToXData

addToXData_ptr SpellFunctions::addToXData

Adds a value to a specific XData entry for the given spell.

This function increments the XData value associated with the given spell and XData key.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the currently active spell.
keyThe XData key to modify.
valueThe value to add to the XData entry.
Returns
Summed value of the spell XData Key

Definition at line 369 of file sf_spell_functions.h.

◆ addVisualEffect

addVisualEffect_ptr SpellFunctions::addVisualEffect

spawn a visual effect.

This function attaches a visual effect to the given spell and its corresponding target.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the currently active spell.
effect_idThe ID of the visual effect to apply.
See also
kGdEffectSpellHitTarget
Parameters
unusedUnused parameter that may be for future extensibility; Set to 0 for now.
targetThe entity target data which the visual effect will be centered on. The X-Y coordinates passed as part of the target data will determine the visual effect offset relative to the target.
See also
SF_CGdTargetData
Parameters
tick_startThe internal game tick when the visual effect must appear.
tick_countThe number of ticks the visual effect will last.
corner_coordsThe area that the visual effect would be within for AoE effects. Use {0,0} for non AOE Spells.

Definition at line 408 of file sf_spell_functions.h.

◆ checkCanApply

checkCanApply_ptr SpellFunctions::checkCanApply

Calls the Refresh handler for a specified spell type.

This function acts as a wrapper to invoke the Refresh handler associated with the given spell. It returns the value that the Refresh handler returns.

Parameters
_thisA pointer to the global spell object.
spell_idThe index of the spell for which the Refresh handler is called.
Returns
The value returned by the Refresh handler.

Definition at line 511 of file sf_spell_functions.h.

◆ figClrChkSplBfrChkBattle

figClrChkSplBfrChkBattle_ptr SpellFunctions::figClrChkSplBfrChkBattle

Clears the CHECK_SPELLS_BEFORE_CHECK_BATTLE flag.

Definition at line 535 of file sf_spell_functions.h.

◆ figTryClrCHkSPlBfrJob2

figTryClrCHkSPlBfrJob2_ptr SpellFunctions::figTryClrCHkSPlBfrJob2

clears the CHECK_SPELLS_BEFORE_JOB2 flag

Definition at line 540 of file sf_spell_functions.h.

◆ figTryUnfreeze

figTryUnfreeze_ptr SpellFunctions::figTryUnfreeze

clears the UNFREEZE flag

Definition at line 545 of file sf_spell_functions.h.

◆ figureAggro

figureAggro_ptr SpellFunctions::figureAggro

Used to trigger aggressive behavior for a figure.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the active spell.
target_indexThe figure to make aggressive towards the caster of the spell.

Definition at line 417 of file sf_spell_functions.h.

◆ getChanceToResistSpell

getChanceToResistSpell_ptr SpellFunctions::getChanceToResistSpell

Returns target's resistance to a primary magic school that a specified spell belongs in. In case the spell has requirements for more than one magic school, the school with the highest requirement is regarded as primary.

Parameters
autoclass34A pointer to an internal class.
sourceThe source character or entity casting the spell.
targetThe target character or entity that we want the resistance from.
effect_infospell effect ID and spell job ID grouped in a single variable of SF_SpellEffectInfo
Returns
The chance that the spell will be resisted, sometimes used as a 'chance' to fully resist the spell, also used to mitigate the damage dealt with the spell.

Definition at line 381 of file sf_spell_functions.h.

◆ getLeveledSpellID

getLeveledSpellID_ptr SpellFunctions::getLeveledSpellID

Definition at line 556 of file sf_spell_functions.h.

◆ getRandom

getRandom_ptr SpellFunctions::getRandom

Generates a random value up to the specified maximum value.

This function returns a random value between 0 and the specified maximum value (inclusive).

Parameters
autoclass14A pointer to the Opaque class of the spell global object.
max_valueThe upper bound for the random number.
Returns
A random value between 0 and the specified maximum.

Definition at line 391 of file sf_spell_functions.h.

◆ getResourceSpellData

getResourceSpellData_ptr SpellFunctions::getResourceSpellData

Definition at line 393 of file sf_spell_functions.h.

◆ getSpellID

getSpellID_ptr SpellFunctions::getSpellID

Retrieves the Spell Effect ID for a given spell index. The spell effect ID can be used to obtain spell parameters (such as damage, radius, duration, etc.) from GameData.cff.

Parameters
_thisA pointer to the global spell object.
spell_indexThe index of the spell.
Returns
The Spell Effect ID.

Definition at line 499 of file sf_spell_functions.h.

◆ getSpellLine

getSpellLine_ptr SpellFunctions::getSpellLine

Retrieves the spell type ID of a given spell.

This function returns the spell type ID associated with a given spell.

Parameters
_thisA pointer to the global spell object.
spell_idThe index of the spell for which the type ID is to be retrieved
Returns
The Spell Type ID associated with the given spell.

Definition at line 485 of file sf_spell_functions.h.

◆ getSpellTags

getSpellTags_ptr SpellFunctions::getSpellTags

Retrieves the tags associated with a spell.

This function returns a set of tags associated with a given spell, which can be used for filtering or classification.

Parameters
spell_indexThe index of the spell.
Returns
A set of tags related to the spell.

Definition at line 520 of file sf_spell_functions.h.

◆ getTargetsRectangle

getTargetsRectangle_ptr SpellFunctions::getTargetsRectangle

This function is used to calculate area of effect for a spell.

The Area of effect for a spell is a circle of a given radius within a rectangle

Parameters
_thisA pointer to the global spell object.
outputA pointer to the rectangle structure to store the result.
spell_idThe Spell Index of the currently active spell.
radiusThe radius of the area of effect.
center_maybeThe center coordinates of the area of effect.
Returns
A pointer to the rectangle representing the affected area that contains all possible targets of the spell.

Definition at line 441 of file sf_spell_functions.h.

◆ getXData

getXData_ptr SpellFunctions::getXData

Retrieves the XData value for a specific spell.

This function returns the XData value stored for a given spell and key.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the currently active spell.
keyNumerical XData key ID or its predefined enumerator.
Returns
The value associated with the XData key.

Definition at line 428 of file sf_spell_functions.h.

◆ hasSpellTag

hasSpellTag_ptr SpellFunctions::hasSpellTag

Checks if a spell has a specific tag.

This function determines whether the given spell contains the specified tag.

Parameters
spell_idThe ID of the spell.
tagThe tag to check for.
See also
SpellTag
Returns
True if the spell has the specified tag, false otherwise.

Definition at line 530 of file sf_spell_functions.h.

◆ initializeSpellData

initializeSpellData_ptr SpellFunctions::initializeSpellData

Initializes spell-related data for a given entity.

This function initializes spell data for a given entity, using the specified spell ID and key.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the spell.
keyThe SpellDataKey to initialize the data with.

Definition at line 346 of file sf_spell_functions.h.

◆ onSpellRemove

onSpellRemove_ptr SpellFunctions::onSpellRemove

This function is triggered when a spell stops.

Definition at line 490 of file sf_spell_functions.h.

◆ removeDLLNode

removeDLLNode_ptr SpellFunctions::removeDLLNode

Used to remove a spell from the list of active spells over the target.

Warning
This function should be used together with setEffectDone in order to correctly finish the spell.
Parameters
_thisA pointer to the global spell object.
spell_indexThe Spell Index of the currently active spell.

Definition at line 449 of file sf_spell_functions.h.

◆ setEffectDone

setEffectDone_ptr SpellFunctions::setEffectDone

Stops a spell effect handler for a given spell.

This function marks the spell effect as completed, which will lead to its automatic termination during the next game tick.

Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the currently active spell.
param_2The second parameter whose purpose is currently unknown; it should always be set to 0.

Definition at line 357 of file sf_spell_functions.h.

◆ setXData

setXData_ptr SpellFunctions::setXData

This function is used to assign specific value to an XData key of a given spell.

Parameters
_thisa pointer to the global spell object
spell_idThe Spell Index of the currently active spell
uint32_tThe predefined enumerator of the XData Key.
valueThe value you wish to assign expressed as integer.

Definition at line 336 of file sf_spell_functions.h.

◆ spellClearFigureFlag

spellClearFigureFlag_ptr SpellFunctions::spellClearFigureFlag

Clears a specific flag on the spell object.

It works as a wrapper of more specific flag clearing functions,

See also
figClrChkSplBfrChkBattle or figTryClrCHkSPlBfrJob2
Parameters
_thisA pointer to the global spell object.
spell_idThe Spell Index of the currently active spell.
keyThe flag key to clear.
See also
SpellFlagKey

Definition at line 459 of file sf_spell_functions.h.

◆ spellEffectCallback

spellEffectCallback_ptr SpellFunctions::spellEffectCallback

callback that iterates through spells on a target, checks a condition then executes the callback.

Definition at line 550 of file sf_spell_functions.h.


The documentation for this struct was generated from the following file: