[CF-Devel] two new small additions

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Sun Aug 24 18:02:28 CDT 2003


Here is the change for your scrutiny:

New function friendly_fire in attack.c:

int friendly_fire(object *op, object *hitter){
	
	int friendlyfire;
	
	if (hitter->head) hitter=hitter->head;

	friendlyfire	= 0;
	
		if(op->type == PLAYER){
			
			if(hitter->type == PLAYER && hitter->contr->peaceful == 1)
			friendlyfire = 1;
		 
			if(get_owner(hitter) && hitter->owner->type == PLAYER &&
hitter->owner->contr->peaceful == 1){
			friendlyfire = 2;
			
				if(hitter->type == CONE || hitter->type == FBALL  || hitter->type ==
FIREWALL
					|| hitter->type == SWARM_SPELL || hitter->type == POISONCLOUD 
					|| hitter->type == POISONING || hitter->type == DISEASE ||
hitter->type == RUNE)
						friendlyfire = 0;
			}
	   }
	
	return friendlyfire;
}



Added to hit_player:


>
     
      if (type & attacktype) {
     
     >
     
          ndam=hit_player_attacktype(op,hitter,dam,attacknum,magic);
     
     >
     
          /* the >= causes us to prefer messages from special attacks, if
     
     >
     
           * the damage is equal.
     
     >
     
           */
     
     >
     
          if (ndam >= maxdam) {
     
     >
     
            maxdam = ndam;
     
     >
     
            maxattacktype = 1<<attacknum;
     
     >
     
      }
     
     		/* if this is friendly fire then do a little bit of damage only */
		friendlyfire = friendly_fire(op, hitter);
		if (friendlyfire)
			maxdam = 1;

>
     
        }
     
     

_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list