#Trap #8 - Spiked Roller
# 4d8+4, save vs. DX for half 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, ["A giant roller, studded with large spikes, swings down from the ceiling amidst the party."], optionInput)
        for partyIdx in range(getPartyCount(e)):
            dmg = dice(1, 4, 2)
            if (savingThrow(e, "dex", partyIdx, 0)):
                dmg = dmg / 2
            modifyHP(e, partyIdx, -dmg)
    return 1
