#encounter at house (25,33)
#always active, so no active time
#active if local flag is zero
from eventAPI import getTag, setTag, setExit, showPicture, playSpecAudio, optionInput, combat, getPartyCount, modifyHP, tickGame
from APIUtils import showMessage
from SDLKeys import SDLK_f, SDLK_r
import strangersHouse

def fireEvent(e):
    lFlagU = getTag(e, "lFlagU")
    if (lFlagU != 0):
        strangersHouse.fireEvent(e)
        setExit(e, None, 25, 34, 0)
        return
    showPicture(e, "Orc_Chief")
    playSpecAudio(e, "House")
    if (optionInput(e,
        ["Orog's gonna get ya"],
        ["(F)ight", "(R)un"], [SDLK_f, SDLK_r]) == SDLK_r):
        return
    combatRet = combat(e, [("Orc Chieftain", 1, 0, 20), ("Orc", 3, 0, 10)])
    if (combatRet == 1):
        showPicture(e, "Naris")
        playSpecAudio(e, "House")
        showMessage(e,
            ["Thank you",
             "Thank you",
             "Thank you"])
        x, c = 0, getPartyCount(e)
        while (x < c):
            modifyHP(e, x, 14)
            x += 1
        tickGame(e, 20)
        setTag(e, "lFlagU", 0x10)
    elif (combatRet == 2):
        showPicture(e, "Orc_Chief")
        showMessage(e,
            ["Hahaha",
             "You run like scared school children"])
    elif (combatRet == 3):
        showPicture(e, "Orc_Chief")
        showMessage(e,
            ["The orcs feast on your still warm carcasses"])
