示例#1
0
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    mainActor.addItem(state["items"]["Spear"], isNew=True)
    desc = mainActor.name + ' crafted a crude spear.'
    # Second entry is the contestants named in desc, in order. Third is anyone who died.
    return (desc, [mainActor, state["items"]["Spear"]], [])


Event.registerEvent("CraftSpear", func)
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    mainActor.addItem(state["items"]["Clean Water"], isNew=True)
    desc = mainActor.name + " found a river with " + \
        state["items"]["Clean Water"].friendly + ", and collected some."
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, state["items"]["Clean Water"]], [])


Event.registerEvent("FindRiverCleanWater", func)
示例#3
0
        "relationInfluence"], True


Event.registerInsertedCallback("modifyIndivActorWeightsWithParticipants",
                               checkParticipantMedicine)
Event.registerInsertedCallback("modifyIndivActorWeightsWithParticipants",
                               checkParticipantLove)


def checkActorLove(actor, origWeight, event):
    if event.name == "FriendGivesMedicine" and actor.hasThing("Love"):
        return (origWeight *
                event.stateStore[0]["settings"]["relationInfluence"] / 3, True)


Event.registerEvent("modifyIndivActorWeights", checkActorLove)


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    if not participants[0].removeItem(state["items"]["Medicine"]):
        return None  # In a rare scenario, the person giving the medicine uses it before this event happens. In that case, the event is waived.
    mainActor.addItem(state["items"]["Medicine"])
    state["allRelationships"].IncreaseFriendLevel(mainActor, participants[0],
                                                  random.randint(3, 4))
    state["allRelationships"].IncreaseLoveLevel(mainActor, participants[0],
                                                random.randint(0, 2))
示例#4
0
        victims[0],
        state["settings"],
        defenseStat=(victims[0].getCombatAbility(mainActor) * 0.5 +
                     victims[0].stats['cleverness']
                     ))  # this event is mildly rigged against attacker
    descList = [mainActor, victims[0]]
    if random.random() < probKill:
        victims[0].kill()
        if mainActor.stats['ruthlessness'] > 6:
            desc = mainActor.name + ' lay in wait for ' + \
                victims[0].name + ', surprising and gutting ' + \
                Event.parseGenderObject(victims[0]) + '.'
        else:
            desc = mainActor.name + ' lay in wait for ' + \
                victims[0].name + ', surprising and killing ' + \
                Event.parseGenderObject(victims[0]) + '.'
        lootDict, destroyedList = self.lootForOne(mainActor, victims[0])
        return EventOutput(desc,
                           descList, [victims[0].name],
                           loot_table=lootDict,
                           destroyed_loot_table=destroyedList)
    else:
        desc = mainActor.name + ' lay in wait for ' + \
            victims[0].name + ', but ' + \
            Event.parseGenderSubject(victims[0]) + ' managed to see it coming.'
        # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
        return (desc, descList, [])


Event.registerEvent("AAmbushesB", func)
示例#5
0
    state["allRelationships"].IncreaseLoveLevel(
        mainActor, state["contestants"][chosen], 10)
    mainActor.permStatChange({'stability': 2})
    eventHandler = IndividualEventHandler(state)
    eventHandler.banMurderEventsAtoB(mainActor.name, chosen)
    eventHandler.banEventForSingleContestant(
        "AWorshipsB", mainActor.name)
    self.eventStore.setdefault("permanent", collections.OrderedDict())[
        mainActor.name] = eventHandler
    if chosen == "Kaname Madoka":
        eventHandler = IndividualEventHandler(state)
        eventHandler.setEventWeightForSingleContestant(
            "HomuciferKillsBadWorshipper", mainActor.name, 10, state)
        state["allRelationships"].IncreaseFriendLevel(
            state["sponsors"]["Madokami"], mainActor, 10)
        self.eventStore[mainActor.name] = eventHandler
    elif chosen == "Akemi Homura":
        eventHandler = IndividualEventHandler(state)
        eventHandler.setEventWeightForSingleContestant(
            "MadokamiKillsBadWorshipper", mainActor.name, 10, state)
        state["allRelationships"].IncreaseFriendLevel(
            state["sponsors"]["Akuma Homura"], mainActor, 10)
        self.eventStore[mainActor.name] = eventHandler
    desc = 'In a delirious state, ' + mainActor.name + \
        ' had a religious epiphany, realizing that ' + \
        chosen + ' is the avatar of a divine being.'
    return (desc, [mainActor, state["contestants"][chosen]], [], None, [mainActor])


