… | |
… | |
461 | |
461 | |
462 | void |
462 | void |
463 | execute_word_of_recall (object *op) |
463 | execute_word_of_recall (object *op) |
464 | { |
464 | { |
465 | if (object *pl = op->in_player ()) |
465 | if (object *pl = op->in_player ()) |
466 | { |
|
|
467 | if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) |
466 | if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) |
468 | 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."); |
469 | else |
468 | else |
470 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
469 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
471 | } |
|
|
472 | |
470 | |
473 | op->destroy (); |
471 | op->destroy (); |
474 | } |
472 | } |
475 | |
473 | |
476 | /* Word of recall causes the player to return 'home'. |
474 | /* Word of recall causes the player to return 'home'. |
… | |
… | |
478 | * time delay effect. |
476 | * time delay effect. |
479 | */ |
477 | */ |
480 | int |
478 | int |
481 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
479 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
482 | { |
480 | { |
483 | object *dummy; |
481 | if (!op->is_player ()) |
484 | int time; |
|
|
485 | |
|
|
486 | if (op->type != PLAYER) |
|
|
487 | return 0; |
482 | return 0; |
488 | |
483 | |
489 | if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL)) |
484 | if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL)) |
490 | { |
485 | { |
491 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
486 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
492 | return 1; |
487 | return 1; |
493 | } |
488 | } |
494 | |
489 | |
495 | dummy = get_archetype (FORCE_NAME); |
490 | object *dummy = get_archetype (FORCE_NAME); |
496 | |
491 | |
497 | if (!dummy) |
|
|
498 | { |
|
|
499 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
|
|
500 | LOG (llevError, "cast_word_of_recall: get_archetype(force) failed!\n"); |
|
|
501 | return 0; |
|
|
502 | } |
|
|
503 | |
|
|
504 | time = spell_ob->duration - SP_level_duration_adjust (caster, spell_ob); |
492 | int time = max (1, spell_ob->duration - SP_level_duration_adjust (caster, spell_ob)); |
505 | if (time < 1) |
|
|
506 | time = 1; |
|
|
507 | |
493 | |
508 | /* value of speed really doesn't make much difference, as long as it is |
494 | /* value of speed really doesn't make much difference, as long as it is |
509 | * positive. Lower value may be useful so that the problem doesn't |
495 | * positive. Lower value may be useful so that the problem doesn't |
510 | * do anything really odd if it say a -1000 or something. |
496 | * do anything really odd if it say a -1000 or something. |
511 | */ |
497 | */ |
512 | dummy->set_speed (0.002); |
498 | dummy->set_speed (0.002); |
513 | dummy->speed_left = -dummy->speed * time; |
499 | dummy->speed_left = -dummy->speed * time; |
514 | dummy->type = SPELL_EFFECT; |
500 | dummy->type = SPELL_EFFECT; |
515 | dummy->subtype = SP_WORD_OF_RECALL; |
501 | dummy->subtype = SP_WORD_OF_RECALL; |
516 | |
502 | dummy->slaying = op->contr->savebed_map; |
517 | /* If we could take advantage of enter_player_savebed() here, it would be |
503 | dummy->stats.hp = op->contr->bed_x; |
518 | * nice, but until the map load fails, we can't. |
504 | dummy->stats.sp = op->contr->bed_y; |
519 | */ |
|
|
520 | EXIT_PATH (dummy) = op->contr->savebed_map; |
|
|
521 | EXIT_X (dummy) = op->contr->bed_x; |
|
|
522 | EXIT_Y (dummy) = op->contr->bed_y; |
|
|
523 | |
505 | |
524 | op->insert (dummy); |
506 | op->insert (dummy); |
525 | |
507 | |
526 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
508 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
527 | |
509 | |
… | |
… | |
1616 | * difficult to see what object is magical/cursed, so the |
1598 | * difficult to see what object is magical/cursed, so the |
1617 | * effect wouldn't be as apparent. |
1599 | * effect wouldn't be as apparent. |
1618 | */ |
1600 | */ |
1619 | |
1601 | |
1620 | /* detect magic */ |
1602 | /* detect magic */ |
1621 | if (spell->flag [FLAG_KNOWN_MAGICAL] && |
1603 | if (spell->flag [FLAG_KNOWN_MAGICAL] |
1622 | !tmp->flag [FLAG_KNOWN_MAGICAL] && !tmp->flag [FLAG_IDENTIFIED] && is_magical (tmp)) |
1604 | && !tmp->flag [FLAG_KNOWN_MAGICAL] |
|
|
1605 | && !tmp->flag [FLAG_IDENTIFIED] |
|
|
1606 | && tmp->need_identify () |
|
|
1607 | && is_magical (tmp)) |
1623 | { |
1608 | { |
1624 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1609 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1625 | /* make runes more visible */ |
1610 | /* make runes more visible */ |
1626 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1611 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1627 | tmp->stats.Cha /= 4; |
1612 | tmp->stats.Cha /= 4; |
… | |
… | |
1650 | |
1635 | |
1651 | if (!detect) |
1636 | if (!detect) |
1652 | detect = tmp; |
1637 | detect = tmp; |
1653 | } |
1638 | } |
1654 | |
1639 | |
1655 | if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && |
1640 | if (spell->flag [FLAG_KNOWN_CURSED] |
|
|
1641 | && !tmp->flag [FLAG_KNOWN_CURSED] |
|
|
1642 | && tmp->need_identify () |
1656 | (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1643 | && (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1657 | { |
1644 | { |
1658 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1645 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1659 | done_one = 1; |
1646 | done_one = 1; |
1660 | } |
1647 | } |
1661 | |
1648 | |