item.h

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 ITEM_H
00026 #define ITEM_H
00027 
00028 /** 
00029         An Object that acts as an item.
00030         This class is quite generic.  Subclasses such as TFood and TWeapon are more specific and usefull.
00031         TItem will normally never be created, only be used as a container class.
00032         
00033  */
00034 
00035 @interface TItem : TObject
00036 {
00037         int lvl;
00038         int hp;
00039         int hp_max;
00040         int price;
00041         int weight;
00042         char *weight_unit;
00043         
00044         char *name;
00045         char *desc;
00046         int *equipable_locations; /**< An array of #defined locations where this item can be equiped. */
00047         int len; /**< Size of the equipable_locations array */
00048 }
00049 
00050 - init:(int)level:(int)hp_max:(int)price:(int)weight:(char *)weight_unit:(char *)name:(char *)desc;
00051 - free;
00052 
00053 - (int)get_lvl;
00054 - (char *)get_name;
00055 - (int)get_hp;
00056 - (int)get_hp_max;
00057 - (char *)get_description;
00058 - (int)get_price;
00059 - (int)get_weight;
00060 - (char *)get_weight_unit;
00061 - (void)set_properties:(int)hp:(int)price;
00062 - (void)set_description:(char *)description;
00063 
00064 /**     
00065  Sets the variable equipable_locations. If there was a previous array there, it will be free'd and replaced.
00066 
00067  \param locations An integer array of locations that this item can be equiped at.
00068  \param len Size of the array.
00069 
00070  */
00071 - (void)set_equipable_locations:(int *)locations:(int)len;
00072 
00073 @end
00074 
00075 /* Consumable Items */
00076 
00077 /**
00078   An item that can be "consumed".
00079  */
00080 @interface TConsumable : TItem
00081 {
00082         @protected
00083         int lvl_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00084         int hp_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */    
00085         int str_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00086         int cons_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00087         int intel_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00088         int wis_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00089         int charisma_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00090         int dex_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00091         int speed_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00092         int exp_mod; /**< Additive modifier for use when this item is "eaten" or "drinken" or etc. */
00093 
00094 }
00095 
00096 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)lvl_mod:
00097 (int)hp_mod:(int)str_mod:(int)cons_mod:(int)intel_mod:(int)wis_mod:(int)charisma_mod:(int)dex_mod:(int)speed_mod:(int)exp_mod;
00098 - free;
00099 
00100 - (int)get_lvl_mod;
00101 - (int)get_hp_mod;
00102 - (int)get_str_mod;
00103 - (int)get_cons_mod;
00104 - (int)get_intel_mod;
00105 - (int)get_wis_mod;
00106 - (int)get_charisma_mod;
00107 - (int)get_dex_mod;
00108 - (int)get_speed_mod;
00109 - (int)get_exp_mod;
00110 
00111 @end
00112 
00113 /**
00114   An item that can be "consumed" or eaten. 
00115  */
00116 
00117 @interface TFood : TConsumable
00118 {
00119         @private int hunger_mod;
00120 }
00121 
00122 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)lvl_mod:
00123 (int)hp_mod:(int)str_mod:(int)cons_mod:(int)intel_mod:(int)wis_mod:(int)charisma_mod:(int)dex_mod:(int)speed_mod:
00124 (int)exp_mod:(int)hunger_mod;
00125 - free;
00126 
00127 - (int)get_hunger_mod;
00128 
00129 @end
00130 
00131 /**
00132   An edible item thats effect lasts for only a limited time. 
00133  */
00134 @interface TDrug : TFood
00135 {       
00136         int effect_timeout; /* don't know how this would be implemented atm... */
00137 }
00138 
00139 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)lvl_mod:
00140 (int)hp_mod:(int)str_mod:(int)cons_mod:(int)intel_mod:(int)wis_mod:(int)charisma_mod:(int)dex_mod:(int)speed_mod:
00141 (int)exp_mod:(int)effect_timeout;
00142 - free;
00143 
00144 - (int)get_effect_timeout;
00145 
00146 @end
00147 
00148 /**
00149   An item that can be "drunk".
00150  */
00151 
00152 @interface TDrink : TConsumable
00153 {
00154         int thirst_mod;
00155 }
00156 
00157 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)lvl_mod:
00158 (int)hp_mod:(int)str_mod:(int)cons_mod:(int)intel_mod:(int)wis_mod:(int)charisma_mod:(int)dex_mod:(int)speed_mod:
00159 (int)exp_mod:(int)thirst_mod;
00160 - free;
00161 
00162 - (int)get_thirst_mod;
00163 
00164 @end
00165 
00166 /**
00167   An item that can be "drunk" with an effect that lasts for a limited time. 
00168  */
00169 
00170 @interface TAlcohol : TDrink
00171 {
00172         int effect_timeout; /* don't know how this would be implemented atm... */
00173 }
00174 
00175 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)lvl_mod:
00176 (int)hp_mod:(int)str_mod:(int)cons_mod:(int)intel_mod:(int)wis_mod:(int)charisma_mod:(int)dex_mod:(int)speed_mod:
00177  (int)exp_mod:(int)effect_timeout;
00178 - free;
00179 
00180 - (int)get_effect_timeout;
00181 
00182 @end
00183 
00184 /* End of Consumable Items */
00185 
00186 /* Weapons */
00187 
00188 /**
00189   An item that can be used in an attack. 
00190  */
00191 
00192 @interface TWeapon : TItem
00193 {
00194         int str;
00195         int dex;
00196         int speed;
00197 }
00198 
00199 - init:(int)level:(int)hp:(int)price:(int)weight:(char *)weight_units:(char *)name:(char *)desc:(int)str:(int)dex:(int)speed;
00200 - free;
00201 
00202 @end
00203 
00204 #endif

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