Event.registerEvent("AWorshipsB", func)
示例#6
0
                str(participants[0]) + ' to go through with it.'
            mainActor.kill()
            deadList = [mainActor.name]
        else:
            desc += ', but ' + Event.parseGenderSubject(
                participants[0]
            ) + ' refused, killing ' + Event.parseGenderReflexive(
                participants[0]) + ' instead!'
            participants[0].kill()
            deadList = [participants[0].name]
        return (desc, [mainActor, participants[0]], deadList)
    if chosen == 'participantBegToKill':
        desc += str(participants[0]) + " begged " + str(mainActor) + \
            " to kill " + Event.parseGenderObject(participants[0])
        if state['allRelationships'].loveships[str(mainActor)][str(
                participants[0])] < 4 or random.random() > 0.5:
            desc += ', forcing ' + str(mainActor) + ' to go through with it.'
            deadList = [participants[0].name]
            participants[0].kill()
        else:
            desc += ', but ' + Event.parseGenderSubject(
                mainActor) + ' refused, killing ' + Event.parseGenderReflexive(
                    mainActor) + ' instead!'
            mainActor.kill()
            deadList = [mainActor.name]
        return (desc, [mainActor, participants[0]], deadList)
    raise AssertionError("This should not happen! " + chosen)


Event.registerEvent("SponsorForceFight", func)
示例#7
0
from Objs.Events.Event import Event
import random
from collections import defaultdict


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    # they shouldn't be practicing combat if injured
    if state["callbackStore"].setdefault('InjuredDict', defaultdict(bool)):
        return None
    desc = mainActor.name + ' practiced combat'
    practiceAbility = mainActor.stats['combat ability']
    injuries = None
    if random.random() > 1 / (1 + 1.3**practiceAbility):
        desc += ' but hurt ' + \
            Event.parseGenderReflexive(mainActor) + ' doing so.'
        mainActor.addStatus(state["statuses"]["Injury"])
        injuries = [str(mainActor)]
    else:
        desc += ' and was successfully able to improve ' + \
            Event.parseGenderPossessive(mainActor) + ' skills'
        mainActor.permStatChange({'combat ability': 1})
    return EventOutput(desc, [mainActor], [], injuries=injuries)


Event.registerEvent("HurtsSelfPracticingCombat", func)
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    desc = mainActor.name + " recovered from " + \
        Event.parseGenderPossessive(mainActor) + " fever."
    if mainActor.hasThing("Medicine"):
        mainActor.removeItem(state["items"]["Medicine"])
        desc = "Thanks to " + \
            Event.parseGenderPossessive(mainActor) + " medicine, " + desc
    mainActor.removeStatus("Fever")
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor], [])


Event.registerEvent("RecoversFromFever", func)
示例#9
0
Event.registerInsertedCallback("overrideContestantEvent",
                               fixedMadokamiCallback)


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    success = random.randint(0, 1)
    if success:
        mainActor.kill()
        desc = sponsors[0].name + ' struck down ' + mainActor.name + " for " + \
            Event.parseGenderPossessive(mainActor) + " blasphemous beliefs."
        tempList = [sponsors[0], mainActor]
        del state["events"]["AWorshipsB"].eventStore[mainActor.name]
        deadList = [mainActor.name]
    else:
        desc = sponsors[
            0].name + ' tried to strike down ' + mainActor.name + " for " + Event.parseGenderPossessive(
                mainActor
            ) + " blasphemous beliefs, but Akuma Homura was able to intervene successfully."
        tempList = [sponsors[0], mainActor, state["sponsors"]["Akuma Homura"]]
        deadList = []
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, tempList, deadList)


Event.registerEvent("MadokamiKillsBadWorshipper", func)
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    mainActor.addItem(state["items"]["Fruit"], isNew=True)
    desc = mainActor.name + ' collected fruit from a tree.'
    # Second entry is the contestants named in desc, in order. Third is anyone who died.
    return (desc, [mainActor, state["items"]["Fruit"]], [])


