summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-03-05 13:51:14 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-03-05 13:51:14 +0100
commit6a82ead205f4463ee34cc4fcbc06f1b3e7b1dd1a (patch)
tree6b9fa780865044b8c57800d48fe251e4dff2d6f6 /src/battle
parent10b1058e56079232728e3fc959709bc784e58b5b (diff)
Starting to work on the client diff messages.
Diffstat (limited to 'src/battle')
-rw-r--r--src/battle/attack.erl34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/battle/attack.erl b/src/battle/attack.erl
index 9baf798..f1ef048 100644
--- a/src/battle/attack.erl
+++ b/src/battle/attack.erl
@@ -21,6 +21,9 @@
| 'nothing'
).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-export_type
(
[
@@ -32,9 +35,7 @@
attack_order_with_parry/0
]
).
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
-export
(
[
@@ -44,6 +45,13 @@
]
).
+-export
+(
+ [
+ encode/1
+ ]
+).
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -278,3 +286,23 @@ get_sequence (AttackRange, AttackerWeapon, DefenderWeapon) ->
true ->
[First, Counter, Second]
end.
+
+-spec encode (attack_desc()) -> binary().
+% This shouldn't be a possibility. Types in this module are a mess...
+encode ({AttackCategory, AttackEffect}) ->
+ jiffy:encode
+ (
+ {
+ [
+ <<"attack">>,
+ list_to_binary
+ (
+ io_lib:format
+ (
+ "~p",
+ [{AttackCategory, AttackEffect}]
+ )
+ )
+ ]
+ }
+ ).