#Trap #77  Curse
#Added with Tales of the North MOD
#8d6+2, save vs. spells for 1/2 damage
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, ["The angry spirits of the castle appear and attack you. Before you can react they disappear again."])
      for partyIdx in range(getPartyCount(e)):
         dmg = dice(8, 6, 2)
         if (savingThrow(e, "spells", partyIdx, 0) > 0):
            dmg = dmg / 2
         modifyHP(e, partyIdx, -dmg)
   return 1
