summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battle')
-rw-r--r-- | src/battle/attack.erl | 34 |
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}] + ) + ) + ] + } + ). |