… | |
… | |
148 | object *env = op->env; |
148 | object *env = op->env; |
149 | int x = op->x, y = op->y; |
149 | int x = op->x, y = op->y; |
150 | maptile *m = op->map; |
150 | maptile *m = op->map; |
151 | |
151 | |
152 | op = stop_item (op); |
152 | op = stop_item (op); |
153 | if (op == NULL) |
153 | if (!op) |
154 | return; |
154 | return; |
155 | |
155 | |
156 | /* Hacked the following so that type LIGHTER will work. |
156 | /* Hacked the following so that type LIGHTER will work. |
157 | * Also, objects which are potential "lights" that are hit by |
157 | * Also, objects which are potential "lights" that are hit by |
158 | * flame/elect attacks will be set to glow. "lights" are any |
158 | * flame/elect attacks will be set to glow. "lights" are any |
… | |
… | |
192 | fix_stopped_item (op, m, originator); |
192 | fix_stopped_item (op, m, originator); |
193 | } |
193 | } |
194 | else |
194 | else |
195 | { |
195 | { |
196 | // drop everything to the ground, if possible |
196 | // drop everything to the ground, if possible |
197 | while (op->inv) |
|
|
198 | op->inv->insert_at (originator); |
197 | op->insert_at (originator); |
199 | |
|
|
200 | op->destroy (); |
198 | op->destroy (); |
201 | } |
199 | } |
202 | |
200 | |
203 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
201 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
204 | if (env) |
202 | if (env) |
… | |
… | |
212 | |
210 | |
213 | return; |
211 | return; |
214 | } |
212 | } |
215 | |
213 | |
216 | /* The value of 50 is arbitrary. */ |
214 | /* The value of 50 is arbitrary. */ |
217 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) |
215 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && rndm (2)) |
218 | { |
216 | { |
219 | archetype *at = archetype::find (shstr_icecube); |
217 | archetype *at = archetype::find (shstr_icecube); |
220 | |
218 | |
221 | if (at == NULL) |
219 | if (at == NULL) |
222 | return; |
220 | return; |
… | |
… | |
1420 | return maxdam; |
1418 | return maxdam; |
1421 | } |
1419 | } |
1422 | |
1420 | |
1423 | /* Now lets start dealing with experience we get for killing something */ |
1421 | /* Now lets start dealing with experience we get for killing something */ |
1424 | |
1422 | |
1425 | owner = hitter->owner; |
1423 | owner = hitter->outer_owner (); |
1426 | if (!owner) |
1424 | if (!owner) |
1427 | owner = hitter; |
1425 | owner = hitter; |
1428 | |
1426 | |
1429 | /* is the victim (op) standing on battleground? */ |
1427 | /* is the victim (op) standing on battleground? */ |
1430 | if (op_on_battleground (op, NULL, NULL)) |
1428 | if (op_on_battleground (op, NULL, NULL)) |
… | |
… | |
1500 | |
1498 | |
1501 | /* 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 |
1502 | * 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! |
1503 | */ |
1501 | */ |
1504 | if ((!skop || skop->type != SKILL) && skill) |
1502 | if ((!skop || skop->type != SKILL) && skill) |
1505 | { |
|
|
1506 | int i; |
|
|
1507 | |
|
|
1508 | for (i = 0; i < NUM_SKILLS; i++) |
1503 | for (int i = 0; i < NUM_SKILLS; i++) |
1509 | 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)) |
1510 | { |
1505 | { |
1511 | skop = owner->contr->last_skill_ob[i]; |
1506 | skop = owner->contr->last_skill_ob[i]; |
1512 | break; |
1507 | break; |
1513 | } |
1508 | } |
1514 | } |
|
|
1515 | } /* Was it a player that hit somethign */ |
1509 | } /* Was it a player that hit somethign */ |
1516 | else |
1510 | else |
1517 | skill = 0; |
1511 | skill = 0; |
1518 | |
1512 | |
1519 | /* Pet (or spell) killed something. */ |
|
|
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 | /* These may have been set in the player code section above */ |
1513 | /* These may have been set in the player code section above */ |
1529 | if (!skop) |
1514 | if (!skop) |
1530 | skop = hitter->chosen_skill; |
1515 | skop = hitter->chosen_skill; |
1531 | |
1516 | |
1532 | if (!skill && skop) |
1517 | if (!skill && skop) |
1533 | skill = skop->skill; |
1518 | skill = skop->skill; |
1534 | |
|
|
1535 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
|
|
1536 | |
1519 | |
1537 | /* If you didn't kill yourself, and your not the wizard */ |
1520 | /* If you didn't kill yourself, and your not the wizard */ |
1538 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1521 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1539 | { |
1522 | { |
1540 | int exp; |
1523 | int exp; |
… | |
… | |
1612 | |
1595 | |
1613 | if (owner1 && owner1->type == PLAYER) |
1596 | if (owner1 && owner1->type == PLAYER) |
1614 | { |
1597 | { |
1615 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1598 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1616 | /* Maybe we should include the owner that killed this, maybe not */ |
1599 | /* Maybe we should include the owner that killed this, maybe not */ |
1617 | 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); |
1618 | } |
1601 | } |
1619 | |
1602 | |
1620 | remove_friendly_object (op); |
1603 | remove_friendly_object (op); |
1621 | } |
1604 | } |
1622 | |
1605 | |
… | |
… | |
2184 | return; |
2167 | return; |
2185 | |
2168 | |
2186 | def_lev = op->level; |
2169 | def_lev = op->level; |
2187 | if (def_lev < 1) |
2170 | if (def_lev < 1) |
2188 | { |
2171 | { |
2189 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->archname, &op->name); |
2172 | LOG (llevError, "BUG: arch %s with level < 1 (%s)\n", &op->arch->archname, op->debug_desc ()); |
2190 | def_lev = 1; |
2173 | def_lev = 1; |
2191 | } |
2174 | } |
2192 | |
2175 | |
2193 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2176 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2194 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
2177 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |