ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/gods.C
(Generate patch)

Comparing deliantra/server/server/gods.C (file contents):
Revision 1.16 by elmex, Wed Jan 3 02:30:52 2007 UTC vs.
Revision 1.21 by root, Sat May 12 18:14:48 2007 UTC

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) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 11 * (at your option) any later version.
11 12 *
12 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 21 *
21 The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail at <crossfire@schmorp.de>
22*/ 23 */
23 24
24 25
25/* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and 26/* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and
26 * monster race initialization. b.t. 27 * monster race initialization. b.t.
27 */ 28 */
400 { 401 {
401 object *item; 402 object *item;
402 403
403 if (!tr->item) 404 if (!tr->item)
404 continue; 405 continue;
406
405 item = &tr->item->clone; 407 item = &tr->item->clone;
406 408
407 /* Basically, see if the matching spell is granted by this god. */ 409 /* Basically, see if the matching spell is granted by this god. */
408 410
409 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)
459 } 461 }
460 } 462 }
461 463
462 /* remove any godgiven items from the old god */ 464 /* remove any godgiven items from the old god */
463 if (old_god) 465 if (old_god)
464 {
465 for (tr = old_god->randomitems->items; tr != NULL; tr = tr->next) 466 for (tr = old_god->randomitems->items; tr; tr = tr->next)
466 {
467 if (tr->item && QUERY_FLAG (&tr->item->clone, FLAG_STARTEQUIP)) 467 if (tr->item && QUERY_FLAG (&tr->item->clone, FLAG_STARTEQUIP))
468 follower_remove_similar_item (op, &tr->item->clone); 468 follower_remove_similar_item (op, &tr->item->clone);
469 }
470 }
471 469
472 if (!op || !new_god) 470 if (!op || !new_god)
473 return; 471 return;
474 472
475 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))
476 { 474 {
477 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
478 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)
479 { 478 {
480 object *tmp = get_archetype (LOOSE_MANA); 479 object *tmp = get_archetype (LOOSE_MANA);
481 480
482 cast_magic_storm (op, tmp, new_god->level + 10); 481 cast_magic_storm (op, tmp, new_god->level + 10);
483 } 482 }
483
484 return; 484 return;
485 } 485 }
486 486
487 487
488 /* give the player any special god-characteristic-items. */ 488 /* give the player any special god-characteristic-items. */
489 for (tr = new_god->randomitems->items; tr != NULL; tr = tr->next) 489 for (tr = new_god->randomitems->items; tr; tr = tr->next)
490 { 490 {
491 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
492 tr->item->clone.type != BOOK && tr->item->clone.type != SPELL) 492 && tr->item->clone.type != BOOK && tr->item->clone.type != SPELL)
493 god_gives_present (op, new_god, tr); 493 god_gives_present (op, new_god, tr);
494 } 494 }
495 495
496 496
497 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);
680 { 680 {
681 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");
682 return NULL; 682 return NULL;
683 } 683 }
684 684
685 for (tr = god->randomitems->items; tr != NULL; tr = tr->next) 685 for (tr = god->randomitems->items; tr; tr = tr->next)
686 { 686 {
687 object *item;
688
689 if (!tr->item) 687 if (!tr->item)
690 continue; 688 continue;
691 689
692 item = &tr->item->clone; 690 object *item = &tr->item->clone;
693 691
694 if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) 692 if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0)
695 return item->other_arch; 693 return item->other_arch;
696 } 694 }
697 return NULL; 695 return NULL;
739 737
740 if (level <= 20) 738 if (level <= 20)
741 return level / difficulty; 739 return level / difficulty;
742 if (level <= 40) 740 if (level <= 40)
743 return (20 + (level - 20) / 2) / difficulty; 741 return (20 + (level - 20) / 2) / difficulty;
742
744 return (30 + (level - 40) / 4) / difficulty; 743 return (30 + (level - 40) / 4) / difficulty;
745} 744}
746 745
747/** 746/**
748 * God wants to enchant weapon. 747 * God wants to enchant weapon.
759 int tmp; 758 int tmp;
760 759
761 for (weapon = op->inv; weapon; weapon = weapon->below) 760 for (weapon = op->inv; weapon; weapon = weapon->below)
762 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))
763 break; 762 break;
763
764 if (weapon == NULL || god_examines_item (god, weapon) <= 0) 764 if (weapon == NULL || god_examines_item (god, weapon) <= 0)
765 return 0; 765 return 0;
766 766
767 /* 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 */
768 if (!weapon->title) 768 if (!weapon->title)
830 if (god_examines_priest (op, god) < 0) 830 if (god_examines_priest (op, god) < 0)
831 return; 831 return;
832 832
833 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!");
834 834
835 for (tr = god->randomitems->items; tr != NULL; tr = tr->next) 835 for (tr = god->randomitems->items; tr; tr = tr->next)
836 { 836 {
837 object *item; 837 object *item;
838 838
839 if (tr->chance <= random_roll (0, 99, op, PREFER_HIGH)) 839 if (tr->chance <= random_roll (0, 99, op, PREFER_HIGH))
840 continue; 840 continue;
841 841
842 /* Treasurelist - generate some treasure for the follower */ 842 /* Treasurelist - generate some treasure for the follower */
843 if (tr->name) 843 if (tr->name)
844 { 844 {
845 treasurelist *tl = find_treasurelist (tr->name); 845 treasurelist *tl = treasurelist::find (tr->name);
846 846
847 if (tl == NULL) 847 if (tl == NULL)
848 continue; 848 continue;
849 849
850 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.");
962 continue; 962 continue;
963 963
964 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!");
965 965
966 for (i = 0; i < NUM_STATS; i++) 966 for (i = 0; i < NUM_STATS; i++)
967 if (get_attr_value (&depl->stats, i)) 967 if (depl->stats.stat (i))
968 new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); 968 new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]);
969 969
970 depl->destroy (); 970 depl->destroy ();
971 op->update_stats (); 971 op->update_stats ();
972 return; 972 return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines