… | |
… | |
425 | /* earth to dust spell. Basically destroys earthwalls in the area. |
425 | /* earth to dust spell. Basically destroys earthwalls in the area. |
426 | */ |
426 | */ |
427 | int |
427 | int |
428 | cast_earth_to_dust (object *op, object *caster, object *spell_ob) |
428 | cast_earth_to_dust (object *op, object *caster, object *spell_ob) |
429 | { |
429 | { |
430 | object *tmp, *next; |
|
|
431 | int range, i, j, mflags; |
430 | int range, i, j, mflags; |
432 | sint16 sx, sy; |
431 | sint16 sx, sy; |
433 | maptile *m; |
432 | maptile *m; |
434 | |
|
|
435 | if (op->type != PLAYER) |
|
|
436 | return 0; |
|
|
437 | |
433 | |
438 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
434 | range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); |
439 | |
435 | |
440 | for (i = -range; i <= range; i++) |
436 | for (i = -range; i <= range; i++) |
441 | for (j = -range; j <= range; j++) |
437 | for (j = -range; j <= range; j++) |
… | |
… | |
446 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
442 | mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); |
447 | |
443 | |
448 | if (mflags & P_OUT_OF_MAP) |
444 | if (mflags & P_OUT_OF_MAP) |
449 | continue; |
445 | continue; |
450 | |
446 | |
451 | // earth to dust tears down everything that can be teared down |
447 | // earth to dust tears down everything that can be torn down |
452 | for (tmp = GET_MAP_OB (m, sx, sy); tmp != NULL; tmp = next) |
448 | for (object *next, *tmp = m->at (sx, sy).bot; tmp; tmp = next) |
453 | { |
449 | { |
454 | next = tmp->above; |
450 | next = tmp->above; |
|
|
451 | |
455 | if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) |
452 | if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) |
456 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
453 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
457 | } |
454 | } |
458 | } |
455 | } |
459 | |
456 | |
… | |
… | |
569 | perceive_self (object *op) |
566 | perceive_self (object *op) |
570 | { |
567 | { |
571 | const char *cp = describe_item (op, op); |
568 | const char *cp = describe_item (op, op); |
572 | archetype *at = archetype::find (ARCH_DEPLETION); |
569 | archetype *at = archetype::find (ARCH_DEPLETION); |
573 | |
570 | |
574 | dynbuf_text buf; |
571 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
575 | |
572 | |
576 | if (player *pl = op->contr) |
573 | if (!op->is_player ()) |
|
|
574 | return 0; |
|
|
575 | |
577 | if (object *race = archetype::find (op->race)) |
576 | if (object *race = archetype::find (op->race)) |
578 | buf << " - You are a G<male|female> " << &race->name << ".\n"; |
577 | buf << " - You are a G<male|female> " << &race->name << ".\n"; |
579 | |
578 | |
580 | if (object *god = find_god (determine_god (op))) |
579 | if (object *god = find_god (determine_god (op))) |
581 | buf << " - You worship " << &god->name << ".\n"; |
580 | buf << " - You worship " << &god->name << ".\n"; |
582 | else |
581 | else |
583 | buf << " - You worship no god.\n"; |
582 | buf << " - You worship no god.\n"; |
… | |
… | |
609 | |
608 | |
610 | break; |
609 | break; |
611 | } |
610 | } |
612 | } |
611 | } |
613 | |
612 | |
614 | buf << '\0'; // zero-terminate |
613 | op->contr->infobox (MSG_CHANNEL ("perceiveself"), buf); |
615 | |
|
|
616 | new_draw_info (NDI_UNIQUE, 0, op, buf.linearise ()); |
|
|
617 | |
614 | |
618 | return 1; |
615 | return 1; |
619 | } |
616 | } |
620 | |
617 | |
621 | /* This creates magic walls. Really, it can create most any object, |
618 | /* This creates magic walls. Really, it can create most any object, |
… | |
… | |
1463 | |
1460 | |
1464 | /* Identifies objects in the players inventory/on the ground */ |
1461 | /* Identifies objects in the players inventory/on the ground */ |
1465 | int |
1462 | int |
1466 | cast_identify (object *op, object *caster, object *spell) |
1463 | cast_identify (object *op, object *caster, object *spell) |
1467 | { |
1464 | { |
1468 | dynbuf_text buf; |
|
|
1469 | object *tmp; |
1465 | object *tmp; |
|
|
1466 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1470 | |
1467 | |
1471 | int num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1468 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1472 | |
|
|
1473 | if (num_ident < 1) |
|
|
1474 | num_ident = 1; |
|
|
1475 | |
1469 | |
1476 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1470 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1477 | { |
1471 | { |
1478 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1472 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1479 | { |
1473 | { |
… | |
… | |
1485 | |
1479 | |
1486 | if (tmp->msg) |
1480 | if (tmp->msg) |
1487 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1481 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1488 | } |
1482 | } |
1489 | |
1483 | |
1490 | num_ident--; |
|
|
1491 | if (!num_ident) |
1484 | if (!--num_ident) |
1492 | break; |
1485 | break; |
1493 | } |
1486 | } |
1494 | } |
1487 | } |
1495 | |
1488 | |
1496 | /* If all the power of the spell has been used up, don't go and identify |
1489 | /* If all the power of the spell has been used up, don't go and identify |
… | |
… | |
1510 | |
1503 | |
1511 | if (tmp->msg) |
1504 | if (tmp->msg) |
1512 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1505 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1513 | } |
1506 | } |
1514 | |
1507 | |
1515 | num_ident--; |
|
|
1516 | if (!num_ident) |
1508 | if (!--num_ident) |
1517 | break; |
1509 | break; |
1518 | } |
1510 | } |
1519 | } |
1511 | } |
1520 | |
1512 | |
1521 | if (buf.empty ()) |
1513 | if (buf.empty ()) |