babylon.data.models.event

Event model for handling game events and their effects.

Classes

Event(**kwargs)

Represents a game event that can occur based on certain conditions.

class babylon.data.models.event.Event(**kwargs)[source]

Bases: Base

Represents a game event that can occur based on certain conditions.

Events can have effects, triggers, and consequences.

id: Mapped[int]
name: Mapped[str]
description: Mapped[str | None]
type: Mapped[str | None]
effects: Mapped[list[dict[str, Any]] | None]
triggers: Mapped[list[dict[str, Any]] | None]
consequences: Mapped[list[dict[str, Any]] | None]
escalation_paths: Mapped[list[dict[str, Any]] | None]
apply_effects(game_state)[source]

Apply all effects of this event to the game state.

Parameters:

game_state (dict[str, Any]) – Current game state to modify

Return type:

None

check_triggers(game_state)[source]

Check if this event’s triggers are met in the current game state.

Parameters:

game_state (dict[str, Any]) – Current game state to check against

Returns:

True if all triggers are met, False otherwise

Return type:

bool

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.