summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-02-26 13:52:29 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-02-26 13:52:29 +0100
commitfd4d031ab5b31763d376c663cc049f62ee389243 (patch)
treecd09a29bb888acf772fa1aee59fe95e8bd75fe4e /src/struct/character.erl
parent66ec11ce5d2e227846d6e6b2899cda851a70fc04 (diff)
Got it to run, at last.
Diffstat (limited to 'src/struct/character.erl')
-rw-r--r--src/struct/character.erl27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/struct/character.erl b/src/struct/character.erl
index 0459214..90e449c 100644
--- a/src/struct/character.erl
+++ b/src/struct/character.erl
@@ -41,6 +41,13 @@
]
).
+-export
+(
+ [
+ random/2
+ ]
+).
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -71,3 +78,23 @@ set_statistics (Stats, Char) ->
{
statistics = Stats
}.
+
+random (ID, OwnerID) ->
+ WeaponIDs = {weapon:random_id(), weapon:random_id()},
+ Attributes = attributes:random(),
+ Statistics = statistics:new(Attributes, WeaponIDs),
+ IDAsListString = integer_to_list(ID),
+ IDAsBinaryString = list_to_binary(IDAsListString),
+
+ #character
+ {
+ id = ID,
+ owner_id = OwnerID,
+ name = list_to_binary("Char" ++ IDAsListString),
+ icon = IDAsBinaryString,
+ portrait = IDAsBinaryString,
+ attributes = Attributes,
+ weapon_ids = WeaponIDs,
+ glyphs = [],
+ statistics = Statistics
+ }.