Combat Events
Combat events are damage, healing and aura events that are reached via the entrypoints into the combat script. They calculate the magnitude of a spell, unless prescribed, check for avoidance and ciritcal hits, apply the hp change or aura to the target, and log the interaction.
combat_event_damage
This function handles damage events. It uses the spell, the source, the target, and the value as arguments. If the value was not prescribed when calling the entrypoint, it is -1 at this point, which causes this function to calculate the actual value as a first step. It then checks whether the spell is avoidable, and if so, if it is avoided. If it is not avoided, it checks whether the spell can hit critically, and changes the value accordingly if the hit is critical. This leads to the finalized value, which is then first applied to the absorb shields on the target, if they are present, and then to the health of the target. The interaction is then logged.
combat_event_heal
This function handles healing events. It uses the spell, the source, the target, and the value as arguments. If the value was not prescribed when calling the entrypoint, it is -1 at this point, which causes this function to calculate the actual value as a first step. It then checks whether the spell can hit critically, and changes teh value accordingly if the hit is critical. This leads to the finalized value, which is appriel to the health of the target. The interaction is then logged.
combat_event_aura
This function handles the instantiating and adding of aura scenes. It uses the spell, the source, and the target as arguments. First, the listed name of the aura is created, which is the name that the child scene will have, and the name that will appear in the aura array of the target. It consists of the name of the spell, and if the aura is not unique (i.e., multiple sources can apply the same aura on one target), the name of the source is appended. This array is sued t track which auras are present on a target. If the aura is already present, it is reinitialized by calling the reinitialize function in the already present aura script. If the aura is not yet present, the appropriate aura scene (dot, buff or absorb) is instantiated, the name is changed to the previously generated listed name, the aura is initialized and added to the appropriate aura container, and the aura name is appended to the aura array of the target. The interaction is then logged.
combat_event_aura_remove
This function handles the removal of auras from a target. It uses the spell, the source, and the target as arguments. First, the listed name of the aura is created, which is the name that the child scene will have, and the name that will appear in the aura array of the target. It consists of the name of the spell, and if the aura is not unique (i.e., multiple sources can apply the same aura on one target), the name of the source is appended. The aura name is then erased from the target's aura array, and the scene is removed from the aura container. The interaction is then logged.
No Comments