Event.registerEvent("GetsFruitFromTree", func)
示例#11
0
Event.registerInsertedCallback("overrideContestantEvent",
                               fixedHomuciferCallback)


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    success = random.randint(0, 1)
    if success:
        mainActor.kill()
        desc = sponsors[0].name + ' struck down ' + mainActor.name + " for " + \
            Event.parseGenderPossessive(mainActor) + " dangerous beliefs."
        tempList = [sponsors[0], mainActor]
        del state["events"]["AWorshipsB"].eventStore[mainActor.name]
        deadList = [mainActor.name]
    else:
        desc = sponsors[
            0].name + ' tried to strike down ' + mainActor.name + " for " + Event.parseGenderPossessive(
                mainActor
            ) + " dangerous beliefs, but Madokami was able to intervene successfully."
        tempList = [sponsors[0], mainActor, state["sponsors"]["Madokami"]]
        deadList = []
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, tempList, deadList)


Event.registerEvent("HomuciferKillsBadWorshipper", func)
示例#12
0
    # Deteriorate relationship of victim toward participant
    state["allRelationships"].IncreaseFriendLevel(victims[0], mainActor, -2)
    state["allRelationships"].IncreaseLoveLevel(victims[0], mainActor, -3)
    lootDict = None
    destroyedList = None
    if random.random() < probKill:
        victims[0].kill()
        deadList = [victims[0].name]
        desc = mainActor.name + ' threw a spear through ' + \
            victims[0].name + "'s neck and killed " + \
            Event.parseGenderObject(victims[0]) + "."
        lootDict, destroyedList = self.lootForOne(mainActor, victims[0])
    else:
        deadList = []
        desc = mainActor.name + ' threw a spear at ' + \
            victims[0].name + ", but missed."
        # 50/50 chance the victim gets the spear, if not broken.
        if not spearBroken and random.randint(0, 1):
            desc += " " + victims[0].name + " was able to steal the spear!"
            lootref = mainActor.removeAndGet(state["items"]["Spear"])
            victims[0].addItem(lootref)
            lootDict = {victims[0].name: [lootref]}
    if spearBroken:
        desc += " The spear was broken in the process."
        mainActor.removeItem(state["items"]["Spear"])
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return EventOutput(desc, tempList, deadList, loot_table=lootDict, destroyed_loot_table=destroyedList)


Event.registerEvent("ThrowSpearKill", func)
示例#13
0
from Objs.Events.Event import Event


def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None):
    victims[0].kill()
    desc = mainActor.name + ' killed ' + victims[0].name + "."
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, victims[0]], [victims[0].name])


Event.registerEvent("TestOneKill", func)
                ' found themselves confused by their feelings.'
            weight = 10
        elif len(confused) == 1:
            desc += ' ' + Event.englishList(
                confused) + ' found ' + Event.parseGenderReflexive(
                    confused[0]
                ) + ' confused by ' + Event.parseGenderPossessive(
                    confused[0]) + ' feelings.'
            weight = 20
        if confused:
            eventHandler = IndividualEventHandler(state)
            eventHandler.banEventForSingleContestant(
                "ShareIntimateConversation", mainActor.name)
            eventHandler.banEventForSingleContestant(
                "ShareIntimateConversation", participants[0].name)
            for person in confused:
                eventHandler.bindRoleForContestantAndEvent(
                    "participants",
                    [mainActor if person != mainActor else participants[0]],
                    person, "ResolvesFeelingConfusion")
                eventHandler.setEventWeightForSingleContestant(
                    "ResolvesFeelingConfusion", person.name, weight, state)
            self.eventStore[mainActor.name] = eventHandler
            self.eventStore[
                participants[0].name] = eventHandler  # Yes, two copies
        # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, participants[0]], [])


Event.registerEvent("ShareIntimateConversation", func)
示例#15
0
from Objs.Utilities.ArenaEnumsAndNamedTuples import EventOutput
from Objs.Events.Event import Event
import random


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    attackers = [mainActor] + participants
    desc = Event.englishList(
        attackers
    ) + " worked together to ambush and attack " + victims[0].name + "."
    descList = attackers + victims
    fightDesc, fightDead, allKillers, lootDict, injuries, destroyedList = self.factionFight(
        attackers, victims, state["allRelationships"])
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return EventOutput(desc + fightDesc,
                       descList,
                       sorted([x.name for x in fightDead]),
                       allKillers,
                       loot_table=lootDict,
                       injuries=injuries,
                       destroyed_loot_table=destroyedList)


