Skip to content

Player Class ~ Design

wellingtj edited this page May 28, 2022 · 10 revisions

Design

Key Features

  1. Provide basic prefabricated classes for game developers to utilize
  2. Provide framework for game developers to create their own classes in place of or in addition to our prefabricated classes
  3. Allow for multiclassing (a single player using more than one class)
  4. Allow certain player classes to use items more or less effectively
  5. Work with rpg-battle team to implement specific combat statistics / effects for different classes (in progress)
  6. Work with other teams to implement additional game functionality based on class, such as custom dialogue, custom NPC names, usage, etc. (in progress)

Data Structures

  • class_t struct
    • char* Name
    • char* Short description
    • char* Long description
    • obj_t* Attributes
    • stats_t* Base Stats
    • effects_hash_t* Effects
    • skill_inventory_t** Combat Actions
    • UT_hash_handle Field for use by UTHASH macros

Modules

class_structs

  • Holds the class structure, but has no functions.

class

  • Note: although these functions seem helpful, only class_new and class_free seems to have been implemented.

  • Create a new playerclass

    • class_t* class_new(char* name, char* shortdesc, char* longdesc, obj_t* attr, stats_hash_t* stat, effects_hash_t* effect);
  • Create a new prefabbed class

    • class_t* class_prefab_new(game_t* game, char* class_name)
    • These prefabbed classes will add items through class_prefab_item_add_items and skills through class_prefab_add_skills
  • Set values inside the playerclass

    • Set the name of the class
      • int class_setname(class_t* c, char* name);
    • Set the description of the class
      • int class_setdesc(class_t* c, char* desc);
    • Set the attributes of the class to a new array of attributes
      • int class_setattributes(class_t*, attribute_t** attributes);
        • This function would need to be updated to use obj_t
    • Set the player stats of the class
      • int class_setstat(class_t* c, stat_t* stat);
    • Set the combat actions of the class
      • int class_setcombat(class_t* c, combat_action_t** combat);
    • Set the non-combat actions of the class
      • int class_setcustom_actions(class_t* c, game_action_t** custom);
  • Get values inside the playerclass

    • Get the name of the class
      • char* class_getname(class_t* c);
    • Get the description of the class
      • char* class_getdesc(class_t* c);
    • Get the list of attributes of the class
      • attribute_t** class_getattributes(class_t* c);
        • This function would need to be updated to use obj_t
    • Get the statistics of the class
      • stat_t* class_getstat(class_t* c);
    • Get the list of combat actions for the class
      • combat_action_t** class_getcombat(class_t* c);
    • Get the list of game actions for the class
      • game_action_t** class_getcustom_action(class_t* c);
  • Free a playerclass

    • void class_free(class_t* c);

class items

  • Add a multiplier to an item for a given class:
    • int add_item_multiplier(item_t* item, class_t* class, double multiplier);
  • Lookup the multiplier for a class-item pair:
    • double get_class_item_multiplier(item_t* item, class_t* class);
  • Remove the multiplier for a class-item pair:
    • int remove_item_multiplier(item_t* item, class_t* class);
  • Add a restricted class to an item:
    • int add_item_restriction(item_t* item, class_t* class);
  • Lookup if an class is restricted from a certain item:
    • bool is_restricted(item_t* item, class_t* class);
  • Remove a class item restriction:
    • int remove_item_restriction(item_t* item, class_t* class);

Updated 5/25/2021 to account for changes to structures or unimplemented parts of the design.

Clone this wiki locally