Event Cards

What’s an Event Card?

EventCards are the full screen text pages you see during end of day random events, plot events, while going on expeditions and receiving and completing side quests.

End of day EventCards exist in a big tree structure: event decks contain event cards and serve a randomly selected one each time. Any time you see an event card, you could also plug in an event deck, they’re interchangeable. This goes for all the subclasses of EventCard. If you’re familiar with Behaviour Trees, the EventCard system is one of those.

Example: Making a Random Event

Here’s a random event which will show up you spam the skip turn cheat enough. It doesn’t do anything other than display a message.

from faust.Constant import get_constant, del_constant
from faust.EventCard import EventCard

def init():
    # Make a card
    my_card = EventCard(
       card_id='rats',              # Card will become a constant with the ID "eventcard.rats"
       title="Rats ate the mana!",  # The big headline
       looping_cue="cue_combat",    # Music. Continues playing the existing background music if left unspecified
       description="""{subj.name} scatches {subj.his} head. Since when do rats even like mana?
    """)

    # Add the card to the random event deck
    eventdeck = get_constant('eventdeck.turnrandom')
    eventdeck.cards.append(my_card)

def deinit():
    del_constant('eventcard.rats')

    # Remove missing cards from deck
    eventdeck = get_constant('eventdeck.turnrandom')
    eventdeck.cards = [card for card in eventdeck.cards if not card.is_constant_missing()]

Classes of Event Card

But wait a minute, that rats event doesn’t deduct any mana, it just shows a message. We can switch out the EventCard class for something else:

Class Notes
EventCard Displays some text, but doesn’t do anything special
RandomEventDeck Contains multiple cards, randomly serves one each time. Skips over the ones that aren’t available
PickEventCard Contains multiple cards. Displays them to the player so they can select one, which displays immediately. If you want randomised options (e.g. loot), you can make the option cards random decks.
AtTurnCard Only available for display if the player’s on a specific day
RatchetDeck Contains multiple cards. Each time it’s asked for a card, it shows the next one in the sequence. Never goes backward. If the next card is unavailable, the deck itself becomes unavailable.
PriorityDeck Contains multiple cards. Looks through the first available one and shows it. Might go backward.
TimelineEventCard For showing a bunch of cards on specific nights. I recommend not using this directly, see the example below.
ChangeAlignmentCard Modifies faction alignment (e.g. Narcissus mood and OWG alert stars). Note, there’s also SetAlignmentCard if you want to reset alignment to an absolute value.
ChangeInnateStatCard Give a bonus or penalty to one of the protagonist’s properties, like min lust or research rate
MultiplyProductionCard Multiply mana production during one night by a factor

Experienced programmers may be wondering why I’m using classical OO here instead of passing in lambdas or building a component system. And yup, that’s totally what I should have done. C’est la vie. Less experienced programmers may be wondering why there isn’t a more comprehensive selection of effects, and I’m afraid that’s up to you. If you’d like to see examples of making new subclasses, check out RandomEvents.py.