#Trap #9 - Flame Jets
# 2d8+4, save vs. Fire 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, ["Jets of flame leap out at the party from the floor."])
        for partyIdx in range(getPartyCount(e)):
            dmg = dice(1, 6, 0)
            if (savingThrow(e, "fire", partyIdx, 0) > 0):
                dmg = dmg / 2
            modifyHP(e, partyIdx, -dmg)
    return 1
