VegansDeluxe.core.Actions package

Submodules

VegansDeluxe.core.Actions.Action module

Action - building block of the game.

All attacks, usage of items, and other actions that Entities do stem from it.

class VegansDeluxe.core.Actions.Action.Action(session: Session, source: Entity, *args)[source]

Bases: object

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property blocked: bool

Returns True if action should appear, but be unavailable to select.

Overwrite this function to define behaviour.

canceled

If set to True, the action will not be executed.

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

async execute()[source]
async func(source: Entity, target: Entity)[source]

Function to override with actual mechanics of the action.

All Actions have Source Entity and Target Entity. Source and Target may be the same.

get_targets(source: Entity, target_type: TargetType) list[VegansDeluxe.core.Entities.Entity.Entity][source]

Function that filters targets by TargetType filter relative to source.

property hidden: bool

True if action should not appear for selection.

Overwrite this function to define behaviour.

id: str = 'action'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

priority: int = 0

Priority of the action. Defines the order to be executed during CallActions stage.

tags: list[VegansDeluxe.core.Actions.ActionTags.ActionTag]

List of tags to categorize the action.

target_type: TargetType = <VegansDeluxe.core.TargetType.TargetType object>

Filter for targets, to which this action can be applied.

property targets

Targets applicable by this Action.

type: str = 'action'

String type definition for the class. Used internally.

class VegansDeluxe.core.Actions.Action.DecisiveAction(session: Session, source: Entity, *args)[source]

Bases: Action

Action that finalizes player’s turn.

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

class VegansDeluxe.core.Actions.Action.FreeAction(session: Session, source: Entity, *args)[source]

Bases: Action

Action that after selection allows to select more for the current turn.

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

VegansDeluxe.core.Actions.ActionManager module

class VegansDeluxe.core.Actions.ActionManager.ActionManager(session_manager: SessionManager, action_map: dict[Union[type[VegansDeluxe.core.Entities.Entity.Entity], type[VegansDeluxe.core.Weapons.Weapon.Weapon], type[VegansDeluxe.core.States.State.State], type[VegansDeluxe.core.Items.Item.Item]], list[type[VegansDeluxe.core.Actions.Action.Action]]])[source]

Bases: object

Manages action queues for all active sessions.

action_map: dict[Union[type[VegansDeluxe.core.Entities.Entity.Entity], type[VegansDeluxe.core.Weapons.Weapon.Weapon], type[VegansDeluxe.core.States.State.State], type[VegansDeluxe.core.Items.Item.Item]], list[type[VegansDeluxe.core.Actions.Action.Action]]]

Map of all game elements (Entity, Weapon, State, Item) to their Actions.

action_queue: list[VegansDeluxe.core.Actions.Action.Action]

Queue of Actions from all active Sessions.

actions: dict[tuple[VegansDeluxe.core.Session.Session, VegansDeluxe.core.Entities.Entity.Entity], list[VegansDeluxe.core.Actions.Action.Action]]

Map of Session & Entity pairs to their available Actions. Updated by ActionManager.update_entity_actions().

attach_action(session: Session, entity: Entity, action_id: str)[source]

Attaches a foreign Action by action_id to the Entity in the Session.

Todo:

Deprecate this. Used by Mimic only.

get_action(session: Session, entity: Entity, action_id: str) Action[source]

Finds an action of an entity that is available to it in the given session.

get_action_from_all_actions(action_id: str) tuple[type[Union[type[VegansDeluxe.core.Entities.Entity.Entity], type[VegansDeluxe.core.Weapons.Weapon.Weapon], type[VegansDeluxe.core.States.State.State], type[VegansDeluxe.core.Items.Item.Item]]], type[VegansDeluxe.core.Actions.Action.Action]] | None[source]
get_actions(session: Session, entity: Entity) list[VegansDeluxe.core.Actions.Action.Action][source]

Returns list of actions, available to the entity in given session.

Usually combination of entity actions, it’s weapon actions and all state and items actions.

get_attached_actions(action_owner: type[VegansDeluxe.core.Entities.Entity.Entity] | type[VegansDeluxe.core.Weapons.Weapon.Weapon] | type[VegansDeluxe.core.States.State.State] | type[VegansDeluxe.core.Items.Item.Item]) list[type[VegansDeluxe.core.Actions.Action.Action]][source]

Returns list of actions, attached to the game element by the ContentManager.

get_available_actions(session: Session, entity: Entity) list[VegansDeluxe.core.Actions.Action.Action][source]

Returns list of actions, visible and available for entity to select on the current turn.

get_queued_entity_actions(session: Session, entity: Entity) list[VegansDeluxe.core.Actions.Action.Action][source]

Returns current action queue of an entity.

get_queued_session_actions(session: Session) list[VegansDeluxe.core.Actions.Action.Action][source]

Returns current action queue of the session.

is_action_available(session: Session, entity: Entity, action_id: str) bool[source]
queue_action(session: Session, entity: Entity, action_id: str) bool[source]

Adds an action to the action queue by its ID.

queue_action_instance(action: Action) bool[source]

Adds an action instance to the action queue.

remove_action(session: Session, entity: Entity, action_id: str)[source]

Marks an action as removed for an entity in the given session.

remove_actions_by_tag(session: Session, entity: Entity, action_tag: ActionTag)[source]

Marks an action with specific tag as removed for an entity in the given session.

reset_removed_actions(session_id)[source]

Sets removed attribute to False in all actions of all entities in the session.

Parameters:

session_id – ID of the Session.

async update_actions(session: Session)[source]
async update_entity_actions(session: Session, entity: Entity)[source]

