tbamud/src/class.c

1500 lines
44 KiB
C
Raw Normal View History

/**************************************************************************
* File: class.c Part of tbaMUD *
* Usage: Source file for class-specific code. *
2006-12-19 22:56:18 +00:00
* *
* All rights reserved. See license for complete information. *
2006-12-19 22:56:18 +00:00
* *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
2006-12-19 22:56:18 +00:00
2007-04-02 00:32:54 +00:00
/* This file attempts to concentrate most of the code which must be changed
2010-11-06 15:47:38 +00:00
* in order for new classes to be added. If you're adding a new class, you
* should go through this entire file from beginning to end and add the
2007-04-02 00:32:54 +00:00
* appropriate new special cases for your new class. */
2006-12-19 22:56:18 +00:00
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line Minor Bugfix: All game configuration settings now reference the world config structure, not the individual config variables found in config.c. ------------------------------------------------------------------------ rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line Added lib/world/qst/ directory, index, index.mini, and 0.qst. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines Bugfix: the include directory (for .h files) is now referenced correctly in the depend statement. Deletion: listrent.c removed as a separate utility. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line Enhancement: utils/ Makefile will now use a depends file, and looks for dependen cies in the ../ directory (shrinks the necessary information to make each utilit y). ------------------------------------------------------------------------ Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line Made TBA specific changes. do_cheat, removed help level checking, and advance to level 32. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a ttribution for the changes. (Thanks seqwith.) ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines Changed Makefile.in to use glob expressions when building the objects. This translates into no longer a need to update Makefile.in whenever a new .c file is added to the mud code. Other Makefile.* have not yet been changed (and need review, anyway). All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen does, however the tbaMUD (and legacy circle code) has never been marked-up with the special CXREF codes required to effectively use the program. Since Doxygen is easier to use, and provides almost as much functionality as CXREF, CXREF support has been dropped. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line Bug Fix: asciiflag_conv* functions now can handle a negative numeric value. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master) will no longer attempt to wander off. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines Based on the compiler warning about mag_materials being an unused function, and the clone spell being unused. Bug fix: Clone can now be cast. It is an 'ignore' target spell. Fix and Modification: Clone, being an effectively unused spell that is only used by mortal Magic Users at level 30, is now implemented as very simple example of how to use mag_materials(). The item required by mag_materials is vnum 161, which in stock tbaMUD is some sacrificial entrails. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix for "Did you mean:" including DG commands. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a door. Documentation: do_simple_move documented. ------------------------------------------------------------------------ Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line Trial run of columnizer function on commands list to see how people like it. ------------------------------------------------------------------------ jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line asciimap, an in game automap, along with a couple of minor bug fixes to do with the automap, patched in (Thanks Jamdog). ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line Minor update: Relocate local variable declaration to the top of ACMD(do_help) ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines Checked in the following placeholders for do_gen_tog: #define SCMD_AUTOLOOT 24 #define SCMD_AUTOGOLD 25 #define SCMD_AUTOSPLIT 26 #define SCMD_AUTOSAC 27 #define SCMD_AUTOASSIST 28 ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line The Autoquest patch, along with a couple of minor bug fixes, has been integrated into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.) ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines Minor Fix: Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int index types. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines Added a new atoidx() conversion function for dealing with string to IDXTYPE conversions (in utils.c, prototype exported through utils.h). Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h). Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c). ------------------------------------------------------------------------ Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line Fixed direction mapping to give readable directions instead of sub commands. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines Since general olc editing are automatically saved to disk, 'shutdown reboot' has been changed to not-autosave by default. (Small change made to do_shutdown in act.wizard.c). ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines Changed: struct attack_hit_type moved to fight.h attack_hit_text exported through fight.h ------------------------------------------------------------------------ jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines - do_file heads or tails files correctly and has also been enhanced to return file info (act.wizard.c) - defines made for common log files created by autorun, and those used by do_file (db.h) - utility functions added: file_head(), file_tail(), file_sizeof(), and file_numlines() (defined utils.c and exported through utils.h) ------------------------------------------------------------------------ Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line Fixed export command. (thanks Kyle) ------------------------------------------------------------------------ jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line Files are now tagged as executable. Should be able to be checked out from subver sion and executed without running chmod. ------------------------------------------------------------------------ Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc() strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back. ------------------------------------------------------------------------ jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line Event queue function definitions, global variables and defines doxygenated. ------------------------------------------------------------------------ Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line Updated levels command to use an arg/range and added color parsing to greetings. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line Doxygen comments completed for weather.c ------------------------------------------------------------------------ Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line Corrected several 64-bit warnings. (thanks Buggo) ------------------------------------------------------------------------ Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line Added get_flag_by_name allowing for new trigedit variable checks like %actor.pref(FLAG)% checks. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines COMPLETE: tbaMUD code re-org of global and local scope function and variable declarations. There may be a few things that I did not catch (some non extern keyword declarations of function prototypes within other functions, for example). BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines Continued clean-up of 'extern' references to functions and variables. BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of the char * returned from title_female and title_male. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines More work on mud clean-up. New file: spec_procs.h Created this file to house the legacy special procedures (spec_procs.c and castle.c) and special feature assignment in general. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines - Minor Bugfix: Fixed parse error in mobact.c - Minor Bugfix: act.h is now included in all of the act functions. Forgot to do that the first time :( - Additions: ban.h has been added as the external entry point into the ban.c globals and functions. Files needing ban.h have been updated. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line All act*.c functions, defines and globals have been prototyped/declared in act.h. The file act.h does not contain every ACMD, only those ACMDs and utility functions available within the act*.c files. ------------------------------------------------------------------------ Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line Fixed the last few flags missed for the 128 bit conversion. ------------------------------------------------------------------------ Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines Adding a column formatter for lists. Accepts printf-like arguments. Only used by medit right now. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines - Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts. - Ongoing cleanup to mud project. ------------------------------------------------------------------------ Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line Fixed run_autowiz which ran twice on advancement. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line act.h created and added. This header will be the external entry point for the functions, function subcommands and variables within the act*.c files. It is not designed to be the entry point for all ACMD functions. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line Merge of another part of the code cleanup, the dg script stuff. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line Modularizing and organizing files continues. Committing comm.c and comm.h because they are hairy, and I don't want to do them over if my hard drive crashes. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines - Marking all file scope functions as 'static' - Reorganization of the global variables and functions. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line * Protected the conf.h.* system config files from multiple calls. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line * Removed extraneous references to TRUE / FALSE and YES / NO defines. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines * BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before) * Migrated NUM_* settings from oasis.h to more appropriate locations near where they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the POSITION_* defines.) ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line Added Appendix A - Coder Support. Right now, it simply speaks to the fact that we have included doxygen config files, are working to document the source code, and provides a rudimentary "do this" guide to create the doxygen cross references. ------------------------------------------------------------------------ jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines - All .h files now have doxygen recognized headers, and the format is slightly altered to ease editing of headers. - Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE R_H_ #define _HEADER_H_ .... #endif) ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line constants.h, structs.h and utils.h now protected from multiple includes. This is sometimes overkill, but good practice overall. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line Updated documentation for constants.c and constants.h. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if Graphviz is not available. Now just need a short document describing the usage of doxygen. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line Minor document correction in struct dex_app_tpe. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line *bugfix* do_drink command: When a container is empty, the correct, "It is empty." message is now displayed. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines Merging changes to trunk for: * utils.h, utils.c and structs.h doxygen comments * adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
#include "db.h"
2006-12-19 22:56:18 +00:00
#include "spells.h"
#include "interpreter.h"
#include "constants.h"
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line Minor Bugfix: All game configuration settings now reference the world config structure, not the individual config variables found in config.c. ------------------------------------------------------------------------ rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line Added lib/world/qst/ directory, index, index.mini, and 0.qst. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines Bugfix: the include directory (for .h files) is now referenced correctly in the depend statement. Deletion: listrent.c removed as a separate utility. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line Enhancement: utils/ Makefile will now use a depends file, and looks for dependen cies in the ../ directory (shrinks the necessary information to make each utilit y). ------------------------------------------------------------------------ Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line Made TBA specific changes. do_cheat, removed help level checking, and advance to level 32. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a ttribution for the changes. (Thanks seqwith.) ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines Changed Makefile.in to use glob expressions when building the objects. This translates into no longer a need to update Makefile.in whenever a new .c file is added to the mud code. Other Makefile.* have not yet been changed (and need review, anyway). All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen does, however the tbaMUD (and legacy circle code) has never been marked-up with the special CXREF codes required to effectively use the program. Since Doxygen is easier to use, and provides almost as much functionality as CXREF, CXREF support has been dropped. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line Bug Fix: asciiflag_conv* functions now can handle a negative numeric value. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master) will no longer attempt to wander off. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines Based on the compiler warning about mag_materials being an unused function, and the clone spell being unused. Bug fix: Clone can now be cast. It is an 'ignore' target spell. Fix and Modification: Clone, being an effectively unused spell that is only used by mortal Magic Users at level 30, is now implemented as very simple example of how to use mag_materials(). The item required by mag_materials is vnum 161, which in stock tbaMUD is some sacrificial entrails. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix for "Did you mean:" including DG commands. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a door. Documentation: do_simple_move documented. ------------------------------------------------------------------------ Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line Trial run of columnizer function on commands list to see how people like it. ------------------------------------------------------------------------ jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line asciimap, an in game automap, along with a couple of minor bug fixes to do with the automap, patched in (Thanks Jamdog). ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line Minor update: Relocate local variable declaration to the top of ACMD(do_help) ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines Checked in the following placeholders for do_gen_tog: #define SCMD_AUTOLOOT 24 #define SCMD_AUTOGOLD 25 #define SCMD_AUTOSPLIT 26 #define SCMD_AUTOSAC 27 #define SCMD_AUTOASSIST 28 ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line The Autoquest patch, along with a couple of minor bug fixes, has been integrated into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.) ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines Minor Fix: Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int index types. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines Added a new atoidx() conversion function for dealing with string to IDXTYPE conversions (in utils.c, prototype exported through utils.h). Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h). Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c). ------------------------------------------------------------------------ Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line Fixed direction mapping to give readable directions instead of sub commands. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines Since general olc editing are automatically saved to disk, 'shutdown reboot' has been changed to not-autosave by default. (Small change made to do_shutdown in act.wizard.c). ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines Changed: struct attack_hit_type moved to fight.h attack_hit_text exported through fight.h ------------------------------------------------------------------------ jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines - do_file heads or tails files correctly and has also been enhanced to return file info (act.wizard.c) - defines made for common log files created by autorun, and those used by do_file (db.h) - utility functions added: file_head(), file_tail(), file_sizeof(), and file_numlines() (defined utils.c and exported through utils.h) ------------------------------------------------------------------------ Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line Fixed export command. (thanks Kyle) ------------------------------------------------------------------------ jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line Files are now tagged as executable. Should be able to be checked out from subver sion and executed without running chmod. ------------------------------------------------------------------------ Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc() strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back. ------------------------------------------------------------------------ jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line Event queue function definitions, global variables and defines doxygenated. ------------------------------------------------------------------------ Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line Updated levels command to use an arg/range and added color parsing to greetings. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line Doxygen comments completed for weather.c ------------------------------------------------------------------------ Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line Corrected several 64-bit warnings. (thanks Buggo) ------------------------------------------------------------------------ Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line Added get_flag_by_name allowing for new trigedit variable checks like %actor.pref(FLAG)% checks. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines COMPLETE: tbaMUD code re-org of global and local scope function and variable declarations. There may be a few things that I did not catch (some non extern keyword declarations of function prototypes within other functions, for example). BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines Continued clean-up of 'extern' references to functions and variables. BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of the char * returned from title_female and title_male. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines More work on mud clean-up. New file: spec_procs.h Created this file to house the legacy special procedures (spec_procs.c and castle.c) and special feature assignment in general. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines - Minor Bugfix: Fixed parse error in mobact.c - Minor Bugfix: act.h is now included in all of the act functions. Forgot to do that the first time :( - Additions: ban.h has been added as the external entry point into the ban.c globals and functions. Files needing ban.h have been updated. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line All act*.c functions, defines and globals have been prototyped/declared in act.h. The file act.h does not contain every ACMD, only those ACMDs and utility functions available within the act*.c files. ------------------------------------------------------------------------ Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line Fixed the last few flags missed for the 128 bit conversion. ------------------------------------------------------------------------ Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines Adding a column formatter for lists. Accepts printf-like arguments. Only used by medit right now. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines - Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts. - Ongoing cleanup to mud project. ------------------------------------------------------------------------ Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line Fixed run_autowiz which ran twice on advancement. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line act.h created and added. This header will be the external entry point for the functions, function subcommands and variables within the act*.c files. It is not designed to be the entry point for all ACMD functions. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line Merge of another part of the code cleanup, the dg script stuff. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line Modularizing and organizing files continues. Committing comm.c and comm.h because they are hairy, and I don't want to do them over if my hard drive crashes. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines - Marking all file scope functions as 'static' - Reorganization of the global variables and functions. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line * Protected the conf.h.* system config files from multiple calls. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line * Removed extraneous references to TRUE / FALSE and YES / NO defines. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines * BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before) * Migrated NUM_* settings from oasis.h to more appropriate locations near where they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the POSITION_* defines.) ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line Added Appendix A - Coder Support. Right now, it simply speaks to the fact that we have included doxygen config files, are working to document the source code, and provides a rudimentary "do this" guide to create the doxygen cross references. ------------------------------------------------------------------------ jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines - All .h files now have doxygen recognized headers, and the format is slightly altered to ease editing of headers. - Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE R_H_ #define _HEADER_H_ .... #endif) ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line constants.h, structs.h and utils.h now protected from multiple includes. This is sometimes overkill, but good practice overall. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line Updated documentation for constants.c and constants.h. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if Graphviz is not available. Now just need a short document describing the usage of doxygen. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line Minor document correction in struct dex_app_tpe. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line *bugfix* do_drink command: When a container is empty, the correct, "It is empty." message is now displayed. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines Merging changes to trunk for: * utils.h, utils.c and structs.h doxygen comments * adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
#include "act.h"
2017-10-09 13:03:48 -04:00
#include "class.h"
2006-12-19 22:56:18 +00:00
/* Names first */
const char *class_abbrevs[] = {
"Mu",
"Cl",
"Th",
"Wa",
2025-08-19 10:54:28 -07:00
"Ba",
"Ra",
"Br",
"Dr",
2006-12-19 22:56:18 +00:00
"\n"
};
const char *pc_class_types[] = {
2025-09-30 07:39:45 -07:00
"Sorceror",
2006-12-19 22:56:18 +00:00
"Cleric",
"Thief",
2025-09-30 07:39:45 -07:00
"Fighter",
2025-08-19 10:54:28 -07:00
"Barbarian",
"Ranger",
"Bard",
"Druid",
2006-12-19 22:56:18 +00:00
"\n"
};
/* The menu for choosing a class in interpreter.c: */
const char *class_menu =
"\r\n"
"Select a class:\r\n"
" [\t(C\t)]leric\r\n"
" [\t(T\t)]hief\r\n"
2025-09-30 07:39:45 -07:00
" [\t(F\t)]ighter\r\n"
" [\t(S\t)]orceror\r\n"
2025-08-19 10:54:28 -07:00
" [\t(B\t)]arbarian\r\n"
" [\t(R\t)]anger\r\n"
" B[\t(A\t)]rd\r\n"
" [\t(D\t)]ruid\r\n";
2006-12-19 22:56:18 +00:00
2010-11-06 15:47:38 +00:00
/* The code to interpret a class letter -- used in interpreter.c when a new
2007-04-02 00:32:54 +00:00
* character is selecting a class and by 'set class' in act.wizard.c. */
2006-12-19 22:56:18 +00:00
int parse_class(char arg)
{
arg = LOWER(arg);
switch (arg) {
2025-09-30 07:39:45 -07:00
case 's': return CLASS_SORCEROR;
2006-12-19 22:56:18 +00:00
case 'c': return CLASS_CLERIC;
2025-09-30 07:39:45 -07:00
case 'f': return CLASS_FIGHTER;
2006-12-19 22:56:18 +00:00
case 't': return CLASS_THIEF;
2025-08-19 10:54:28 -07:00
case 'b': return CLASS_BARBARIAN;
case 'r': return CLASS_RANGER;
case 'a': return CLASS_BARD;
case 'd': return CLASS_DRUID;
2006-12-19 22:56:18 +00:00
default: return CLASS_UNDEFINED;
}
}
2010-11-06 15:47:38 +00:00
/* bitvectors (i.e., powers of two) for each class, mainly for use in do_who
2007-04-02 00:32:54 +00:00
* and do_users. Add new classes at the end so that all classes use sequential
2010-11-06 15:47:38 +00:00
* powers of two (1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, etc.) up to
2007-04-02 00:32:54 +00:00
* the limit of your bitvector_t, typically 0-31. */
2006-12-19 22:56:18 +00:00
bitvector_t find_class_bitvector(const char *arg)
{
size_t rpos, ret = 0;
for (rpos = 0; rpos < strlen(arg); rpos++)
ret |= (1 << parse_class(arg[rpos]));
return (ret);
}
2010-11-06 15:47:38 +00:00
/* These are definitions which control the guildmasters for each class.
* The first field (top line) controls the highest percentage skill level a
* character of the class is allowed to attain in any skill. (After this
2007-04-02 00:32:54 +00:00
* level, attempts to practice will say "You are already learned in this area."
*
2007-04-02 00:32:54 +00:00
* The second line controls the maximum percent gain in learnedness a character
* is allowed per practice -- in other words, if the random die throw comes out
* higher than this number, the gain will only be this number instead.
2006-12-19 22:56:18 +00:00
*
2010-11-06 15:47:38 +00:00
* The third line controls the minimu percent gain in learnedness a character
* is allowed per practice -- in other words, if the random die throw comes
2007-04-02 00:32:54 +00:00
* out below this number, the gain will be set up to this number.
*
2007-04-02 00:32:54 +00:00
* The fourth line simply sets whether the character knows 'spells' or 'skills'.
* This does not affect anything except the message given to the character when
* trying to practice (i.e. "You know of the following spells" vs. "You know of
* the following skills" */
2006-12-19 22:56:18 +00:00
#define SPELL 0
#define SKILL 1
/* #define LEARNED_LEVEL 0 % known which is considered "learned" */
/* #define MAX_PER_PRAC 1 max percent gain in skill per practice */
/* #define MIN_PER_PRAC 2 min percent gain in skill per practice */
/* #define PRAC_TYPE 3 should it say 'spell' or 'skill'? */
int prac_params[4][NUM_CLASSES] = {
2025-09-30 07:39:45 -07:00
/* SOR CLE THE FIG BAR RAN BARD DRU */
2025-08-19 10:54:28 -07:00
{ 95, 95, 85, 80, 75, 85, 85, 95 }, /* learned level */
{ 100, 100, 12, 12, 11, 12, 13, 90 }, /* max per practice */
{ 25, 25, 0, 0, 0, 0, 25, 25 }, /* min per practice */
{ SPELL, SPELL, SKILL, SKILL, SKILL, SKILL, SKILL, SKILL }, /* prac name */
2006-12-19 22:56:18 +00:00
};
/* The appropriate rooms for each guildmaster/guildguard; controls which types
2010-11-06 15:47:38 +00:00
* of people the various guildguards let through. i.e., the first line shows
2025-09-30 07:39:45 -07:00
* that from room 3017, only SORCERORS are allowed to go south. Don't forget
* to visit spec_assign.c if you create any new mobiles that should be a guild
2010-11-06 15:47:38 +00:00
* master or guard so they can act appropriately. If you "recycle" the
* existing mobs that are used in other guilds for your new guild, then you
* don't have to change that file, only here. Guildguards are now implemented
* via triggers. This code remains as an example. */
2025-08-19 10:54:28 -07:00
/* TO-DO: Is this necessary anymore now that there are no official guild rooms? */
struct guild_info_type guild_info[] = {
/* Midgaard */
2025-09-30 07:39:45 -07:00
{ CLASS_SORCEROR, 3017, SOUTH },
2010-11-06 15:47:38 +00:00
{ CLASS_CLERIC, 3004, NORTH },
{ CLASS_THIEF, 3027, EAST },
2025-09-30 07:39:45 -07:00
{ CLASS_FIGHTER, 3021, EAST },
2025-08-19 10:54:28 -07:00
{ CLASS_BARBARIAN, 3021, EAST },
{ CLASS_RANGER, 3021, EAST },
{ CLASS_BARD, 3021, EAST },
{ CLASS_DRUID, 3021, EAST },
/* Brass Dragon */
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line Minor Bugfix: All game configuration settings now reference the world config structure, not the individual config variables found in config.c. ------------------------------------------------------------------------ rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line Added lib/world/qst/ directory, index, index.mini, and 0.qst. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines Bugfix: the include directory (for .h files) is now referenced correctly in the depend statement. Deletion: listrent.c removed as a separate utility. ------------------------------------------------------------------------ jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line Enhancement: utils/ Makefile will now use a depends file, and looks for dependen cies in the ../ directory (shrinks the necessary information to make each utilit y). ------------------------------------------------------------------------ Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line Made TBA specific changes. do_cheat, removed help level checking, and advance to level 32. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a ttribution for the changes. (Thanks seqwith.) ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines Changed Makefile.in to use glob expressions when building the objects. This translates into no longer a need to update Makefile.in whenever a new .c file is added to the mud code. Other Makefile.* have not yet been changed (and need review, anyway). All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen does, however the tbaMUD (and legacy circle code) has never been marked-up with the special CXREF codes required to effectively use the program. Since Doxygen is easier to use, and provides almost as much functionality as CXREF, CXREF support has been dropped. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line Bug Fix: asciiflag_conv* functions now can handle a negative numeric value. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master) will no longer attempt to wander off. ------------------------------------------------------------------------ jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines Based on the compiler warning about mag_materials being an unused function, and the clone spell being unused. Bug fix: Clone can now be cast. It is an 'ignore' target spell. Fix and Modification: Clone, being an effectively unused spell that is only used by mortal Magic Users at level 30, is now implemented as very simple example of how to use mag_materials(). The item required by mag_materials is vnum 161, which in stock tbaMUD is some sacrificial entrails. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix for "Did you mean:" including DG commands. ------------------------------------------------------------------------ jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a door. Documentation: do_simple_move documented. ------------------------------------------------------------------------ Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line Trial run of columnizer function on commands list to see how people like it. ------------------------------------------------------------------------ jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line asciimap, an in game automap, along with a couple of minor bug fixes to do with the automap, patched in (Thanks Jamdog). ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line Minor update: Relocate local variable declaration to the top of ACMD(do_help) ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines Checked in the following placeholders for do_gen_tog: #define SCMD_AUTOLOOT 24 #define SCMD_AUTOGOLD 25 #define SCMD_AUTOSPLIT 26 #define SCMD_AUTOSAC 27 #define SCMD_AUTOASSIST 28 ------------------------------------------------------------------------ jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line The Autoquest patch, along with a couple of minor bug fixes, has been integrated into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.) ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines Minor Fix: Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int index types. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines Added a new atoidx() conversion function for dealing with string to IDXTYPE conversions (in utils.c, prototype exported through utils.h). Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h). Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c). ------------------------------------------------------------------------ Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line Fixed direction mapping to give readable directions instead of sub commands. ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines Since general olc editing are automatically saved to disk, 'shutdown reboot' has been changed to not-autosave by default. (Small change made to do_shutdown in act.wizard.c). ------------------------------------------------------------------------ jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines Changed: struct attack_hit_type moved to fight.h attack_hit_text exported through fight.h ------------------------------------------------------------------------ jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines - do_file heads or tails files correctly and has also been enhanced to return file info (act.wizard.c) - defines made for common log files created by autorun, and those used by do_file (db.h) - utility functions added: file_head(), file_tail(), file_sizeof(), and file_numlines() (defined utils.c and exported through utils.h) ------------------------------------------------------------------------ Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line Fixed export command. (thanks Kyle) ------------------------------------------------------------------------ jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line Files are now tagged as executable. Should be able to be checked out from subver sion and executed without running chmod. ------------------------------------------------------------------------ Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc() strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back. ------------------------------------------------------------------------ jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line Event queue function definitions, global variables and defines doxygenated. ------------------------------------------------------------------------ Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line Updated levels command to use an arg/range and added color parsing to greetings. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line Doxygen comments completed for weather.c ------------------------------------------------------------------------ Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line Corrected several 64-bit warnings. (thanks Buggo) ------------------------------------------------------------------------ Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line Added get_flag_by_name allowing for new trigedit variable checks like %actor.pref(FLAG)% checks. (thanks Jamdog) ------------------------------------------------------------------------ jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines COMPLETE: tbaMUD code re-org of global and local scope function and variable declarations. There may be a few things that I did not catch (some non extern keyword declarations of function prototypes within other functions, for example). BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines Continued clean-up of 'extern' references to functions and variables. BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of the char * returned from title_female and title_male. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines More work on mud clean-up. New file: spec_procs.h Created this file to house the legacy special procedures (spec_procs.c and castle.c) and special feature assignment in general. ------------------------------------------------------------------------ jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines - Minor Bugfix: Fixed parse error in mobact.c - Minor Bugfix: act.h is now included in all of the act functions. Forgot to do that the first time :( - Additions: ban.h has been added as the external entry point into the ban.c globals and functions. Files needing ban.h have been updated. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line All act*.c functions, defines and globals have been prototyped/declared in act.h. The file act.h does not contain every ACMD, only those ACMDs and utility functions available within the act*.c files. ------------------------------------------------------------------------ Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line Fixed the last few flags missed for the 128 bit conversion. ------------------------------------------------------------------------ Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines Adding a column formatter for lists. Accepts printf-like arguments. Only used by medit right now. ------------------------------------------------------------------------ jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines - Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts. - Ongoing cleanup to mud project. ------------------------------------------------------------------------ Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line Fixed run_autowiz which ran twice on advancement. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line act.h created and added. This header will be the external entry point for the functions, function subcommands and variables within the act*.c files. It is not designed to be the entry point for all ACMD functions. ------------------------------------------------------------------------ jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line Merge of another part of the code cleanup, the dg script stuff. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line Modularizing and organizing files continues. Committing comm.c and comm.h because they are hairy, and I don't want to do them over if my hard drive crashes. ------------------------------------------------------------------------ jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines - Marking all file scope functions as 'static' - Reorganization of the global variables and functions. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line * Protected the conf.h.* system config files from multiple calls. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line * Removed extraneous references to TRUE / FALSE and YES / NO defines. ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines * BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before) * Migrated NUM_* settings from oasis.h to more appropriate locations near where they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the POSITION_* defines.) ------------------------------------------------------------------------ jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line Added Appendix A - Coder Support. Right now, it simply speaks to the fact that we have included doxygen config files, are working to document the source code, and provides a rudimentary "do this" guide to create the doxygen cross references. ------------------------------------------------------------------------ jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines - All .h files now have doxygen recognized headers, and the format is slightly altered to ease editing of headers. - Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE R_H_ #define _HEADER_H_ .... #endif) ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line constants.h, structs.h and utils.h now protected from multiple includes. This is sometimes overkill, but good practice overall. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line Updated documentation for constants.c and constants.h. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if Graphviz is not available. Now just need a short document describing the usage of doxygen. ------------------------------------------------------------------------ jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line Minor document correction in struct dex_app_tpe. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line *bugfix* do_drink command: When a container is empty, the correct, "It is empty." message is now displayed. ------------------------------------------------------------------------ jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines Merging changes to trunk for: * utils.h, utils.c and structs.h doxygen comments * adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
{ -999 /* all */ , 5065, WEST },
/* this must go last -- add new guards above! */
{ -1, NOWHERE, -1}
};
2010-11-06 15:47:38 +00:00
/* Saving throws for : MCTW : PARA, ROD, PETRI, BREATH, SPELL. Levels 0-40. Do
2007-04-02 00:32:54 +00:00
* not forget to change extern declaration in magic.c if you add to this. */
2006-12-19 22:56:18 +00:00
byte saving_throws(int class_num, int type, int level)
{
switch (class_num) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 90;
case 1: return 70;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for mage paralyzation saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 90;
case 1: return 55;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for mage rod saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 90;
case 1: return 65;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for mage petrification saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 75;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for mage breath saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 60;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for mage spell saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
case CLASS_CLERIC:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 90;
case 1: return 60;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for cleric paralyzation saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 90;
case 1: return 70;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for cleric rod saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 90;
case 1: return 65;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for cleric petrification saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 80;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for cleric breath saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 75;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for cleric spell saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
case CLASS_THIEF:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 90;
case 1: return 65;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for thief paralyzation saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 90;
case 1: return 70;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for thief rod saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 90;
case 1: return 60;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for thief petrification saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 80;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for thief breath saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 75;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-08-19 10:54:28 -07:00
log("SYSERR: Missing level for thief spell saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 90;
case 1: return 70;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-09-30 07:39:45 -07:00
log("SYSERR: Missing level for fighter paralyzation saving throw.");
2025-08-19 10:54:28 -07:00
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 90;
case 1: return 80;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-09-30 07:39:45 -07:00
log("SYSERR: Missing level for fighter rod saving throw.");
2025-08-19 10:54:28 -07:00
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 90;
case 1: return 75;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-09-30 07:39:45 -07:00
log("SYSERR: Missing level for fighter petrification saving throw.");
2025-08-19 10:54:28 -07:00
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 85;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-09-30 07:39:45 -07:00
log("SYSERR: Missing level for fighter breath saving throw.");
2025-08-19 10:54:28 -07:00
break;
2006-12-19 22:56:18 +00:00
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 85;
2025-08-14 13:15:10 -07:00
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
2006-12-19 22:56:18 +00:00
default:
2025-09-30 07:39:45 -07:00
log("SYSERR: Missing level for fighter spell saving throw.");
2025-08-19 10:54:28 -07:00
break;
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
case CLASS_BARBARIAN:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 80;
case 1: return 60;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for barbarian paralyzation saving throw.");
break;
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 90;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for barbarian rod saving throw.");
break;
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 70;
case 1: return 65;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for barbarian petrification saving throw.");
break;
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for barbarian breath saving throw.");
break;
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for barbarian spell saving throw.");
break;
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
case CLASS_RANGER:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 75;
case 1: return 70;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for ranger paralyzation saving throw.");
break;
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 85;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for ranger rod saving throw.");
break;
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 80;
case 1: return 75;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for ranger petrification saving throw.");
break;
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for ranger breath saving throw.");
break;
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 90;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for ranger spell saving throw.");
break;
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
case CLASS_BARD:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 90;
case 1: return 70;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for bard paralyzation saving throw.");
break;
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 85;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for bard rod saving throw.");
break;
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 85;
case 1: return 75;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for bard petrification saving throw.");
break;
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 85;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for bard breath saving throw.");
break;
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 85;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for bard spell saving throw.");
break;
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
case CLASS_DRUID:
switch (type) {
case SAVING_PARA: /* Paralyzation */
switch (level) {
case 0: return 75;
case 1: return 70;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for druid paralyzation saving throw.");
break;
}
case SAVING_ROD: /* Rods */
switch (level) {
case 0: return 80;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for druid rod saving throw.");
break;
}
case SAVING_PETRI: /* Petrification */
switch (level) {
case 0: return 90;
case 1: return 75;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for druid petrification saving throw.");
break;
}
case SAVING_BREATH: /* Breath weapons */
switch (level) {
case 0: return 90;
case 1: return 85;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for druid breath saving throw.");
break;
}
case SAVING_SPELL: /* Generic spells */
switch (level) {
case 0: return 85;
case 1: return 80;
case 2: return 0;
case 3: return 0;
case 4: return 0;
case 5: return 0;
default:
log("SYSERR: Missing level for druid spell saving throw.");
break;
2006-12-19 22:56:18 +00:00
}
default:
log("SYSERR: Invalid saving throw type.");
break;
}
break;
}
/* Should not get here unless something is wrong. */
return 100;
}
2007-04-02 00:32:54 +00:00
/* Roll the 6 stats for a character... each stat is made of the sum of the best
2010-11-06 15:47:38 +00:00
* 3 out of 4 rolls of a 6-sided die. Each class then decides which priority
2007-04-02 00:32:54 +00:00
* will be given for the best to worst stats. */
2006-12-19 22:56:18 +00:00
void roll_real_abils(struct char_data *ch)
{
int i, j, k, temp;
ubyte table[6];
ubyte rolls[4];
for (i = 0; i < 6; i++)
table[i] = 0;
for (i = 0; i < 6; i++) {
for (j = 0; j < 4; j++)
rolls[j] = rand_number(1, 6);
temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] -
MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));
for (k = 0; k < 6; k++)
if (table[k] < temp) {
temp ^= table[k];
table[k] ^= temp;
temp ^= table[k];
}
}
ch->real_abils.str_add = 0;
switch (GET_CLASS(ch)) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
ch->real_abils.intel = table[0];
ch->real_abils.wis = table[1];
ch->real_abils.dex = table[2];
ch->real_abils.str = table[3];
ch->real_abils.con = table[4];
ch->real_abils.cha = table[5];
break;
case CLASS_CLERIC:
ch->real_abils.wis = table[0];
ch->real_abils.intel = table[1];
ch->real_abils.str = table[2];
ch->real_abils.dex = table[3];
ch->real_abils.con = table[4];
ch->real_abils.cha = table[5];
break;
case CLASS_THIEF:
ch->real_abils.dex = table[0];
ch->real_abils.str = table[1];
ch->real_abils.con = table[2];
ch->real_abils.intel = table[3];
ch->real_abils.wis = table[4];
ch->real_abils.cha = table[5];
break;
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
ch->real_abils.str = table[0];
ch->real_abils.dex = table[1];
ch->real_abils.con = table[2];
ch->real_abils.wis = table[3];
ch->real_abils.intel = table[4];
ch->real_abils.cha = table[5];
if (ch->real_abils.str == 18)
ch->real_abils.str_add = rand_number(0, 100);
break;
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
ch->real_abils.dex = table[0];
ch->real_abils.str = table[1];
ch->real_abils.con = table[2];
ch->real_abils.intel = table[3];
ch->real_abils.wis = table[4];
ch->real_abils.cha = table[5];
break;
case CLASS_RANGER:
ch->real_abils.dex = table[0];
ch->real_abils.str = table[1];
ch->real_abils.con = table[2];
ch->real_abils.intel = table[3];
ch->real_abils.wis = table[4];
ch->real_abils.cha = table[5];
break;
case CLASS_BARD:
ch->real_abils.dex = table[0];
ch->real_abils.str = table[1];
ch->real_abils.con = table[2];
ch->real_abils.intel = table[3];
ch->real_abils.wis = table[4];
ch->real_abils.cha = table[5];
break;
case CLASS_DRUID:
ch->real_abils.dex = table[0];
ch->real_abils.str = table[1];
ch->real_abils.con = table[2];
ch->real_abils.intel = table[3];
ch->real_abils.wis = table[4];
ch->real_abils.cha = table[5];
break;
2006-12-19 22:56:18 +00:00
}
ch->aff_abils = ch->real_abils;
}
/* Some initializations for characters, including initial skills */
void do_start(struct char_data *ch)
{
GET_LEVEL(ch) = 1;
GET_EXP(ch) = 1;
set_title(ch, NULL);
roll_real_abils(ch);
GET_MAX_HIT(ch) = 10;
GET_MAX_MANA(ch) = 100;
GET_MAX_MOVE(ch) = 82;
switch (GET_CLASS(ch)) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2025-08-18 08:26:56 -07:00
SET_SKILL(ch, SPELL_MAGIC_MISSILE, 5);
SET_SKILL(ch, SPELL_DETECT_INVIS, 5);
SET_SKILL(ch, SPELL_DETECT_MAGIC, 5);
SET_SKILL(ch, SPELL_CHILL_TOUCH, 5);
SET_SKILL(ch, SPELL_INFRAVISION, 5);
SET_SKILL(ch, SPELL_INVISIBLE, 5);
SET_SKILL(ch, SPELL_ARMOR, 5);
SET_SKILL(ch, SPELL_BURNING_HANDS, 5);
SET_SKILL(ch, SPELL_LOCATE_OBJECT, 5);
SET_SKILL(ch, SPELL_STRENGTH, 5);
SET_SKILL(ch, SPELL_SHOCKING_GRASP, 5);
SET_SKILL(ch, SPELL_SLEEP, 5);
SET_SKILL(ch, SPELL_LIGHTNING_BOLT, 5);
SET_SKILL(ch, SPELL_BLINDNESS, 5);
SET_SKILL(ch, SPELL_DETECT_POISON, 5);
SET_SKILL(ch, SPELL_COLOR_SPRAY, 5);
SET_SKILL(ch, SPELL_ENERGY_DRAIN, 5);
SET_SKILL(ch, SPELL_CURSE, 5);
SET_SKILL(ch, SPELL_POISON, 5);
SET_SKILL(ch, SPELL_FIREBALL, 5);
SET_SKILL(ch, SPELL_CHARM, 5);
SET_SKILL(ch, SPELL_IDENTIFY, 5);
SET_SKILL(ch, SPELL_FLY, 5);
SET_SKILL(ch, SPELL_ENCHANT_WEAPON, 5);
SET_SKILL(ch, SPELL_CLONE, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
2006-12-19 22:56:18 +00:00
break;
case CLASS_CLERIC:
2025-08-18 08:26:56 -07:00
SET_SKILL(ch, SPELL_CURE_LIGHT, 5);
SET_SKILL(ch, SPELL_ARMOR, 5);
SET_SKILL(ch, SPELL_CREATE_FOOD, 5);
SET_SKILL(ch, SPELL_CREATE_WATER, 5);
SET_SKILL(ch, SPELL_DETECT_POISON, 5);
SET_SKILL(ch, SPELL_DETECT_ALIGN, 5);
SET_SKILL(ch, SPELL_CURE_BLIND, 5);
SET_SKILL(ch, SPELL_BLESS, 5);
SET_SKILL(ch, SPELL_DETECT_INVIS, 5);
SET_SKILL(ch, SPELL_BLINDNESS, 5);
SET_SKILL(ch, SPELL_INFRAVISION, 5);
SET_SKILL(ch, SPELL_PROT_FROM_EVIL, 5);
SET_SKILL(ch, SPELL_POISON, 5);
SET_SKILL(ch, SPELL_GROUP_ARMOR, 5);
SET_SKILL(ch, SPELL_CURE_CRITIC, 5);
SET_SKILL(ch, SPELL_SUMMON, 5);
SET_SKILL(ch, SPELL_REMOVE_POISON, 5);
SET_SKILL(ch, SPELL_IDENTIFY, 5);
SET_SKILL(ch, SPELL_WORD_OF_RECALL, 5);
SET_SKILL(ch, SPELL_DARKNESS, 5);
SET_SKILL(ch, SPELL_EARTHQUAKE, 5);
SET_SKILL(ch, SPELL_DISPEL_EVIL, 5);
SET_SKILL(ch, SPELL_DISPEL_GOOD, 5);
SET_SKILL(ch, SPELL_SANCTUARY, 5);
SET_SKILL(ch, SPELL_CALL_LIGHTNING, 5);
SET_SKILL(ch, SPELL_HEAL, 5);
SET_SKILL(ch, SPELL_CONTROL_WEATHER, 5);
SET_SKILL(ch, SPELL_SENSE_LIFE, 5);
SET_SKILL(ch, SPELL_HARM, 5);
SET_SKILL(ch, SPELL_GROUP_HEAL, 5);
SET_SKILL(ch, SPELL_REMOVE_CURSE, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
2006-12-19 22:56:18 +00:00
break;
case CLASS_THIEF:
2025-08-18 08:26:56 -07:00
SET_SKILL(ch, SKILL_SNEAK, 5);
2006-12-19 22:56:18 +00:00
SET_SKILL(ch, SKILL_HIDE, 5);
SET_SKILL(ch, SKILL_TRACK, 5);
2025-08-18 08:26:56 -07:00
SET_SKILL(ch, SKILL_STEAL, 5);
SET_SKILL(ch, SKILL_BACKSTAB, 5);
SET_SKILL(ch, SKILL_PICK_LOCK, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2006-12-19 22:56:18 +00:00
break;
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2025-08-18 08:26:56 -07:00
SET_SKILL(ch, SKILL_KICK, 5);
SET_SKILL(ch, SKILL_RESCUE, 5);
SET_SKILL(ch, SKILL_BANDAGE, 5);
SET_SKILL(ch, SKILL_BASH, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_SLASHING_WEAPONS, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
SET_SKILL(ch, SKILL_BLUDGEONING_WEAPONS, 5);
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2006-12-19 22:56:18 +00:00
break;
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
SET_SKILL(ch, SKILL_KICK, 5);
SET_SKILL(ch, SKILL_RESCUE, 5);
SET_SKILL(ch, SKILL_BANDAGE, 5);
SET_SKILL(ch, SKILL_WHIRLWIND, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
SET_SKILL(ch, SKILL_BLUDGEONING_WEAPONS, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2025-08-19 10:54:28 -07:00
break;
case CLASS_RANGER:
SET_SKILL(ch, SKILL_SNEAK, 5);
SET_SKILL(ch, SKILL_HIDE, 5);
SET_SKILL(ch, SKILL_BANDAGE, 5);
SET_SKILL(ch, SKILL_TRACK, 5);
SET_SKILL(ch, SKILL_BASH, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_SLASHING_WEAPONS, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2025-08-19 10:54:28 -07:00
break;
case CLASS_BARD:
SET_SKILL(ch, SPELL_ARMOR, 5);
SET_SKILL(ch, SPELL_IDENTIFY, 5);
SET_SKILL(ch, SKILL_BANDAGE, 5);
SET_SKILL(ch, SKILL_TRACK, 5);
SET_SKILL(ch, SKILL_PICK_LOCK, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2025-08-19 10:54:28 -07:00
break;
case CLASS_DRUID:
SET_SKILL(ch, SPELL_DETECT_INVIS, 5);
SET_SKILL(ch, SPELL_DETECT_MAGIC, 5);
SET_SKILL(ch, SPELL_LOCATE_OBJECT, 5);
SET_SKILL(ch, SKILL_BANDAGE, 5);
SET_SKILL(ch, SKILL_TRACK, 5);
2025-08-19 13:18:53 -07:00
SET_SKILL(ch, SKILL_UNARMED, 5);
SET_SKILL(ch, SKILL_PIERCING_WEAPONS, 5);
SET_SKILL(ch, SKILL_SHIELD_USE, 5);
2025-08-28 10:47:05 -07:00
SET_SKILL(ch, SKILL_PERCEPTION, 5);
2025-08-19 10:54:28 -07:00
break;
2006-12-19 22:56:18 +00:00
}
advance_level(ch);
GET_HIT(ch) = GET_MAX_HIT(ch);
GET_MANA(ch) = GET_MAX_MANA(ch);
GET_MOVE(ch) = GET_MAX_MOVE(ch);
GET_COND(ch, THIRST) = 24;
GET_COND(ch, HUNGER) = 24;
2006-12-19 22:56:18 +00:00
GET_COND(ch, DRUNK) = 0;
if (CONFIG_SITEOK_ALL)
2007-05-08 15:20:59 +00:00
SET_BIT_AR(PLR_FLAGS(ch), PLR_SITEOK);
2006-12-19 22:56:18 +00:00
}
2010-11-06 15:47:38 +00:00
/* This function controls the change to maxmove, maxmana, and maxhp for each
2007-04-02 00:32:54 +00:00
* class every time they gain a level. */
2006-12-19 22:56:18 +00:00
void advance_level(struct char_data *ch)
{
int add_hp, add_mana = 0, add_move = 0, i;
add_hp = con_app[GET_CON(ch)].hitp;
switch (GET_CLASS(ch)) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
add_hp += rand_number(3, 8);
add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));
add_mana = MIN(add_mana, 10);
add_move = rand_number(0, 2);
break;
case CLASS_CLERIC:
add_hp += rand_number(5, 10);
add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));
add_mana = MIN(add_mana, 10);
add_move = rand_number(0, 2);
break;
case CLASS_THIEF:
add_hp += rand_number(7, 13);
add_mana = 0;
add_move = rand_number(1, 3);
break;
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
add_hp += rand_number(10, 15);
add_mana = 0;
add_move = rand_number(1, 3);
break;
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
add_hp += rand_number(12, 18);
add_mana = 0;
add_move = rand_number(1, 3);
break;
case CLASS_RANGER:
add_hp += rand_number(10, 15);
add_mana = 0;
add_move = rand_number(2, 4);
break;
case CLASS_BARD:
add_hp += rand_number(7, 13);
add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));
add_mana = MIN(add_mana, 10);
add_move = rand_number(1, 3);
break;
case CLASS_DRUID:
add_hp += rand_number(10, 15);
add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));
add_mana = MIN(add_mana, 10);
add_move = rand_number(1, 4);
break;
2006-12-19 22:56:18 +00:00
}
ch->points.max_hit += MAX(1, add_hp);
ch->points.max_move += MAX(1, add_move);
if (GET_LEVEL(ch) > 1)
ch->points.max_mana += add_mana;
if (GET_LEVEL(ch) >= LVL_IMMORT) {
2006-12-19 22:56:18 +00:00
for (i = 0; i < 3; i++)
GET_COND(ch, i) = (char) -1;
2007-05-08 15:20:59 +00:00
SET_BIT_AR(PRF_FLAGS(ch), PRF_HOLYLIGHT);
2006-12-19 22:56:18 +00:00
}
snoop_check(ch);
save_char(ch);
}
2007-04-02 00:32:54 +00:00
/* This simply calculates the backstab multiplier based on a character's level.
2010-11-06 15:47:38 +00:00
* This used to be an array, but was changed to be a function so that it would
* be easier to add more levels to your MUD. This doesn't really create a big
2007-04-02 00:32:54 +00:00
* performance hit because it's not used very often. */
2006-12-19 22:56:18 +00:00
int backstab_mult(int level)
{
2025-08-14 13:15:10 -07:00
if (level < LVL_IMMORT)
return 2; /* mortal levels */
else
return 20; /* immortals */
2006-12-19 22:56:18 +00:00
}
2007-04-02 00:32:54 +00:00
/* invalid_class is used by handler.c to determine if a piece of equipment is
* usable by a particular class, based on the ITEM_ANTI_{class} bitvectors. */
2006-12-19 22:56:18 +00:00
int invalid_class(struct char_data *ch, struct obj_data *obj)
{
2025-09-30 07:39:45 -07:00
if (OBJ_FLAGGED(obj, ITEM_ANTI_SORCEROR) && IS_SORCEROR(ch))
2006-12-19 22:56:18 +00:00
return TRUE;
if (OBJ_FLAGGED(obj, ITEM_ANTI_CLERIC) && IS_CLERIC(ch))
return TRUE;
2025-09-30 07:39:45 -07:00
if (OBJ_FLAGGED(obj, ITEM_ANTI_FIGHTER) && IS_FIGHTER(ch))
2006-12-19 22:56:18 +00:00
return TRUE;
if (OBJ_FLAGGED(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch))
return TRUE;
2025-08-19 10:54:28 -07:00
if (OBJ_FLAGGED(obj, ITEM_ANTI_BARBARIAN) && IS_BARBARIAN(ch))
return TRUE;
if (OBJ_FLAGGED(obj, ITEM_ANTI_RANGER) && IS_RANGER(ch))
return TRUE;
if (OBJ_FLAGGED(obj, ITEM_ANTI_BARD) && IS_BARD(ch))
return TRUE;
if (OBJ_FLAGGED(obj, ITEM_ANTI_DRUID) && IS_DRUID(ch))
return TRUE;
2006-12-19 22:56:18 +00:00
return FALSE;
}
2010-11-06 15:47:38 +00:00
/* SPELLS AND SKILLS. This area defines which spells are assigned to which
* classes, and the minimum level the character must be to use the spell or
2007-04-02 00:32:54 +00:00
* skill. */
2006-12-19 22:56:18 +00:00
void init_spell_levels(void)
{
2025-09-30 07:39:45 -07:00
/* SORCERORS */
spell_level(SPELL_MAGIC_MISSILE, CLASS_SORCEROR, 1);
spell_level(SPELL_DETECT_INVIS, CLASS_SORCEROR, 1);
spell_level(SPELL_DETECT_MAGIC, CLASS_SORCEROR, 1);
spell_level(SPELL_CHILL_TOUCH, CLASS_SORCEROR, 1);
spell_level(SPELL_INFRAVISION, CLASS_SORCEROR, 1);
spell_level(SPELL_INVISIBLE, CLASS_SORCEROR, 1);
spell_level(SPELL_ARMOR, CLASS_SORCEROR, 1);
spell_level(SPELL_BURNING_HANDS, CLASS_SORCEROR, 1);
spell_level(SPELL_LOCATE_OBJECT, CLASS_SORCEROR, 1);
spell_level(SPELL_STRENGTH, CLASS_SORCEROR, 1);
spell_level(SPELL_SHOCKING_GRASP, CLASS_SORCEROR, 1);
spell_level(SPELL_SLEEP, CLASS_SORCEROR, 1);
spell_level(SPELL_LIGHTNING_BOLT, CLASS_SORCEROR, 1);
spell_level(SPELL_BLINDNESS, CLASS_SORCEROR, 1);
spell_level(SPELL_DETECT_POISON, CLASS_SORCEROR, 1);
spell_level(SPELL_COLOR_SPRAY, CLASS_SORCEROR, 1);
spell_level(SPELL_ENERGY_DRAIN, CLASS_SORCEROR, 1);
spell_level(SPELL_CURSE, CLASS_SORCEROR, 1);
spell_level(SPELL_POISON, CLASS_SORCEROR, 1);
spell_level(SPELL_FIREBALL, CLASS_SORCEROR, 1);
spell_level(SPELL_CHARM, CLASS_SORCEROR, 1);
spell_level(SPELL_IDENTIFY, CLASS_SORCEROR, 1);
spell_level(SPELL_FLY, CLASS_SORCEROR, 1);
spell_level(SPELL_ENCHANT_WEAPON, CLASS_SORCEROR, 1);
spell_level(SPELL_CLONE, CLASS_SORCEROR, 1);
spell_level(SKILL_UNARMED, CLASS_SORCEROR, 1);
2006-12-19 22:56:18 +00:00
/* CLERICS */
spell_level(SPELL_CURE_LIGHT, CLASS_CLERIC, 1);
spell_level(SPELL_ARMOR, CLASS_CLERIC, 1);
2025-08-18 08:26:56 -07:00
spell_level(SPELL_CREATE_FOOD, CLASS_CLERIC, 1);
spell_level(SPELL_CREATE_WATER, CLASS_CLERIC, 1);
spell_level(SPELL_DETECT_POISON, CLASS_CLERIC, 1);
spell_level(SPELL_DETECT_ALIGN, CLASS_CLERIC, 1);
spell_level(SPELL_CURE_BLIND, CLASS_CLERIC, 1);
spell_level(SPELL_BLESS, CLASS_CLERIC, 1);
spell_level(SPELL_DETECT_INVIS, CLASS_CLERIC, 1);
spell_level(SPELL_BLINDNESS, CLASS_CLERIC, 1);
spell_level(SPELL_INFRAVISION, CLASS_CLERIC, 1);
spell_level(SPELL_PROT_FROM_EVIL, CLASS_CLERIC, 1);
spell_level(SPELL_POISON, CLASS_CLERIC, 1);
spell_level(SPELL_GROUP_ARMOR, CLASS_CLERIC, 1);
spell_level(SPELL_CURE_CRITIC, CLASS_CLERIC, 1);
spell_level(SPELL_SUMMON, CLASS_CLERIC, 1);
spell_level(SPELL_REMOVE_POISON, CLASS_CLERIC, 1);
spell_level(SPELL_IDENTIFY, CLASS_CLERIC, 1);
spell_level(SPELL_WORD_OF_RECALL, CLASS_CLERIC, 1);
spell_level(SPELL_DARKNESS, CLASS_CLERIC, 1);
spell_level(SPELL_EARTHQUAKE, CLASS_CLERIC, 1);
spell_level(SPELL_DISPEL_EVIL, CLASS_CLERIC, 1);
spell_level(SPELL_DISPEL_GOOD, CLASS_CLERIC, 1);
spell_level(SPELL_SANCTUARY, CLASS_CLERIC, 1);
spell_level(SPELL_CALL_LIGHTNING, CLASS_CLERIC, 1);
spell_level(SPELL_HEAL, CLASS_CLERIC, 1);
spell_level(SPELL_CONTROL_WEATHER, CLASS_CLERIC, 1);
spell_level(SPELL_SENSE_LIFE, CLASS_CLERIC, 1);
spell_level(SPELL_HARM, CLASS_CLERIC, 1);
spell_level(SPELL_GROUP_HEAL, CLASS_CLERIC, 1);
spell_level(SPELL_REMOVE_CURSE, CLASS_CLERIC, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_SHIELD_USE, CLASS_CLERIC, 1);
2006-12-19 22:56:18 +00:00
/* THIEVES */
spell_level(SKILL_SNEAK, CLASS_THIEF, 1);
2025-08-18 08:26:56 -07:00
spell_level(SKILL_PICK_LOCK, CLASS_THIEF, 1);
spell_level(SKILL_BACKSTAB, CLASS_THIEF, 1);
spell_level(SKILL_STEAL, CLASS_THIEF, 1);
spell_level(SKILL_HIDE, CLASS_THIEF, 1);
spell_level(SKILL_TRACK, CLASS_THIEF, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_UNARMED, CLASS_THIEF, 1);
spell_level(SKILL_PIERCING_WEAPONS, CLASS_THIEF, 1);
spell_level(SKILL_SHIELD_USE, CLASS_THIEF, 1);
2025-08-28 10:47:05 -07:00
spell_level(SKILL_PERCEPTION, CLASS_THIEF, 1);
2006-12-19 22:56:18 +00:00
2025-09-30 07:39:45 -07:00
/* FIGHTERS */
spell_level(SKILL_KICK, CLASS_FIGHTER, 1);
spell_level(SKILL_RESCUE, CLASS_FIGHTER, 1);
spell_level(SKILL_BANDAGE, CLASS_FIGHTER, 1);
spell_level(SKILL_BASH, CLASS_FIGHTER, 1);
spell_level(SKILL_UNARMED, CLASS_FIGHTER, 1);
spell_level(SKILL_SLASHING_WEAPONS, CLASS_FIGHTER, 1);
spell_level(SKILL_PIERCING_WEAPONS, CLASS_FIGHTER, 1);
spell_level(SKILL_BLUDGEONING_WEAPONS, CLASS_FIGHTER, 1);
spell_level(SKILL_SHIELD_USE, CLASS_FIGHTER, 1);
spell_level(SKILL_PERCEPTION, CLASS_FIGHTER, 1);
2025-08-19 10:54:28 -07:00
/* BARBARIANS */
spell_level(SKILL_KICK, CLASS_BARBARIAN, 1);
spell_level(SKILL_RESCUE, CLASS_BARBARIAN, 1);
spell_level(SKILL_BANDAGE, CLASS_BARBARIAN, 1);
spell_level(SKILL_WHIRLWIND, CLASS_BARBARIAN, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_UNARMED, CLASS_BARBARIAN, 1);
spell_level(SKILL_SLASHING_WEAPONS, CLASS_BARBARIAN, 1);
spell_level(SKILL_BLUDGEONING_WEAPONS, CLASS_BARBARIAN, 1);
2025-08-28 10:47:05 -07:00
spell_level(SKILL_PERCEPTION, CLASS_BARBARIAN, 1);
2025-08-19 10:54:28 -07:00
/* RANGERS */
spell_level(SKILL_SNEAK, CLASS_RANGER, 1);
spell_level(SKILL_HIDE, CLASS_RANGER, 1);
spell_level(SKILL_BANDAGE, CLASS_RANGER, 1);
spell_level(SKILL_TRACK, CLASS_RANGER, 1);
spell_level(SKILL_BASH, CLASS_RANGER, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_UNARMED, CLASS_RANGER, 1);
spell_level(SKILL_SLASHING_WEAPONS, CLASS_RANGER, 1);
spell_level(SKILL_PIERCING_WEAPONS, CLASS_RANGER, 1);
spell_level(SKILL_SHIELD_USE, CLASS_RANGER, 1);
2025-08-28 10:47:05 -07:00
spell_level(SKILL_PERCEPTION, CLASS_RANGER, 1);
2025-08-19 10:54:28 -07:00
/* BARDS */
spell_level(SPELL_ARMOR, CLASS_BARD, 1);
spell_level(SPELL_IDENTIFY, CLASS_BARD, 1);
spell_level(SKILL_BANDAGE, CLASS_BARD, 1);
spell_level(SKILL_TRACK, CLASS_BARD, 1);
spell_level(SKILL_PICK_LOCK, CLASS_BARD, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_UNARMED, CLASS_BARD, 1);
spell_level(SKILL_PIERCING_WEAPONS, CLASS_BARD, 1);
spell_level(SKILL_SHIELD_USE, CLASS_BARD, 1);
2025-08-28 10:47:05 -07:00
spell_level(SKILL_PERCEPTION, CLASS_BARD, 1);
2025-08-19 10:54:28 -07:00
/* DRUIDS */
spell_level(SPELL_DETECT_INVIS, CLASS_DRUID, 1);
spell_level(SPELL_DETECT_MAGIC, CLASS_DRUID, 1);
spell_level(SPELL_LOCATE_OBJECT, CLASS_DRUID, 1);
spell_level(SKILL_BANDAGE, CLASS_DRUID, 1);
spell_level(SKILL_TRACK, CLASS_DRUID, 1);
2025-08-19 13:18:53 -07:00
spell_level(SKILL_UNARMED, CLASS_DRUID, 1);
spell_level(SKILL_PIERCING_WEAPONS, CLASS_DRUID, 1);
spell_level(SKILL_SHIELD_USE, CLASS_DRUID, 1);
2025-08-28 10:47:05 -07:00
spell_level(SKILL_PERCEPTION, CLASS_DRUID, 1);
2006-12-19 22:56:18 +00:00
}
2010-11-06 15:47:38 +00:00
/* This is the exp given to implementors -- it must always be greater than the
2007-04-02 00:32:54 +00:00
* exp required for immortality, plus at least 20,000 or so. */
2006-12-19 22:56:18 +00:00
#define EXP_MAX 10000000
/* Function to return the exp required for each class/level */
int level_exp(int chclass, int level)
{
if (level > LVL_IMPL || level < 0) {
log("SYSERR: Requesting exp for invalid level %d!", level);
2006-12-19 22:56:18 +00:00
return 0;
}
/* Gods have exp close to EXP_MAX. This statement should never have to
* changed, regardless of how many mortal or immortal levels exist. */
if (level > LVL_IMMORT) {
return EXP_MAX - ((LVL_IMPL - level) * 1000);
}
2006-12-19 22:56:18 +00:00
/* Exp required for normal mortals is below */
switch (chclass) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
switch (level) {
case 0: return 0;
case 1: return 1;
2025-08-18 08:26:56 -07:00
case LVL_IMMORT: return 9999999;
2006-12-19 22:56:18 +00:00
}
break;
case CLASS_CLERIC:
switch (level) {
case 0: return 0;
case 1: return 1;
2025-08-18 08:26:56 -07:00
case LVL_IMMORT: return 9999999;
2006-12-19 22:56:18 +00:00
}
break;
case CLASS_THIEF:
switch (level) {
case 0: return 0;
case 1: return 1;
2025-08-18 08:26:56 -07:00
case LVL_IMMORT: return 9999999;
2006-12-19 22:56:18 +00:00
}
break;
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
switch (level) {
case 0: return 0;
case 1: return 1;
2025-08-18 08:26:56 -07:00
case LVL_IMMORT: return 9999999;
2006-12-19 22:56:18 +00:00
}
break;
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
switch (level) {
case 0: return 0;
case 1: return 1;
case LVL_IMMORT: return 9999999;
}
break;
case CLASS_RANGER:
switch (level) {
case 0: return 0;
case 1: return 1;
case LVL_IMMORT: return 9999999;
}
break;
case CLASS_BARD:
switch (level) {
case 0: return 0;
case 1: return 1;
case LVL_IMMORT: return 9999999;
}
break;
case CLASS_DRUID:
switch (level) {
case 0: return 0;
case 1: return 1;
case LVL_IMMORT: return 9999999;
}
break;
2006-12-19 22:56:18 +00:00
}
2007-04-02 00:32:54 +00:00
/* This statement should never be reached if the exp tables in this function
2006-12-19 22:56:18 +00:00
* are set up properly. If you see exp of 123456 then the tables above are
2007-04-02 00:32:54 +00:00
* incomplete. */
2006-12-19 22:56:18 +00:00
log("SYSERR: XP tables not set up correctly in class.c!");
return 123456;
}
2007-04-02 00:32:54 +00:00
/* Default titles of male characters. */
2006-12-19 22:56:18 +00:00
const char *title_male(int chclass, int level)
{
if (level <= 0 || level > LVL_IMPL)
2006-12-19 22:56:18 +00:00
return "the Man";
if (level == LVL_IMPL)
return "the Implementor";
2006-12-19 22:56:18 +00:00
switch (chclass) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
switch (level) {
case 1: return "the Apprentice of Magic";
case LVL_IMMORT: return "the Immortal Warlock";
case LVL_GOD: return "the Avatar of Magic";
case LVL_GRGOD: return "the God of Magic";
2025-09-30 07:39:45 -07:00
default: return "the Sorceror";
2006-12-19 22:56:18 +00:00
}
case CLASS_CLERIC:
switch (level) {
case 1: return "the Believer";
case LVL_IMMORT: return "the Immortal Cardinal";
case LVL_GOD: return "the Inquisitor";
case LVL_GRGOD: return "the God of Good and Evil";
2006-12-19 22:56:18 +00:00
default: return "the Cleric";
}
case CLASS_THIEF:
switch (level) {
case 1: return "the Pilferer";
case LVL_IMMORT: return "the Immortal Assassin";
case LVL_GOD: return "the Demi God of Thieves";
case LVL_GRGOD: return "the God of Thieves and Tradesmen";
2006-12-19 22:56:18 +00:00
default: return "the Thief";
}
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
switch(level) {
case 1: return "the Swordpupil";
case LVL_IMMORT: return "the Immortal Warlord";
case LVL_GOD: return "the Extirpator";
case LVL_GRGOD: return "the God of War";
2025-09-30 07:39:45 -07:00
default: return "the Fighter";
2006-12-19 22:56:18 +00:00
}
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
switch(level) {
case 1: return "the Savage";
case LVL_IMMORT: return "the Immortal Conquerer";
case LVL_GOD: return "the Primal";
case LVL_GRGOD: return "the God of Blood and Thunder";
default: return "the Barbarian";
}
case CLASS_RANGER:
switch(level) {
case 1: return "the Pathfinder";
case LVL_IMMORT: return "the Immortal Trapmaster";
case LVL_GOD: return "the Wanderer";
case LVL_GRGOD: return "the God of the Hunt";
default: return "the Ranger";
}
case CLASS_BARD:
switch(level) {
case 1: return "the Singer";
case LVL_IMMORT: return "the Immortal Songwriter";
case LVL_GOD: return "the Musician";
case LVL_GRGOD: return "the God of Ballads";
default: return "the Bard";
}
case CLASS_DRUID:
switch(level) {
case 1: return "the Communer";
case LVL_IMMORT: return "the Immortal Augur";
case LVL_GOD: return "the Naturophile";
case LVL_GRGOD: return "the God of Nature";
default: return "the Druid";
}
2006-12-19 22:56:18 +00:00
}
/* Default title for classes which do not have titles defined */
return "the Classless";
}
2007-04-02 00:32:54 +00:00
/* Default titles of female characters. */
2006-12-19 22:56:18 +00:00
const char *title_female(int chclass, int level)
{
if (level <= 0 || level > LVL_IMPL)
2006-12-19 22:56:18 +00:00
return "the Woman";
if (level == LVL_IMPL)
return "the Implementress";
2006-12-19 22:56:18 +00:00
switch (chclass) {
2025-09-30 07:39:45 -07:00
case CLASS_SORCEROR:
2006-12-19 22:56:18 +00:00
switch (level) {
case 1: return "the Apprentice of Magic";
case LVL_IMMORT: return "the Immortal Enchantress";
case LVL_GOD: return "the Empress of Magic";
case LVL_GRGOD: return "the Goddess of Magic";
2006-12-19 22:56:18 +00:00
default: return "the Witch";
}
case CLASS_CLERIC:
switch (level) {
case 1: return "the Believer";
case LVL_IMMORT: return "the Immortal Priestess";
case LVL_GOD: return "the Inquisitress";
case LVL_GRGOD: return "the Goddess of Good and Evil";
2006-12-19 22:56:18 +00:00
default: return "the Cleric";
}
case CLASS_THIEF:
switch (level) {
case 1: return "the Pilferess";
case LVL_IMMORT: return "the Immortal Assassin";
case LVL_GOD: return "the Demi Goddess of Thieves";
case LVL_GRGOD: return "the Goddess of Thieves and Tradesmen";
2006-12-19 22:56:18 +00:00
default: return "the Thief";
}
2025-09-30 07:39:45 -07:00
case CLASS_FIGHTER:
2006-12-19 22:56:18 +00:00
switch(level) {
case 1: return "the Swordpupil";
case LVL_IMMORT: return "the Immortal Lady of War";
case LVL_GOD: return "the Queen of Destruction";
case LVL_GRGOD: return "the Goddess of War";
2025-09-30 07:39:45 -07:00
default: return "the Fighter";
2006-12-19 22:56:18 +00:00
}
2025-08-19 10:54:28 -07:00
case CLASS_BARBARIAN:
switch(level) {
case 1: return "the Savage";
case LVL_IMMORT: return "the Immortal Conquerer";
case LVL_GOD: return "the Primal";
case LVL_GRGOD: return "the Goddess of Blood and Thunder";
default: return "the Barbarian";
}
case CLASS_RANGER:
switch(level) {
case 1: return "the Pathfinder";
case LVL_IMMORT: return "the Immortal Trapmaster";
case LVL_GOD: return "the Wanderer";
case LVL_GRGOD: return "the Goddess of the Hunt";
default: return "the Ranger";
}
case CLASS_BARD:
switch(level) {
case 1: return "the Singer";
case LVL_IMMORT: return "the Immortal Songwriter";
case LVL_GOD: return "the Musician";
case LVL_GRGOD: return "the Goddess of Ballads";
default: return "the Bard";
}
case CLASS_DRUID:
switch(level) {
case 1: return "the Communer";
case LVL_IMMORT: return "the Immortal Augur";
case LVL_GOD: return "the Naturophile";
case LVL_GRGOD: return "the Goddess of Nature";
default: return "the Druid";
}
2006-12-19 22:56:18 +00:00
}
/* Default title for classes which do not have titles defined */
return "the Classless";
}