… | |
… | |
103 | ncharges = 1; |
103 | ncharges = 1; |
104 | |
104 | |
105 | wand->stats.food += ncharges; |
105 | wand->stats.food += ncharges; |
106 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s glows with power.", query_name (wand)); |
106 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s glows with power.", query_name (wand)); |
107 | |
107 | |
108 | if (wand->arch && QUERY_FLAG (wand->arch, FLAG_ANIMATE)) |
108 | if (wand->arch && wand->arch->flag [FLAG_ANIMATE]) |
109 | { |
109 | { |
110 | SET_FLAG (wand, FLAG_ANIMATE); |
110 | wand->set_flag (FLAG_ANIMATE); |
111 | wand->set_speed (wand->arch->speed); |
111 | wand->set_speed (wand->arch->speed); |
112 | } |
112 | } |
113 | |
113 | |
114 | return 1; |
114 | return 1; |
115 | } |
115 | } |
… | |
… | |
129 | { |
129 | { |
130 | int bonus_plus = 0; |
130 | int bonus_plus = 0; |
131 | const char *missile_name = "arrow"; |
131 | const char *missile_name = "arrow"; |
132 | |
132 | |
133 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
133 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
134 | if (tmp->type == BOW && QUERY_FLAG (tmp, FLAG_APPLIED)) |
134 | if (tmp->type == BOW && tmp->flag [FLAG_APPLIED]) |
135 | missile_name = tmp->race; |
135 | missile_name = tmp->race; |
136 | |
136 | |
137 | int missile_plus = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
137 | int missile_plus = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
138 | |
138 | |
139 | archetype *missile_arch = archetype::find (missile_name); |
139 | archetype *missile_arch = archetype::find (missile_name); |
… | |
… | |
193 | |
193 | |
194 | missile->magic = missile_plus; |
194 | missile->magic = missile_plus; |
195 | /* Can't get any money for these objects */ |
195 | /* Can't get any money for these objects */ |
196 | missile->value = 0; |
196 | missile->value = 0; |
197 | |
197 | |
198 | SET_FLAG (missile, FLAG_IDENTIFIED); |
198 | missile->set_flag (FLAG_IDENTIFIED); |
199 | |
199 | |
200 | if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) |
200 | if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) |
201 | pick_up (op, missile); |
201 | pick_up (op, missile); |
202 | |
202 | |
203 | return 1; |
203 | return 1; |
… | |
… | |
297 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
297 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
298 | |
298 | |
299 | if (mflags & P_OUT_OF_MAP) |
299 | if (mflags & P_OUT_OF_MAP) |
300 | break; |
300 | break; |
301 | |
301 | |
302 | if (!QUERY_FLAG (op, FLAG_WIZCAST) && (mflags & P_NO_MAGIC)) |
302 | if (!op->flag [FLAG_WIZCAST] && (mflags & P_NO_MAGIC)) |
303 | { |
303 | { |
304 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your magic."); |
304 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your magic."); |
305 | return 0; |
305 | return 0; |
306 | } |
306 | } |
307 | |
307 | |
308 | if (mflags & P_IS_ALIVE) |
308 | if (mflags & P_IS_ALIVE) |
309 | { |
309 | { |
310 | for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) |
310 | for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) |
311 | if (QUERY_FLAG (tmp, FLAG_ALIVE) && (tmp->type == PLAYER || QUERY_FLAG (tmp, FLAG_MONSTER))) |
311 | if (tmp->flag [FLAG_ALIVE] && (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER])) |
312 | { |
312 | { |
313 | new_draw_info (NDI_UNIQUE, 0, op, "You detect something."); |
313 | new_draw_info (NDI_UNIQUE, 0, op, "You detect something."); |
314 | if (tmp->head != NULL) |
314 | if (tmp->head != NULL) |
315 | tmp = tmp->head; |
315 | tmp = tmp->head; |
316 | examine_monster (op, tmp); |
316 | examine_monster (op, tmp); |
… | |
… | |
339 | if (pl->type == PLAYER) |
339 | if (pl->type == PLAYER) |
340 | { |
340 | { |
341 | /* If race isn't set, then invisible unless it is undead */ |
341 | /* If race isn't set, then invisible unless it is undead */ |
342 | if (!pl->contr->invis_race) |
342 | if (!pl->contr->invis_race) |
343 | { |
343 | { |
344 | if (QUERY_FLAG (mon, FLAG_UNDEAD)) |
344 | if (mon->flag [FLAG_UNDEAD]) |
345 | return 0; |
345 | return 0; |
346 | |
346 | |
347 | return 1; |
347 | return 1; |
348 | } |
348 | } |
349 | |
349 | |
… | |
… | |
396 | |
396 | |
397 | if (op->type == PLAYER) |
397 | if (op->type == PLAYER) |
398 | { |
398 | { |
399 | op->contr->invis_race = spell_ob->race; |
399 | op->contr->invis_race = spell_ob->race; |
400 | |
400 | |
401 | if (QUERY_FLAG (spell_ob, FLAG_MAKE_INVIS)) |
401 | if (spell_ob->flag [FLAG_MAKE_INVIS]) |
402 | op->contr->tmp_invis = 0; |
402 | op->contr->tmp_invis = 0; |
403 | else |
403 | else |
404 | op->contr->tmp_invis = 1; |
404 | op->contr->tmp_invis = 1; |
405 | |
405 | |
406 | op->contr->hidden = 0; |
406 | op->contr->hidden = 0; |
… | |
… | |
448 | // earth to dust tears down everything that can be torn down |
448 | // earth to dust tears down everything that can be torn down |
449 | for (object *next, *tmp = m->at (sx, sy).bot; tmp; tmp = next) |
449 | for (object *next, *tmp = m->at (sx, sy).bot; tmp; tmp = next) |
450 | { |
450 | { |
451 | next = tmp->above; |
451 | next = tmp->above; |
452 | |
452 | |
453 | if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) |
453 | if (tmp->flag [FLAG_TEAR_DOWN]) |
454 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
454 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
455 | } |
455 | } |
456 | } |
456 | } |
457 | |
457 | |
458 | return 1; |
458 | return 1; |
… | |
… | |
461 | void |
461 | void |
462 | execute_word_of_recall (object *op) |
462 | execute_word_of_recall (object *op) |
463 | { |
463 | { |
464 | if (object *pl = op->in_player ()) |
464 | if (object *pl = op->in_player ()) |
465 | { |
465 | { |
466 | if (pl->ms ().flags () & P_NO_CLERIC && !QUERY_FLAG (pl, FLAG_WIZCAST)) |
466 | if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) |
467 | new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); |
467 | new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); |
468 | else |
468 | else |
469 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
469 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
470 | } |
470 | } |
471 | |
471 | |
… | |
… | |
679 | tmp->attacktype = spell_ob->attacktype; |
679 | tmp->attacktype = spell_ob->attacktype; |
680 | tmp->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
680 | tmp->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
681 | tmp->stats.dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
681 | tmp->stats.dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
682 | tmp->range = 0; |
682 | tmp->range = 0; |
683 | } |
683 | } |
684 | else if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
684 | else if (tmp->flag [FLAG_ALIVE]) |
685 | { |
685 | { |
686 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
686 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
687 | tmp->stats.maxhp = tmp->stats.hp; |
687 | tmp->stats.maxhp = tmp->stats.hp; |
688 | } |
688 | } |
689 | |
689 | |
690 | if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) |
690 | if (spell_ob->flag [FLAG_IS_USED_UP] || tmp->flag [FLAG_IS_USED_UP]) |
691 | { |
691 | { |
692 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
692 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
693 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
693 | tmp->set_flag (FLAG_IS_USED_UP); |
694 | } |
694 | } |
695 | |
695 | |
696 | if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN)) |
696 | if (spell_ob->flag [FLAG_TEAR_DOWN]) |
697 | { |
697 | { |
698 | tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
698 | tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
699 | tmp->stats.maxhp = tmp->stats.hp; |
699 | tmp->stats.maxhp = tmp->stats.hp; |
700 | SET_FLAG (tmp, FLAG_TEAR_DOWN); |
700 | tmp->set_flag (FLAG_TEAR_DOWN); |
701 | SET_FLAG (tmp, FLAG_ALIVE); |
701 | tmp->set_flag (FLAG_ALIVE); |
702 | } |
702 | } |
703 | |
703 | |
704 | /* This can't really hurt - if the object doesn't kill anything, |
704 | /* This can't really hurt - if the object doesn't kill anything, |
705 | * these fields just won't be used. Do not set the owner for |
705 | * these fields just won't be used. Do not set the owner for |
706 | * earthwalls, though, so they survive restarts. |
706 | * earthwalls, though, so they survive restarts. |
… | |
… | |
771 | } |
771 | } |
772 | else |
772 | else |
773 | negblocked = 1; |
773 | negblocked = 1; |
774 | } |
774 | } |
775 | |
775 | |
776 | if (QUERY_FLAG (tmp, FLAG_BLOCKSVIEW)) |
776 | if (tmp->flag [FLAG_BLOCKSVIEW]) |
777 | update_all_los (op->map, op->x, op->y); |
777 | update_all_los (op->map, op->x, op->y); |
778 | |
778 | |
779 | return 1; |
779 | return 1; |
780 | } |
780 | } |
781 | |
781 | |
… | |
… | |
1103 | |
1103 | |
1104 | force->name_pl = spell_ob->name; |
1104 | force->name_pl = spell_ob->name; |
1105 | |
1105 | |
1106 | force->speed = 1.0; |
1106 | force->speed = 1.0; |
1107 | force->speed_left = -1.0; |
1107 | force->speed_left = -1.0; |
1108 | SET_FLAG (force, FLAG_APPLIED); |
1108 | force->set_flag (FLAG_APPLIED); |
1109 | |
1109 | |
1110 | /* Now start processing the effects. First, protections */ |
1110 | /* Now start processing the effects. First, protections */ |
1111 | for (i = 0; i < NROFATTACKS; i++) |
1111 | for (i = 0; i < NROFATTACKS; i++) |
1112 | { |
1112 | { |
1113 | if (spell_ob->resist[i]) |
1113 | if (spell_ob->resist[i]) |
… | |
… | |
1143 | } |
1143 | } |
1144 | } |
1144 | } |
1145 | |
1145 | |
1146 | force->move_type = spell_ob->move_type; |
1146 | force->move_type = spell_ob->move_type; |
1147 | |
1147 | |
1148 | if (QUERY_FLAG (spell_ob, FLAG_SEE_IN_DARK)) |
1148 | if (spell_ob->flag [FLAG_SEE_IN_DARK]) |
1149 | SET_FLAG (force, FLAG_SEE_IN_DARK); |
1149 | force->set_flag (FLAG_SEE_IN_DARK); |
1150 | |
1150 | |
1151 | if (QUERY_FLAG (spell_ob, FLAG_XRAYS)) |
1151 | if (spell_ob->flag [FLAG_XRAYS]) |
1152 | SET_FLAG (force, FLAG_XRAYS); |
1152 | force->set_flag (FLAG_XRAYS); |
1153 | |
1153 | |
1154 | /* Haste/bonus speed */ |
1154 | /* Haste/bonus speed */ |
1155 | if (spell_ob->stats.exp) |
1155 | if (spell_ob->stats.exp) |
1156 | { |
1156 | { |
1157 | if (op->speed > 0.5f) |
1157 | if (op->speed > 0.5f) |
… | |
… | |
1238 | return 0; |
1238 | return 0; |
1239 | } |
1239 | } |
1240 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1240 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1241 | force->speed = 1.0; |
1241 | force->speed = 1.0; |
1242 | force->speed_left = -1.0; |
1242 | force->speed_left = -1.0; |
1243 | SET_FLAG (force, FLAG_APPLIED); |
1243 | force->set_flag (FLAG_APPLIED); |
1244 | |
1244 | |
1245 | if (!god) |
1245 | if (!god) |
1246 | { |
1246 | { |
1247 | new_draw_info (NDI_UNIQUE, 0, op, "Your blessing seems empty."); |
1247 | new_draw_info (NDI_UNIQUE, 0, op, "Your blessing seems empty."); |
1248 | } |
1248 | } |
… | |
… | |
1302 | * the nuggets, alchemy the gold from that, etc. |
1302 | * the nuggets, alchemy the gold from that, etc. |
1303 | * Otherwise, give 9 silver on the gold for other objects, |
1303 | * Otherwise, give 9 silver on the gold for other objects, |
1304 | * so that it would still be more affordable to haul |
1304 | * so that it would still be more affordable to haul |
1305 | * the stuff back to town. |
1305 | * the stuff back to town. |
1306 | */ |
1306 | */ |
1307 | if (QUERY_FLAG (obj, FLAG_UNPAID)) |
1307 | if (obj->flag [FLAG_UNPAID]) |
1308 | value = 0; |
1308 | value = 0; |
1309 | else if (obj->type == MONEY || obj->type == GEM) |
1309 | else if (obj->type == MONEY || obj->type == GEM) |
1310 | value /= 3; |
1310 | value /= 3; |
1311 | else |
1311 | else |
1312 | value = value * 9 / 10; |
1312 | value = value * 9 / 10; |
… | |
… | |
1366 | |
1366 | |
1367 | for (object *next, *tmp = mp->at (nx, ny).bot; tmp; tmp = next) |
1367 | for (object *next, *tmp = mp->at (nx, ny).bot; tmp; tmp = next) |
1368 | { |
1368 | { |
1369 | next = tmp->above; |
1369 | next = tmp->above; |
1370 | |
1370 | |
1371 | if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) && |
1371 | if (tmp->weight > 0 && !tmp->flag [FLAG_NO_PICK] && |
1372 | !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) |
1372 | !tmp->flag [FLAG_ALIVE] && !tmp->flag [FLAG_IS_CAULDRON]) |
1373 | { |
1373 | { |
1374 | if (tmp->inv) |
1374 | if (tmp->inv) |
1375 | { |
1375 | { |
1376 | object *next1, *tmp1; |
1376 | object *next1, *tmp1; |
1377 | |
1377 | |
1378 | for (tmp1 = tmp->inv; tmp1; tmp1 = next1) |
1378 | for (tmp1 = tmp->inv; tmp1; tmp1 = next1) |
1379 | { |
1379 | { |
1380 | next1 = tmp1->below; |
1380 | next1 = tmp1->below; |
1381 | if (tmp1->weight > 0 && !QUERY_FLAG (tmp1, FLAG_NO_PICK) && |
1381 | if (tmp1->weight > 0 && !tmp1->flag [FLAG_NO_PICK] && |
1382 | !QUERY_FLAG (tmp1, FLAG_ALIVE) && !QUERY_FLAG (tmp1, FLAG_IS_CAULDRON)) |
1382 | !tmp1->flag [FLAG_ALIVE] && !tmp1->flag [FLAG_IS_CAULDRON]) |
1383 | alchemy_object (tmp1, value, weight); |
1383 | alchemy_object (tmp1, value, weight); |
1384 | } |
1384 | } |
1385 | } |
1385 | } |
1386 | |
1386 | |
1387 | alchemy_object (tmp, value, weight); |
1387 | alchemy_object (tmp, value, weight); |
… | |
… | |
1421 | remove_curse (object *op, object *caster, object *spell) |
1421 | remove_curse (object *op, object *caster, object *spell) |
1422 | { |
1422 | { |
1423 | int success = 0, was_one = 0; |
1423 | int success = 0, was_one = 0; |
1424 | |
1424 | |
1425 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1425 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1426 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && |
1426 | if (tmp->flag [FLAG_APPLIED] && |
1427 | ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || |
1427 | ((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) || |
1428 | (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) |
1428 | (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))) |
1429 | { |
1429 | { |
1430 | was_one++; |
1430 | was_one++; |
1431 | |
1431 | |
1432 | if (tmp->level <= casting_level (caster, spell)) |
1432 | if (tmp->level <= casting_level (caster, spell)) |
1433 | { |
1433 | { |
1434 | success++; |
1434 | success++; |
1435 | if (QUERY_FLAG (spell, FLAG_DAMNED)) |
1435 | if (spell->flag [FLAG_DAMNED]) |
1436 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
1436 | tmp->clr_flag (FLAG_DAMNED); |
1437 | |
1437 | |
1438 | CLEAR_FLAG (tmp, FLAG_CURSED); |
1438 | tmp->clr_flag (FLAG_CURSED); |
1439 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
1439 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
1440 | tmp->value = 0; /* Still can't sell it */ |
1440 | tmp->value = 0; /* Still can't sell it */ |
1441 | |
1441 | |
1442 | if (object *pl = tmp->visible_to ()) |
1442 | if (object *pl = tmp->visible_to ()) |
1443 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1443 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1444 | } |
1444 | } |
… | |
… | |
1469 | |
1469 | |
1470 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1470 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1471 | |
1471 | |
1472 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1472 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1473 | { |
1473 | { |
1474 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1474 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) |
1475 | { |
1475 | { |
1476 | identify (tmp); |
1476 | identify (tmp); |
1477 | |
1477 | |
1478 | if (op->type == PLAYER) |
1478 | if (op->type == PLAYER) |
1479 | { |
1479 | { |
… | |
… | |
1493 | * was not fully used. |
1493 | * was not fully used. |
1494 | */ |
1494 | */ |
1495 | if (num_ident) |
1495 | if (num_ident) |
1496 | { |
1496 | { |
1497 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
1497 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
1498 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1498 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) |
1499 | { |
1499 | { |
1500 | identify (tmp); |
1500 | identify (tmp); |
1501 | |
1501 | |
1502 | if (object *pl = tmp->visible_to ()) |
1502 | if (object *pl = tmp->visible_to ()) |
1503 | { |
1503 | { |
… | |
… | |
1567 | floor = 0; |
1567 | floor = 0; |
1568 | detect = NULL; |
1568 | detect = NULL; |
1569 | for (tmp = last; tmp; tmp = tmp->below) |
1569 | for (tmp = last; tmp; tmp = tmp->below) |
1570 | { |
1570 | { |
1571 | /* show invisible */ |
1571 | /* show invisible */ |
1572 | if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) |
1572 | if (spell->flag [FLAG_MAKE_INVIS] |
1573 | /* Might there be other objects that we can make visible? */ |
1573 | /* Might there be other objects that we can make visible? */ |
1574 | && (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) |
1574 | && (tmp->invisible && (tmp->flag [FLAG_MONSTER] |
1575 | || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) |
1575 | || (tmp->type == PLAYER && !tmp->flag [FLAG_WIZ]) |
1576 | || tmp->type == T_HANDLE |
1576 | || tmp->type == T_HANDLE |
1577 | || tmp->type == TRAPDOOR |
1577 | || tmp->type == TRAPDOOR |
1578 | || tmp->type == EXIT |
1578 | || tmp->type == EXIT |
1579 | || tmp->type == HOLE |
1579 | || tmp->type == HOLE |
1580 | || tmp->type == BUTTON |
1580 | || tmp->type == BUTTON |
… | |
… | |
1596 | tmp->invisible = 0; |
1596 | tmp->invisible = 0; |
1597 | done_one = 1; |
1597 | done_one = 1; |
1598 | } |
1598 | } |
1599 | } |
1599 | } |
1600 | |
1600 | |
1601 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1601 | if (tmp->flag [FLAG_IS_FLOOR]) |
1602 | floor = 1; |
1602 | floor = 1; |
1603 | |
1603 | |
1604 | /* All detections below this point don't descend beneath the floor, |
1604 | /* All detections below this point don't descend beneath the floor, |
1605 | * so just continue on. We could be clever and look at the type of |
1605 | * so just continue on. We could be clever and look at the type of |
1606 | * detection to completely break out if we don't care about objects beneath |
1606 | * detection to completely break out if we don't care about objects beneath |
… | |
… | |
1615 | * difficult to see what object is magical/cursed, so the |
1615 | * difficult to see what object is magical/cursed, so the |
1616 | * effect wouldn't be as apparent. |
1616 | * effect wouldn't be as apparent. |
1617 | */ |
1617 | */ |
1618 | |
1618 | |
1619 | /* detect magic */ |
1619 | /* detect magic */ |
1620 | if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && |
1620 | if (spell->flag [FLAG_KNOWN_MAGICAL] && |
1621 | !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_IDENTIFIED) && is_magical (tmp)) |
1621 | !tmp->flag [FLAG_KNOWN_MAGICAL] && !tmp->flag [FLAG_IDENTIFIED] && is_magical (tmp)) |
1622 | { |
1622 | { |
1623 | SET_FLAG (tmp, FLAG_KNOWN_MAGICAL); |
1623 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1624 | /* make runes more visible */ |
1624 | /* make runes more visible */ |
1625 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1625 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1626 | tmp->stats.Cha /= 4; |
1626 | tmp->stats.Cha /= 4; |
1627 | |
1627 | |
1628 | done_one = 1; |
1628 | done_one = 1; |
1629 | } |
1629 | } |
1630 | |
1630 | |
1631 | /* detect monster */ |
1631 | /* detect monster */ |
1632 | if (QUERY_FLAG (spell, FLAG_MONSTER) && (QUERY_FLAG (tmp, FLAG_MONSTER) || tmp->type == PLAYER)) |
1632 | if (spell->flag [FLAG_MONSTER] && (tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER)) |
1633 | { |
1633 | { |
1634 | done_one = 2; |
1634 | done_one = 2; |
1635 | |
1635 | |
1636 | if (!detect) |
1636 | if (!detect) |
1637 | detect = tmp; |
1637 | detect = tmp; |
… | |
… | |
1639 | |
1639 | |
1640 | /* Basically, if race is set in the spell, then the creatures race must |
1640 | /* Basically, if race is set in the spell, then the creatures race must |
1641 | * match that. if the spell race is set to GOD, then the gods opposing |
1641 | * match that. if the spell race is set to GOD, then the gods opposing |
1642 | * race must match. |
1642 | * race must match. |
1643 | */ |
1643 | */ |
1644 | if (spell->race && QUERY_FLAG (tmp, FLAG_MONSTER) && tmp->race && |
1644 | if (spell->race && tmp->flag [FLAG_MONSTER] && tmp->race && |
1645 | ((spell->race == shstr_GOD && god && god->slaying.contains (tmp->race)) || |
1645 | ((spell->race == shstr_GOD && god && god->slaying.contains (tmp->race)) || |
1646 | spell->race.contains (tmp->race))) |
1646 | spell->race.contains (tmp->race))) |
1647 | { |
1647 | { |
1648 | done_one = 2; |
1648 | done_one = 2; |
1649 | |
1649 | |
1650 | if (!detect) |
1650 | if (!detect) |
1651 | detect = tmp; |
1651 | detect = tmp; |
1652 | } |
1652 | } |
1653 | |
1653 | |
1654 | if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && |
1654 | if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && |
1655 | (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))) |
1655 | (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1656 | { |
1656 | { |
1657 | SET_FLAG (tmp, FLAG_KNOWN_CURSED); |
1657 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1658 | done_one = 1; |
1658 | done_one = 1; |
1659 | } |
1659 | } |
1660 | |
1660 | |
1661 | // Do mining detection spell: |
1661 | // Do mining detection spell: |
1662 | if (spell->last_sp == 1) // 1 - detect any vein |
1662 | if (spell->last_sp == 1) // 1 - detect any vein |
… | |
… | |
1688 | detect_ob->face = detect->face; |
1688 | detect_ob->face = detect->face; |
1689 | detect_ob->animation_id = detect->animation_id; |
1689 | detect_ob->animation_id = detect->animation_id; |
1690 | detect_ob->anim_speed = detect->anim_speed; |
1690 | detect_ob->anim_speed = detect->anim_speed; |
1691 | detect_ob->last_anim = 0; |
1691 | detect_ob->last_anim = 0; |
1692 | /* by default, the detect_ob is already animated */ |
1692 | /* by default, the detect_ob is already animated */ |
1693 | if (!QUERY_FLAG (detect, FLAG_ANIMATE)) |
1693 | if (!detect->flag [FLAG_ANIMATE]) |
1694 | CLEAR_FLAG (detect_ob, FLAG_ANIMATE); |
1694 | detect_ob->clr_flag (FLAG_ANIMATE); |
1695 | } |
1695 | } |
1696 | |
1696 | |
1697 | m->insert (detect_ob, nx, ny, op, INS_ON_TOP); |
1697 | m->insert (detect_ob, nx, ny, op, INS_ON_TOP); |
1698 | } |
1698 | } |
1699 | } /* for processing the surrounding spaces */ |
1699 | } /* for processing the surrounding spaces */ |
1700 | |
1700 | |
1701 | |
1701 | |
1702 | /* Now process objects in the players inventory if detect curse or magic */ |
1702 | /* Now process objects in the players inventory if detect curse or magic */ |
1703 | if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) || QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL)) |
1703 | if (spell->flag [FLAG_KNOWN_CURSED] || spell->flag [FLAG_KNOWN_MAGICAL]) |
1704 | { |
1704 | { |
1705 | done_one = 0; |
1705 | done_one = 0; |
1706 | |
1706 | |
1707 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1707 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1708 | { |
1708 | { |
1709 | if (!tmp->invisible && !QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1709 | if (!tmp->invisible && !tmp->flag [FLAG_IDENTIFIED]) |
1710 | { |
1710 | { |
1711 | if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && is_magical (tmp) && !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL)) |
1711 | if (spell->flag [FLAG_KNOWN_MAGICAL] && is_magical (tmp) && !tmp->flag [FLAG_KNOWN_MAGICAL]) |
1712 | { |
1712 | { |
1713 | SET_FLAG (tmp, FLAG_KNOWN_MAGICAL); |
1713 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1714 | |
1714 | |
1715 | if (object *pl = tmp->visible_to ()) |
1715 | if (object *pl = tmp->visible_to ()) |
1716 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1716 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1717 | } |
1717 | } |
1718 | |
1718 | |
1719 | if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && |
1719 | if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && |
1720 | (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))) |
1720 | (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1721 | { |
1721 | { |
1722 | SET_FLAG (tmp, FLAG_KNOWN_CURSED); |
1722 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1723 | |
1723 | |
1724 | if (object *pl = tmp->visible_to ()) |
1724 | if (object *pl = tmp->visible_to ()) |
1725 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1725 | esrv_update_item (UPD_FLAGS, pl, tmp); |
1726 | } |
1726 | } |
1727 | } /* if item is not identified */ |
1727 | } /* if item is not identified */ |
… | |
… | |
1787 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1787 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1788 | |
1788 | |
1789 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
1789 | if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) |
1790 | { |
1790 | { |
1791 | for (plyr = GET_MAP_OB (m, x, y); plyr != NULL; plyr = plyr->above) |
1791 | for (plyr = GET_MAP_OB (m, x, y); plyr != NULL; plyr = plyr->above) |
1792 | if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) |
1792 | if (plyr != op && plyr->flag [FLAG_ALIVE]) |
1793 | break; |
1793 | break; |
1794 | } |
1794 | } |
1795 | |
1795 | |
1796 | |
1796 | |
1797 | /* If we did not find a player in the specified direction, transfer |
1797 | /* If we did not find a player in the specified direction, transfer |
1798 | * to anyone on top of us. This is used for the rune of transference mostly. |
1798 | * to anyone on top of us. This is used for the rune of transference mostly. |
1799 | */ |
1799 | */ |
1800 | if (plyr == NULL) |
1800 | if (plyr == NULL) |
1801 | for (plyr = GET_MAP_OB (op->map, op->x, op->y); plyr != NULL; plyr = plyr->above) |
1801 | for (plyr = GET_MAP_OB (op->map, op->x, op->y); plyr != NULL; plyr = plyr->above) |
1802 | if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) |
1802 | if (plyr != op && plyr->flag [FLAG_ALIVE]) |
1803 | break; |
1803 | break; |
1804 | |
1804 | |
1805 | if (!plyr) |
1805 | if (!plyr) |
1806 | { |
1806 | { |
1807 | new_draw_info (NDI_BLACK, 0, op, "There is no one there."); |
1807 | new_draw_info (NDI_BLACK, 0, op, "There is no one there."); |
… | |
… | |
1824 | if (rate > 95) |
1824 | if (rate > 95) |
1825 | rate = 95; |
1825 | rate = 95; |
1826 | |
1826 | |
1827 | sucked = (plyr->stats.sp * rate) / 100; |
1827 | sucked = (plyr->stats.sp * rate) / 100; |
1828 | plyr->stats.sp -= sucked; |
1828 | plyr->stats.sp -= sucked; |
1829 | if (QUERY_FLAG (op, FLAG_ALIVE)) |
1829 | if (op->flag [FLAG_ALIVE]) |
1830 | { |
1830 | { |
1831 | /* Player doesn't get full credit */ |
1831 | /* Player doesn't get full credit */ |
1832 | sucked = (sucked * rate) / 100; |
1832 | sucked = (sucked * rate) / 100; |
1833 | op->stats.sp += sucked; |
1833 | op->stats.sp += sucked; |
1834 | if (sucked > 0) |
1834 | if (sucked > 0) |
… | |
… | |
1885 | * monsters either. |
1885 | * monsters either. |
1886 | */ |
1886 | */ |
1887 | |
1887 | |
1888 | if (head->attacktype & AT_MAGIC |
1888 | if (head->attacktype & AT_MAGIC |
1889 | && !(head->attacktype & AT_COUNTERSPELL) |
1889 | && !(head->attacktype & AT_COUNTERSPELL) |
1890 | && !QUERY_FLAG (head, FLAG_MONSTER) |
1890 | && !head->flag [FLAG_MONSTER] |
1891 | && (op->level > head->level)) |
1891 | && (op->level > head->level)) |
1892 | head->destroy (); |
1892 | head->destroy (); |
1893 | else |
1893 | else |
1894 | switch (head->type) |
1894 | switch (head->type) |
1895 | { |
1895 | { |
1896 | case SPELL_EFFECT: |
1896 | case SPELL_EFFECT: |
1897 | // XXX: Don't affect floor spelleffects. See also XXX comment |
1897 | // XXX: Don't affect floor spelleffects. See also XXX comment |
1898 | // about sanctuary in spell_util.C |
1898 | // about sanctuary in spell_util.C |
1899 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1899 | if (tmp->flag [FLAG_IS_FLOOR]) |
1900 | continue; |
1900 | continue; |
1901 | |
1901 | |
1902 | if (op->level > head->level) |
1902 | if (op->level > head->level) |
1903 | head->destroy (); |
1903 | head->destroy (); |
1904 | |
1904 | |
… | |
… | |
1933 | return 0; |
1933 | return 0; |
1934 | } |
1934 | } |
1935 | |
1935 | |
1936 | for (tmp = op->below; tmp; tmp = tmp->below) |
1936 | for (tmp = op->below; tmp; tmp = tmp->below) |
1937 | { |
1937 | { |
1938 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1938 | if (tmp->flag [FLAG_IS_FLOOR]) |
1939 | break; |
1939 | break; |
1940 | if (tmp->type == HOLY_ALTAR) |
1940 | if (tmp->type == HOLY_ALTAR) |
1941 | { |
1941 | { |
1942 | |
1942 | |
1943 | if (tmp->level > casting_level (caster, spell)) |
1943 | if (tmp->level > casting_level (caster, spell)) |
… | |
… | |
2036 | { |
2036 | { |
2037 | new_draw_info (NDI_UNIQUE, 0, op, "You need to wield a weapon to animate it."); |
2037 | new_draw_info (NDI_UNIQUE, 0, op, "You need to wield a weapon to animate it."); |
2038 | return 0; |
2038 | return 0; |
2039 | } |
2039 | } |
2040 | |
2040 | |
2041 | if (QUERY_FLAG (weapon, FLAG_APPLIED)) |
2041 | if (weapon->flag [FLAG_APPLIED]) |
2042 | { |
2042 | { |
2043 | new_draw_info_format (NDI_BLACK, 0, op, "You need to unequip %s before using it in this spell", query_name (weapon)); |
2043 | new_draw_info_format (NDI_BLACK, 0, op, "You need to unequip %s before using it in this spell", query_name (weapon)); |
2044 | return 0; |
2044 | return 0; |
2045 | } |
2045 | } |
2046 | |
2046 | |
… | |
… | |
2048 | |
2048 | |
2049 | /* create the golem object */ |
2049 | /* create the golem object */ |
2050 | tmp = spell->other_arch->instance (); |
2050 | tmp = spell->other_arch->instance (); |
2051 | |
2051 | |
2052 | /* if animated by a player, give the player control of the golem */ |
2052 | /* if animated by a player, give the player control of the golem */ |
2053 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2053 | tmp->clr_flag (FLAG_MONSTER); |
2054 | tmp->stats.exp = 0; |
2054 | tmp->stats.exp = 0; |
2055 | add_friendly_object (tmp); |
2055 | add_friendly_object (tmp); |
2056 | tmp->type = GOLEM; |
2056 | tmp->type = GOLEM; |
2057 | tmp->set_owner (op); |
2057 | tmp->set_owner (op); |
2058 | op->contr->golem = tmp; |
2058 | op->contr->golem = tmp; |
… | |
… | |
2060 | |
2060 | |
2061 | /* Give the weapon to the golem now. A bit of a hack to check the |
2061 | /* Give the weapon to the golem now. A bit of a hack to check the |
2062 | * removed flag - it should only be set if weapon->split was |
2062 | * removed flag - it should only be set if weapon->split was |
2063 | * used above. |
2063 | * used above. |
2064 | */ |
2064 | */ |
2065 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2065 | if (!weapon->flag [FLAG_REMOVED]) |
2066 | weapon->remove (); |
2066 | weapon->remove (); |
2067 | |
2067 | |
2068 | tmp->insert (weapon); |
2068 | tmp->insert (weapon); |
2069 | |
2069 | |
2070 | /* To do everything necessary to let a golem use the weapon is a pain, |
2070 | /* To do everything necessary to let a golem use the weapon is a pain, |
2071 | * so instead, just set it as equipped (otherwise, we need to update |
2071 | * so instead, just set it as equipped (otherwise, we need to update |
2072 | * body_info, skills, etc) |
2072 | * body_info, skills, etc) |
2073 | */ |
2073 | */ |
2074 | SET_FLAG (tmp, FLAG_USE_WEAPON); |
2074 | tmp->set_flag (FLAG_USE_WEAPON); |
2075 | SET_FLAG (weapon, FLAG_APPLIED); |
2075 | weapon->set_flag (FLAG_APPLIED); |
2076 | tmp->update_stats (); |
2076 | tmp->update_stats (); |
2077 | |
2077 | |
2078 | /* There used to be 'odd' code that basically seemed to take the absolute |
2078 | /* There used to be 'odd' code that basically seemed to take the absolute |
2079 | * value of the weapon->magic an use that. IMO, that doesn't make sense - |
2079 | * value of the weapon->magic an use that. IMO, that doesn't make sense - |
2080 | * if you're using a crappy weapon, it shouldn't be as good. |
2080 | * if you're using a crappy weapon, it shouldn't be as good. |
… | |
… | |
2284 | for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above) |
2284 | for (object *tmp = op->ms ().bot; tmp; tmp = tmp->above) |
2285 | { |
2285 | { |
2286 | int atk_lev, def_lev; |
2286 | int atk_lev, def_lev; |
2287 | object *victim = tmp->head_ (); |
2287 | object *victim = tmp->head_ (); |
2288 | |
2288 | |
2289 | if (!QUERY_FLAG (victim, FLAG_MONSTER)) |
2289 | if (!victim->flag [FLAG_MONSTER]) |
2290 | continue; |
2290 | continue; |
2291 | |
2291 | |
2292 | if (QUERY_FLAG (victim, FLAG_UNAGGRESSIVE)) |
2292 | if (victim->flag [FLAG_UNAGGRESSIVE]) |
2293 | continue; |
2293 | continue; |
2294 | |
2294 | |
2295 | if (victim->stats.exp == 0) |
2295 | if (victim->stats.exp == 0) |
2296 | continue; |
2296 | continue; |
2297 | |
2297 | |
… | |
… | |
2313 | victim->stats.sp = 0; |
2313 | victim->stats.sp = 0; |
2314 | victim->stats.grace = 0; |
2314 | victim->stats.grace = 0; |
2315 | victim->stats.Pow = 0; |
2315 | victim->stats.Pow = 0; |
2316 | #endif |
2316 | #endif |
2317 | victim->attack_movement = RANDO2; |
2317 | victim->attack_movement = RANDO2; |
2318 | SET_FLAG (victim, FLAG_UNAGGRESSIVE); |
2318 | victim->set_flag (FLAG_UNAGGRESSIVE); |
2319 | SET_FLAG (victim, FLAG_RUN_AWAY); |
2319 | victim->set_flag (FLAG_RUN_AWAY); |
2320 | SET_FLAG (victim, FLAG_RANDOM_MOVE); |
2320 | victim->set_flag (FLAG_RANDOM_MOVE); |
2321 | CLEAR_FLAG (victim, FLAG_MONSTER); |
2321 | victim->clr_flag (FLAG_MONSTER); |
2322 | |
2322 | |
2323 | if (victim->name) |
2323 | if (victim->name) |
2324 | new_draw_info_format (NDI_UNIQUE, 0, op->owner, "%s no longer feels like fighting.", &victim->name); |
2324 | new_draw_info_format (NDI_UNIQUE, 0, op->owner, "%s no longer feels like fighting.", &victim->name); |
2325 | } |
2325 | } |
2326 | } |
2326 | } |