character.h

Go to the documentation of this file.
00001 /*
00002     toten
00003     Copyright (C) 2004,2005 Toten Developers
00004 
00005     Toten is the legal property of its developers, whose names are
00006     too numerous to list here.  Please refer to the COPYRIGHT file
00007     for the full text of this license and to the AUTHORS file for
00008     the complete list of developers.
00009 
00010     This program is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Lesser General Public
00012     License as published by the Free Software Foundation; either
00013     version 2.1 of the License, or (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public
00021     License along with this program; if not, write to the Free Software
00022     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 */
00024 
00025 #ifndef CHARACTER_H
00026 #define CHARACTER_H
00027         
00028 /* locations to equip things */
00029 /** \file character.h
00030  Defines TCharacterClass & TCharacter interfaces.
00031  */
00032 #define HELMET                  (1<<0)
00033 #define FACE                    (1<<1)
00034 #define TUNIC                   (1<<2)
00035 #define ARMOR                   (1<<3)
00036 #define BELT                    (1<<4)
00037 #define BACKPACK                (1<<5)
00038 #define R_HAND_HOLDING          (1<<6)
00039 #define R_HAND_INDEX_FINGER     (1<<7)
00040 #define R_HAND_MIDDLE_FINGER    (1<<8)
00041 #define R_HAND_RING_FINGER      (1<<9)
00042 #define R_HAND_PINKY_FINGER     (1<<10)
00043 #define L_HAND_HOLDING          (1<<11)
00044 #define L_HAND_INDEX_FINGER     (1<<12)
00045 #define L_HAND_MIDDLE_FINGER    (1<<13)
00046 #define L_HAND_RING_FINGER      (1<<14)
00047 #define L_HAND_PINKY_FINGER     (1<<15)
00048 #define GLOVES                  (1<<16)
00049 #define BOOTS                   (1<<17)
00050 
00051 #define MALE                    (1<<0)
00052 #define FEMALE                  (1<<1)
00053 
00054 /**
00055         A character classification.
00056 
00057         Defines things that are specific to a "class" of characters, not one character.
00058         For example, you might create a character class of a Human Rogue or of an Elvish Archer.
00059         Note that is is specific to Race and race class.
00060 
00061  */
00062 @interface TCharacterClass : TObject
00063 {
00064         @protected
00065         char *name_race;  /* Human, Android, etc. */
00066         char *name_class; /* Rogue, Mage, etc. */
00067 
00068         @public 
00069         int start_lvl; /**< Starting level */
00070         int start_hp_max; /**< Starting max hp */
00071         int start_str; /**< Starting strength */
00072         int start_cons; /**< Starting constitution */
00073         int start_intel; /**< Starting intelligence */
00074         int start_wis; /**< Starting wisdom */
00075         int start_charisma; /**< Starting charisma */
00076         int start_dex; /**< Starting dexterity */
00077         int start_speed; /**< Starting speed */
00078 
00079         int lvl_exp_increment; /**< Ammount of exp points needed to level up */
00080         int exp_increment; /**< Part of the way the new lvl_exp_increment is determined after leveling up */ 
00081         float exp_bonus; /**< Other half of how lvl_exp_increment is determined after leveling up */
00082         float hp_bonus; /**< Multiplied with level and added to max_hp after leveling up */
00083         float str_bonus; /**< Multiplied with level and added to str after leveling up */
00084         float cons_bonus; /**< Multiplied with level and added to cons after leveling up */
00085         float intel_bonus; /**< Multiplied with level and added to intel after leveling up */
00086         float wis_bonus; /**< Multiplied with level and added to wis after leveling up */
00087         float charisma_bonus; /**< Multiplied with level and added to charisma after leveling up */
00088         float dex_bonus; /**< Multiplied with level and added to dex after leveling up */
00089         float speed_bonus; /**< Multiplied with level and added to speed after leveling up */
00090 
00091         int hunger_speed; /**< should be positive, how fast hunger increases */
00092         int thirst_speed;/**< should be positive, how fast thirst increases */
00093         
00094         TSkillSet *skillset; /**< Set of skills that can be learned by this class */
00095         
00096 }
00097 
00098 /**
00099         Params are copied into the respective fields in the new class.
00100  */
00101 
00102 /* OMFG this is ugly :( */
00103 - init:(char *)name_race:(char *)name_class:(int)start_lvl:(int)start_hp_max:(int)start_str:(int)start_cons:
00104         (int)start_intel:(int)start_wis:(int)start_charisma:(int)start_dex:(int)start_speed:(int)lvl_exp_increment:
00105         (int)exp_increment:(float)exp_bonus:(float)hp_bonus:(float)str_bonus:(float)cons_bonus:(float)intel_bonus:
00106         (float)wis_bonus:(float)charisma_bonus:(float)dex_bonus:(float)speed_bonus:(int)hunger_speed:(int)thirst_speed;
00107 
00108 - free;
00109 
00110 /**
00111         Set a new skillset for the class.
00112  */
00113 - (void)setskillset:(TSkillSet *)skillset;
00114 
00115 
00116 
00117 @end
00118 
00119 /**
00120         A generic character class.
00121 
00122         Contains many variables for the state of the character and its characteristics.
00123         Contains many functions for manipulating the character and for getting and setting its state.
00124  */
00125 
00126 @interface TCharacter : TObject
00127 {       
00128         char *first_name;
00129         char *last_name;
00130         unsigned int height;
00131         unsigned int weight;
00132         char *eye_color;
00133         char *hair_color;
00134         unsigned short int sex; /**< Use a predefined macro for this */
00135         char *bio; /**< A description of this character. */
00136 
00137         @public
00138         char *height_unit; /**< Something like "Centimeters" to be displayed after the height. */
00139         char *weight_unit; /**< Something like "Newtons" to be displayed after the weight. */
00140         
00141         /* game elements */
00142         @protected
00143         int lvl; /**< Current level */
00144         int hp; /**< Current HP */
00145         int hp_max; /**< Maximum HP */
00146         int str; /**< strength */
00147         int cons; /**< constitution */
00148         int intel; /**< intelligence */
00149         int wis; /**< wisdom */
00150         int charisma;
00151         int dex; /**< dexterity */
00152         int speed; /**< speed */
00153         int exp; /**< experience points */
00154         
00155         @public
00156         int hunger; /**< 10 is dying from hunger, 0 is full */
00157         int thirst; /**< 10 is dying from thirst, 0 is not thirsty */
00158         int hunger_speed; /**< should be positive, how fast hunger increases */
00159         int thirst_speed; /**< should be positive, how fast thirst increases */
00160                 
00161         /* basically "slots" for placing items */
00162         
00163         @protected
00164         
00165         /* head */
00166         TItem *helmet; /**< Slot to place an item */
00167         TItem *face; /**< Slot to place an item */
00168 
00169         /* torso */
00170         TItem *tunic; /**< Slot to place an item */
00171         TItem *armor; /**< Slot to place an item */
00172         TItem *belt; /**< Slot to place an item */
00173         TItem *backpack; /**< Slot to place an item */
00174 
00175         /* right hand */
00176         TItem *r_hand_holding; /**< Slot to place an item */
00177         TItem *r_hand_index_finger; /**< Slot to place an item */
00178         TItem *r_hand_middle_finger; /**< Slot to place an item */
00179         TItem *r_hand_ring_finger; /**< Slot to place an item */
00180         TItem *r_hand_pinky_finger; /**< Slot to place an item */
00181 
00182         /* left_hand */
00183         TItem *l_hand_holding; /**< Slot to place an item */  
00184         TItem *l_hand_index_finger; /**< Slot to place an item */
00185         TItem *l_hand_middle_finger; /**< Slot to place an item */
00186         TItem *l_hand_ring_finger; /**< Slot to place an item */
00187         TItem *l_hand_pinky_finger; /**< Slot to place an item */
00188 
00189         /* miscellaneous items */
00190         TItem *gloves; /**< Slot to place an item */
00191         TItem *boots; /**< Slot to place an item */
00192 
00193         TCharacterClass *charclass; /**< This character's Character Class */
00194         TSkillSet *skillset; /**< This character's Skill Set (independent from Character Class) */
00195         
00196 }
00197 
00198 /**
00199         Initializes the character.
00200 
00201         \param charclass The character class of this character.
00202  */
00203 - init:(TCharacterClass *)charclass;
00204 - free;
00205 /**
00206         Set the physical properties of the character.
00207 
00208         Paramaters are copied into their respective fields in the class.  
00209         Use NULL for pointers and -1 for others to keep the current.
00210  */
00211 - (void)set_phys_properties:(char *)first_name:(char *)last_name:(unsigned int)height:(unsigned int)weight:
00212 (char *)height_unit:(char *)weight_unit:(char *)eye_color:(char *)hair_color:
00213                         (unsigned short int)sex: (char *)bio;
00214 
00215 /**
00216         Have the character gain experience points in add_exp.
00217         Calls lvl_up if the new experience passes lvl_exp_increment in the character's charclass.
00218         
00219         \param add_exp Experience points to be added.
00220  */  
00221 - (int)gain_exp:(int)add_exp;
00222 
00223 /**
00224         Level up the character by one.
00225  */
00226 - (int)lvl_up;
00227 
00228 - (char *)get_first_name;
00229 - (char *)get_last_name;
00230 - (char *)get_eye_color;
00231 - (char *)get_hair_color;
00232 - (char *)get_bio;
00233 - (int)get_lvl;
00234 - (int)get_hp;
00235 - (int)get_hp_max;
00236 - (int)get_str;
00237 - (int)get_cons;
00238 - (int)get_intel;
00239 - (int)get_wis;
00240 - (int)get_charisma;
00241 - (int)get_dex;
00242 - (int)get_speed;
00243 - (int)get_exp;
00244 
00245 - (void)set_hp:(int)hp;
00246 
00247 /**
00248         Put the item in the specified location, returning what was previously there.
00249 
00250         \param item Item to be equipped
00251         \param location Location where the item should be equipped.  This should be a macro defined in character.h
00252         
00253  */
00254 - (TItem *)equip:(TItem *)item:(int)location;
00255 /**
00256         Get item at location.
00257 
00258         \param location This should be a macro defined in character.h
00259 
00260  */
00261 - (TItem *)get_item_equipped_at_location:(int)location;
00262 - (void)consume:(TConsumable *)consumable;
00263 - (void)eat:(TFood *)food;
00264 - (void)drink:(TDrink *)drink;
00265 
00266 @end
00267 
00268 #endif

Generated on Wed Dec 21 13:16:07 2005 for Toten by  doxygen 1.4.5 SourceForge.net Logo