-
-
Save anonymous/b78ec6513f0a5c1f626ba4df55250929 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from templeplus.pymod import PythonModifier | |
from toee import * | |
import tpdp | |
def testAdd(attachee, args, evt_obj): | |
attachee.float_text_line("sp-Test Spell condition ON", tf_white) | |
return 0 | |
def testTooltip(attachee, args, evt_obj): | |
evt_obj.append("Test Spell") | |
return 0 | |
def testGrappling(attachee, args, evt_obj): | |
evt_obj.return_val = 1 | |
return 0 | |
def testBreakFreeQ(attachee, args, evt_obj): | |
#fires on NPC critter's turn if crippled via EK_Q_Critter_Is_Grappling | |
if args.get_arg(2) == 0: #to prevent multiple firings | |
print "testQBreakFree fired!" | |
attachee.float_text_line("testQBreakFree fired!", tf_white) | |
args.set_arg(2, 1) | |
return 0 | |
def testRadial(attachee, args, evt_obj): | |
#combat.mes {5061}{Break Free} | |
radialAction = tpdp.RadialMenuEntryAction(5061, D20A_BREAK_FREE, args.get_arg(0), "TAG_INTERFACE_HELP") | |
radialAction.add_child_to_standard(attachee, tpdp.RadialMenuStandardNode.Movement) | |
return 0 | |
def testBreakFreeR(attachee, args, evt_obj): | |
#fires when PC breaks free via radial | |
print "BREAKS FREE!" | |
attachee.float_text_line("BREAKS FREE!", tf_white) | |
return 0 | |
def testDivideByZero(attachee, args, evt_obj): | |
#never fires | |
print "THIS WILL NOT FIRE!" | |
attachee.float_text_line("THIS WILL NOT FIRE!", tf_white) | |
return 0 | |
testSP = PythonModifier("sp-Test Spell", 3) | |
testSP.AddHook(ET_OnConditionAdd, EK_NONE, testAdd, ()) | |
testSP.AddHook(ET_OnGetTooltip, EK_NONE, testTooltip, ()) | |
testSP.AddHook(ET_OnD20Query, EK_Q_Critter_Is_Grappling, testGrappling, ()) | |
testSP.AddHook(ET_OnD20Query, EK_Q_Is_BreakFree_Possible, testBreakFreeQ, ()) | |
testSP.AddHook(ET_OnBuildRadialMenuEntry, EK_NONE, testRadial, ()) | |
testSP.AddHook(ET_OnD20Signal, EK_S_BreakFree, testBreakFreeR, ()) | |
testSP.AddHook(ET_OnD20ActionPerform, EK_D20A_BREAK_FREE, testDivideByZero, ()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type the following into the console to test this:
You'll see that it'll only change state if you add evt_obj.return_val = 1 in the BreakFree query callback.