#Trap #5 - Poisonous Gas
# no damage, 2d2/20 ticks, save vs. CN for poison
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 stinking green cloud fills the air, choking the party!"], optionInput)
        for partyIdx in range(getPartyCount(e)):
            if (not savingThrow(e, "con", partyIdx, 0)):
                poison(e, partyIdx, 2, 2, 0, 20, 1, dice(20, 6, 240))
    return 1
