1 | /* |
1 | /* |
2 | * static char *rcsid_attack_c = |
2 | * static char *rcsid_attack_c = |
3 | * "$Id: attack.c,v 1.1.1.2 2006/02/22 18:03:19 elmex Exp $"; |
3 | * "$Id: attack.c,v 1.8 2006/03/30 11:15:47 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
… | |
… | |
1189 | * not much is drained, low rate means a lot is drained. |
1189 | * not much is drained, low rate means a lot is drained. |
1190 | */ |
1190 | */ |
1191 | int rate; |
1191 | int rate; |
1192 | |
1192 | |
1193 | if(op->resist[ATNR_DRAIN] >= 0) |
1193 | if(op->resist[ATNR_DRAIN] >= 0) |
1194 | rate = 50 + op->resist[ATNR_DRAIN] / 2; |
1194 | rate = 400 + op->resist[ATNR_DRAIN] * 3; |
1195 | else if(op->resist[ATNR_DRAIN] < 0) |
1195 | else |
1196 | rate = 5000 / (100 - op->resist[ATNR_DRAIN]); |
1196 | rate = 400 * 100 / (100 - op->resist[ATNR_DRAIN]); |
1197 | |
1197 | |
1198 | /* full protection has no effect. Nothing else in this |
|
|
1199 | * function needs to get done, so just return. */ |
|
|
1200 | if(!rate) |
|
|
1201 | return 0; |
|
|
1202 | |
|
|
1203 | if(op->stats.exp <= rate) { |
1198 | if(op->stats.exp <= rate) { |
1204 | if(op->type == GOLEM) |
1199 | if(op->type == GOLEM) |
1205 | dam = 999; /* Its force is "sucked" away. 8) */ |
1200 | dam = 999; /* Its force is "sucked" away. 8) */ |
1206 | else |
1201 | else |
1207 | /* If we can't drain, lets try to do physical damage */ |
1202 | /* If we can't drain, lets try to do physical damage */ |
… | |
… | |
1653 | |
1648 | |
1654 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1649 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1655 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1650 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1656 | return 0; |
1651 | return 0; |
1657 | |
1652 | |
|
|
1653 | #ifdef PROHIBIT_PLAYERKILL |
|
|
1654 | if (op->type == PLAYER) { |
|
|
1655 | object *owner = get_owner (hitter); |
|
|
1656 | if (!owner) owner = hitter; |
|
|
1657 | if (owner->type == PLAYER |
|
|
1658 | && !op_on_battleground (op, 0, 0) |
|
|
1659 | && op != owner) { |
|
|
1660 | return 0; |
|
|
1661 | } |
|
|
1662 | } |
|
|
1663 | #endif |
|
|
1664 | |
1658 | op_tag = op->count; |
1665 | op_tag = op->count; |
1659 | hitter_tag = hitter->count; |
1666 | hitter_tag = hitter->count; |
1660 | |
1667 | |
1661 | if (body_attack) { |
1668 | if (body_attack) { |
1662 | /* slow and paralyze must hit the head. But we don't want to just |
1669 | /* slow and paralyze must hit the head. But we don't want to just |
… | |
… | |
1766 | * doing damage - otherwise, the +1 in the coe below will make |
1773 | * doing damage - otherwise, the +1 in the coe below will make |
1767 | * an attack do damage before when it otherwise didn't |
1774 | * an attack do damage before when it otherwise didn't |
1768 | */ |
1775 | */ |
1769 | friendlyfire = friendly_fire(op, hitter); |
1776 | friendlyfire = friendly_fire(op, hitter); |
1770 | if (friendlyfire && maxdam){ |
1777 | if (friendlyfire && maxdam){ |
1771 | maxdam = ((dam * settings.set_friendly_fire) / 100)+1; |
1778 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1772 | |
1779 | #ifndef COZY_SERVER |
|
|
1780 | maxdam++; |
|
|
1781 | #endif |
|
|
1782 | |
1773 | #ifdef ATTACK_DEBUG |
1783 | #ifdef ATTACK_DEBUG |
1774 | LOG(llevDebug,"Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1784 | LOG(llevDebug,"Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1775 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1785 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1776 | #endif |
1786 | #endif |
1777 | } |
1787 | } |