… | |
… | |
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 | |