VegansDeluxe.core.Session package

Submodules

VegansDeluxe.core.Session.Session module

Abstract base class for generic types.

On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class’s name:

class Mapping[KT, VT]:
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

On older versions of Python, however, generic classes have to explicitly inherit from Generic.

After a class has been declared to be generic, it can then be used as follows:

def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default

Module contents

class VegansDeluxe.core.Session.Session(event_manager: EventManager)[source]

Bases: Generic

property alive_entities: list[T]

Get the list of entities which are not dead.

property alive_teams: set[str]

Get the set of teams which have alive entities.

attach_entity(entity: T)[source]
async calculate_damages()[source]
cancel_damages(source)[source]
async death() None[source]

Handle the death of entities. Publishes PreDeathGameEvent and DeathGameEvent.

async finish()[source]
get_entity(entity_id: str) T[source]

Get an entity by its ID.

async lose_hp(entity: T, damage: int) None[source]

Deduct HP from the entity and print a message.

async move()[source]
pre_move()[source]
say(text: str | LocalizedString, n: bool = True) None[source]

Adds given text to log queue.

async start()[source]
async stop()[source]
tick()[source]