#Trap #78  lava and fire
#Added with Tales of the North MOD
#6d6+2, save vs. fire 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 lava nearby erupts in a great flame and heat scorches your lungs as you breathe in the toxic air."])
      for partyIdx in range(getPartyCount(e)):
         dmg = dice(6, 6, 2)
         if (savingThrow(e, "fire", partyIdx, 0) > 0):
            dmg = dmg / 2
         modifyHP(e, partyIdx, -dmg)
   return 1
