ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/attack.C
(Generate patch)

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.84 by root, Sun May 4 18:24:11 2008 UTC vs.
Revision 1.101 by root, Fri Dec 26 13:33:22 2008 UTC

77did_make_save_item (object *op, int type, object *originator) 77did_make_save_item (object *op, int type, object *originator)
78{ 78{
79 int i, roll, saves = 0, attacks = 0, number; 79 int i, roll, saves = 0, attacks = 0, number;
80 materialtype_t *mt; 80 materialtype_t *mt;
81 81
82 if (op->materialname == NULL) 82 if (!op->materialname)
83 { 83 {
84 for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) 84 for (mt = materialt; mt && mt->next; mt = mt->next)
85 if (op->materials & mt->material) 85 if (op->materials & mt->material)
86 break; 86 break;
87 } 87 }
88 else 88 else
89 mt = name_to_material (op->materialname); 89 mt = name_to_material (op->materialname);
104 if (type != AT_MAGIC) 104 if (type != AT_MAGIC)
105 type &= ~(AT_CONFUSION | AT_DRAIN | AT_GHOSTHIT | AT_POISON | AT_SLOW | 105 type &= ~(AT_CONFUSION | AT_DRAIN | AT_GHOSTHIT | AT_POISON | AT_SLOW |
106 AT_PARALYZE | AT_TURN_UNDEAD | AT_FEAR | AT_DEPLETE | AT_DEATH | 106 AT_PARALYZE | AT_TURN_UNDEAD | AT_FEAR | AT_DEPLETE | AT_DEATH |
107 AT_COUNTERSPELL | AT_HOLYWORD | AT_BLIND | AT_LIFE_STEALING | AT_MAGIC); 107 AT_COUNTERSPELL | AT_HOLYWORD | AT_BLIND | AT_LIFE_STEALING | AT_MAGIC);
108 108
109 if (type == 0) 109 if (type == 0) return TRUE;
110 return TRUE; 110
111 if (roll == 20) 111 if (roll == 20) return TRUE;
112 return TRUE; 112 if (roll == 1) return FALSE;
113 if (roll == 1)
114 return FALSE;
115 113
116 for (number = 0; number < NROFATTACKS; number++) 114 for (number = 0; number < NROFATTACKS; number++)
117 { 115 {
118 i = 1 << number; 116 i = 1 << number;
117
119 if (!(i & type)) 118 if (!(i & type))
120 continue; 119 continue;
120
121 attacks++; 121 attacks++;
122 if (op->resist[number] == 100) 122 if (op->resist[number] == 100)
123 saves++; 123 saves++;
124 else if (roll >= mt->save[number] - op->magic - op->resist[number] / 100) 124 else if (roll >= mt->save[number] - op->magic - op->resist[number] / 100)
125 saves++; 125 saves++;
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 potenital "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
159 * object with +/- glow_radius and an "other_arch" to change to. 159 * object with +/- glow_radius and an "other_arch" to change to.
160 * (and please note that we cant fail our save and reach this 160 * (and please note that we cant fail our save and reach this
161 * function if the object doesnt contain a material that can burn. 161 * function if the object doesnt contain a material that can burn.
162 * So forget lighting magical swords on fire with this!) -b.t. 162 * So forget lighting magical swords on fire with this!) -b.t.
169 fix_stopped_item (op, m, originator); 169 fix_stopped_item (op, m, originator);
170 170
171 if ((op = archetype::get (arch))) 171 if ((op = archetype::get (arch)))
172 { 172 {
173 if (env) 173 if (env)
174 {
175 op->x = env->x, op->y = env->y; //???? wtf
176 env->insert (op); 174 env->insert (op);
177 }
178 else 175 else
179 {
180 op->x = x, op->y = y;
181 insert_ob_in_map (op, m, originator, 0); 176 m->insert (op, x, y, originator);
182 }
183 } 177 }
184 178
185 return; 179 return;
186 } 180 }
187 181
196 { 190 {
197 if (op->decrease (rndm (0, op->nrof - 1))) 191 if (op->decrease (rndm (0, op->nrof - 1)))
198 fix_stopped_item (op, m, originator); 192 fix_stopped_item (op, m, originator);
199 } 193 }
200 else 194 else
195 {
196 // drop everything to the ground, if possible
197 op->insert_at (originator);
201 op->destroy (); 198 op->drop_and_destroy ();
199 }
202 200
203 if (type & (AT_FIRE | AT_ELECTRICITY)) 201 if (type & (AT_FIRE | AT_ELECTRICITY))
204 if (env) 202 if (env)
205 { 203 {
206 op = archetype::get (shstr_burnout); 204 op = archetype::get (shstr_burnout);
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 object *tmp;
220 archetype *at = archetype::find (shstr_icecube); 217 archetype *at = archetype::find (shstr_icecube);
221 218
222 if (at == NULL) 219 if (at == NULL)
223 return; 220 return;
224 221
225 op = stop_item (op); 222 op = stop_item (op);
226 if (op == NULL) 223 if (op == NULL)
227 return; 224 return;
228 225
229 if ((tmp = present_arch (at, op->map, op->x, op->y)) == NULL) 226 object *tmp = present_arch (at, op->map, op->x, op->y);
227 if (!tmp)
230 { 228 {
231 tmp = arch_to_object (at); 229 tmp = arch_to_object (at);
232 tmp->x = op->x, tmp->y = op->y; 230 tmp->x = op->x, tmp->y = op->y;
233 /* This was in the old (pre new movement code) - 231 /* This was in the old (pre new movement code) -
234 * icecubes have slow_move set to 1 - don't want 232 * icecubes have slow_move set to 1 - don't want
237 tmp->move_slow_penalty = 0; 235 tmp->move_slow_penalty = 0;
238 tmp->move_slow = 0; 236 tmp->move_slow = 0;
239 insert_ob_in_map (tmp, op->map, originator, 0); 237 insert_ob_in_map (tmp, op->map, originator, 0);
240 } 238 }
241 239
242 if (!QUERY_FLAG (op, FLAG_REMOVED)) 240 tmp->insert (op);
243 op->remove ();
244
245 insert_ob_in_ob (op, tmp);
246 return; 241 return;
247 } 242 }
248} 243}
249 244
250/* Object op is hitting the map. 245/* Object op is hitting the map.
279 } 274 }
280 275
281 if (op->head) 276 if (op->head)
282 op = op->head; 277 op = op->head;
283 278
284 map = op->map; 279 mapxy pos (op);
285 x = op->x + freearr_x[dir]; 280 pos.move (dir);
286 y = op->y + freearr_y[dir];
287 281
288 if (!xy_normalise (map, x, y)) 282 if (!pos.normalise ())
289 return 0; 283 return 0;
290 284
291 // elmex: a safe map tile can't be hit! 285 // elmex: a safe map tile can't be hit!
292 // this should prevent most harmful effects on items and players there. 286 // this should prevent most harmful effects on items and players there.
293 mapspace &ms = map->at (x, y); 287 mapspace &ms = pos.ms ();
294 288
295 if (ms.flags () & P_SAFE) 289 if (ms.flags () & P_SAFE)
296 return 0; 290 return 0;
297 291
298 /* peterm: a few special cases for special attacktypes --counterspell 292 /* peterm: a few special cases for special attacktypes --counterspell
336 330
337 /* Something could have happened to 'tmp' while 'tmp->below' was processed. 331 /* Something could have happened to 'tmp' while 'tmp->below' was processed.
338 * For example, 'tmp' was put in an icecube. 332 * For example, 'tmp' was put in an icecube.
339 * This is one of the few cases where on_same_map should not be used. 333 * This is one of the few cases where on_same_map should not be used.
340 */ 334 */
341 if (tmp->map != map || tmp->x != x || tmp->y != y) 335 if (tmp->map != pos.m || tmp->x != pos.x || tmp->y != pos.y)
342 continue; 336 continue;
343 337
344 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 338 if (QUERY_FLAG (tmp, FLAG_ALIVE))
345 { 339 {
346 hit_player (tmp, op->stats.dam, op, type, full_hit); 340 hit_player (tmp, op->stats.dam, op, type, full_hit);
523 { 517 {
524 int mtype; 518 int mtype;
525 519
526 switch (hitter->current_weapon->weapontype) 520 switch (hitter->current_weapon->weapontype)
527 { 521 {
528 case WEAP_HIT: 522 case WEAP_HIT:
529 mtype = ATM_BASIC; 523 mtype = ATM_BASIC;
530 break; 524 break;
531 case WEAP_SLASH: 525 case WEAP_SLASH:
532 mtype = ATM_SLASH; 526 mtype = ATM_SLASH;
533 break; 527 break;
534 case WEAP_PIERCE: 528 case WEAP_PIERCE:
535 mtype = ATM_PIERCE; 529 mtype = ATM_PIERCE;
536 break; 530 break;
537 case WEAP_CLEAVE: 531 case WEAP_CLEAVE:
538 mtype = ATM_CLEAVE; 532 mtype = ATM_CLEAVE;
539 break; 533 break;
540 case WEAP_SLICE: 534 case WEAP_SLICE:
541 mtype = ATM_SLICE; 535 mtype = ATM_SLICE;
542 break; 536 break;
543 case WEAP_STAB: 537 case WEAP_STAB:
544 mtype = ATM_STAB; 538 mtype = ATM_STAB;
545 break; 539 break;
546 case WEAP_WHIP: 540 case WEAP_WHIP:
547 mtype = ATM_WHIP; 541 mtype = ATM_WHIP;
548 break; 542 break;
549 case WEAP_CRUSH: 543 case WEAP_CRUSH:
550 mtype = ATM_CRUSH; 544 mtype = ATM_CRUSH;
551 break; 545 break;
552 case WEAP_BLUD: 546 case WEAP_BLUD:
553 mtype = ATM_BLUD; 547 mtype = ATM_BLUD;
554 break; 548 break;
555 default: 549 default:
556 mtype = ATM_BASIC; 550 mtype = ATM_BASIC;
557 break; 551 break;
558 } 552 }
553
559 for (i = 0; i < MAXATTACKMESS && attack_mess[mtype][i].level != -1; i++) 554 for (i = 0; i < MAXATTACKMESS && attack_mess[mtype][i].level != -1; i++)
560 if (dam < attack_mess[mtype][i].level || attack_mess[mtype][i + 1].level == -1) 555 if (dam < attack_mess[mtype][i].level || attack_mess[mtype][i + 1].level == -1)
561 { 556 {
562 sprintf (buf1, "%s %s%s", attack_mess[mtype][i].buf1, &op->name, attack_mess[mtype][i].buf2); 557 sprintf (buf1, "%s %s%s", attack_mess[mtype][i].buf1, &op->name, attack_mess[mtype][i].buf2);
563 strcpy (buf2, attack_mess[mtype][i].buf3); 558 strcpy (buf2, attack_mess[mtype][i].buf3);
680 *target = (*target)->head; 675 *target = (*target)->head;
681 676
682 if ((*hitter)->head) 677 if ((*hitter)->head)
683 *hitter = (*hitter)->head; 678 *hitter = (*hitter)->head;
684 679
680 if ((*target)->type == LOCKED_DOOR)
681 return 1; // locked doors cannot be hit
682
685 if ((*hitter)->env != NULL || (*target)->env != NULL) 683 if ((*hitter)->env || (*target)->env)
686 { 684 {
687 *simple_attack = 1; 685 *simple_attack = 1;
688 return 0; 686 return 0;
689 } 687 }
690 688
782 * for help. */ 780 * for help. */
783 if (op->type != PLAYER && !can_see_enemy (op, hitter) && !op->owner && rndm (0, op->stats.Int)) 781 if (op->type != PLAYER && !can_see_enemy (op, hitter) && !op->owner && rndm (0, op->stats.Int))
784 npc_call_help (op); 782 npc_call_help (op);
785 783
786 /* if you were hidden and hit by a creature, you are discovered */ 784 /* if you were hidden and hit by a creature, you are discovered */
787 if (op->hide && QUERY_FLAG (hitter, FLAG_ALIVE)) 785 if (op->flag [FLAG_HIDDEN] && hitter->flag [FLAG_ALIVE])
788 { 786 {
789 make_visible (op); 787 make_visible (op);
790 788
791 if (op->type == PLAYER) 789 if (op->type == PLAYER)
792 new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!"); 790 new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!");
893 /* Disassemble missile */ 891 /* Disassemble missile */
894 if (op->inv) 892 if (op->inv)
895 { 893 {
896 container = op; 894 container = op;
897 hitter = op->inv; 895 hitter = op->inv;
898 hitter->remove ();
899 insert_ob_in_map (hitter, container->map, hitter, INS_NO_MERGE | INS_NO_WALK_ON); 896 hitter->insert_at (container, hitter, INS_NO_MERGE | INS_NO_WALK_ON);
900 /* Note that we now have an empty THROWN_OBJ on the map. Code that 897 /* Note that we now have an empty THROWN_OBJ on the map. Code that
901 * might be called until this THROWN_OBJ is either reassembled or 898 * might be called until this THROWN_OBJ is either reassembled or
902 * removed at the end of this function must be able to deal with empty 899 * removed at the end of this function must be able to deal with empty
903 * THROWN_OBJs. */ 900 * THROWN_OBJs. */
904 } 901 }
918 * other places as well!) 915 * other places as well!)
919 */ 916 */
920 if (hitter->destroyed () || hitter->env != NULL) 917 if (hitter->destroyed () || hitter->env != NULL)
921 { 918 {
922 if (container) 919 if (container)
923 {
924 container->remove ();
925 container->destroy (); 920 container->destroy ();
926 }
927 921
928 return 0; 922 return 0;
929 } 923 }
930 924
931 /* Missile hit victim */ 925 /* Missile hit victim */
955 * can fly over but not otherwise move over. What is the correct 949 * can fly over but not otherwise move over. What is the correct
956 * way to handle those otherwise? 950 * way to handle those otherwise?
957 */ 951 */
958 if (victim->x != hitter->x || victim->y != hitter->y) 952 if (victim->x != hitter->x || victim->y != hitter->y)
959 { 953 {
954 if (victim->destroyed ())
955 hitter->destroy ();
956 else
957 {
960 hitter->remove (); 958 hitter->remove ();
961 hitter->x = victim->x; 959 hitter->x = victim->x;
962 hitter->y = victim->y; 960 hitter->y = victim->y;
963 insert_ob_in_map (hitter, victim->map, hitter, 0); 961 insert_ob_in_map (hitter, victim->map, hitter, 0);
962 }
964 } 963 }
965 else 964 else
966 /* Else leave arrow where it is */ 965 /* Else leave arrow where it is */
967 merge_ob (hitter, NULL); 966 merge_ob (hitter, NULL);
968 967
1383 */ 1382 */
1384int 1383int
1385kill_object (object *op, int dam, object *hitter, int type) 1384kill_object (object *op, int dam, object *hitter, int type)
1386{ 1385{
1387 char buf[MAX_BUF]; 1386 char buf[MAX_BUF];
1388 const char *skill; 1387 shstr skill;
1389 int maxdam = 0; 1388 int maxdam = 0;
1390 int battleg = 0; /* true if op standing on battleground */ 1389 int battleg = 0; /* true if op standing on battleground */
1391 int pk = 0; /* true if op and what controls hitter are both players */ 1390 int pk = 0; /* true if op and what controls hitter are both players */
1392 object *owner = 0; 1391 object *owner = 0;
1393 object *skop = 0; 1392 object *skop = 0;
1414 return maxdam; 1413 return maxdam;
1415 } 1414 }
1416 1415
1417 if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) 1416 if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER)
1418 { 1417 {
1419 op->destroy (); 1418 op->drop_and_destroy ();
1420 return maxdam; 1419 return maxdam;
1421 } 1420 }
1422 1421
1423 /* Now lets start dealing with experience we get for killing something */ 1422 /* Now lets start dealing with experience we get for killing something */
1424 1423
1425 owner = hitter->owner; 1424 owner = hitter->outer_owner ();
1426 if (!owner) 1425 if (!owner)
1427 owner = hitter; 1426 owner = hitter;
1428 1427
1429 /* is the victim (op) standing on battleground? */ 1428 /* is the victim (op) standing on battleground? */
1430 if (op_on_battleground (op, NULL, NULL)) 1429 if (op_on_battleground (op, NULL, NULL))
1435 pk = 1; 1434 pk = 1;
1436 1435
1437 /* Player killed something */ 1436 /* Player killed something */
1438 if (owner->type == PLAYER) 1437 if (owner->type == PLAYER)
1439 { 1438 {
1440 Log_Kill (owner->name,
1441 query_name (op), op->type, (owner != hitter) ? query_name (hitter) : NULL, (owner != hitter) ? hitter->type : 0);
1442
1443 /* Log players killing other players - makes it easier to detect 1439 /* Log players killing other players - makes it easier to detect
1444 * and filter out malicious player killers - that is why the 1440 * and filter out malicious player killers - that is why the
1445 * ip address is included. 1441 * ip address is included.
1446 */ 1442 */
1447 if (op->type == PLAYER && !battleg) 1443 if (op->type == PLAYER && !battleg)
1485 1481
1486 /* This code below deals with finding the appropriate skill 1482 /* This code below deals with finding the appropriate skill
1487 * to credit exp to. This is a bit problematic - we should 1483 * to credit exp to. This is a bit problematic - we should
1488 * probably never really have to look at current_weapon->skill 1484 * probably never really have to look at current_weapon->skill
1489 */ 1485 */
1490 skill = 0;
1491
1492 if (hitter->skill && hitter->type != PLAYER) 1486 if (hitter->skill && hitter->type != PLAYER)
1493 skill = hitter->skill; 1487 skill = hitter->skill;
1494 else if (owner->chosen_skill) 1488 else if (owner->chosen_skill)
1495 { 1489 {
1496 skop = owner->chosen_skill; 1490 skop = owner->chosen_skill;
1497 skill = skop->skill; 1491 skill = skop->skill;
1498 } 1492 }
1499 else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) 1493 else if (QUERY_FLAG (owner, FLAG_READY_WEAPON) && owner->current_weapon)
1500 skill = owner->current_weapon->skill; 1494 skill = owner->current_weapon->skill;
1501 else 1495 else
1496 {
1502 LOG (llevError, "kill_object - unable to find skill that killed monster\n"); 1497 LOG (llevError, "BUG: kill_object - unable to find skill that killed monster\n"
1498 "op: %s\n" "hitter: %s\n" "owner: %s\n",
1499 owner->debug_desc (), hitter->debug_desc (), op->debug_desc ());
1500 skill = 0;
1501 }
1503 1502
1504 /* We have the skill we want to credit to - now find the object this goes 1503 /* We have the skill we want to credit to - now find the object this goes
1505 * to. Make sure skop is an actual skill, and not a skill tool! 1504 * to. Make sure skop is an actual skill, and not a skill tool!
1506 */ 1505 */
1507 if ((!skop || skop->type != SKILL) && skill) 1506 skop = owner->contr->find_skill (skill);
1508 {
1509 int i;
1510
1511 for (i = 0; i < NUM_SKILLS; i++)
1512 if (owner->contr->last_skill_ob[i] && !strcmp (owner->contr->last_skill_ob[i]->skill, skill))
1513 {
1514 skop = owner->contr->last_skill_ob[i];
1515 break;
1516 }
1517 }
1518 } /* Was it a player that hit somethign */ 1507 } /* Was it a player that hit somethign */
1519 else 1508 else
1520 skill = 0; 1509 skill = 0;
1521 1510
1522 /* Pet (or spell) killed something. */
1523 if (owner != hitter)
1524 sprintf (buf, "%s killed %s with %s%s%s.", &owner->name,
1525 query_name (op), query_name (hitter), battleg ? " (duel)" : "", pk ? " (pk)" : "");
1526 else
1527 sprintf (buf, "%s killed %s%s%s%s.", &hitter->name, &op->name,
1528 (QUERY_FLAG (hitter, FLAG_MONSTER)) || hitter->type == PLAYER ?
1529 " in hand to hand combat" : "", battleg ? " (duel)" : "", pk ? " (pk)" : "");
1530
1531 /* These may have been set in the player code section above */ 1511 /* These may have been set in the player code section above */
1532 if (!skop) 1512 if (!skop)
1533 skop = hitter->chosen_skill; 1513 skop = hitter->chosen_skill;
1534 1514
1535 if (!skill && skop) 1515 if (!skill && skop)
1536 skill = skop->skill; 1516 skill = skop->skill;
1537
1538 new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf);
1539 1517
1540 /* If you didn't kill yourself, and your not the wizard */ 1518 /* If you didn't kill yourself, and your not the wizard */
1541 if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) 1519 if (owner != op && !QUERY_FLAG (op, FLAG_WIZ))
1542 { 1520 {
1543 int exp; 1521 int exp;
1615 1593
1616 if (owner1 && owner1->type == PLAYER) 1594 if (owner1 && owner1->type == PLAYER)
1617 { 1595 {
1618 owner1->contr->play_sound (sound_find ("pet_is_killed")); 1596 owner1->contr->play_sound (sound_find ("pet_is_killed"));
1619 /* Maybe we should include the owner that killed this, maybe not */ 1597 /* Maybe we should include the owner that killed this, maybe not */
1620 new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); 1598 new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, was killed by %s.", &op->name, &hitter->name);
1621 } 1599 }
1622 1600
1623 remove_friendly_object (op); 1601 remove_friendly_object (op);
1624 } 1602 }
1625 1603
1626 op->destroy (); 1604 op->drop_and_destroy ();
1627 } 1605 }
1628 else 1606 else
1629 /* Player has been killed! */ 1607 /* Player has been killed! */
1630 op->contr->killer = owner->type == PLAYER ? owner : hitter; 1608 op->contr->killer = owner->type == PLAYER ? owner : hitter;
1631 1609
1917 /* See if the creature has been killed */ 1895 /* See if the creature has been killed */
1918 rtn_kill = kill_object (op, maxdam, hitter, type); 1896 rtn_kill = kill_object (op, maxdam, hitter, type);
1919 if (rtn_kill != -1) 1897 if (rtn_kill != -1)
1920 return rtn_kill; 1898 return rtn_kill;
1921 1899
1922
1923 /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note 1900 /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note
1924 * that before if the player was immune to ghosthit, the monster 1901 * that before if the player was immune to ghosthit, the monster
1925 * remained - that is no longer the case. 1902 * remained - that is no longer the case.
1926 */ 1903 */
1927 if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) 1904 if (QUERY_FLAG (hitter, FLAG_ONE_HIT))
1928 hitter->destroy (); 1905 hitter->drop_and_destroy ();
1929
1930 /* Lets handle creatures that are splitting now */ 1906 /* Lets handle creatures that are splitting now */
1931 else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) 1907 else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING))
1932 { 1908 {
1933 int i; 1909 int i;
1934 int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); 1910 int friendly = QUERY_FLAG (op, FLAG_FRIENDLY);
1974 } 1950 }
1975 1951
1976 op->destroy (); 1952 op->destroy ();
1977 } 1953 }
1978 else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) 1954 else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10)
1979 hitter->destroy (); 1955 hitter->drop_and_destroy ();
1980 1956
1981 return maxdam; 1957 return maxdam;
1982} 1958}
1983 1959
1984void 1960void
2187 return; 2163 return;
2188 2164
2189 def_lev = op->level; 2165 def_lev = op->level;
2190 if (def_lev < 1) 2166 if (def_lev < 1)
2191 { 2167 {
2192 LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->archname, &op->name); 2168 LOG (llevError, "BUG: arch %s with level < 1 (%s)\n", &op->arch->archname, op->debug_desc ());
2193 def_lev = 1; 2169 def_lev = 1;
2194 } 2170 }
2195 2171
2196 atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; 2172 atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2;
2197 /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", 2173 /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n",
2290 { 2266 {
2291 /* target is unseen */ 2267 /* target is unseen */
2292 if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) 2268 if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND))
2293 adjust -= 10; 2269 adjust -= 10;
2294 /* dark map penalty for the hitter (lacks infravision if we got here). */ 2270 /* dark map penalty for the hitter (lacks infravision if we got here). */
2295 else if (target->map && target->map->darkness > 0 && !stand_in_light (target)) 2271 else if (target->map && target->map->darklevel () > 0 && !stand_in_light (target))
2296 adjust -= target->map->darkness; 2272 adjust -= target->map->darklevel ();
2297 } 2273 }
2298 2274
2299 if (QUERY_FLAG (attacker, FLAG_SCARED)) 2275 if (QUERY_FLAG (attacker, FLAG_SCARED))
2300 adjust -= 3; 2276 adjust -= 3;
2301 2277

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines