… | |
… | |
1449 | op->speed = 0.1; |
1449 | op->speed = 0.1; |
1450 | update_ob_speed (op); |
1450 | update_ob_speed (op); |
1451 | op->speed_left = -0.05; |
1451 | op->speed_left = -0.05; |
1452 | return maxdam; |
1452 | return maxdam; |
1453 | } |
1453 | } |
|
|
1454 | |
1454 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1455 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1455 | { |
1456 | { |
1456 | remove_friendly_object (op); |
1457 | remove_friendly_object (op); |
1457 | if (get_owner (op) != NULL && op->owner->type == PLAYER && op->owner->contr->ranges[range_golem] == op) |
1458 | if (get_owner (op) && op->owner->type == PLAYER && op->owner->contr->ranges[range_golem] == op) |
1458 | { |
1459 | { |
1459 | op->owner->contr->ranges[range_golem] = NULL; |
1460 | op->owner->contr->ranges[range_golem] = 0; |
1460 | op->owner->contr->golem_count = 0; |
1461 | op->owner->contr->golem_count = 0; |
1461 | } |
1462 | } |
1462 | |
1463 | |
1463 | remove_ob (op); |
1464 | remove_ob (op); |
1464 | free_object (op); |
1465 | free_object (op); |
… | |
… | |
1466 | } |
1467 | } |
1467 | |
1468 | |
1468 | /* Now lets start dealing with experience we get for killing something */ |
1469 | /* Now lets start dealing with experience we get for killing something */ |
1469 | |
1470 | |
1470 | owner = get_owner (hitter); |
1471 | owner = get_owner (hitter); |
1471 | if (owner == NULL) |
1472 | if (!owner) |
1472 | owner = hitter; |
1473 | owner = hitter; |
1473 | |
1474 | |
1474 | /* is the victim (op) standing on battleground? */ |
1475 | /* is the victim (op) standing on battleground? */ |
1475 | if (op_on_battleground (op, NULL, NULL)) |
1476 | if (op_on_battleground (op, NULL, NULL)) |
1476 | battleg = 1; |
1477 | battleg = 1; |
… | |
… | |
1506 | * probably don't want to see that. |
1507 | * probably don't want to see that. |
1507 | */ |
1508 | */ |
1508 | if (owner->level < op->level * 2 || op->stats.exp > 1000) |
1509 | if (owner->level < op->level * 2 || op->stats.exp > 1000) |
1509 | { |
1510 | { |
1510 | if (owner != hitter) |
1511 | if (owner != hitter) |
1511 | { |
|
|
1512 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s with %s.", query_name (op), query_name (hitter)); |
1512 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s with %s.", query_name (op), query_name (hitter)); |
1513 | } |
|
|
1514 | else |
1513 | else |
1515 | { |
|
|
1516 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1514 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1517 | } |
1515 | |
1518 | /* Only play sounds for melee kills */ |
1516 | /* Only play sounds for melee kills */ |
1519 | if (hitter->type == PLAYER) |
1517 | if (hitter->type == PLAYER) |
1520 | play_sound_map (owner->map, owner->x, owner->y, SOUND_PLAYER_KILLS); |
1518 | play_sound_map (owner->map, owner->x, owner->y, SOUND_PLAYER_KILLS); |
1521 | } |
1519 | } |
1522 | |
1520 | |
… | |
… | |
1533 | |
1531 | |
1534 | /* This code below deals with finding the appropriate skill |
1532 | /* This code below deals with finding the appropriate skill |
1535 | * to credit exp to. This is a bit problematic - we should |
1533 | * to credit exp to. This is a bit problematic - we should |
1536 | * probably never really have to look at current_weapon->skill |
1534 | * probably never really have to look at current_weapon->skill |
1537 | */ |
1535 | */ |
1538 | skill = NULL; |
1536 | skill = 0; |
|
|
1537 | |
1539 | if (hitter->skill && hitter->type != PLAYER) |
1538 | if (hitter->skill && hitter->type != PLAYER) |
1540 | skill = hitter->skill; |
1539 | skill = hitter->skill; |
1541 | else if (owner->chosen_skill) |
1540 | else if (owner->chosen_skill) |
1542 | { |
1541 | { |
1543 | skill = owner->chosen_skill->skill; |
1542 | skill = owner->chosen_skill->skill; |
… | |
… | |
1562 | break; |
1561 | break; |
1563 | } |
1562 | } |
1564 | } |
1563 | } |
1565 | } /* Was it a player that hit somethign */ |
1564 | } /* Was it a player that hit somethign */ |
1566 | else |
1565 | else |
1567 | { |
|
|
1568 | skill = NULL; |
1566 | skill = 0; |
1569 | } |
|
|
1570 | |
1567 | |
1571 | /* Pet (or spell) killed something. */ |
1568 | /* Pet (or spell) killed something. */ |
1572 | if (owner != hitter) |
1569 | if (owner != hitter) |
1573 | { |
|
|
1574 | (void) sprintf (buf, "%s killed %s with %s%s%s.", &owner->name, |
1570 | sprintf (buf, "%s killed %s with %s%s%s.", &owner->name, |
1575 | query_name (op), query_name (hitter), battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
1571 | query_name (op), query_name (hitter), battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
1576 | } |
|
|
1577 | else |
1572 | else |
1578 | { |
|
|
1579 | (void) sprintf (buf, "%s killed %s%s%s%s.", &hitter->name, &op->name, |
1573 | sprintf (buf, "%s killed %s%s%s%s.", &hitter->name, &op->name, |
1580 | (QUERY_FLAG (hitter, FLAG_MONSTER)) || hitter->type == PLAYER ? |
1574 | (QUERY_FLAG (hitter, FLAG_MONSTER)) || hitter->type == PLAYER ? |
1581 | " in hand to hand combat" : "", battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
1575 | " in hand to hand combat" : "", battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
1582 | } |
1576 | |
1583 | /* These may have been set in the player code section above */ |
1577 | /* These may have been set in the player code section above */ |
1584 | if (!skop) |
1578 | if (!skop) |
1585 | skop = hitter->chosen_skill; |
1579 | skop = hitter->chosen_skill; |
|
|
1580 | |
1586 | if (!skill && skop) |
1581 | if (!skill && skop) |
1587 | skill = skop->skill; |
1582 | skill = skop->skill; |
1588 | |
1583 | |
1589 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1584 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1590 | |
1585 | |
1591 | |
|
|
1592 | /* If you didn't kill yourself, and your not the wizard */ |
1586 | /* If you didn't kill yourself, and your not the wizard */ |
1593 | if (owner != op && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1587 | if (owner != op && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1594 | { |
1588 | { |
1595 | int exp; |
1589 | int exp; |
1596 | |
1590 | |
1597 | /* Really don't give much experience for killing other players */ |
1591 | /* Really don't give much experience for killing other players */ |
1598 | // schmorp: temporary? reduce the amount of exp gained for pking enourmously |
1592 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
1599 | if (op->type == PLAYER) |
1593 | if (op->type == PLAYER) |
1600 | { |
1594 | { |
1601 | if (battleg) |
1595 | if (battleg) |
1602 | { |
1596 | { |
1603 | new_draw_info (NDI_UNIQUE, 0, owner, "Your foe has fallen!"); |
1597 | new_draw_info (NDI_UNIQUE, 0, owner, "Your foe has fallen!"); |
… | |
… | |
1627 | change_exp (owner, exp, skill, 0); |
1621 | change_exp (owner, exp, skill, 0); |
1628 | } |
1622 | } |
1629 | else |
1623 | else |
1630 | { |
1624 | { |
1631 | int shares = 0, count = 0; |
1625 | int shares = 0, count = 0; |
1632 | |
|
|
1633 | player *pl; |
1626 | player *pl; |
1634 | |
|
|
1635 | partylist *party = owner->contr->party; |
1627 | partylist *party = owner->contr->party; |
1636 | |
1628 | |
1637 | #ifdef PARTY_KILL_LOG |
1629 | #ifdef PARTY_KILL_LOG |
1638 | add_kill_to_party (party, query_name (owner), query_name (op), exp); |
1630 | add_kill_to_party (party, query_name (owner), query_name (op), exp); |
1639 | #endif |
1631 | #endif |
1640 | for (pl = first_player; pl != NULL; pl = pl->next) |
1632 | for (pl = first_player; pl != NULL; pl = pl->next) |
1641 | { |
|
|
1642 | if (party && pl->ob->contr->party == party && on_same_map (pl->ob, owner)) |
1633 | if (party && pl->ob->contr->party == party && on_same_map (pl->ob, owner)) |
1643 | { |
1634 | { |
1644 | count++; |
1635 | count++; |
1645 | shares += (pl->ob->level + 4); |
1636 | shares += (pl->ob->level + 4); |
1646 | } |
1637 | } |
1647 | } |
1638 | |
1648 | if (count == 1 || shares > exp) |
1639 | if (count == 1 || shares > exp) |
1649 | change_exp (owner, exp, skill, SK_EXP_TOTAL); |
1640 | change_exp (owner, exp, skill, SK_EXP_TOTAL); |
1650 | else |
1641 | else |
1651 | { |
1642 | { |
1652 | int share = exp / shares, given = 0, nexp; |
1643 | int share = exp / shares, given = 0, nexp; |
1653 | |
1644 | |
1654 | for (pl = first_player; pl != NULL; pl = pl->next) |
1645 | for (pl = first_player; pl != NULL; pl = pl->next) |
1655 | { |
|
|
1656 | if (party && pl->ob->contr->party == party && on_same_map (pl->ob, owner)) |
1646 | if (party && pl->ob->contr->party == party && on_same_map (pl->ob, owner)) |
1657 | { |
1647 | { |
1658 | nexp = (pl->ob->level + 4) * share; |
1648 | nexp = (pl->ob->level + 4) * share; |
1659 | change_exp (pl->ob, nexp, skill, SK_EXP_TOTAL); |
1649 | change_exp (pl->ob, nexp, skill, SK_EXP_TOTAL); |
1660 | given += nexp; |
1650 | given += nexp; |
1661 | } |
1651 | } |
1662 | } |
1652 | |
1663 | exp -= given; |
1653 | exp -= given; |
1664 | /* give any remainder to the player */ |
1654 | /* give any remainder to the player */ |
1665 | change_exp (owner, exp, skill, SK_EXP_ADD_SKILL); |
1655 | change_exp (owner, exp, skill, SK_EXP_ADD_SKILL); |
1666 | } |
1656 | } |
1667 | } /* else part of a party */ |
1657 | } /* else part of a party */ |
1668 | |
|
|
1669 | } /* end if person didn't kill himself */ |
1658 | } /* end if person didn't kill himself */ |
1670 | |
1659 | |
1671 | if (op->type != PLAYER) |
1660 | if (op->type != PLAYER) |
1672 | { |
1661 | { |
1673 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
1662 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
1674 | { |
1663 | { |
1675 | object *owner1 = get_owner (op); |
1664 | object *owner1 = get_owner (op); |
1676 | |
1665 | |
1677 | if (owner1 != NULL && owner1->type == PLAYER) |
1666 | if (owner1 && owner1->type == PLAYER) |
1678 | { |
1667 | { |
1679 | play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0); |
1668 | play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0); |
1680 | /* Maybe we should include the owner that killed this, maybe not */ |
1669 | /* Maybe we should include the owner that killed this, maybe not */ |
1681 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1670 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1682 | } |
1671 | } |
… | |
… | |
1685 | } |
1674 | } |
1686 | |
1675 | |
1687 | remove_ob (op); |
1676 | remove_ob (op); |
1688 | free_object (op); |
1677 | free_object (op); |
1689 | } |
1678 | } |
1690 | /* Player has been killed! */ |
|
|
1691 | else |
1679 | else |
1692 | { |
1680 | { |
|
|
1681 | /* Player has been killed! */ |
1693 | if (owner->type == PLAYER) |
1682 | if (owner->type == PLAYER) |
1694 | { |
|
|
1695 | snprintf (op->contr->killer, BIG_NAME, "%s the %s", &owner->name, owner->contr->title); |
1683 | snprintf (op->contr->killer, BIG_NAME, "%s the %s", &owner->name, owner->contr->title); |
1696 | } |
|
|
1697 | else |
1684 | else |
1698 | assign (op->contr->killer, hitter->name); |
1685 | assign (op->contr->killer, hitter->name); |
1699 | } |
1686 | } |
1700 | |
1687 | |
1701 | /* This was return -1 - that doesn't seem correct - if we return -1, process |
1688 | /* This was return -1 - that doesn't seem correct - if we return -1, process |