#Trap #70  Life Siphon
#Added with Tales of the North MOD
#8d8+4, save vs. Con for half
from eventAPI import *
from APIUtils import *

def fireEvent(e):
   lFlagS = getTag(e, "lFlagS")
   if (not issetany(lFlagS, 0x00000300)):
      return 1
   if (isclearall(lFlagS, 0x00000002)):
      showMessage(e, ["A magical glow surrounds you and you feel your life being siphoned away!"], optionInput)
      for partyIdx in range(getPartyCount(e)):
         dmg = dice(8, 8, 4)
         if (savingThrow(e, "con", partyIdx, 0) > 0):
            dmg = dmg / 2
         modifyHP(e, partyIdx, -dmg)
   return 1
