#Trap #4 - Darts
# 5d4+2, save vs. DX
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, ["A flurry of darts shoots into your party from the shadows!"], optionInput)
        for partyIdx in range(getPartyCount(e)):
            if (not savingThrow(e, "dex", partyIdx, 0)):
                modifyHP(e, partyIdx, -dice(5, 4, 2))
    return 1
