def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): desc = CLIFF_DESCRIPTIONS[random.randint(0, len(CLIFF_DESCRIPTIONS) - 1)](mainActor, victims[0]) state["allRelationships"].IncreaseFriendLevel(victims[0], mainActor, -4) state["allRelationships"].IncreaseLoveLevel(victims[0], mainActor, -6) victims[0].kill() if mainActor.stats["stability"] < 3: desc += ' ' + Event.parseGenderSubject(mainActor).capitalize() + ' smiled as ' + Event.parseGenderSubject( mainActor) + ' watched ' + Event.parseGenderObject(victims[0]) + ' die.' mainActor.permStatChange({'stability': -1}) tempList = [mainActor, victims[0]] lootDict, destroyedList = self.lootForOne(mainActor, victims[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, tempList, [victims[0].name], loot_table=lootDict, destroyed_loot_table=destroyedList)
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): mainActor.permStatChange({ "gregariousness": -1, "endurance": -1, "stability": -2 }) desc = mainActor.name + " was haunted by images of the things " + \ Event.parseGenderSubject(mainActor) + " had seen." return (desc, [mainActor], [])
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): if self.eventStore["trapCounter"] == 0: return None everyone = [mainActor] + participants # First determine who this trap belongs to. trapSource = weightedDictRandom(self.eventStore["trapMakerCounter"])[0] desc = Event.englishList( everyone ) + " stumbled into an explosive trap set by " + trapSource + ", " # If the maker of this trap is anywhere in the group, chance that they warn the group. found = False 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)
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): desc = mainActor.name + ' stalked ' + \ victims[0].name + ' from the shadows, building an understanding of ' + Event.parseGenderPossessive(victims[0]) + ' behavior and skills.' mainActor.addItem(state["items"]["Dossier"], isNew=True, target=victims[0]) descList = [mainActor, victims[0]] # If it's evening, mainActor gains hypothermia from not making a fire. if state["curPhase"] == "Evening": desc += " However, " + Event.parseGenderSubject( mainActor) + " sacrificed " + Event.parseGenderPossessive( mainActor) + " ability to make a fire, and became hypothermic." descList.append(state["statuses"]["Hypothermia"]) mainActor.addStatus("Hypothermia") # 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, [], None, [mainActor])
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): probSurvival = (1 - Event.DieOrEscapeProb1v1( mainActor, victims[0], state["settings"], defenseStat=(victims[0].getCombatAbility(mainActor) * 0.75 + victims[0].stats['cleverness'] * 0.25)) ) * 0.5 # This event is rigged against defender tempList = [mainActor, state["items"]["MolotovCocktail"], victims[0]] state["allRelationships"].IncreaseFriendLevel(victims[0], mainActor, -4) state["allRelationships"].IncreaseLoveLevel(victims[0], mainActor, -6) if random.random() < probSurvival: desc = mainActor.name + ' threw a molotov cocktail at ' + \ victims[0].name + " but " + \ Event.parseGenderSubject(victims[0]) + " escaped!" return (desc, tempList, []) else: victims[0].kill() desc = mainActor.name + ' threw a molotov cocktail at ' + \ victims[0].name + " and burned " + \ Event.parseGenderObject(victims[0]) + " alive." mainActor.permStatChange({'stability': -2}) if mainActor.stats["stability"] < 3: desc += " " + mainActor.name + " laughed at " + \ Event.parseGenderPossessive(victims[0]) + " agony." mainActor.removeItem(state["items"]["MolotovCocktail"]) lootDict, destroyedList = self.lootForOne(mainActor, victims[0]) if victims[0].removeStatus(state["statuses"]["Hypothermia"]): desc += " " + victims[0].name + " is no longer hypothermic." # 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, [victims[0].name], loot_table=lootDict, destroyed_loot_table=destroyedList)
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): # Deteriorate relationship of victim toward participant state["allRelationships"].IncreaseFriendLevel(victims[0], mainActor, -2) state["allRelationships"].IncreaseLoveLevel(victims[0], mainActor, -3) probKill = Event.DieOrEscapeProb1v1( mainActor, 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, [])
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): desc = "Tired of waiting, the sponsors force two of the remaining contestants to fight. " # Build dict of weights for various possibilities optionDict = collections.OrderedDict() optionDict['fight'] = 1 if state['allRelationships'].friendships[str(mainActor)][str( participants[0])] > 3 and state['allRelationships'].friendships[ str(participants[0])][str(mainActor)] > 3: optionDict['attemptEscape'] = 2 if state['allRelationships'].loveships[str(mainActor)][str( participants[0])] > 3: optionDict['actorSuicide'] = 1 optionDict['actorBegToKill'] = 1 if state['allRelationships'].loveships[str( participants[0])][str(mainActor)] > 3: optionDict['participantSuicide'] = 1 optionDict['participantBegToKill'] = 1 chosen = weightedDictRandom(optionDict, 1)[0] if chosen == 'fight': # Keep running until only neither 0 nor all contestants are dead. fightDead = [] # dummy list. while (len(fightDead) != 1): fightDesc, fightDead, allKillers, lootDict, injuries, destroyedList = self.fight( [mainActor, participants[0]], state['allRelationships'], deferActualKilling=True, forceRelationshipFight=True) # We had to deny Event.fight actually killing anyone because of fact that it might be reset. fightDead[0].kill() desc += "They did so." + fightDesc return EventOutput(desc, [mainActor, participants[0]], [str(x) for x in fightDead], allKillers, loot_table=lootDict, injuries=injuries, destroyed_loot_table=destroyedList) if chosen == 'attemptEscape': escape = bool(random.randint(0, 1)) if escape: mainActor.escape() participants[0].escape() desc += 'Instead of fighting, the two contestants attempt to escape, and do so successfully!' # This is a hack, declaring both of them "Dead" but ending the game immediately with overriding text that suggests they survived. return (desc, [mainActor, participants[0]], [str(mainActor), str(participants[0])], {}, [mainActor, participants[0]], True) dead = mainActor if random.randint(0, 1) else participants[0] desc += 'Instead of fighting, the two contestants attempt to escape, but ' + \ dead.name + ' is caught and killed by the sponsors!' dead.kill() return (desc, [mainActor, participants[0]], [dead.name]) if chosen == 'actorSuicide': desc += "Rather than be forced to fight " + Event.parseGenderPossessive( mainActor) + " loved one, " + str( mainActor) + " committed suicide!" mainActor.kill() return (desc, [mainActor, participants[0]], [mainActor.name]) if chosen == 'participantSuicide': desc += "Rather than be forced to fight " + Event.parseGenderPossessive( participants[0]) + " loved one, " + str( participants[0]) + " committed suicide!" participants[0].kill() return (desc, [mainActor, participants[0]], [participants[0].name]) if chosen == 'actorBegToKill': desc += str(mainActor) + " begged " + \ str(participants[0]) + " to kill " + \ Event.parseGenderObject(mainActor) if state['allRelationships'].loveships[str( participants[0])][str(mainActor)] < 4 or random.random() > 0.5: desc += ', forcing ' + \ 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)
def func(self, mainActor, state=None, participants=None, victims=None, sponsors=None): eventPeople = [mainActor] + participants relationships = state["allRelationships"] while True: whatHappens = random.randint(0, 2) # 0 is empty, 1 is loot, 2 is trap descList = eventPeople.copy() desc = Event.englishList( eventPeople) + ' found an abandoned building, ' fightDead = [] allKillers = None lootDict = None destroyedList = None injuries = None if whatHappens == 0: desc += 'but it turned out to have nothing of value.' if len(eventPeople) > 1: probViolence = 0.25 - \ relationships.groupCohesion(eventPeople) / 200 if random.random() < probViolence: fightDesc, fightDead, allKillers, lootDict, injuries, destroyedList = self.fight( eventPeople, relationships) if fightDesc is None: continue desc += ' Violence broke out due to frustration.' desc += fightDesc break elif whatHappens == 1: # get one or two random pieces of loot new_loot = random.sample(list(state['items'].values()), random.randint(1, 2)) desc += ' and found sweet loot!' # let the loot be described separately lootDict = {} destroyedList = [] # If there is no fight, there's no reason loot would be destroyed. overrideLootDestructionChance = 0 if len(eventPeople) > 1: probViolence = 0.5 - relationships.groupCohesion( eventPeople) / 100 if random.random() < probViolence: overrideLootDestructionChange = None fightDesc, fightDead, allKillers, lootDict, injuries, destroyedList = self.fight( eventPeople, relationships, False, False, preexistingLoot=new_loot) if fightDesc is None: continue desc += ' A fight broke out over the loot.' desc += fightDesc break # This has separate logic than what happens if there is no fight. partialLoot, partialDestroyed = self.lootForMany( eventPeople, new_loot, chanceDestroyedOverride=overrideLootDestructionChance) Event.MergeLootDicts(lootDict, partialLoot) Event.MergeDestroyedLists(destroyedList, partialDestroyed) break elif whatHappens == 2: desc += ' but the building was booby-trapped! ' for person in eventPeople: if person.stats['cleverness'] + person.stats[ 'combat ability'] + random.randint(0, 21) < 21: person.kill() fightDead.append(person) if not fightDead: if len(eventPeople) > 1: desc += 'Everyone escaped safely.' else: desc += Event.parseGenderSubject( eventPeople[0]).capitalize() + ' escaped safely.' # This must be done separately because it assigns no killers # 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, [x.name for x in fightDead], collections.OrderedDict()) # 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, [x.name for x in fightDead], allKillers, loot_table=lootDict, injuries=injuries, list_killers=True, destroyed_loot_table=destroyedList)