Confusion spell
ConfusionSpell
class
¶
Bases: Consumable
Consumable which applies a confusion effect on a target.
Attributes
Name | Type | Description |
---|---|---|
number_of_turns |
int
|
Number of turns the confusion effect should persist for. |
owner |
Item | None
|
|
Parameters
Name | Type | Description | Default |
---|---|---|---|
number_of_turns |
int
|
Number of turns the confusion effect should persist for. |
required |
owner |
Item | None
|
|
None
|
get_action_or_handler
method
¶
Method to get the event handler that should be used to consume this consumable.
Parameters
Name | Type | Description | Default |
---|---|---|---|
entity |
ActiveEntity
|
Entity consuming the consumable. This argument is not actually used by the method. |
required |
engine |
Engine
|
Engine that represents the current game. |
required |
old_event_handler |
BaseEventHandler | None
|
Previous event handler. |
None
|
Raises
Type | Description |
---|---|
AttributeError
|
When |
Returns
Type | Description |
---|---|
SelectTargetIndexEventHandler
|
Event handler for selecting the target index. |
get_targets
method
¶
Method to get the target for the confusion effect.
Passing consumer
has no effect since the confusion spell
is applied to a specific entity at a location.
Parameters
Name | Type | Description | Default |
---|---|---|---|
engine |
Engine
|
Engine that represents the current game. |
required |
location |
tuple[int, int] | None
|
Location to get the target from. |
None
|
Returns
Type | Description |
---|---|
ActiveEntity | set[ActiveEntity] | None
|
Target at |
activate
method
¶
Method to activate the confusion effect on a target.
Parameters
Name | Type | Description | Default |
---|---|---|---|
consumer |
ActiveEntity
|
Entity consuming the consumable. |
required |
engine |
Engine
|
Engine representing the current game. |
required |
target_location |
tuple[int, int] | None
|
Location of the target the effect should be applied on. |
None
|
Raises
Type | Description |
---|---|
AttributeError
|
If |
ImpossibleActionException
|
When consumable cannot be activated. |