Event.registerEvent("GangUpFight", func)
        victims[0],
        state["settings"],
        defenseStat=(victims[0].getCombatAbility(mainActor) * 0.25 +
                     victims[0].stats['cleverness'] * 0.15))
    tempList = [mainActor, state["items"]["Bow and Arrow"], victims[0]]
    # Deteriorate relationship of victim toward participant
    state["allRelationships"].IncreaseFriendLevel(victims[0], mainActor, -2)
    state["allRelationships"].IncreaseLoveLevel(victims[0], mainActor, -3)
    lootDict = None
    destroyedList = None
    if random.random() < probKill:
        victims[0].kill()
        deadList = [victims[0].name]
        desc = mainActor.name + ' shot an arrow at ' + \
            victims[0].name + " and killed " + \
            Event.parseGenderObject(victims[0]) + "."
        lootDict, destroyedList = self.lootForOne(mainActor, victims[0])
    else:
        deadList = []
        desc = mainActor.name + ' shot an arrow at ' + \
            victims[0].name + ", but missed."
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return EventOutput(desc,
                       tempList,
                       deadList,
                       loot_table=lootDict,
                       destroyed_loot_table=destroyedList)


Event.registerEvent("FireArrowKill", func)
示例#17
0
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    mainActor.kill()
    desc = mainActor.name + \
        " was decapitated by a trap due to carelessness and wanting to show off."
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor], [mainActor.name])


Event.registerEvent("MamiDecap", func)
from Objs.Events.Event import Event
from Objs.Events.IndividualEventHandler import IndividualEventHandler


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    if mainActor.hasThing("Medicine"):
        mainActor.removeItem(state["items"]["Medicine"])
        desc = mainActor.name + " felt " + Event.parseGenderReflexive(
            mainActor
        ) + " getting sick, but was able to ward it off with " + Event.parseGenderPossessive(
            mainActor) + " medicine."
    else:
        desc = mainActor.name + " got sick with a severe fever."
        mainActor.addStatus("Fever")
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, state["statuses"]["Fever"]], [])


Event.registerEvent("SickWithFever", func)
示例#19
0
        victims[0],
        state["settings"],
        defenseStat=(victims[0].getCombatAbility(mainActor) +
                     victims[0].stats['cleverness'] *
                     0.5))  # this event is mildly rigged against attacker
    descList = [mainActor, victims[0]]
    if random.random() < probKill:
        victims[0].kill()
        if mainActor.stats['ruthlessness'] > 6:
            desc = mainActor.name + ' snuck up on ' + \
                victims[0].name + ', killing ' + \
                Event.parseGenderObject(victims[0]) + ' brutally.'
        else:
            desc = mainActor.name + ' attacked ' + \
                victims[0].name + ', killing ' + \
                Event.parseGenderObject(victims[0]) + ' efficiently.'
        lootDict, destroyedList = self.lootForOne(mainActor, victims[0])
        return EventOutput(desc,
                           descList, [victims[0].name],
                           loot_table=lootDict,
                           destroyed_loot_table=destroyedList)
    else:
        desc = mainActor.name + ' tried to attack ' + \
            victims[0].name + ', but ' + \
            Event.parseGenderSubject(victims[0]) + ' managed to escape.'
        # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
        return (desc, descList, [])


Event.registerEvent("AAttacksB", func)
示例#20
0
Event.registerInsertedCallback("postDayCallbacks", countDaysWithoutWater)


def adjustDysenteryChance(actor, indivProb, event):
    if str(event) == "Dysentary":
        # initializes if not present, by default it always returns 0
        event.eventStore.setdefault("daysWithoutWater", defaultdict(int))
        # A simple linear multiplier, more merciful and easier than exponential
        indivProb *= event.eventStore["daysWithoutWater"][str(actor)]
    return indivProb, True


Event.registerInsertedCallback("modifyIndivActorWeights",
                               adjustDysenteryChance)


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    mainActor.kill()
    desc = mainActor.name + " died horribly of dysentery."
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor], [mainActor.name])


Event.registerEvent("Dysentary", func)
from Objs.Events.Event import Event
import random


def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None):
    # Random relationship boost
    state["allRelationships"].IncreaseFriendLevel(
        mainActor, participants[0], random.randint(0, 2))
    state["allRelationships"].IncreaseLoveLevel(
        mainActor, participants[0], random.randint(0, 1))
    state["allRelationships"].IncreaseFriendLevel(
        participants[0], mainActor, random.randint(0, 2))
    state["allRelationships"].IncreaseLoveLevel(
        participants[0], mainActor, random.randint(0, 1))
    desc = mainActor.name + ' and ' + \
        participants[0].name + ' shared stories about their lives.'
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, participants[0]], [])


