[CF-Devel] spell book names

Preston Crow crow at bear.cs.dartmouth.edu
Fri Mar 23 16:27:09 CST 2001


I'm probably the only one, but I never liked that spellbooks can have four
different names for a given spell.  While I appreciate having different
types of spell books for flavor, I thought it would make more sense to have
the name be based on the level of the spell.

I figured it couldn't be too hard to implement, so I did it--see the patch
below.

So, is this a good thing?

--PC

--- readable.c.orig	Fri Mar 23 17:21:02 2001
+++ readable.c	Fri Mar 23 17:14:46 2001
@@ -425,22 +425,20 @@
 
 static char *mage_book_name[] =
 {
-    "grimoire",
-    "grimoire",
-    "grimoire",
-    "manual",
-    "tome",
-    "treatise"
+    "grimoire",     /* Level 1   */
+    "grimoire",     /* Level 2-3 */
+    "manual",       /* Level 4-5 */
+    "tome",         /* Level 6-7 */
+    "treatise"      /* Level 8+  */
 };
 
 static char *priest_book_name[] =
 {
-    "hymnal",
-    "prayerbook",
-    "prayerbook",
-    "prayerbook",
-    "sacred text",
-    "testiment"
+    "hymnal",       /* Level 1   */
+    "prayerbook",   /* Level 2-3 */
+    "prayerbook",   /* Level 4-5 */
+    "sacred text",  /* Level 6-7 */
+    "testiment"     /* Level 8+  */
 };
 
 static int max_titles[6] =
@@ -1131,13 +1129,20 @@
       case SPELLBOOK:		/* depends on mage/clerical */
 	  if (!strcmp (book->arch->name, "cleric_book"))
 	    {
+		int level;
+		level=spells[book->stats.sp].level;
 		nbr = sizeof (priest_book_name) / sizeof (char *);
-		strcpy (name, priest_book_name[RANDOM () % nbr]);
+		if (level>nbr*2-1) level=nbr*2-1;
+		strcpy (name, priest_book_name[level/2]);
 	    }
 	  else
 	    {
+		int level;
+
+		level=spells[book->stats.sp].level;
 		nbr = sizeof (mage_book_name) / sizeof (char *);
-		strcpy (name, mage_book_name[RANDOM () % nbr]);
+		if (level>nbr*2-1) level=nbr*2-1;
+		strcpy (name, mage_book_name[level/2]);
 	    }
 	  if (book->name)
 	      free_string (book->name);

    
    


More information about the crossfire mailing list