| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/struct/character.erl')
| -rw-r--r-- | src/struct/character.erl | 27 | 
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 +   }. | 