Event.registerEvent("ShareStoryofLife", func)
示例#22
0
import random

from Objs.Events.Event import Event


def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None):
    probSuccess = mainActor.stats["cleverness"] * \
        0.03 + mainActor.stats["survivalism"] * 0.03
    descList = [mainActor]
    if random.random() < probSuccess:
        mainActor.addItem(state["items"]["Bow and Arrow"], isNew=True)
        descList.append(state["items"]["Bow and Arrow"])
        desc = mainActor.name + ' crafted a Bow and Arrow set.'
    else:
        desc = mainActor.name + ' tried crafting a Bow and Arrow set, but failed.'
    # Second entry is the contestants named in desc, in order. Third is anyone who died.
    return (desc, descList, [])


Event.registerEvent("CraftBowAndArrow", func)
示例#23
0
def checkSponsorLove(actor, sponsor, baseEventActorWeight, event):
    if event.name != "SponsorGivesTips":
        return baseEventActorWeight, True
    possible_love = actor.hasThing("Love")
    if not possible_love or str(possible_love[0].target) != str(sponsor):    
        return baseEventActorWeight, True
    return baseEventActorWeight*event.stateStore[0]["settings"]["relationInfluence"], True

Event.registerInsertedCallback(
    "modifyIndivActorWeightsWithSponsors", checkSponsorLove)

def checkActorLove(actor, origWeight, event):
    if event.name == "SponsorGivesTips" and actor.hasThing("Love"):
        return (origWeight*event.stateStore[0]["settings"]["relationInfluence"]/3, True)

Event.registerEvent("modifyIndivActorWeights", checkActorLove)

def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None):
    state["allRelationships"].IncreaseFriendLevel(
        mainActor, sponsors[0], random.randint(2, 3))
    mainActor.permStatChange({'survivalism': 2,
                              'cleverness': 2})

    # This cannot happen more than once
    eventHandler = IndividualEventHandler(state)
    eventHandler.banEventForSingleContestant(
        "SponsorGivesTips", mainActor.name)
    # This will remain in place for the rest of the game
    self.eventStore[mainActor.name] = eventHandler
    potential_love = sponsors[0].hasThing("Love")
    if (random.random() > self.local_settings["UnknownSponsorRate"]) or (potential_love and str(potential_love[0].target) == str(mainActor)):
示例#24
0
    currentAmmo -= ammoUsed
    lootDict = None
    destroyedList = None
    if random.random() < probKill:
        victims[0].kill()
        deadList = [victims[0].name]
        desc = mainActor.name + ' fired at ' + \
            victims[0].name + " from long range and killed " + \
            Event.parseGenderObject(victims[0]) + "."
        lootDict, destroyedList = self.lootForOne(mainActor, victims[0])
    else:
        deadList = []
        desc = mainActor.name + ' fired at ' + \
            victims[0].name + " from long range, but missed."
    if currentAmmo > 0:
        desc += "\nAmmo remaining: " + str(currentAmmo) + " (" + str(
            ammoUsed) + " used)"
        actualItem.data["currentammo"] = currentAmmo
    else:
        desc += "\nThe Rifle belonging to " + mainActor.name + " exhausted its ammo."
        mainActor.removeItem("Rifle")
    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return EventOutput(desc,
                       tempList,
                       deadList,
                       loot_table=lootDict,
                       destroyed_loot_table=destroyedList)


Event.registerEvent("FireRifleKill", func)
示例#25
0
from Objs.Events.Event import Event


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    if mainActor.stats["stability"] < 4:
        desc = mainActor.name + ' sleeps fitfully, disturbed by the recent events.'
        mainActor.permStatChange({'stability': +0.5})
    else:
        desc = mainActor.name + ' sleeps, preparing for another long day tomorrow.'
        mainActor.permStatChange({'stability': +1})
    # Second entry is the contestants named in desc, in order. Third is anyone who died.
    return (desc, [mainActor], [])


Event.registerEvent("Sleep", func)
示例#26
0
from Objs.Events.Event import Event
import random


