#plane of fire - random fire damage trap
from eventAPI import *
from APIUtils import *

rtPOFFlame1 = 0

def fireEvent(e):
   global rtPOFFlame1
   rtPOFFlame1 = getTag(e, "rtPOFFlame1")
   if (rtPOFFlame1 == 2):
      return 1
   else:
      for partyIdx in range(getPartyCount(e)):
         dmg = 8
         if (savingThrow(e, "fire", partyIdx, 0) > 0):
            dmg = dmg / 2
         modifyHP(e, partyIdx, -dmg)
      return 1
