Competence
src.model.competence
¶
Abstract competence model shared by attacks and defenses.
A competence represents an action available to a unit. It defines common metadata such as name, power, effect zone, activation speed, and range, while leaving the activation behavior to concrete subclasses.
The documentation follows Google-style docstrings so tools such as pdoc, Sphinx Napoleon, or MkDocs-based pipelines can expose parameters, return values, and side effects in a consistent HTML API reference.
Competence
¶
Bases: ABC
Abstract base class for all unit competences.
A competence describes an action that has a power value, an effect zone, an activation speed, and a range. Subclasses provide the concrete activation logic for offensive or defensive behavior.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name. |
power |
int
|
Base strength value. |
effect_zone |
tuple[int, int, int]
|
Effect-zone constraints. |
speed |
int
|
Activation or animation speed. |
range |
tuple[int, int, int]
|
Range constraints. |
Notes
This class is documented as part of the public project API and is intended to be readable in generated HTML documentation.
Source code in src\model\competence.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
name
property
¶
Return the display name.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Display name. |
power
property
¶
Return the configured power value.
Returns:
| Name | Type | Description |
|---|---|---|
object |
Value produced by the underlying game or rendering operation. |
effect_zone
property
¶
Return the configured effect zone.
Returns:
| Name | Type | Description |
|---|---|---|
object |
Value produced by the underlying game or rendering operation. |
speed
property
¶
Return the speed value.
Returns:
| Name | Type | Description |
|---|---|---|
int |
Configured speed value. |
range
property
¶
Return the configured range limits.
Returns:
| Name | Type | Description |
|---|---|---|
object |
Value produced by the underlying game or rendering operation. |
is_within_range(user_position, target_position)
¶
Check whether a target position is inside the competence range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_position
|
Tuple[int, int]
|
Source position expressed as an |
required |
target_position
|
Tuple[int, int]
|
Target position expressed as an |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Source code in src\model\competence.py
activate(user, target)
abstractmethod
¶
Activate the competence.
Subclasses must implement the concrete gameplay behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
Unit that owns or activates the competence. |
required | |
target
|
Target unit affected by an attack or competence. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
This method is executed for its side effects. |
Side Effects
Applies gameplay effects defined by the concrete competence.
Notes
Concrete subclasses define whether activation changes health, damage, or visual effects.