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

CF: Several fixes for 0.95.5



Hi,

The attached patch includes several fixes that I have ported from my
patched 0.93.1 tree to 0.95.5.

server/apply.c, improve_armour():
Maximum armour value reduced to 90.  Items can now always be improved up
to this value.  For armour x you need level x, not level x + 1 as before.
esrv_send_item() and fix_player() also called if only magic value was
improved.

server/attack.c, attack_message():
More messages.  "grind to dust" is more damage than "shred to pieces".

server/spell_effect.c, magic_wall():
Fix calculation of duration of darkness spell.  Before, you could get
huge negative speed values with high experience levels, which meant very
short duration.

server/spell_util.c:
New argument of fire_swarm() to specify whether it's a magic attack.
All swarm spells except meteor swarm are now magic (just as the
underlying basic spell).

New function fire_arch_from_position() which doesn't use the owner's
position as the starting position of the fired arch.

move_swarm_spell(): Correctly set owner and magic in call to
fire_arch_from_position().

(-> "cause many wounds" is working now)


There is still a problem with the darkness spell.  Only the object in
the middle of a darkness wall is on the active list (I think because
get_archetype() put's it there), all other darkness objects are not on
the active list and therefore last forever.

Could somebody tell me why update_ob_speed() in common/object.c doesn't
put objects with speed less thant or equal to 0.001 on the active
list?

-- 
Jan
diff -ru orig/crossfire-0.95.5/include/sproto.h crossfire-0.95.5/include/sproto.h
--- orig/crossfire-0.95.5/include/sproto.h	Wed Mar 22 08:56:49 2000
+++ crossfire-0.95.5/include/sproto.h	Tue Apr  4 14:48:54 2000
@@ -562,6 +562,7 @@
 extern int cast_create_obj ( object *op, object *caster, object *new_op, int dir );
 extern int summon_monster ( object *op, object *caster, int dir, archetype *at, int spellnum );
 extern int fire_bolt ( object *op, object *caster, int dir, int type, int magic );
+extern int fire_arch_from_position ( object *op, object *caster, sint16 x, sint16 y, int dir, archetype *at, int type, int magic );
 extern int fire_arch ( object *op, object *caster, int dir, archetype *at, int type, int magic );
 extern int cast_cone ( object *op, object *caster, int dir, int strength, int spell_type, archetype *spell_arch, int magic );
 extern void move_cone ( object *op );
@@ -585,7 +586,7 @@
 extern int SP_level_strength_adjust ( object *op, object *caster, int spell_type );
 extern int SP_level_spellpoint_cost ( object *op, object *caster, int spell_type );
 extern void move_swarm_spell ( object *op );
-extern void fire_swarm ( object *op, int dir, archetype *swarm_type, int spell_type, int n );
+extern void fire_swarm ( object *op, int dir, archetype *swarm_type, int spell_type, int n, int magic );
 extern int look_up_spell_by_name ( object *op, char *spname );
 extern void put_a_monster ( object *op, char *monstername );
 extern void shuffle_attack ( object *op, int change_face );
diff -ru orig/crossfire-0.95.5/server/apply.c crossfire-0.95.5/server/apply.c
--- orig/crossfire-0.95.5/server/apply.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/apply.c	Tue Apr  4 13:37:53 2000
@@ -603,42 +603,41 @@
  * value (magic) of the armour can never be increased beyond
  * the level of the character / 10 -- rounding upish, nor may
  * the armour value of the piece of equipment exceed either 
- * the users level or 99)
+ * the users level or 90)
  */
  
 int improve_armour(object *op, object *improver, object *armour)
 {
-    int addarm;
+    int new_armour;
  
-    addarm = armour->armour/25 + op->level/20 + 1;
+    new_armour = armour->armour + armour->armour/25 + op->level/20 + 1;
+    if (new_armour > 90)
+        new_armour = 90;
 
-    if (armour->magic>=(op->level/10+1) || ((armour->armour + 
-		addarm) >= op->level )) {
+    if (armour->magic >= (op->level / 10 + 1)
+        || new_armour > op->level)
+    {
         new_draw_info(NDI_UNIQUE, 0,op,"You are not yet powerfull enough");
         new_draw_info(NDI_UNIQUE, 0,op,"to improve this armour.");
         return 0;
     }
 
-    if( (armour->armour + addarm) <= 99)  {
-        armour->magic++;
-	armour->armour+=addarm;
-	armour->weight+=armour->weight*0.05;
-	if (op->type == PLAYER) {
-	  esrv_send_item(op, armour);
-	  if(QUERY_FLAG(armour, FLAG_APPLIED))
-	    fix_player(op);
-	}
-        decrease_ob(improver);
-        return 1;
+    if (new_armour > armour->armour) {
+	armour->armour = new_armour;
+	armour->weight += armour->weight * 0.05;
     } else {
-        armour->magic++;
         new_draw_info(NDI_UNIQUE, 0,op,"The armour value of this equipment");
         new_draw_info(NDI_UNIQUE, 0,op,"cannot be further improved.");
-        decrease_ob(improver);
-	return 1;
     } 
-
- }
+    armour->magic++;
+    if (op->type == PLAYER) {
+        esrv_send_item(op, armour);
+        if(QUERY_FLAG(armour, FLAG_APPLIED))
+            fix_player(op);
+    }
+    decrease_ob(improver);
+    return 1;
+}
 
 
 /* archetypes don't contain any MONEY_CHANGER object,
diff -ru orig/crossfire-0.95.5/server/attack.c crossfire-0.95.5/server/attack.c
--- orig/crossfire-0.95.5/server/attack.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/attack.c	Tue Apr  4 14:53:12 2000
@@ -255,15 +255,24 @@
   } else if(dam<20) {
     strcpy(buf1,"crush");
     strcpy(buf2," very hard");
-  } else if(dam<25) {
+  } else if(dam<27) {
     strcpy(buf1,"smash");
     strcpy(buf2," with a bonecrunching sound");
-  } else if(dam<35) {
+  } else if(dam<40) {
+    strcpy(buf1,"shred");
+    strcpy(buf2," to pieces");
+  } else if(dam<70) {
+    strcpy(buf1,"beat");
+    strcpy(buf2," to a pulp");
+  } else if(dam<130) {
     strcpy(buf1,"grind");
     strcpy(buf2," to dust");
+  } else if(dam<250) {
+    strcpy(buf1,"atomize");
+    buf2[0]='\0';
   } else {
-    strcpy(buf1,"shred");
-    strcpy(buf2," to pieces");
+    strcpy(buf1,"annihilate");
+    buf2[0]='\0';
   }
   messages.msg1=buf1,messages.msg2=buf2;
   return &messages;
diff -ru orig/crossfire-0.95.5/server/spell_effect.c crossfire-0.95.5/server/spell_effect.c
--- orig/crossfire-0.95.5/server/spell_effect.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/spell_effect.c	Tue Apr  4 15:13:06 2000
@@ -846,8 +846,9 @@
     break;
   case SP_DARKNESS:
     tmp=get_archetype("darkness");
-    tmp->speed = 0.000001 * (SP_PARAMETERS[SP_DARKNESS].bdur
-              - (10*SP_level_strength_adjust(op,caster,SP_DARKNESS)));
+    tmp->speed = 0.000350 * SP_PARAMETERS[SP_DARKNESS].bdur
+                 / (SP_PARAMETERS[SP_DARKNESS].bdur
+                    + SP_level_strength_adjust (op, caster, SP_DARKNESS));
     break; 
   case SP_COUNTERWALL:
     tmp=get_archetype("counterspell");
diff -ru orig/crossfire-0.95.5/server/spell_util.c crossfire-0.95.5/server/spell_util.c
--- orig/crossfire-0.95.5/server/spell_util.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/spell_util.c	Tue Apr  4 14:52:00 2000
@@ -571,7 +571,7 @@
     n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
       SP_level_strength_adjust(op,caster, type);
     success = 1;
-    fire_swarm(op,dir,spellarch[type],SP_METEOR,n);
+    fire_swarm(op,dir,spellarch[type],SP_METEOR,n,0);
     break;
   }
   case SP_BULLET_SWARM: {
@@ -579,7 +579,7 @@
     n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
       SP_level_strength_adjust(op,caster, type);
     success = 1;
-    fire_swarm(op,dir,spellarch[type],SP_BULLET,n);
+    fire_swarm(op,dir,spellarch[type],SP_BULLET,n,1);
     break;
   }
   case SP_BULLET_STORM: {
@@ -587,7 +587,7 @@
     n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
       SP_level_strength_adjust(op,caster, type);
     success = 1;
-    fire_swarm(op,dir,spellarch[type],SP_LARGE_BULLET,n);
+    fire_swarm(op,dir,spellarch[type],SP_LARGE_BULLET,n,1);
     break;
   }
   case SP_CAUSE_MANY: {
@@ -595,7 +595,7 @@
     n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
       SP_level_strength_adjust(op,caster, type);
     success = 1;
-    fire_swarm(op,dir,spellarch[type],SP_CAUSE_HEAVY,n);
+    fire_swarm(op,dir,spellarch[type],SP_CAUSE_HEAVY,n,1);
     break;
   }
   case SP_METEOR:
@@ -966,7 +966,16 @@
  * casting object.
  */
 
-int fire_arch(object *op,object *caster,int dir,archetype *at, int type, int magic) {
+int fire_arch (object *op, object *caster, int dir, archetype *at, int type,
+	int magic)
+{
+	return fire_arch_from_position (op, caster, op->x, op->y, dir, at,
+	                                type, magic);
+}
+
+int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y,
+	int dir, archetype *at, int type, int magic)
+{
   object *tmp, *env;
  
   if(at==NULL)
@@ -980,7 +989,7 @@
   tmp->stats.sp=type;
   tmp->stats.dam=SP_PARAMETERS[type].bdam+SP_level_dam_adjust(op,caster,type);
   tmp->stats.hp=SP_PARAMETERS[type].bdur+SP_level_strength_adjust(op,caster,type);
-  tmp->x=op->x,tmp->y=op->y;
+  tmp->x=x, tmp->y=y;
   tmp->direction=dir;
   set_owner(tmp,op);
 #ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */
@@ -1759,29 +1768,34 @@
 from a set of squares surrounding the caster, in a given direction. */
 
 void move_swarm_spell(object *op)
-{  int x,y; int di;
-    if(!(op->stats.hp--)||get_owner(op)==NULL) {
+{
+    sint16 x,y;
+    int di;
+    object *owner = get_owner (op);
+
+    if(op->stats.hp == 0 || owner == NULL) {
 	remove_ob(op);
 	free_object(op);
 	return;
     }
-   x=op->x; y=op->y;  /*  save original location of swarm object */
-    
-   if(op->stats.hp) di=RANDOM()%7-3;  /* get a random number of -3->3 */
-    else di=0;  /* fire the last one from forward. */
-   op->x+=freearr_x[absdir(op->direction +di)];
-   op->y+=freearr_y[absdir(op->direction +di)];
-/*  for level dependence, we need to know what spell is fired.  */
-/*  that's stored in op->stats.sp  by fire_swarm  */
-   if(!wall(op->map,op->x,op->y))
-   fire_arch(op,op,op->direction,op->other_arch,op->stats.sp,0);
-   op->x=x; op->y=y;  /* reset original location */
+    op->stats.hp--;
 
+   if(op->stats.hp)
+        di=RANDOM()%7-3;  /* get a random number of -3->3 */
+   else
+        di=0;  /* fire the last one from forward. */
+   x = op->x + freearr_x[absdir(op->direction +di)];
+   y = op->y + freearr_y[absdir(op->direction +di)];
+
+   /*  for level dependence, we need to know what spell is fired.  */
+   /*  that's stored in op->stats.sp  by fire_swarm  */
+   if ( ! wall (op->map, x, y))
+       fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch,
+                                op->stats.sp, op->magic);
 }
 
 
 
-
 /*  fire_swarm:  peterm */
 /*  The following routine creates a swarm of objects.  It actually
     sets up a specific swarm object, which then fires off all
@@ -1796,7 +1810,8 @@
 */
     
 
-void fire_swarm(object *op,int dir,archetype *swarm_type,int spell_type,int n)
+void fire_swarm (object *op, int dir, archetype *swarm_type, int spell_type,
+	int n, int magic)
 {
   object *tmp;
   tmp=arch_to_object(find_archetype("swarm_spell"));
@@ -1805,6 +1820,7 @@
   set_owner(tmp,op);       /* needed so that if swarm elements kill, caster gets xp.*/
   tmp->level=op->level;   /*needed later, to get level dep. right.*/
   tmp->stats.sp=spell_type;  /* needed later, see move_swarm_spell */
+  tmp->magic = magic;
   tmp->stats.hp=n;	    /* n in swarm*/
   tmp->other_arch=swarm_type;  /* the archetype of the things to be fired*/
   tmp->direction=dir;