Sitra Achara
Arcane
- Joined
- Sep 1, 2003
- Messages
- 1,860
Q5 - Some explanations for the following event types would be helpful (ET_OnDispelCheck, ET_OnSpellImmunityCheck, ET_OnImmunityTrigger), what are they used for, and what do I need to code in these hooks manually? Is dispel magic smart enough to cancel a custom condition or do I need to code it in?
OnImmunityTrigger - basically almost every spell, and some of the spell effects, have this hook. (See https://github.com/GrognardsFromHell/DllDocumentation/wiki/Conditions-(List) and https://github.com/GrognardsFromHell/DllDocumentation/wiki/Conditions-List-Pt2-(spell-effects) )
What this does is signal to the game that before applying the effect (Modifier), it should trigger an immunity check. It also returns the type of immunity it entails (spell / racial / special / other), which is used in the big-ass hardcoded immunity handler function (which triggers on a ET_OnSpellImmunityCheck event) that's currently shared across the various protective ward spells like Death Ward, Prot from Alignment, Minor Globe and others.
They all use the same callback function (at address 100ED5A0), which does the following:
Code:
int __cdecl ImmunityTriggerCallback(DispCallbackArgs args)
{
DispIoType21 *evtObj; // esi@1
int result; // eax@4
evtObj = DispIoCheckIoType21(args.dispIO);
if ( args.subDispNode->condNode != evtObj->condNode || (void *)args.dispKey != args.subDispNode->subDispDef->data1 )
{
LABEL_11:
result = 0;
}
else
{
evtObj->shouldInterrupt = 1;
evtObj->SDDKey1 = (int)args.subDispNode->subDispDef->data1;
switch ( args.subDispNode->subDispDef->data1 )
{
case Disp_Key_Immunity_Spell:
evtObj->spellId = CondNodeGetArg(args.subDispNode->condNode, 0);
result = 10;
break;
case DK_Immunity_11:
result = 11;
break;
case DK_Immunity_12:
result = 12;
break;
case DK_Immunity_Courage:
result = 13;
break;
case DK_Immunity_Racial:
result = 14;
break;
case DK_Immunity_15:
result = 15;
break;
case DK_Immunity_Special:
result = 16;
break;
default:
goto LABEL_11;
}
}
return result;
}
It looks like I haven't exposed the Event Object for Immunity Queries yet, so maybe now would be a good time Though perhaps it'd be simpler to add a method ".AddStandardImmunityTrigger" that uses the above standard function since they all use the same one.
Similarly, DispelCheck has a standard Dispel Handler function that's shared by most of the spell effects (only exception is the spell effect for Bestow Curse, which has a special handler that only reacts to Break Enchantment rather than Dispel Magic).
Q6 - is there a list of all possible variables and flags for the data/rules/spells file?
Not that I know of. You can find the Temple+ extensions and a few of the vanilla ones in spell.cpp \ SpellEntryFileParse.
Not in python, though perhaps what you're after already exists and just has to be exposed to it. If you want to delve deeper into it you should check out history.h / .cpp.Q7 - is it possible to code a custom saving throw/opposing roll (without using a function like reflex_save_and_damage) where the result/breakdown of the roll appears in the roll information box as a hypertext link instead of directly writing it in with create_history_freeform.