Compiles actions available to the entity from itself, all its items, states, skills and the weapon.

Can be influenced by subscribing to PreUpdateActionsGameEvent and PostUpdateActionsGameEvent events.

VegansDeluxe.core.Actions.ActionTags module

class VegansDeluxe.core.Actions.ActionTags.ActionTag(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

ATTACK = 'attack'
HARMFUL = 'harmful'
ITEM = 'item'
MEDICINE = 'medicine'
RELOAD = 'reload'
SKIP = 'skip'

VegansDeluxe.core.Actions.EntityActions module

class VegansDeluxe.core.Actions.EntityActions.ApproachAction(session: Session, source: Entity, *args)[source]

Bases: DecisiveAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

cls

alias of Entity

async func(source, target)[source]

Function to override with actual mechanics of the action.

All Actions have Source Entity and Target Entity. Source and Target may be the same.

property hidden: bool

True if action should not appear for selection.

Overwrite this function to define behaviour.

id: str = 'approach'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

target_type: TargetType = <VegansDeluxe.core.TargetType.OwnOnly object>

Filter for targets, to which this action can be applied.

class VegansDeluxe.core.Actions.EntityActions.ReloadAction(*args)[source]

Bases: DecisiveAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

cls

alias of Entity

async func(source, target)[source]

Function to override with actual mechanics of the action.

All Actions have Source Entity and Target Entity. Source and Target may be the same.

id: str = 'reload'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

target_type: TargetType = <VegansDeluxe.core.TargetType.OwnOnly object>

Filter for targets, to which this action can be applied.

class VegansDeluxe.core.Actions.EntityActions.SkipActionGameEvent(session_id, turn, entity_id)[source]

Bases: GameEvent

class VegansDeluxe.core.Actions.EntityActions.SkipTurnAction(*args)[source]

Bases: DecisiveAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

cls

alias of Entity

async func(source, target)[source]

Function to override with actual mechanics of the action.

All Actions have Source Entity and Target Entity. Source and Target may be the same.

id: str = 'skip'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

priority: int = 2

Priority of the action. Defines the order to be executed during CallActions stage.

target_type: TargetType = <VegansDeluxe.core.TargetType.OwnOnly object>

Filter for targets, to which this action can be applied.

VegansDeluxe.core.Actions.ItemAction module

class VegansDeluxe.core.Actions.ItemAction.DecisiveItem(session: Session, source: Entity, item: Item)[source]

Bases: ItemAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

class VegansDeluxe.core.Actions.ItemAction.FreeItem(session: Session, source: Entity, item: Item)[source]

Bases: ItemAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

class VegansDeluxe.core.Actions.ItemAction.ItemAction(session: Session, source: Entity, item: Item)[source]

Bases: Action

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

id: str = 'item'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

VegansDeluxe.core.Actions.StateAction module

class VegansDeluxe.core.Actions.StateAction.DecisiveStateAction(session: Session, source: Entity, state: State)[source]

Bases: StateAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

class VegansDeluxe.core.Actions.StateAction.FreeStateAction(session: Session, source: Entity, state: State)[source]

Bases: StateAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

property cost

True if player’s turn should be finalized after selecting this action, otherwise False.

class VegansDeluxe.core.Actions.StateAction.StateAction(session: Session, source: Entity, state: State)[source]

Bases: Action

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

VegansDeluxe.core.Actions.WeaponAction module

class VegansDeluxe.core.Actions.WeaponAction.Attack(*args)[source]

Bases: DecisiveWeaponAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

async attack(source, target, pay_energy=True) DamageData[source]

Actually performs attack on target, dealing damage.

calculate_damage(source: Entity, target: Entity) int[source]

Calculate the damage based on weapon’s damage bonus and accuracy

async func(source, target)[source]

Function to override with actual mechanics of the action.

All Actions have Source Entity and Target Entity. Source and Target may be the same.

id: str = 'attack'

ID of the action.

name: str | LocalizedString = <VegansDeluxe.core.Translator.LocalizedString.LocalizedString object>

Name of the action, that is displayed to the player.

priority: int = 0

Priority of the action. Defines the order to be executed during CallActions stage.

async publish_attack_event(source, target, damage)[source]
async publish_post_attack_event(source, target, damage)[source]
send_attack_message(source, target, damage)[source]
target_type: TargetType = <VegansDeluxe.core.TargetType.Enemies object>

Filter for targets, to which this action can be applied.

class VegansDeluxe.core.Actions.WeaponAction.DamageData(calculated, displayed, dealt)[source]

Bases: object

class VegansDeluxe.core.Actions.WeaponAction.DecisiveWeaponAction(session: Session, source: Entity, weapon: T)[source]

Bases: WeaponAction, DecisiveAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

class VegansDeluxe.core.Actions.WeaponAction.FreeWeaponAction(session: Session, source: Entity, weapon: T)[source]

Bases: WeaponAction, FreeAction

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

class VegansDeluxe.core.Actions.WeaponAction.MeleeAttack(*args)[source]

Bases: Attack

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

target_type: TargetType = <VegansDeluxe.core.TargetType.Enemies object>

Filter for targets, to which this action can be applied.

class VegansDeluxe.core.Actions.WeaponAction.RangedAttack(*args)[source]

Bases: MeleeAttack

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

target_type: TargetType = <VegansDeluxe.core.TargetType.Enemies object>

Filter for targets, to which this action can be applied.

class VegansDeluxe.core.Actions.WeaponAction.WeaponAction(session: Session, source: Entity, weapon: T)[source]

Bases: Action, Generic

Parameters:
  • session – Session instance

  • source – Entity instance of action owner

Module contents