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

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

    showMessage(e,
                ["Halt! We know you've been snooping around! You've been charged with treason against the Town, and we're here to mete out justice!"]);

    combatRet = combat(e,[("Guardian of Rennibister",5,3,20)]);
    if combatRet==1:
        guardCount=getTag(e,"guardCount");
        guardCount+=1;
        setTag(e,"guardCount",guardCount);
        if guardCount==5:
            GuardPlt1=getTag(e,"GuardPlt1");
            GuardPlt1|=0x04;
            setTag(e,"GuardPlt1",GuardPlt1);
            showMessage(e,
                        ["A note is placed in your hand..."]);
            giveItems(e, ["Harassment Note"])
            return 1;
        elif (guardCount%5)==0:
            showMessage(e,
                        ["A note is placed in your hand..."]);
            giveItems(e, ["Watcher Note"])
            return 1;

    return 1;

