from eventAPI import *
from APIUtils import *
from SDLKeys import *

def fireEvent(e):
    MallornPlt1 = getTag(e, "MallornPlt1");
    if not (MallornPlt1 & 0x1):
        return 1;

    showPicture(e, "Lightning_Mage")
    showMessage(e,
        ["\"You were foolish to disrespect my colleagues!\"",
         "",
         "Lightning bolts rain down on the party!"])
    i, c = 0, getPartyCount(e)
    while (i < c):
        modifyBP(e, i, -5, 1)
        modifyHP(e, i, -20)
        i += 1
    clearPicture(e)
    if (optionInput(e,
        ["When the dust settles, the man is gone.  You notice a scrap of paper laying near where he was standing."],
        ["(R)ead the note", "(L)eave the scene"],
        [SDLK_r, SDLK_l]) == SDLK_r):
        optionInput(e,
            ["Go and see a lovely, but dark, woman in a house near a general store in the SE of town."],
            ["(L)eave the scene"],
            [SDLK_l])
    #giveItems(e, ["Mallorn Note"])
    MallornPlt1 |= 0x2
    MallornPlt1 &= ~0x1
    setTag(e, "MallornPlt1", MallornPlt1)
    return 1
