… | |
… | |
1418 | return maxdam; |
1418 | return maxdam; |
1419 | } |
1419 | } |
1420 | |
1420 | |
1421 | /* Now lets start dealing with experience we get for killing something */ |
1421 | /* Now lets start dealing with experience we get for killing something */ |
1422 | |
1422 | |
1423 | owner = hitter->owner; |
1423 | owner = hitter->outer_owner (); |
1424 | if (!owner) |
1424 | if (!owner) |
1425 | owner = hitter; |
1425 | owner = hitter; |
1426 | |
1426 | |
1427 | /* is the victim (op) standing on battleground? */ |
1427 | /* is the victim (op) standing on battleground? */ |
1428 | if (op_on_battleground (op, NULL, NULL)) |
1428 | if (op_on_battleground (op, NULL, NULL)) |
… | |
… | |
1498 | |
1498 | |
1499 | /* We have the skill we want to credit to - now find the object this goes |
1499 | /* We have the skill we want to credit to - now find the object this goes |
1500 | * to. Make sure skop is an actual skill, and not a skill tool! |
1500 | * to. Make sure skop is an actual skill, and not a skill tool! |
1501 | */ |
1501 | */ |
1502 | if ((!skop || skop->type != SKILL) && skill) |
1502 | if ((!skop || skop->type != SKILL) && skill) |
1503 | { |
|
|
1504 | int i; |
|
|
1505 | |
|
|
1506 | for (i = 0; i < NUM_SKILLS; i++) |
1503 | for (int i = 0; i < NUM_SKILLS; i++) |
1507 | if (owner->contr->last_skill_ob[i] && !strcmp (owner->contr->last_skill_ob[i]->skill, skill)) |
1504 | if (owner->contr->last_skill_ob[i] && !strcmp (owner->contr->last_skill_ob[i]->skill, skill)) |
1508 | { |
1505 | { |
1509 | skop = owner->contr->last_skill_ob[i]; |
1506 | skop = owner->contr->last_skill_ob[i]; |
1510 | break; |
1507 | break; |
1511 | } |
1508 | } |
1512 | } |
|
|
1513 | } /* Was it a player that hit somethign */ |
1509 | } /* Was it a player that hit somethign */ |
1514 | else |
1510 | else |
1515 | skill = 0; |
1511 | skill = 0; |
1516 | |
|
|
1517 | /* Pet (or spell) killed something. */ |
|
|
1518 | if (op->type == PLAYER) |
|
|
1519 | { |
|
|
1520 | if (owner != hitter) |
|
|
1521 | sprintf (buf, "%s killed %s with %s%s%s.", &owner->name, |
|
|
1522 | query_name (op), query_name (hitter), battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
|
|
1523 | else |
|
|
1524 | sprintf (buf, "%s killed %s%s%s%s.", &hitter->name, &op->name, |
|
|
1525 | (QUERY_FLAG (hitter, FLAG_MONSTER)) || hitter->type == PLAYER ? |
|
|
1526 | " in hand to hand combat" : "", battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
|
|
1527 | |
|
|
1528 | new_draw_info (NDI_ALL, 0, NULL, buf); |
|
|
1529 | } |
|
|
1530 | |
1512 | |
1531 | /* These may have been set in the player code section above */ |
1513 | /* These may have been set in the player code section above */ |
1532 | if (!skop) |
1514 | if (!skop) |
1533 | skop = hitter->chosen_skill; |
1515 | skop = hitter->chosen_skill; |
1534 | |
1516 | |
… | |
… | |
1613 | |
1595 | |
1614 | if (owner1 && owner1->type == PLAYER) |
1596 | if (owner1 && owner1->type == PLAYER) |
1615 | { |
1597 | { |
1616 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1598 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1617 | /* Maybe we should include the owner that killed this, maybe not */ |
1599 | /* Maybe we should include the owner that killed this, maybe not */ |
1618 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1600 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, was killed by %s.", &op->name, &hitter->name); |
1619 | } |
1601 | } |
1620 | |
1602 | |
1621 | remove_friendly_object (op); |
1603 | remove_friendly_object (op); |
1622 | } |
1604 | } |
1623 | |
1605 | |