1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
348 | |
348 | |
349 | /* May switch Gods, but its random chance based on our current level |
349 | /* May switch Gods, but its random chance based on our current level |
350 | * note it gets harder to swap gods the higher we get |
350 | * note it gets harder to swap gods the higher we get |
351 | */ |
351 | */ |
352 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
352 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
353 | { |
|
|
354 | become_follower (pl, &altar->other_arch->clone); |
353 | become_follower (pl, &altar->other_arch->clone); |
355 | } |
|
|
356 | else |
354 | else |
357 | { |
355 | { |
358 | /* toss this player off the altar. He can try again. */ |
356 | /* toss this player off the altar. He can try again. */ |
359 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
357 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
|
|
358 | pl->contr->fire_on = 0; |
|
|
359 | pl->speed_left = 1.f; |
360 | move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */ |
360 | move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */ |
361 | } |
361 | } |
362 | } |
362 | } |
363 | } |
363 | } |
364 | |
364 | |
… | |
… | |
401 | { |
401 | { |
402 | object *item; |
402 | object *item; |
403 | |
403 | |
404 | if (!tr->item) |
404 | if (!tr->item) |
405 | continue; |
405 | continue; |
|
|
406 | |
406 | item = &tr->item->clone; |
407 | item = &tr->item->clone; |
407 | |
408 | |
408 | /* Basically, see if the matching spell is granted by this god. */ |
409 | /* Basically, see if the matching spell is granted by this god. */ |
409 | |
410 | |
410 | if (tr->item->clone.type == SPELL && tr->item->clone.name == tmp->name) |
411 | if (tr->item->clone.type == SPELL && tr->item->clone.name == tmp->name) |
… | |
… | |
460 | } |
461 | } |
461 | } |
462 | } |
462 | |
463 | |
463 | /* remove any godgiven items from the old god */ |
464 | /* remove any godgiven items from the old god */ |
464 | if (old_god) |
465 | if (old_god) |
465 | { |
|
|
466 | for (tr = old_god->randomitems->items; tr != NULL; tr = tr->next) |
466 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
467 | { |
|
|
468 | if (tr->item && QUERY_FLAG (&tr->item->clone, FLAG_STARTEQUIP)) |
467 | if (tr->item && QUERY_FLAG (&tr->item->clone, FLAG_STARTEQUIP)) |
469 | follower_remove_similar_item (op, &tr->item->clone); |
468 | follower_remove_similar_item (op, &tr->item->clone); |
470 | } |
|
|
471 | } |
|
|
472 | |
469 | |
473 | if (!op || !new_god) |
470 | if (!op || !new_god) |
474 | return; |
471 | return; |
475 | |
472 | |
476 | if (op->race && new_god->slaying && strstr (op->race, new_god->slaying)) |
473 | if (op->race && new_god->slaying && strstr (op->race, new_god->slaying)) |
477 | { |
474 | { |
478 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "Fool! %s detests your kind!", &new_god->name); |
475 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "Fool! %s detests your kind!", &new_god->name); |
|
|
476 | |
479 | if (random_roll (0, op->level - 1, op, PREFER_LOW) - 5 > 0) |
477 | if (random_roll (0, op->level - 1, op, PREFER_LOW) - 5 > 0) |
480 | { |
478 | { |
481 | object *tmp = get_archetype (LOOSE_MANA); |
479 | object *tmp = get_archetype (LOOSE_MANA); |
482 | |
480 | |
483 | cast_magic_storm (op, tmp, new_god->level + 10); |
481 | cast_magic_storm (op, tmp, new_god->level + 10); |
484 | } |
482 | } |
|
|
483 | |
485 | return; |
484 | return; |
486 | } |
485 | } |
487 | |
486 | |
488 | |
487 | |
489 | /* give the player any special god-characteristic-items. */ |
488 | /* give the player any special god-characteristic-items. */ |
490 | for (tr = new_god->randomitems->items; tr != NULL; tr = tr->next) |
489 | for (tr = new_god->randomitems->items; tr; tr = tr->next) |
491 | { |
490 | { |
492 | if (tr->item && tr->item->clone.invisible && tr->item->clone.type != SPELLBOOK && |
491 | if (tr->item && tr->item->clone.invisible && tr->item->clone.type != SPELLBOOK |
493 | tr->item->clone.type != BOOK && tr->item->clone.type != SPELL) |
492 | && tr->item->clone.type != BOOK && tr->item->clone.type != SPELL) |
494 | god_gives_present (op, new_god, tr); |
493 | god_gives_present (op, new_god, tr); |
495 | } |
494 | } |
496 | |
495 | |
497 | |
496 | |
498 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name); |
497 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name); |
… | |
… | |
681 | { |
680 | { |
682 | LOG (llevError, "BUG: determine_holy_arch(): no god or god without " "randomitems\n"); |
681 | LOG (llevError, "BUG: determine_holy_arch(): no god or god without " "randomitems\n"); |
683 | return NULL; |
682 | return NULL; |
684 | } |
683 | } |
685 | |
684 | |
686 | for (tr = god->randomitems->items; tr != NULL; tr = tr->next) |
685 | for (tr = god->randomitems->items; tr; tr = tr->next) |
687 | { |
686 | { |
688 | object *item; |
|
|
689 | |
|
|
690 | if (!tr->item) |
687 | if (!tr->item) |
691 | continue; |
688 | continue; |
692 | |
689 | |
693 | item = &tr->item->clone; |
690 | object *item = &tr->item->clone; |
694 | |
691 | |
695 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
692 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
696 | return item->other_arch; |
693 | return item->other_arch; |
697 | } |
694 | } |
698 | return NULL; |
695 | return NULL; |
… | |
… | |
740 | |
737 | |
741 | if (level <= 20) |
738 | if (level <= 20) |
742 | return level / difficulty; |
739 | return level / difficulty; |
743 | if (level <= 40) |
740 | if (level <= 40) |
744 | return (20 + (level - 20) / 2) / difficulty; |
741 | return (20 + (level - 20) / 2) / difficulty; |
|
|
742 | |
745 | return (30 + (level - 40) / 4) / difficulty; |
743 | return (30 + (level - 40) / 4) / difficulty; |
746 | } |
744 | } |
747 | |
745 | |
748 | /** |
746 | /** |
749 | * God wants to enchant weapon. |
747 | * God wants to enchant weapon. |
… | |
… | |
760 | int tmp; |
758 | int tmp; |
761 | |
759 | |
762 | for (weapon = op->inv; weapon; weapon = weapon->below) |
760 | for (weapon = op->inv; weapon; weapon = weapon->below) |
763 | if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED)) |
761 | if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED)) |
764 | break; |
762 | break; |
|
|
763 | |
765 | if (weapon == NULL || god_examines_item (god, weapon) <= 0) |
764 | if (weapon == NULL || god_examines_item (god, weapon) <= 0) |
766 | return 0; |
765 | return 0; |
767 | |
766 | |
768 | /* First give it a title, so other gods won't touch it */ |
767 | /* First give it a title, so other gods won't touch it */ |
769 | if (!weapon->title) |
768 | if (!weapon->title) |
… | |
… | |
831 | if (god_examines_priest (op, god) < 0) |
830 | if (god_examines_priest (op, god) < 0) |
832 | return; |
831 | return; |
833 | |
832 | |
834 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a holy presence!"); |
833 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a holy presence!"); |
835 | |
834 | |
836 | for (tr = god->randomitems->items; tr != NULL; tr = tr->next) |
835 | for (tr = god->randomitems->items; tr; tr = tr->next) |
837 | { |
836 | { |
838 | object *item; |
837 | object *item; |
839 | |
838 | |
840 | if (tr->chance <= random_roll (0, 99, op, PREFER_HIGH)) |
839 | if (tr->chance <= random_roll (0, 99, op, PREFER_HIGH)) |
841 | continue; |
840 | continue; |
842 | |
841 | |
843 | /* Treasurelist - generate some treasure for the follower */ |
842 | /* Treasurelist - generate some treasure for the follower */ |
844 | if (tr->name) |
843 | if (tr->name) |
845 | { |
844 | { |
846 | treasurelist *tl = find_treasurelist (tr->name); |
845 | treasurelist *tl = treasurelist::find (tr->name); |
847 | |
846 | |
848 | if (tl == NULL) |
847 | if (tl == NULL) |
849 | continue; |
848 | continue; |
850 | |
849 | |
851 | new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your " "eyes. You catch it before it falls to the ground."); |
850 | new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your " "eyes. You catch it before it falls to the ground."); |
… | |
… | |
963 | continue; |
962 | continue; |
964 | |
963 | |
965 | new_draw_info (NDI_UNIQUE, 0, op, "Shimmering light surrounds and restores you!"); |
964 | new_draw_info (NDI_UNIQUE, 0, op, "Shimmering light surrounds and restores you!"); |
966 | |
965 | |
967 | for (i = 0; i < NUM_STATS; i++) |
966 | for (i = 0; i < NUM_STATS; i++) |
968 | if (get_attr_value (&depl->stats, i)) |
967 | if (depl->stats.stat (i)) |
969 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
968 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
970 | |
969 | |
971 | depl->destroy (); |
970 | depl->destroy (); |
972 | op->update_stats (); |
971 | op->update_stats (); |
973 | return; |
972 | return; |