summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-06-12 12:19:04 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-06-12 12:19:04 +0200
commit02c9231c5a4b05141c91d86f3dbb0c8e205466f1 (patch)
tree03f164048cf28a572575a95337d18035e86aedda /src/battle/struct/btl_action.erl
parentdf54ba490259e1eb1e7c8133903417579ec4f400 (diff)
[Untested] Adds handling of opportunity attacks.
Diffstat (limited to 'src/battle/struct/btl_action.erl')
-rw-r--r--src/battle/struct/btl_action.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/battle/struct/btl_action.erl b/src/battle/struct/btl_action.erl
index 50606ac..11b2d06 100644
--- a/src/battle/struct/btl_action.erl
+++ b/src/battle/struct/btl_action.erl
@@ -65,7 +65,8 @@
-export
(
[
- new_move/3
+ new_move/3,
+ new_attack_of_opportunity/2
]
).
@@ -187,6 +188,20 @@ new_move (ActorIX, Path, MovementPoints) ->
movement_points = MovementPoints
}.
+-spec new_attack_of_opportunity
+ (
+ non_neg_integer(),
+ non_neg_integer()
+ )
+ -> type().
+new_attack_of_opportunity (ActorIX, TargetIX) ->
+ #attack
+ {
+ actor_ix = ActorIX,
+ target_ix = TargetIX,
+ is_opportunistic = true
+ }.
+
-spec get_category (type()) -> category().
get_category (Action) when is_record(Action, attack) -> attack;
get_category (Action) when is_record(Action, move) -> move;