Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: More Fixes




---------- Forwarded message ----------
Date: Fri, 7 Apr 2000 15:40:02 +0200
From: Jan Echternach <echter@informatik.uni-rostock.de>
Reply-To: Jan Echternach <jan.echternach@informatik.uni-rostock.de>
To: crossfire@ifi.uio.no

common/object.c, get_living_level():
New function that gets op->level and checks that it is not 0.


server/gods.c, pray_at_altar():
Reduce experience loss and chance of conversion by a factor of 10.

There are many altars on the maps that don't look like altars.  For example,
it is not a good idea to pray over a gold floor ("You pray over the drop
10 gold coins of Ruggilli." (sic!)).  Furthermore, some "Altar
of Mostrai" is actually an "Altar of Mostrai of Sorig" and Mostrai gets
very angry when praying at that altar.  The real fix would be to change
the archetypes on the maps such that only real altars are altars and not
every item trigger.  And an "Altar of Mostrai" should always be "of
Mostrai" (and not have it's name changed to "Altar of Mostrai of Mostrai").


server/attack.c, deathstrike_player():
Use get_living_level() for defender's level.  Server shouldn't crash
anymore when a priest of Devourers attacks a generator with a cause
wounds spell.

Call get_living_level() to catch even more bugs in archetypes.  (The
real fix is IMHO to set a level for each living object.)


server/spell_effect.c, magic_wall(); lib/spell_params:
Final fix for darkness spell.

-- 
Jan
diff -ru orig/crossfire-0.95.5-patch1/common/object.c crossfire-0.95.5/common/object.c
--- orig/crossfire-0.95.5-patch1/common/object.c	Wed Mar 22 08:56:47 2000
+++ crossfire-0.95.5/common/object.c	Fri Apr  7 14:38:52 2000
@@ -1977,4 +1977,31 @@
     return dst;
 }
 
+
+/*
+ * Get level from object that is supposed to be alive.
+ */
+
+short get_living_level (object *op)
+{
+    short level = op->level;
+
+
+    if ( ! QUERY_FLAG (op, FLAG_ALIVE))
+    {
+        LOG (llevError, "BUG: get_living_level() called with non-living "
+             "object (arch %s, name %s).\n", op->arch->name, op->name);
+        if (level < 1)
+            level = 1;
+    }
+    else if (level < 1)
+    {
+        LOG (llevError, "BUG: Living object (arch %s, name %s) without "
+             "level.\n", op->arch->name, op->name);
+        level = 1;
+    }
+
+    return level;
+}
+
 /*** end of object.c ***/
diff -ru orig/crossfire-0.95.5-patch1/include/libproto.h crossfire-0.95.5/include/libproto.h
--- orig/crossfire-0.95.5-patch1/include/libproto.h	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/include/libproto.h	Fri Apr  7 14:25:19 2000
@@ -173,6 +173,7 @@
 extern mapstruct *get_empty_map ( int sizex, int sizey );
 extern recipelist * get_formulalist ( int i );
 extern char *get_levelnumber ( int i );
+extern short get_living_level (object *op);
 extern mapstruct *get_linked_map ( char *path );
 extern int get_magic ( int diff );
 extern object *get_nearest_part ( object *op, object *pl );
diff -ru orig/crossfire-0.95.5-patch1/lib/spell_params crossfire-0.95.5/lib/spell_params
--- orig/crossfire-0.95.5-patch1/lib/spell_params	Wed Mar 22 08:56:50 2000
+++ crossfire-0.95.5/lib/spell_params	Fri Apr  7 14:02:15 2000
@@ -31,7 +31,7 @@
 light
 1 4  2 1000 20 1 10
 darkness
-2 8  0 350 0 1 20
+2 8  0 10 0 2 20
 sunspear
 6 8  8 8 3 9  30
 dark vision
diff -ru orig/crossfire-0.95.5-patch1/server/attack.c crossfire-0.95.5/server/attack.c
--- orig/crossfire-0.95.5-patch1/server/attack.c	Fri Apr  7 14:32:54 2000
+++ crossfire-0.95.5/server/attack.c	Fri Apr  7 15:26:18 2000
@@ -876,7 +876,8 @@
 	    /* This appears to be doing primitive filtering to only
 	     * display the more interesting monsters.
 	     */
-	    if ( owner->level/2<op->level || op->stats.exp>1000) {
+            /* Use get_living_level() once to catch bugs. */
+	    if ( owner->level/2<get_living_level(op) || op->stats.exp>1000) {
 		if(owner!=hitter) {
 		    (void) sprintf(buf,"You killed %s with %s.",query_name(op)
 				       ,query_name(hitter));
@@ -1186,7 +1187,7 @@
 	if(!( (QUERY_FLAG(op,FLAG_UNDEAD)&&strstr(hitter->slaying,undead_name)) ||
 		(op->race&&strstr(hitter->slaying,op->race))))	return;
 
-    def_lev = op->level;
+    def_lev = get_living_level (op);
 /*  atk_lev  = (hitter->level)/2; */ 
     atk_lev  = SK_level(hitter)/2;
     LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n",
diff -ru orig/crossfire-0.95.5-patch1/server/gods.c crossfire-0.95.5/server/gods.c
--- orig/crossfire-0.95.5-patch1/server/gods.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/gods.c	Fri Apr  7 14:45:43 2000
@@ -119,12 +119,13 @@
      /* whether we will be successfull in defecting or not -
       * we lose experience from the clerical experience obj */
 
-     loss = 0.1 * (float) pl->chosen_skill->exp_obj->stats.exp;
+     loss = 0.01 * (float) pl->chosen_skill->exp_obj->stats.exp;
      if(loss) lose_priest_exp(pl,RANDOM()%(loss*angry));
  
      /* May switch Gods, but its random chance based on our current level
       * note it gets harder to swap gods the higher we get */
-     if((angry==1)&&!(RANDOM()%(pl->chosen_skill->exp_obj->level+1))) {
+     if (angry == 1 && RANDOM()%(10*(pl->chosen_skill->exp_obj->level+1)) == 0)
+     {
        int i;  /* index over known_spells */
        int sp;  /*  spell index */
        become_follower(pl,altar->title);
diff -ru orig/crossfire-0.95.5-patch1/server/spell_effect.c crossfire-0.95.5/server/spell_effect.c
--- orig/crossfire-0.95.5-patch1/server/spell_effect.c	Fri Apr  7 14:32:54 2000
+++ crossfire-0.95.5/server/spell_effect.c	Fri Apr  7 13:42:06 2000
@@ -846,9 +846,8 @@
     break;
   case SP_DARKNESS:
     tmp=get_archetype("darkness");
-    tmp->speed = 0.000350 * SP_PARAMETERS[SP_DARKNESS].bdur
-                 / (SP_PARAMETERS[SP_DARKNESS].bdur
-                    + SP_level_strength_adjust (op, caster, SP_DARKNESS));
+    tmp->stats.food = SP_PARAMETERS[SP_DARKNESS].bdur
+                      + SP_level_strength_adjust (op, caster, SP_DARKNESS);
     break; 
   case SP_COUNTERWALL:
     tmp=get_archetype("counterspell");