#Trap #1 - Falling Rocks
# 3d6+4 damage, save vs. DX to avoid entirely
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, ["You hear a subtle click, and immediately are pummeled by a mass of falling rocks!"], optionInput)
        for partyIdx in range(getPartyCount(e)):
            if (not savingThrow(e, "dex", partyIdx, 0)):
                modifyHP(e, partyIdx, -dice(3, 6, 4))
    return 1
