version 1.89 | | version 1.90 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.89 2003/06/26 11:27:43 gros Exp $"; | | * "$Id: attack.c,v 1.90 2003/08/27 00:00:46 temitchell Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
return maxdam; | | return maxdam; |
} | | } |
| | |
| | /* Find out if this is friendly fire (PVP and attacker is peaceful) or not |
| | * Returns 0 this is not friendly fire |
| | */ |
| | |
| | int friendly_fire(object *op, object *hitter){ |
| | object *owner; |
| | int friendlyfire; |
| | |
| | if (hitter->head) hitter=hitter->head; |
| | |
| | friendlyfire = 0; |
| | |
| | if(op->type == PLAYER){ |
| | |
| | if(hitter->type == PLAYER && hitter->contr->peaceful == 1) |
| | return 1; |
| | |
| | if(owner = get_owner(hitter)){ |
| | if(owner->type == PLAYER && 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; |
| | } |
| | |
| | |
/* This isn't used just for players, but in fact most objects. | | /* This isn't used just for players, but in fact most objects. |
* op is the object to be hit, dam is the amount of damage, hitter | | * op is the object to be hit, dam is the amount of damage, hitter |
* is what is hitting the object, and type is the attacktype. | | * is what is hitting the object, and type is the attacktype. |
| | |
int simple_attack; | | int simple_attack; |
tag_t op_tag, hitter_tag; | | tag_t op_tag, hitter_tag; |
int rtn_kill = 0; | | int rtn_kill = 0; |
| | int friendlyfire; |
| | |
if (get_attack_mode (&op, &hitter, &simple_attack)) | | if (get_attack_mode (&op, &hitter, &simple_attack)) |
return 0; | | return 0; |
| | |
maxdam = ndam; | | maxdam = ndam; |
maxattacktype = 1<<attacknum; | | maxattacktype = 1<<attacknum; |
} | | } |
| | |
| | /* if this is friendly fire then do a set % of damage only*/ |
| | friendlyfire = friendly_fire(op, hitter); |
| | if (friendlyfire){ |
| | |
| | maxdam = ((dam * settings.set_friendly_fire) / 100)+1; |
| | |
| | #ifdef ATTACK_DEBUG |
| | LOG(llevDebug,"Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
| | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
| | #endif |
| | } |
} | | } |
} | | } |
| | |
| | |
return 1; | | return 1; |
return 0; | | return 0; |
} | | } |
| | |