Crossfire Server, Branches 1.12  R18729
gods.c
Go to the documentation of this file.
1 /*
2  * static char *rcsid_gods_c =
3  * "$Id: gods.c 14477 2011-05-21 17:59:50Z ryo_saeba $";
4  */
5 
6 /*
7  CrossFire, A Multiplayer game for X-windows
8 
9  Copyright (C) 2006 Mark Wedel & Crossfire Development Team
10  Copyright (C) 1992 Frank Tore Johansen
11 
12  This program is free software; you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 2 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 
26  The authors can be reached via e-mail at crossfire-devel@real-time.com
27 */
28 
39 #include <global.h>
40 #include <living.h>
41 #include <object.h>
42 #include <spells.h>
43 #include <sounds.h>
44 #ifndef __CEXTRACT__
45 #include <sproto.h>
46 #endif
47 
48 static int worship_forbids_use(object *op, object *exp_obj, uint32 flag, const char *string);
49 static void stop_using_item(object *op, int type, int number);
50 static void update_priest_flag(const object *god, object *exp_ob, uint32 flag);
51 static void god_intervention(object *op, const object *god, object *skill);
52 static int god_examines_priest(object *op, const object *god);
53 static int god_examines_item(const object *god, object *item);
54 static const char *get_god_for_race(const char *race);
55 
66 static int lookup_god_by_name(const char *name) {
67  int godnr = -1;
68  size_t nmlen = strlen(name);
69 
70  if (name && strcmp(name, "none")) {
71  godlink *gl;
72  for (gl = first_god; gl; gl = gl->next)
73  if (!strncmp(name, gl->name, MIN(strlen(gl->name), nmlen)))
74  break;
75  if (gl)
76  godnr = gl->id;
77  }
78  return godnr;
79 }
80 
92 const object *find_god(const char *name) {
93  godlink *gl;
94 
95  if (!name)
96  return NULL;
97 
98  for (gl = first_god; gl; gl = gl->next) {
99  if (!strcmp(name, gl->name))
100  return pntr_to_god_obj(gl);
101  }
102 
103  return NULL;
104 }
105 
118 const char *determine_god(object *op) {
119  int godnr = -1;
120  const char *godname;
121 
122  /* spells */
123  if ((op->type == SPELL || op->type == SPELL_EFFECT)
124  && op->title) {
125  if (lookup_god_by_name(op->title) >= 0)
126  return op->title;
127  }
128 
129  if (op->type != PLAYER && QUERY_FLAG(op, FLAG_ALIVE)) {
130  /* find a god based on race */
131  if (!op->title) {
132  if (op->race != NULL) {
133  godname = get_god_for_race(op->race);
134  if (godname != NULL) {
135  op->title = add_string(godname);
136  }
137  }
138  }
139 
140  /* find a random god */
141  if (!op->title) {
142  godlink *gl = first_god;
143 
144  godnr = rndm(1, gl->id);
145  while (gl) {
146  if (gl->id == godnr)
147  break;
148  gl = gl->next;
149  }
150  op->title = add_string(gl->name);
151  }
152 
153  return op->title;
154  }
155 
156  /* The god the player worships is in the praying skill (native skill
157  * not skill tool). Since a player can only have one instance of
158  * that skill, once we find it, we can return, either with the
159  * title or "none".
160  */
161  if (op->type == PLAYER) {
162  object *tmp;
163 
164  for (tmp = op->inv; tmp != NULL; tmp = tmp->below)
165  if (tmp->type == SKILL && tmp->subtype == SK_PRAYING) {
166  if (tmp->title)
167  return (tmp->title);
168  else
169  return("none");
170  }
171  }
172  return ("none");
173 }
174 
183 static int same_string(const char *s1, const char *s2) {
184  if (s1 == NULL)
185  if (s2 == NULL)
186  return 1;
187  else
188  return 0;
189  else
190  if (s2 == NULL)
191  return 0;
192  else
193  return strcmp(s1, s2) == 0;
194 }
195 
211 static void follower_remove_given_items(object *pl, object *op, const object *god) {
212  object *tmp, *next;
213  const char *given_by;
214 
215  /* search the inventory */
216  for (tmp = op->inv; tmp != NULL; tmp = next) {
217  next = tmp->below; /* backup in case we remove tmp */
218 
219  given_by = get_ob_key_value(tmp, "divine_giver_name");
220  if (given_by == god->name) {
221  char name[HUGE_BUF];
222 
223  query_short_name(tmp, name, HUGE_BUF);
224  /* Send the client a message. */
225  if (tmp->nrof > 1)
227  "The %s crumble to dust!",
228  "The %s crumble to dust!",
229  name);
230  else
232  "The %s crumbles to dust!",
233  "The %s crumbles to dust!",
234  name);
235 
236  remove_ob(tmp); /* remove obj from players inv. */
237  free_object(tmp);
238  } else if (tmp->inv)
239  follower_remove_given_items(pl, tmp, god);
240  }
241 }
242 
252 static int follower_has_similar_item(object *op, object *item) {
253  object *tmp;
254 
255  for (tmp = op->inv; tmp != NULL; tmp = tmp->below) {
256  if (tmp->type == item->type
257  && same_string(tmp->name, item->name)
258  && same_string(tmp->title, item->title)
259  && same_string(tmp->msg, item->msg)
260  && same_string(tmp->slaying, item->slaying))
261  return 1;
262  if (tmp->inv && follower_has_similar_item(tmp, item))
263  return 1;
264  }
265  return 0;
266 }
267 
280 static int god_gives_present(object *op, const object *god, treasure *tr) {
281  object *tmp;
282  char name[HUGE_BUF];
283 
284  if (follower_has_similar_item(op, &tr->item->clone))
285  return 0;
286 
287  tmp = arch_to_object(tr->item);
288 
289  /*
290  * Give inventory if needed, for instance Lythander's pipe.
291  * Use high level and magic so something IS put in inventory.
292  */
293  fix_generated_item(tmp, NULL, 120, 120, GT_ONLY_GOOD);
294 
295  /* And just in case nothing was put and something is needed, bail out. */
296  if ((tmp->type == ROD || tmp->type == WAND) && (tmp->inv == NULL)) {
297  free_object2(tmp, 0);
298  return 0;
299  }
300 
301  query_short_name(tmp, name, HUGE_BUF);
303  "%s lets %s appear in your hands.",
304  NULL,
305  god->name, name);
309  set_ob_key_value(tmp, "divine_giver_name", god->name, TRUE);
310  insert_ob_in_ob(tmp, op);
311  return 1;
312 }
313 
325 void pray_at_altar(object *pl, object *altar, object *skill) {
326  const object *pl_god = find_god(determine_god(pl));
327 
328  /* Lauwenmark: Handle for plugin altar-praying (apply) event */
329  if (execute_event(altar, EVENT_APPLY, pl, NULL, NULL, SCRIPT_FIX_ALL) != 0)
330  return;
331 
332  /* If non consecrate altar, don't do anything */
333  if (!altar->other_arch)
334  return;
335 
336  /* hmm. what happend depends on pl's current god, level, etc */
337  if (!pl_god) { /*new convert */
338  become_follower(pl, &altar->other_arch->clone);
339  return;
340 
341  } else if (!strcmp(pl_god->name, altar->other_arch->clone.name)) {
342  /* pray at your gods altar */
343  int bonus = (pl->stats.Wis+skill->level)/10;
344 
345  /* we can get neg grace up faster */
346  if (pl->stats.grace < 0)
347  pl->stats.grace += (bonus > -1*(pl->stats.grace/10) ? bonus : -1*(pl->stats.grace/10));
348  /* we can super-charge grace to 2x max */
349  if (pl->stats.grace < (2*pl->stats.maxgrace)) {
350  pl->stats.grace += bonus/2;
351  }
352  if (pl->stats.grace > (2*pl->stats.maxgrace)) {
353  pl->stats.grace = (2*pl->stats.maxgrace);
354  }
355 
356  /* Every once in a while, the god decides to checkup on their
357  * follower, and may intervene to help them out.
358  */
359  bonus = MAX(1, bonus+MAX(pl->stats.luck, -3)); /* -- DAMN -- */
360 
361  if (((random_roll(0, 399, pl, PREFER_LOW))-bonus) < 0)
362  god_intervention(pl, pl_god, skill);
363 
364  } else { /* praying to another god! */
365  uint64 loss = 0;
366  int angry = 1;
367 
368  /* I believe the logic for detecting opposing gods was completely
369  * broken - I think it should work now. altar->other_arch
370  * points to the god of this altar (which we have
371  * already verified is non null). pl_god->other_arch
372  * is the opposing god - we need to verify that exists before
373  * using its values.
374  */
375  if (pl_god->other_arch
376  && (altar->other_arch->name == pl_god->other_arch->name)) {
377  angry = 2;
378  if (random_roll(0, skill->level+2, pl, PREFER_LOW)-5 > 0) {
379  object *tmp;
380 
381  /* you really screwed up */
382  angry = 3;
384  "Foul Priest! %s punishes you!",
385  "Foul Priest! %s punishes you!",
386  pl_god->name);
388  cast_magic_storm(pl, tmp, pl_god->level+20);
389  } else
391  "Foolish heretic! %s is livid!",
392  "Foolish heretic! %s is livid!",
393  pl_god->name);
394  } else
396  "Heretic! %s is angered!",
397  "Heretic! %s is angered!",
398  pl_god->name);
399 
400  /* whether we will be successfull in defecting or not -
401  * we lose experience from the clerical experience obj
402  */
403 
404  loss = angry*(skill->stats.exp/10);
405  if (loss)
406  change_exp(pl, -random_roll64(0, loss, pl, PREFER_LOW), skill ? skill->skill : "none", SK_SUBTRACT_SKILL_EXP);
407 
408  /* May switch Gods, but its random chance based on our current level
409  * note it gets harder to swap gods the higher we get
410  */
411  if ((angry == 1) && !(random_roll(0, skill->level, pl, PREFER_LOW))) {
412  become_follower(pl, &altar->other_arch->clone);
413  } else {
414  /* toss this player off the altar. He can try again. */
416  "A divine force pushes you off the altar.", NULL);
417 
418  move_player(pl, absdir(pl->facing+4)); /* back him off the way he came. */
419  }
420  }
421 }
422 
431 static void check_special_prayers(object *op, const object *god) {
432  /* Ensure that 'op' doesn't know any special prayers that are not granted
433  * by 'god'.
434  */
435  treasure *tr;
436  object *tmp, *next_tmp;
437  int remove = 0;
438 
439  /* Outer loop iterates over all special prayer marks */
440  for (tmp = op->inv; tmp; tmp = next_tmp) {
441  next_tmp = tmp->below;
442 
443  /* we mark special prayers with the STARTEQUIP flag, so if it isn't
444  * in that category, not something we need to worry about.
445  */
446  if (tmp->type != SPELL || !QUERY_FLAG(tmp, FLAG_STARTEQUIP))
447  continue;
448 
449  if (god->randomitems == NULL) {
450  LOG(llevError, "BUG: check_special_prayers(): god %s without randomitems\n", god->name);
451  do_forget_spell(op, tmp->name);
452  continue;
453  }
454 
455  /* Inner loop tries to find the special prayer in the god's treasure
456  * list. We default that the spell should be removed.
457  */
458  remove = 1;
459  for (tr = god->randomitems->items; tr; tr = tr->next) {
460  object *item;
461 
462  if (tr->item == NULL)
463  continue;
464  item = &tr->item->clone;
465 
466  /* Basically, see if the matching spell is granted by this god. */
467 
468  if (tr->item->clone.type == SPELL && tr->item->clone.name == tmp->name) {
469  remove = 0;
470  break;
471  }
472  }
473  if (remove) {
474  /* just do the work of removing the spell ourselves - we already
475  * know that the player knows the spell
476  */
479  "You lose knowledge of %s.",
480  "You lose knowledge of %s.",
481  tmp->name);
482  player_unready_range_ob(op->contr, tmp);
483  remove_ob(tmp);
484  free_object(tmp);
485  }
486 
487  }
488 }
489 
502 void become_follower(object *op, const object *new_god) {
503  const object *old_god = NULL; /* old god */
504  treasure *tr;
505  object *item, *skop, *next;
506  int i, sk_applied;
507  int undeadified = 0; /* Turns to true if changing god can changes the undead
508  * status of the player.*/
509  old_god = find_god(determine_god(op));
510 
511  /* take away any special god-characteristic items. */
512  for (item = op->inv; item != NULL; item = next) {
513  next = item->below;
514  /* remove all invisible startequip items which are
515  * not skill, exp or force
516  */
517  if (QUERY_FLAG(item, FLAG_STARTEQUIP)
518  && item->invisible
519  && (item->type != SKILL)
520  && (item->type != EXPERIENCE)
521  && (item->type != FORCE)) {
522  if (item->type == SPELL)
524  "You lose knowledge of %s.",
525  "You lose knowledge of %s.",
526  item->name);
527  player_unready_range_ob(op->contr, item);
528  remove_ob(item);
529  free_object(item);
530  }
531  }
532 
533  /* remove any items given by the old god */
534  if (old_god) {
535  /* Changed to use the new "divine_giver_name" key_value
536  * so it can reliably delete enchanted items. Now it loops
537  * through the player's inventory, instead of the god's
538  * treasure list.
539  */
540  follower_remove_given_items(op, op, old_god);
541  }
542 
543  if (!op || !new_god)
544  return;
545 
546  if (op->race && new_god->slaying && strstr(op->race, new_god->slaying)) {
548  "Fool! %s detests your kind!",
549  "Fool! %s detests your kind!",
550  new_god->name);
551  if (random_roll(0, op->level-1, op, PREFER_LOW)-5 > 0) {
552  object *tmp = create_archetype(LOOSE_MANA);
553  cast_magic_storm(op, tmp, new_god->level+10);
554  }
555  return;
556  }
557 
558  /* give the player any special god-characteristic-items. */
559  for (tr = new_god->randomitems->items; tr != NULL; tr = tr->next) {
560  if (tr->item
561  && tr->item->clone.invisible
562  && tr->item->clone.type != SPELLBOOK
563  && tr->item->clone.type != BOOK
564  && tr->item->clone.type != SPELL)
565  god_gives_present(op, new_god, tr);
566  }
567 
569  "You become a follower of %s!",
570  "You become a follower of %s!",
571  new_god->name);
572 
573  for (skop = op->inv; skop != NULL; skop = skop->below)
574  if (skop->type == SKILL && skop->subtype == SK_PRAYING)
575  break;
576 
577  /* Player has no skill - give them the skill */
578  if (!skop) {
579  /* The archetype should always be defined - if we crash here because it doesn't,
580  * things are really messed up anyways.
581  */
583  link_player_skills(op);
584  }
585 
586  sk_applied = QUERY_FLAG(skop, FLAG_APPLIED); /* save skill status */
587 
588  /* Clear the "undead" status. We also need to force a call to change_abil,
589  * so I set undeadified for that.
590  * - gros, 21th July 2006.
591  */
592  if ((old_god) && (QUERY_FLAG(old_god, FLAG_UNDEAD))) {
593  CLEAR_FLAG(skop, FLAG_UNDEAD);
594  undeadified = 1;
595  }
596 
597  if (skop->title) { /* get rid of old god */
599  "%s's blessing is withdrawn from you.",
600  "%s's blessing is withdrawn from you.",
601  skop->title);
602 
603  /* The point of this is to really show what abilities the player just lost */
604  if (sk_applied || undeadified) {
605  CLEAR_FLAG(skop, FLAG_APPLIED);
606  (void)change_abil(op, skop);
607  }
608  free_string(skop->title);
609  }
610 
611  /* now change to the new gods attributes to exp_obj */
612  skop->title = add_string(new_god->name);
613  skop->path_attuned = new_god->path_attuned;
614  skop->path_repelled = new_god->path_repelled;
615  skop->path_denied = new_god->path_denied;
616  /* copy god's resistances */
617  memcpy(skop->resist, new_god->resist, sizeof(new_god->resist));
618 
619  /* make sure that certain immunities do NOT get passed
620  * to the follower!
621  */
622  for (i = 0; i < NROFATTACKS; i++)
623  if (skop->resist[i] > 30
624  && (i == ATNR_FIRE || i == ATNR_COLD || i == ATNR_ELECTRICITY || i == ATNR_POISON))
625  skop->resist[i] = 30;
626 
627  skop->stats.hp = (sint16)new_god->last_heal;
628  skop->stats.sp = (sint16)new_god->last_sp;
629  skop->stats.grace = (sint16)new_god->last_grace;
630  skop->stats.food = (sint16)new_god->last_eat;
631  skop->stats.luck = (sint8)new_god->stats.luck;
632  /* gods may pass on certain flag properties */
633  update_priest_flag(new_god, skop, FLAG_SEE_IN_DARK);
634  update_priest_flag(new_god, skop, FLAG_REFL_SPELL);
635  update_priest_flag(new_god, skop, FLAG_REFL_MISSILE);
636  update_priest_flag(new_god, skop, FLAG_STEALTH);
637  update_priest_flag(new_god, skop, FLAG_MAKE_INVIS);
638  update_priest_flag(new_god, skop, FLAG_UNDEAD);
639  update_priest_flag(new_god, skop, FLAG_BLIND);
640  update_priest_flag(new_god, skop, FLAG_XRAYS); /* better have this if blind! */
641  update_priest_flag(new_god, skop, FLAG_USE_WEAPON);
642  update_priest_flag(new_god, skop, FLAG_USE_ARMOUR);
643  update_priest_flag(new_god, skop, FLAG_USE_SHIELD);
644 
646  "You are bathed in %s's aura.",
647  "You are bathed in %s's aura.",
648  new_god->name);
649 
650  /* Weapon/armour use are special...handle flag toggles here as this can
651  * only happen when gods are worshipped and if the new priest could
652  * have used armour/weapons in the first place.
653  *
654  * This also can happen for monks which cannot use weapons. In this case
655  * do not allow to use weapons even if the god otherwise would allow it.
656  */
657  if (!present_in_ob_by_name(FORCE, "no weapon force", op)) {
658  if (worship_forbids_use(op, skop, FLAG_USE_WEAPON, "weapons"))
659  stop_using_item(op, WEAPON, 2);
660  }
661  update_priest_flag(new_god, skop, FLAG_USE_ARMOUR);
662 
663  if (worship_forbids_use(op, skop, FLAG_USE_ARMOUR, "armour")) {
664  stop_using_item(op, ARMOUR, 1);
665  stop_using_item(op, HELMET, 1);
666  stop_using_item(op, BOOTS, 1);
667  stop_using_item(op, GLOVES, 1);
668  }
669 
670  if (worship_forbids_use(op, skop, FLAG_USE_SHIELD, "shield"))
671  stop_using_item(op, SHIELD, 1);
672 
673  SET_FLAG(skop, FLAG_APPLIED);
674  (void)change_abil(op, skop);
675 
676  /* return to previous skill status */
677  if (!sk_applied)
678  CLEAR_FLAG(skop, FLAG_APPLIED);
679 
680  check_special_prayers(op, new_god);
681 }
682 
696 static int worship_forbids_use(object *op, object *exp_obj, uint32 flag, const char *string) {
697  if (QUERY_FLAG(&op->arch->clone, flag)) {
698  if (QUERY_FLAG(op, flag) != QUERY_FLAG(exp_obj, flag)) {
699  update_priest_flag(exp_obj, op, flag);
700  if (QUERY_FLAG(op, flag))
702  "You may use %s again.",
703  "You may use %s again.",
704  string);
705  else {
707  "You are forbidden to use %s.",
708  "You are forbidden to use %s.",
709  string);
710  return 1;
711  }
712  }
713  }
714  return 0;
715 }
716 
728 static void stop_using_item(object *op, int type, int number) {
729  object *tmp;
730 
731  for (tmp = op->inv; tmp && number; tmp = tmp->below)
732  if (tmp->type == type && QUERY_FLAG(tmp, FLAG_APPLIED)) {
734  number--;
735  }
736 }
737 
750 static void update_priest_flag(const object *god, object *exp_ob, uint32 flag) {
751  if (QUERY_FLAG(god, flag) && !QUERY_FLAG(exp_ob, flag))
752  SET_FLAG(exp_ob, flag);
753  else if (QUERY_FLAG(exp_ob, flag) && !QUERY_FLAG(god, flag)) {
754  /* When this is called with the exp_ob set to the player,
755  * this check is broken, because most all players arch
756  * allow use of weapons. I'm not actually sure why this
757  * check is here - I guess if you had a case where the
758  * value in the archetype (wisdom) should over ride the restrictions
759  * the god places on it, this may make sense. But I don't think
760  * there is any case like that.
761  */
762 
763 /* if (!(QUERY_FLAG(&(exp_ob->arch->clone), flag)))*/
764  CLEAR_FLAG(exp_ob, flag);
765  }
766 }
767 
768 
782 archetype *determine_holy_arch(const object *god, const char *type) {
783  treasure *tr;
784  int count;
785  archetype *last;
786  object *item;
787 
788  if (!god || !god->randomitems) {
789  LOG(llevError, "BUG: determine_holy_arch(): no god or god without randomitems\n");
790  return NULL;
791  }
792 
793  count = 0;
794  last = NULL;
795  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
796  if (!tr->item)
797  continue;
798  item = &tr->item->clone;
799  if (item->type == BOOK && item->invisible && item->name == type)
800  count++;
801  }
802  if (count == 0) {
803  return NULL;
804  }
805 
806  count = rndm(1, count);
807 
808  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
809  if (!tr->item)
810  continue;
811  item = &tr->item->clone;
812  if (item->type == BOOK && item->invisible && item->name == type) {
813  count--;
814  if (count == 0)
815  return item->other_arch;
816  }
817  }
818 
819  return NULL;
820 }
821 
832 static int god_removes_curse(object *op, int remove_damnation) {
833  object *tmp;
834  int success = 0;
835 
836  for (tmp = op->inv; tmp; tmp = tmp->below) {
837  if (tmp->invisible)
838  continue;
839  if (QUERY_FLAG(tmp, FLAG_DAMNED) && !remove_damnation)
840  continue;
841  if (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED)) {
842  success = 1;
843  CLEAR_FLAG(tmp, FLAG_DAMNED);
844  CLEAR_FLAG(tmp, FLAG_CURSED);
846  if (op->type == PLAYER)
847  esrv_update_item(UPD_FLAGS, op, tmp);
848  }
849  }
850 
851  if (success)
853  "You feel like someone is helping you.", NULL);
854  return success;
855 }
856 
866 static int follower_level_to_enchantments(int level, int difficulty) {
867  if (difficulty < 1) {
868  LOG(llevError, "follower_level_to_enchantments(): difficulty %d is invalid\n", difficulty);
869  return 0;
870  }
871 
872  if (level <= 20)
873  return level/difficulty;
874  if (level <= 40)
875  return (20+(level-20)/2)/difficulty;
876  return (30+(level-40)/4)/difficulty;
877 }
878 
897 static int improve_weapon_magic(object *op, object *tr, object *weapon, object *skill) {
898  int tmp = follower_level_to_enchantments(skill->level, tr->level);
899 
900  if (weapon->magic < tmp) {
902  "A phosphorescent glow envelops your weapon!", NULL);
903  weapon->magic++;
904  if (op->type == PLAYER)
905  esrv_update_item(UPD_NAME, op, weapon);
906  weapon->item_power++;
907  return 1;
908  }
909 
910  return 0;
911 }
912 
930 static int god_enchants_weapon(object *op, const object *god, object *tr, object *skill) {
931  char buf[MAX_BUF];
932  object *weapon;
933  uint32 attacktype;
934 
935  for (weapon = op->inv; weapon; weapon = weapon->below)
936  if ((weapon->type == WEAPON || weapon->type == BOW)
937  && QUERY_FLAG(weapon, FLAG_APPLIED))
938  break;
939  if (weapon == NULL || god_examines_item(god, weapon) <= 0)
940  return 0;
941 
942  if (weapon->item_power >= MAX_WEAPON_ITEM_POWER) {
944  "%s considers your %s is not worthy to be enchanted any more.",
945  "%s considers your %s is not worthy to be enchanted any more.",
946  god->name,
947  weapon->name);
948  return 0;
949  }
950 
951  /* If personalized_blessings is activated, then the god's name is
952  * associated with the weapon, as well as the owner (the one who blesses it),
953  * and a "weapon willpower", which is equivalent to the owner's experience
954  * in praying when the weapon is blessed.
955  * Those values are used later, when another player attempts to wield the
956  * weapon - nasty things may happen to those who do not deserve to use it ! :)
957  */
959  const char *divine_owner = get_ob_key_value(weapon, "divine_blessing_name");
960  const char *owner = get_ob_key_value(weapon, "item_owner");
961  object *skillop = NULL;
962 
963  if (divine_owner != NULL) {
964  if (!strcmp(divine_owner, god->name)) {
965  /* It already belongs to this god - do not go further. */
966  /*
967  [DT] (2009-06-10): It is ok if the weapon has already been enchanted
968  one time, but in that particular case we only give out additional plusses.
969  No new slays or new attacktypes
970  */
971  return improve_weapon_magic(op, tr, weapon, skill);
972  }
973 
974  /* Huho... Another god already blessed this one ! */
976  "Your %s already belongs to %s !",
977  "Your %s already belongs to %s !",
978  weapon->name, divine_owner);
979  return 0;
980  } else if ((owner != NULL) && (!strcmp(owner, op->name))) {
981  /* Maybe the weapon itself will not agree ? */
983  "The %s is not yours, and is magically protected against such changes !",
984  "The %s is not yours, and is magically protected against such changes !",
985  weapon->name);
986  return 0;
987  }
988  skillop = find_skill_by_number(op, SK_PRAYING);
989  if (skillop == NULL) {
990  LOG(llevError, "god_enchants_weapon: no praying skill object found ?!\n");
991  snprintf(buf, sizeof(buf), "%d", 1);
992  } else
993  snprintf(buf, sizeof(buf), "%"FMT64, skillop->stats.exp);
994  set_ob_key_value(weapon, "divine_blessing_name", god->name, TRUE);
995  set_ob_key_value(weapon, "item_owner", op->name, TRUE);
996  set_ob_key_value(weapon, "item_willpower", buf, TRUE);
997  }
998 
999  /* First give it a title, so other gods won't touch it */
1000  if (!weapon->title) {
1001  snprintf(buf, sizeof(buf), "of %s", god->name);
1002  weapon->title = add_string(buf);
1003  if (op->type == PLAYER)
1004  esrv_update_item(UPD_NAME, op, weapon);
1006  "Your weapon quivers as if struck!", NULL);
1007  }
1008 
1009  /* Allow the weapon to slay enemies */
1010  if (!weapon->slaying && god->slaying) {
1011  weapon->slaying = add_string(god->slaying);
1013  "Your %s now hungers to slay enemies of your god!",
1014  "Your %s now hungers to slay enemies of your god!",
1015  weapon->name);
1016  weapon->item_power++;
1017  return 1;
1018  }
1019 
1020  /* Add the gods attacktype */
1021  attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype;
1022  if ((attacktype&god->attacktype) != god->attacktype) {
1024  "Your weapon suddenly glows!", NULL);
1025  weapon->attacktype = attacktype|god->attacktype;
1026  weapon->item_power++;
1027  return 1;
1028  }
1029 
1030  /* Higher magic value */
1031  return improve_weapon_magic(op, tr, weapon, skill);
1032 }
1033 
1047 static void god_intervention(object *op, const object *god, object *skill) {
1048  treasure *tr;
1049 
1050  if (!god || !god->randomitems) {
1051  LOG(llevError, "BUG: god_intervention(): no god or god without randomitems\n");
1052  return;
1053  }
1054 
1055  check_special_prayers(op, god);
1056 
1057  /* lets do some checks of whether we are kosher with our god */
1058  if (god_examines_priest(op, god) < 0)
1059  return;
1060 
1062  "You feel a holy presence!", NULL);
1063 
1064  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
1065  object *item;
1066 
1067  if (tr->chance <= random_roll(0, 99, op, PREFER_HIGH))
1068  continue;
1069 
1070  /* Treasurelist - generate some treasure for the follower */
1071  if (tr->name) {
1072  treasurelist *tl = find_treasurelist(tr->name);
1073  if (tl == NULL)
1074  continue;
1075 
1077  "Something appears before your eyes. You catch it before it falls to the ground.",
1078  NULL);
1079 
1081  return;
1082  }
1083 
1084  if (!tr->item) {
1085  LOG(llevError, "BUG: empty entry in %s's treasure list\n", god->name);
1086  continue;
1087  }
1088  item = &tr->item->clone;
1089 
1090  /* Grace limit */
1091  if (item->type == BOOK && item->invisible
1092  && strcmp(item->name, "grace limit") == 0) {
1093  if (op->stats.grace < item->stats.grace
1094  || op->stats.grace < op->stats.maxgrace) {
1095  object *tmp;
1096 
1097  /* Follower lacks the required grace for the following
1098  * treasure list items. */
1099 
1101  cast_change_ability(op, op, tmp, 0, 1);
1102  free_object(tmp);
1103  return;
1104  }
1105  continue;
1106  }
1107 
1108  /* Restore grace */
1109  if (item->type == BOOK && item->invisible
1110  && strcmp(item->name, "restore grace") == 0) {
1111  if (op->stats.grace >= 0)
1112  continue;
1113  op->stats.grace = random_roll(0, 9, op, PREFER_HIGH);
1115  "You are returned to a state of grace.", NULL);
1116  return;
1117  }
1118 
1119  /* Heal damage */
1120  if (item->type == BOOK && item->invisible
1121  && strcmp(item->name, "restore hitpoints") == 0) {
1122  if (op->stats.hp >= op->stats.maxhp)
1123  continue;
1125  "A white light surrounds and heals you!", NULL);
1126  op->stats.hp = op->stats.maxhp;
1127  return;
1128  }
1129 
1130  /* Restore spellpoints */
1131  if (item->type == BOOK
1132  && item->invisible
1133  && strcmp(item->name, "restore spellpoints") == 0) {
1134  int max = op->stats.maxsp*(item->stats.maxsp/100.0);
1135  /* Restore to 50 .. 100%, if sp < 50% */
1136  int new_sp = random_roll(1000, 1999, op, PREFER_HIGH)/2000.0*max;
1137  if (op->stats.sp >= max/2)
1138  continue;
1140  "A blue lightning strikes your head but doesn't hurt you!", NULL);
1141  op->stats.sp = new_sp;
1142  }
1143 
1144  /* Various heal spells */
1145  if (item->type == BOOK && item->invisible
1146  && strcmp(item->name, "heal spell") == 0) {
1147  object *tmp;
1148  int success;
1149 
1151 
1152  success = cast_heal(op, op, tmp, 0);
1153  free_object(tmp);
1154  if (success)
1155  return;
1156  else
1157  continue;
1158  }
1159 
1160  /* Remove curse */
1161  if (item->type == BOOK && item->invisible
1162  && strcmp(item->name, "remove curse") == 0) {
1163  if (god_removes_curse(op, 0))
1164  return;
1165  else
1166  continue;
1167  }
1168 
1169  /* Remove damnation */
1170  if (item->type == BOOK && item->invisible
1171  && strcmp(item->name, "remove damnation") == 0) {
1172  if (god_removes_curse(op, 1))
1173  return;
1174  else
1175  continue;
1176  }
1177 
1178  /* Heal depletion */
1179  if (item->type == BOOK && item->invisible
1180  && strcmp(item->name, "heal depletion") == 0) {
1181  object *depl;
1182  archetype *at;
1183  int i;
1184 
1185  if ((at = find_archetype(ARCH_DEPLETION)) == NULL) {
1186  LOG(llevError, "Could not find archetype depletion.\n");
1187  continue;
1188  }
1189  depl = present_arch_in_ob(at, op);
1190  if (depl == NULL)
1191  continue;
1193  "Shimmering light surrounds and restores you!", NULL);
1194  for (i = 0; i < NUM_STATS; i++)
1195  if (get_attr_value(&depl->stats, i))
1198  restore_msg[i], restore_msg[i]);
1199  remove_ob(depl);
1200  free_object(depl);
1201  fix_object(op);
1202  return;
1203  }
1204 
1205  /* Voices */
1206  if (item->type == BOOK && item->invisible
1207  && strcmp(item->name, "voice_behind") == 0) {
1209  "You hear a voice from behind you, but you don't dare to "
1210  "turn around:", NULL);
1212  item->msg, item->msg);
1213  return;
1214  }
1215 
1216  /* Messages */
1217  if (item->type == BOOK && item->invisible
1218  && strcmp(item->name, "message") == 0) {
1220  item->msg, item->msg);
1221  return;
1222  }
1223 
1224  /* Enchant weapon */
1225  if (item->type == BOOK && item->invisible
1226  && strcmp(item->name, "enchant weapon") == 0) {
1227  if (god_enchants_weapon(op, god, item, skill))
1228  return;
1229  else
1230  continue;
1231  }
1232 
1233  /* Spellbooks - works correctly only for prayers */
1234  if (item->type == SPELL) {
1235  if (check_spell_known(op, item->name))
1236  continue;
1237  if (item->level > skill->level)
1238  continue;
1239 
1241  "%s grants you use of a special prayer!",
1242  "%s grants you use of a special prayer!",
1243  god->name);
1244  do_learn_spell(op, item, 1);
1245  return;
1246 
1247  }
1248 
1249  /* Other gifts */
1250  if (!item->invisible) {
1251  if (god_gives_present(op, god, tr))
1252  return;
1253  else
1254  continue;
1255  }
1256  /* else ignore it */
1257  }
1258 
1260  "You feel rapture.", NULL);
1261 }
1262 
1275 static int god_examines_priest(object *op, const object *god) {
1276  int reaction = 1;
1277  object *item = NULL, *skop;
1278 
1279  for (item = op->inv; item; item = item->below) {
1280  if (QUERY_FLAG(item, FLAG_APPLIED)) {
1281  reaction += god_examines_item(god, item)*(item->magic ? abs(item->magic) : 1);
1282  }
1283  }
1284 
1285  /* well, well. Looks like we screwed up. Time for god's revenge */
1286  if (reaction < 0) {
1287  int loss = 10000000;
1288  int angry = abs(reaction);
1289 
1290  for (skop = op->inv; skop != NULL; skop = skop->below)
1291  if (skop->type == SKILL && skop->subtype == SK_PRAYING)
1292  break;
1293 
1294  if (skop)
1295  loss = 0.05*(float)skop->stats.exp;
1296  change_exp(op, -random_roll(0, loss*angry-1, op, PREFER_LOW), skop ? skop->skill : "none", SK_SUBTRACT_SKILL_EXP);
1297  if (random_roll(0, angry, op, PREFER_LOW)) {
1298  object *tmp = create_archetype(LOOSE_MANA);
1299 
1300  cast_magic_storm(op, tmp, op->level+(angry*3));
1301  }
1303  "%s becomes angry and punishes you!",
1304  "%s becomes angry and punishes you!",
1305  god->name);
1306  }
1307  return reaction;
1308 }
1309 
1326 static int god_examines_item(const object *god, object *item) {
1327  char buf[MAX_BUF];
1328 
1329  if (!god || !item)
1330  return 0;
1331 
1332  if (!item->title)
1333  return 1; /* unclaimed item are ok */
1334 
1335  snprintf(buf, sizeof(buf), "of %s", god->name);
1336  if (!strcmp(item->title, buf))
1337  return 1; /* belongs to that God */
1338 
1339  if (god->title) { /* check if we have any enemy blessed item*/
1340  snprintf(buf, sizeof(buf), "of %s", god->title);
1341  if (!strcmp(item->title, buf)) {
1342  if (item->env) {
1343  char name[MAX_BUF];
1344 
1345  query_name(item, name, MAX_BUF);
1347  "Heretic! You are using %s!",
1348  "Heretic! You are using %s!",
1349  name);
1350  }
1351  return -1;
1352  }
1353  }
1354  return 0; /* item is sacred to a non-enemy god/or is otherwise magical */
1355 }
1356 
1367 static const char *get_god_for_race(const char *race) {
1368  godlink *gl = first_god;
1369  const char *godname = NULL;
1370 
1371  if (race == NULL)
1372  return NULL;
1373  while (gl) {
1374  if (gl->arch->clone.race && !strcasecmp(gl->arch->clone.race, race)) {
1375  godname = gl->name;
1376  break;
1377  }
1378  gl = gl->next;
1379  }
1380  return godname;
1381 }
1382 
1394 int tailor_god_spell(object *spellop, object *caster) {
1395  const object *god = find_god(determine_god(caster));
1396  int caster_is_spell = 0;
1397 
1398  if (caster->type == SPELL_EFFECT || caster->type == SPELL)
1399  caster_is_spell = 1;
1400 
1401  /* if caster is a rune or the like, it doesn't worship anything. However,
1402  * if this object is owned by someone, then the god that they worship
1403  * is relevant, so use that.
1404  */
1405  if (!god && get_owner(caster))
1406  god = find_god(determine_god(get_owner(caster)));
1407 
1408  if (!god || (spellop->attacktype&AT_HOLYWORD && !god->race)) {
1409  if (!caster_is_spell)
1411  "This prayer is useless unless you worship an appropriate god", NULL);
1412  else
1413  LOG(llevError, "BUG: tailor_god_spell(): no god\n");
1414  free_object(spellop);
1415  return 0;
1416  }
1417 
1418  /* either holy word or godpower attacks will set the slaying field */
1419  if (spellop->attacktype&AT_HOLYWORD || spellop->attacktype&AT_GODPOWER) {
1420  if (spellop->slaying) {
1421  free_string(spellop->slaying);
1422  spellop->slaying = NULL;
1423  }
1424  if (!caster_is_spell)
1425  spellop->slaying = god->slaying ? add_string(god->slaying) : NULL;
1426  else if (caster->slaying)
1427  spellop->slaying = add_string(caster->slaying);
1428  }
1429 
1430  /* only the godpower attacktype adds the god's attack onto the spell */
1431  if (spellop->attacktype&AT_GODPOWER)
1432  spellop->attacktype = spellop->attacktype|god->attacktype;
1433 
1434  /* tack on the god's name to the spell */
1435  if (spellop->attacktype&AT_HOLYWORD || spellop->attacktype&AT_GODPOWER) {
1436  if (spellop->title)
1437  free_string(spellop->title);
1438  spellop->title = add_string(god->name);
1439  if (spellop->title) {
1440  char buf[MAX_BUF];
1441 
1442  snprintf(buf, sizeof(buf), "%s of %s", spellop->name, spellop->title);
1443  FREE_AND_COPY(spellop->name, buf);
1444  FREE_AND_COPY(spellop->name_pl, buf);
1445  }
1446  }
1447 
1448  return 1;
1449 }
#define AP_UNAPPLY
Definition: define.h:1010
#define UPD_FLAGS
Definition: newclient.h:255
#define AT_HOLYWORD
Definition: attack.h:125
signed char sint8
Definition: global.h:80
Definition: player.h:146
#define FLAG_SEE_IN_DARK
Definition: define.h:634
int apply_special(object *who, object *op, int aflags)
Definition: apply.c:1139
archetype * find_archetype(const char *name)
Definition: arch.c:700
#define FLAG_DAMNED
Definition: define.h:614
static int improve_weapon_magic(object *op, object *tr, object *weapon, object *skill)
Definition: gods.c:897
#define MSG_TYPE_ATTRIBUTE_GOD
Definition: newclient.h:488
const char * get_ob_key_value(const object *op, const char *const key)
Definition: object.c:3701
int move_player(object *op, int dir)
Definition: player.c:2741
signed short sint16
Definition: global.h:72
void change_exp(object *op, sint64 exp, const char *skill_name, int flag)
Definition: living.c:2015
object * check_spell_known(object *op, const char *name)
Definition: spell_util.c:408
const char * race
Definition: object.h:171
const char *const restore_msg[NUM_STATS]
Definition: living.c:240
archetype * determine_holy_arch(const object *god, const char *type)
Definition: gods.c:782
#define SET_FLAG(xyz, p)
Definition: define.h:510
void do_forget_spell(object *op, const char *spell)
Definition: apply.c:440
#define HOLY_POSSESSION
Definition: spells.h:195
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
#define WAND
Definition: define.h:291
#define NDI_WHITE
Definition: newclient.h:196
#define FLAG_USE_ARMOUR
Definition: define.h:592
#define UPD_NAME
Definition: newclient.h:258
static int lookup_god_by_name(const char *name)
Definition: gods.c:66
struct archt * arch
Definition: god.h:14
#define MSG_TYPE_ITEM
Definition: newclient.h:334
treasurelist * find_treasurelist(const char *name)
Definition: treasure.c:295
sint32 last_heal
Definition: object.h:208
sint8 get_attr_value(const living *stats, int attr)
Definition: living.c:377
sint16 maxgrace
Definition: living.h:86
void free_string(sstring str)
Definition: shstr.c:272
#define HUGE_BUF
Definition: define.h:83
void esrv_update_item(int flags, object *pl, object *op)
Definition: standalone.c:200
struct treasureliststruct * randomitems
Definition: object.h:236
object clone
Definition: object.h:326
sint16 invisible
Definition: object.h:211
#define PREFER_LOW
Definition: define.h:909
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
Definition: standalone.c:171
const char * slaying
Definition: object.h:172
sint32 last_sp
Definition: object.h:209
#define FLAG_STEALTH
Definition: define.h:609
uint8 subtype
Definition: object.h:190
Definition: god.h:12
#define EXPERIENCE
Definition: define.h:158
#define FLAG_USE_WEAPON
Definition: define.h:593
sint64 exp
Definition: living.h:88
static int worship_forbids_use(object *op, object *exp_obj, uint32 flag, const char *string)
Definition: gods.c:696
#define BOOTS
Definition: define.h:281
const char * name
Definition: god.h:13
object * create_archetype_by_object_name(const char *name)
Definition: arch.c:173
uint32 path_attuned
Definition: object.h:194
sint16 sp
Definition: living.h:83
uint32 path_repelled
Definition: object.h:195
#define SCRIPT_FIX_ALL
Definition: global.h:450
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
Definition: standalone.c:175
#define FLAG_USE_SHIELD
Definition: define.h:533
struct archt * other_arch
Definition: object.h:264
#define ARMOUR
Definition: define.h:128
int absdir(int d)
Definition: object.c:3417
static void check_special_prayers(object *op, const object *god)
Definition: gods.c:431
Definition: object.h:321
#define PLAYER
Definition: define.h:113
struct archt * item
Definition: treasure.h:93
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
Definition: newclient.h:481
sint16 maxsp
Definition: living.h:84
sint16 hp
Definition: living.h:81
#define NDI_NAVY
Definition: newclient.h:197
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
Definition: treasure.c:499
#define LOOSE_MANA
Definition: spells.h:189
object * give_skill_by_name(object *op, const char *skill_name)
Definition: living.c:1689
int rndm(int min, int max)
Definition: utils.c:174
#define FLAG_UNDEAD
Definition: define.h:566
#define MSG_TYPE_SKILL_PRAY
Definition: newclient.h:505
int change_abil(object *op, object *tmp)
Definition: living.c:443
const char * title
Definition: object.h:170
void remove_ob(object *op)
Definition: object.c:1515
sint16 maxhp
Definition: living.h:82
#define AT_GODPOWER
Definition: attack.h:124
static void follower_remove_given_items(object *pl, object *op, const object *god)
Definition: gods.c:211
static int god_examines_priest(object *op, const object *god)
Definition: gods.c:1275
uint32 path_denied
Definition: object.h:196
#define MSG_TYPE_ITEM_REMOVE
Definition: newclient.h:557
#define FLAG_ALIVE
Definition: define.h:526
#define AP_IGNORE_CURSE
Definition: define.h:1016
#define FLAG_REFL_SPELL
Definition: define.h:571
const char * name_pl
Definition: object.h:168
object * create_archetype(const char *name)
Definition: arch.c:625
static void update_priest_flag(const object *god, object *exp_ob, uint32 flag)
Definition: gods.c:750
int tailor_god_spell(object *spellop, object *caster)
Definition: gods.c:1394
sint8 Wis
Definition: living.h:78
static const char * get_god_for_race(const char *race)
Definition: gods.c:1367
#define MSG_TYPE_ITEM_INFO
Definition: newclient.h:560
#define ARCH_DEPLETION
Definition: object.h:405
#define MSG_TYPE_ATTRIBUTE
Definition: newclient.h:327
const char * name
Definition: object.h:167
struct obj * env
Definition: object.h:151
#define SPELL
Definition: define.h:283
object * get_owner(object *op)
Definition: object.c:524
struct obj * below
Definition: object.h:145
const char * determine_god(object *op)
Definition: gods.c:118
sint16 last_grace
Definition: object.h:210
#define MSG_TYPE_ITEM_CHANGE
Definition: newclient.h:559
static int follower_has_similar_item(object *op, object *item)
Definition: gods.c:252
#define TRUE
Definition: exp.c:41
#define MAX_WEAPON_ITEM_POWER
Definition: define.h:768
uint32 nrof
Definition: object.h:184
const object * pntr_to_god_obj(godlink *godlnk)
Definition: holy.c:133
object * present_in_ob_by_name(int type, const char *str, const object *op)
Definition: object.c:2840
sint8 facing
Definition: object.h:186
void do_learn_spell(object *op, object *spell, int special_prayer)
Definition: apply.c:398
struct pl * contr
Definition: object.h:134
sint8 item_power
Definition: object.h:213
#define WEAPON
Definition: define.h:127
static void god_intervention(object *op, const object *god, object *skill)
Definition: gods.c:1047
static int god_examines_item(const object *god, object *item)
Definition: gods.c:1326
void player_unready_range_ob(player *pl, object *ob)
Definition: player.c:4221
#define FLAG_XRAYS
Definition: define.h:597
void cast_magic_storm(object *op, object *tmp, int lvl)
Definition: spell_effect.c:55
EXTERN godlink * first_god
Definition: global.h:197
#define MAX(x, y)
Definition: define.h:70
static void stop_using_item(object *op, int type, int number)
Definition: gods.c:728
sint8 luck
Definition: living.h:80
#define ATNR_ELECTRICITY
Definition: attack.h:80
#define MSG_TYPE_SKILL
Definition: newclient.h:329
#define ATNR_POISON
Definition: attack.h:87
#define AT_PHYSICAL
Definition: attack.h:104
#define QUERY_FLAG(xyz, p)
Definition: define.h:514
#define CLEAR_FLAG(xyz, p)
Definition: define.h:512
struct glnk * next
Definition: god.h:16
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
Definition: treasure.c:1070
object * insert_ob_in_ob(object *op, object *where)
Definition: object.c:2510
static int god_removes_curse(object *op, int remove_damnation)
Definition: gods.c:832
#define MAX_BUF
Definition: define.h:81
#define GLOVES
Definition: define.h:282
#define SK_PRAYING
Definition: skills.h:77
static int god_gives_present(object *op, const object *god, treasure *tr)
Definition: gods.c:280
static int follower_level_to_enchantments(int level, int difficulty)
Definition: gods.c:866
#define BOOK
Definition: define.h:120
struct treasurestruct * items
Definition: treasure.h:119
const char * skill
Definition: object.h:174
sint32 last_eat
Definition: object.h:207
void become_follower(object *op, const object *new_god)
Definition: gods.c:502
#define MIN(x, y)
Definition: define.h:67
sint16 resist[NROFATTACKS]
Definition: object.h:192
#define FLAG_KNOWN_CURSED
Definition: define.h:617
#define FLAG_CURSED
Definition: define.h:613
#define SHIELD
Definition: define.h:145
int snprintf(char *dest, int max, const char *format,...)
Definition: porting.c:498
static int god_enchants_weapon(object *op, const object *god, object *tr, object *skill)
Definition: gods.c:930
#define FORCE
Definition: define.h:296
#define PREFER_HIGH
Definition: define.h:908
uint32 attacktype
Definition: object.h:193
#define NUM_STATS
Definition: living.h:48
#define FLAG_BLIND
Definition: define.h:633
int cast_heal(object *op, object *caster, object *spell, int dir)
#define FREE_AND_COPY(sv, nv)
Definition: global.h:288
sint16 grace
Definition: living.h:85
int set_ob_key_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:3826
void free_object2(object *ob, int free_inventory)
Definition: object.c:1258
archetype * get_archetype_by_type_subtype(int type, int subtype)
Definition: arch.c:149
#define EVENT_APPLY
Definition: plugin.h:62
living stats
Definition: object.h:219
struct archt * arch
Definition: object.h:263
object * present_arch_in_ob(const archetype *at, const object *op)
Definition: object.c:2859
#define SKILL
Definition: define.h:157
struct Settings settings
Definition: init.c:48
#define SPELL_EFFECT
Definition: define.h:284
#define FLAG_APPLIED
Definition: define.h:531
#define NROFATTACKS
Definition: attack.h:45
void query_short_name(const object *op, char *buf, size_t size)
Definition: item.c:551
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Definition: standalone.c:225
const char * msg
Definition: object.h:175
#define FLAG_MAKE_INVIS
Definition: define.h:625
#define FLAG_STARTEQUIP
Definition: define.h:564
#define BOW
Definition: define.h:126
sstring add_string(const char *str)
Definition: shstr.c:116
void link_player_skills(object *op)
Definition: skill_util.c:112
int strcasecmp(const char *s1, const char *s2)
Definition: porting.c:434
uint8 personalized_blessings
Definition: global.h:401
struct obj * inv
Definition: object.h:148
#define NDI_UNIQUE
Definition: newclient.h:219
#define HELMET
Definition: define.h:146
#define SPELLBOOK
Definition: define.h:266
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:63
unsigned int uint32
Definition: global.h:58
#define ROD
Definition: define.h:115
static int same_string(const char *s1, const char *s2)
Definition: gods.c:183
#define ATNR_COLD
Definition: attack.h:81
void query_name(const object *op, char *buf, size_t size)
Definition: item.c:628
#define SK_SUBTRACT_SKILL_EXP
Definition: skills.h:106
object * find_skill_by_number(object *who, int skillno)
Definition: standalone.c:209
void free_object(object *ob)
Definition: object.c:1238
int random_roll(int min, int max, const object *op, int goodbad)
Definition: utils.c:51
sint64 random_roll64(sint64 min, sint64 max, const object *op, int goodbad)
Definition: utils.c:86
struct treasurestruct * next
Definition: treasure.h:95
#define FLAG_REFL_MISSILE
Definition: define.h:569
sint16 level
Definition: object.h:202
void fix_object(object *op)
Definition: living.c:900
const char * name
Definition: treasure.h:94
int id
Definition: god.h:15
#define MSG_TYPE_ITEM_ADD
Definition: newclient.h:558
object * arch_to_object(archetype *at)
Definition: arch.c:576
sint8 magic
Definition: object.h:199
uint8 chance
Definition: treasure.h:99
const char * name
Definition: object.h:322
void pray_at_altar(object *pl, object *altar, object *skill)
Definition: gods.c:325
uint8 type
Definition: object.h:189
const object * find_god(const char *name)
Definition: gods.c:92
sint32 food
Definition: living.h:89
#define ATNR_FIRE
Definition: attack.h:79