#Trap #74  Mind Zap
#Added with Tales of the North MOD
#10d8+4, save vs. psionics for half
#A mind is a terrible thing to lay waste
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 slight buzzing in your ears quickly becomes a painful roar in you mind.It feels as if someone is beating on your skull from the inside."], optionInput)
      for partyIdx in range(getPartyCount(e)):
         dmg = dice(10, 8, 4)
         if (savingThrow(e, "psionics", partyIdx, 0) > 0):
            dmg = dmg / 2
         modifyHP(e, partyIdx, -dmg)
   return 1
