Ejemplo n.º 1
0
Event.registerEvent("MakeCampfire", func)

# Debug functions for this event.


# Check that the haunting event never spreads Fever from the ghost. We detect Haunting here by checking for Contestants in the DescList that were dead at the _beginning_ of the event.
def CheckHauntNoFever(event_info, state, event_outputs):
    if event_info["event_data"]["eventName"] != "MakeCampfire":
        return True, None
    mainActor = event_info["event_data"]["mainActor"]
    # Check if the current mainActor has no fever. If so, return.
    if not state["contestants"][mainActor].hasThing("Fever"):
        return True, None
    # Check if the pre-event mainActor had fever. If so, return.
    if event_info["pre_state"]["contestants"][mainActor].hasThing("Fever"):
        return True, None
    # mainActor caught Fever somehow. Is this a haunting event?
    from Objs.Contestants.Contestant import Contestant
    # Find contestants listed in the event_outputs that aren't the mainActor.
    for item in event_outputs.display_items:
        if isinstance(item, Contestant
                      ) and str(item) != event_info["event_data"]["mainActor"]:
            if not event_info["pre_state"]["contestants"][str(item)].alive:
                # This is a haunting event, but mainActor caught Fever. This is an error.
                return False, "CheckHauntNoFever failed"
    return True, None


Event.registerDebug(CheckHauntNoFever)
    mainActor = event_info["event_data"]["mainActor"]
    if state["contestants"][mainActor].alive:
        living_pre_contestants.append(
            event_info["pre_state"]["contestants"][mainActor])
    if not living_pre_contestants:  # Everyone died in this event, so loot not distributed.
        return True, None
    for potential_item in event_outputs.display_items:
        if (not isinstance(potential_item, ItemInstance) and not isinstance(
                potential_item, Item)) or not potential_item.lootable:
            continue
        for _, item_list in event_outputs.loot_table.items():
            for item in item_list:
                if item.is_same_item(potential_item):
                    break
            else:
                continue
            break
        else:
            # Now check the *pre-event* inventory of survivors.
            if potential_item.stackable:
                continue
            for pre_contestant in living_pre_contestants:
                if pre_contestant.hasThing(potential_item):
                    break
            else:
                return False, "CheckPreexistingLootAcquired Failed"
    return True, None


Event.registerDebug(CheckPreexistingLootAcquired)