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.28 by root, Sun Jul 1 05:00:20 2007 UTC vs.
Revision 1.29 by root, Mon Aug 27 03:56:17 2007 UTC

104 { 104 {
105 105
106 /* find a god based on race */ 106 /* find a god based on race */
107 if (!op->title) 107 if (!op->title)
108 { 108 {
109 if (op->race != NULL) 109 if (op->race)
110 { 110 {
111 godname = get_god_for_race (op->race); 111 godname = get_god_for_race (op->race);
112
112 if (godname != NULL) 113 if (godname)
113 {
114 op->title = godname; 114 op->title = godname;
115 }
116 } 115 }
117 } 116 }
118 117
119 /* find a random god */ 118 /* find a random god */
120 if (!op->title) 119 if (!op->title)
142 * that skill, once we find it, we can return, either with the 141 * that skill, once we find it, we can return, either with the
143 * title or "none". 142 * title or "none".
144 */ 143 */
145 if (op->type == PLAYER) 144 if (op->type == PLAYER)
146 { 145 {
147 object *tmp;
148
149 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 146 for (object *tmp = op->inv; tmp; tmp = tmp->below)
150 if (tmp->type == SKILL && tmp->subtype == SK_PRAYING) 147 if (tmp->type == SKILL && tmp->subtype == SK_PRAYING)
151 { 148 {
152 if (tmp->title) 149 if (tmp->title)
153 return (tmp->title); 150 return tmp->title;
154 else 151 else
155 return ("none"); 152 return "none";
156 } 153 }
157 } 154 }
155
158 return ("none"); 156 return "none";
159} 157}
160 158
161/** 159/**
162 * Returns 1 if s1 and s2 are the same - either both NULL, or strcmp( ) == 0 160 * Returns 1 if s1 and s2 are the same - either both NULL, or strcmp( ) == 0
163 */ 161 */
277 /* hmm. what happend depends on pl's current god, level, etc */ 275 /* hmm. what happend depends on pl's current god, level, etc */
278 if (!pl_god) 276 if (!pl_god)
279 { /*new convert */ 277 { /*new convert */
280 become_follower (pl, altar->other_arch); 278 become_follower (pl, altar->other_arch);
281 return; 279 return;
282
283 } 280 }
284 else if (!strcmp (&pl_god->name, altar->other_arch->object::name)) 281 else if (!strcmp (&pl_god->name, altar->other_arch->object::name))
285 { 282 {
286 /* pray at your gods altar */ 283 /* pray at your gods altar */
287 int bonus = (pl->stats.Wis + skill->level) / 10; 284 int bonus = (pl->stats.Wis + skill->level) / 10;
304 */ 301 */
305 bonus = MAX (1, bonus + MAX (pl->stats.luck, -3)); /* -- DAMN -- */ 302 bonus = MAX (1, bonus + MAX (pl->stats.luck, -3)); /* -- DAMN -- */
306 303
307 if (((random_roll (0, 399, pl, PREFER_LOW)) - bonus) < 0) 304 if (((random_roll (0, 399, pl, PREFER_LOW)) - bonus) < 0)
308 god_intervention (pl, pl_god, skill); 305 god_intervention (pl, pl_god, skill);
309
310 } 306 }
311 else 307 else
312 { /* praying to another god! */ 308 { /* praying to another god! */
313 uint64 loss = 0; 309 uint64 loss = 0;
314 int angry = 1; 310 int angry = 1;
804 } 800 }
805 801
806 return 0; 802 return 0;
807} 803}
808 804
809
810/** 805/**
811 * Every once in a while the god will intervene to help the worshiper. 806 * Every once in a while the god will intervene to help the worshiper.
812 * Later, this fctn can be used to supply quests, etc for the 807 * Later, this fctn can be used to supply quests, etc for the
813 * priest. -b.t. 808 * priest. -b.t.
814 * called from pray_at_altar() currently. 809 * called from pray_at_altar() currently.
815 */ 810 */
816
817void 811void
818god_intervention (object *op, object *god, object *skill) 812god_intervention (object *op, object *god, object *skill)
819{ 813{
820 treasure *tr; 814 treasure *tr;
821 815
829 823
830 /* lets do some checks of whether we are kosher with our god */ 824 /* lets do some checks of whether we are kosher with our god */
831 if (god_examines_priest (op, god) < 0) 825 if (god_examines_priest (op, god) < 0)
832 return; 826 return;
833 827
828 op->play_sound (sound_find ("god_intervention"));
834 new_draw_info (NDI_UNIQUE, 0, op, "You feel a holy presence!"); 829 new_draw_info (NDI_UNIQUE, 0, op, "You feel a holy presence!");
835 830
836 for (tr = god->randomitems->items; tr; tr = tr->next) 831 for (tr = god->randomitems->items; tr; tr = tr->next)
837 { 832 {
838 object *item; 833 object *item;
846 treasurelist *tl = treasurelist::find (tr->name); 841 treasurelist *tl = treasurelist::find (tr->name);
847 842
848 if (tl == NULL) 843 if (tl == NULL)
849 continue; 844 continue;
850 845
851 new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your " "eyes. You catch it before it falls to the ground."); 846 new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your eyes. You catch it before it falls to the ground.");
852 847
853 create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); 848 create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0);
854 return; 849 return;
855 } 850 }
856 851
872 tmp = get_archetype (HOLY_POSSESSION); 867 tmp = get_archetype (HOLY_POSSESSION);
873 cast_change_ability (op, op, tmp, 0, 1); 868 cast_change_ability (op, op, tmp, 0, 1);
874 tmp->destroy (); 869 tmp->destroy ();
875 return; 870 return;
876 } 871 }
872
877 continue; 873 continue;
878 } 874 }
879 875
880 /* Restore grace */ 876 /* Restore grace */
881 if (item->type == BOOK && item->invisible && strcmp (item->name, "restore grace") == 0) 877 if (item->type == BOOK && item->invisible && strcmp (item->name, "restore grace") == 0)
974 } 970 }
975 971
976 /* Voices */ 972 /* Voices */
977 if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0) 973 if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0)
978 { 974 {
979 new_draw_info (NDI_UNIQUE, 0, op, "You hear a voice from behind you, but you don't dare to " "turn around:"); 975 new_draw_info (NDI_UNIQUE, 0, op, "You hear a voice from behind you, but you don't dare to turn around:");
980 new_draw_info (NDI_WHITE, 0, op, item->msg); 976 new_draw_info (NDI_WHITE, 0, op, item->msg);
981 return; 977 return;
982 } 978 }
983 979
984 /* Messages */ 980 /* Messages */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines