… | |
… | |
771 | /* See if we hit the creature */ |
771 | /* See if we hit the creature */ |
772 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
772 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
773 | { |
773 | { |
774 | int hitdam = base_dam; |
774 | int hitdam = base_dam; |
775 | |
775 | |
776 | if (settings.casting_time == TRUE) |
|
|
777 | { |
|
|
778 | if (hitter->type == PLAYER && hitter->casting_time > -1) |
|
|
779 | { |
|
|
780 | hitter->casting_time = -1; |
|
|
781 | new_draw_info (NDI_UNIQUE, 0, hitter, "You attacked and lost your spell!"); |
|
|
782 | } |
|
|
783 | |
|
|
784 | if (op->casting_time > -1 && hitdam > 0) |
|
|
785 | { |
|
|
786 | op->casting_time = -1; |
|
|
787 | if (op->type == PLAYER) |
|
|
788 | { |
|
|
789 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit and lost your spell!"); |
|
|
790 | new_draw_info_format (NDI_ALL | NDI_UNIQUE, 5, NULL, "%s was hit by %s and lost a spell.", &op_name, &hitter->name); |
|
|
791 | } |
|
|
792 | } |
|
|
793 | } |
|
|
794 | |
|
|
795 | if (!simple_attack) |
776 | if (!simple_attack) |
796 | { |
777 | { |
797 | /* If you hit something, the victim should *always* wake up. |
778 | /* If you hit something, the victim should *always* wake up. |
798 | * Before, invisible hitters could avoid doing this. |
779 | * Before, invisible hitters could avoid doing this. |
799 | * -b.t. */ |
780 | * -b.t. */ |
… | |
… | |
1273 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1254 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1274 | * nothing happens. |
1255 | * nothing happens. |
1275 | * Try to credit the owner. We try to display player -> player drain |
1256 | * Try to credit the owner. We try to display player -> player drain |
1276 | * attacks, hence all the != PLAYER checks. |
1257 | * attacks, hence all the != PLAYER checks. |
1277 | */ |
1258 | */ |
1278 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1259 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WIZ)) |
1279 | { |
1260 | { |
1280 | object *owner = hitter->owner; |
1261 | object *owner = hitter->owner; |
1281 | |
1262 | |
1282 | if (owner && owner != hitter) |
1263 | if (owner && owner != hitter) |
1283 | { |
1264 | { |
… | |
… | |
1562 | skill = skop->skill; |
1543 | skill = skop->skill; |
1563 | |
1544 | |
1564 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1545 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1565 | |
1546 | |
1566 | /* If you didn't kill yourself, and your not the wizard */ |
1547 | /* If you didn't kill yourself, and your not the wizard */ |
1567 | if (owner != op && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1548 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1568 | { |
1549 | { |
1569 | int exp; |
1550 | int exp; |
1570 | |
1551 | |
1571 | /* Really don't give much experience for killing other players */ |
1552 | /* Really don't give much experience for killing other players */ |
1572 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
1553 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
… | |
… | |
1726 | |
1707 | |
1727 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1708 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1728 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1709 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1729 | return 0; |
1710 | return 0; |
1730 | |
1711 | |
1731 | #ifdef PROHIBIT_PLAYERKILL |
1712 | // only allow pk for hostile players |
1732 | if (op->type == PLAYER) |
1713 | if (op->type == PLAYER) |
1733 | { |
1714 | { |
1734 | object *owner = hitter->owner; |
1715 | object *owner = hitter->owner; |
1735 | |
1716 | |
1736 | if (!owner) |
1717 | if (!owner) |
… | |
… | |
1740 | && (!op_on_battleground (op, 0, 0) |
1721 | && (!op_on_battleground (op, 0, 0) |
1741 | && (op->contr->peaceful || owner->contr->peaceful)) |
1722 | && (op->contr->peaceful || owner->contr->peaceful)) |
1742 | && op != owner) |
1723 | && op != owner) |
1743 | return 0; |
1724 | return 0; |
1744 | } |
1725 | } |
1745 | #endif |
|
|
1746 | |
1726 | |
1747 | if (body_attack) |
1727 | if (body_attack) |
1748 | { |
1728 | { |
1749 | /* slow and paralyze must hit the head. But we don't want to just |
1729 | /* slow and paralyze must hit the head. But we don't want to just |
1750 | * return - we still need to process other attacks the spell still |
1730 | * return - we still need to process other attacks the spell still |
… | |
… | |
1871 | */ |
1851 | */ |
1872 | friendlyfire = friendly_fire (op, hitter); |
1852 | friendlyfire = friendly_fire (op, hitter); |
1873 | if (friendlyfire && maxdam) |
1853 | if (friendlyfire && maxdam) |
1874 | { |
1854 | { |
1875 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1855 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1876 | #ifndef COZY_SERVER |
|
|
1877 | maxdam++; |
|
|
1878 | #endif |
|
|
1879 | |
1856 | |
1880 | #ifdef ATTACK_DEBUG |
1857 | #ifdef ATTACK_DEBUG |
1881 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1858 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1882 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1859 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1883 | #endif |
1860 | #endif |