Skip to content

Consume targeted item action

ConsumeTargetedItemAction class

def __init__(self, engine, entity, target_location, item=None):

Bases: Action

Action which handles consuming an targeted item if it is consumable with the invoking entity as the consumer.

Attributes
Name Type Description
engine Engine

Engine representing the current game.

entity ActiveEntity

Entity that invoked this action.

target_location tuple[int, int]

Location of the target.

item Item | None

Item to consume.

Parameters
Name Type Description Default
engine Engine

Engine representing the current game.

required
entity ActiveEntity

Entity that invoked this action.

required
target_location tuple[int, int]

Location of the target.

required
item Item | None

Item to consume.

None

perform method

def perform(self):

Method to consume the item with the invoking entity as the consumer.

Raises
Type Description
ImpossibleActionException

If self.item is None or item.consumable is None.