def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None):
    if state["allRelationships"].loveships[str(mainActor)][str(participants[0])]:
        desc = str(mainActor) + " offered to cook for " + str(
            participants[0]) + ", who gladly accepted. The meal was crafted with care and tenderness."
    else:
        desc = str(mainActor) + " offered to cook for " + \
            str(participants[0]) + \
            ", who gladly accepted. The meal was pretty good."
    state["allRelationships"].IncreaseFriendLevel(
        mainActor, participants[0], random.randint(1, 3))
    state["allRelationships"].IncreaseLoveLevel(
        mainActor, participants[0], random.randint(0, 2))
    state["allRelationships"].IncreaseFriendLevel(
        participants[0], mainActor, random.randint(1, 3))
    state["allRelationships"].IncreaseLoveLevel(
        participants[0], mainActor, random.randint(0, 2))
    participants[0].permStatChange({"endurance": 1})

    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return (desc, [mainActor, participants[0]], [])


Event.registerEvent("ACooksForB", func)
示例#27
0
                    victims[0].name + ' was injured and forced to flee.'
            return EventOutput(desc,
                               descList, [],
                               loot_table=lootDict,
                               injuries=injuries,
                               destroyed_loot_table=destroyedList)

        if not fightDeadList:
            desc += ' The fight was a draw, and the two sides departed, friends no more.'
            return (desc, descList, [])
        desc += fightDesc
        return (desc, descList, [x.name for x in fightDeadList], allKillers)

    else:
        desc += str(victims[0]) + \
            " ate the meal, blissfully unaware, before falling over dead."
        victims[0].kill()
        lootDict, destroyedList = self.lootForOne(mainActor,
                                                  victims[0],
                                                  chanceDestroyedOverride=0)

    # Second entry is the contestants or items named in desc, in desired display. Third is anyone who died. This is in strings.
    return EventOutput(desc,
                       descList, [str(victims[0])],
                       loot_table=lootDict,
                       injuries=injuries,
                       destroyed_loot_table=destroyedList)


Event.registerEvent("ACooksForBButPoison", func)
示例#28
0
        desc += '\nIn the end both sides got tired and gave up, agreeing to use the fire together for one night. Neither side slept well.'
        return EventOutput(desc, descList, [], injuries=injuries)

    # need to ban contestant from turning up again in fire events if they won the fight.
    if contestant.name not in fightDeadList:
        self.eventStore["turnRecord"][contestant.name] = state["turnNumber"][0]
    desc += fightDesc
    return EventOutput(desc,
                       descList, [x.name for x in fightDeadList],
                       allKillers,
                       loot_table=lootDict,
                       injuries=injuries,
                       destroyed_loot_table=destroyedList)


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
示例#29
0
    for person in everyone:
        if str(person) == trapSource:
            found = True
            notBeingStupidRatio = (mainActor.stats["stability"] +
                                   mainActor.stats["cleverness"] * 3) / 40
            if random.random() < notBeingStupidRatio:
                if len(everyone) > 1:
                    desc += " but they were able to escape thanks to " + str(
                        person) + "'s warning!"
                else:
                    desc += " but excaped from " + Event.parseGenderPossessive(
                        mainActor) + " own trap."
                return (desc, everyone, [])
        break
    desc += " and they all died in the ensuing detonation!" if (
        len(everyone) > 1) else " and " + Event.parseGenderSubject(
            mainActor) + " died in the ensuing detonation!"
    for person in everyone:
        person.kill()
    self.eventStore["trapCounter"] -= 1
    self.eventStore["trapMakerCounter"][trapSource] -= 1
    descList = [mainActor] + participants
    if not found:
        descList.append(state["contestants"][trapSource])
    return (desc, descList, [str(x) for x in everyone],
            {str(x): trapSource
             for x in everyone}, everyone)


Event.registerEvent("DiesFromExplosiveTrap", func)
示例#30
0
import random
from Objs.Utilities.ArenaUtils import DictToOrderedDict

TRAPS = ['spike trap', 'poison dart trap', 'fall trap']


def func(self,
         mainActor,
         state=None,
         participants=None,
         victims=None,
         sponsors=None):
    trap_type = random.randint(0, 2)
    desc = str(mainActor) + ' built a deadly ' + \
        TRAPS[trap_type] + ' to kill other contestants with.'

    state["events"]["DiesFromTrap"].eventStore["trapCounter"][trap_type] += 1
    state["events"]["DiesFromTrap"].eventStore["trapMakerCounter"].setdefault(
        str(mainActor), DictToOrderedDict({
            0: 0,
            1: 0,
            2: 0
        }))
    state["events"]["DiesFromTrap"].eventStore["trapMakerCounter"][str(
        mainActor)][trap_type] += 1

    return (desc, [mainActor], [])


Event.registerEvent("SetTrap", func)