Crossfire Server, Trunk
gods.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
24 #include "global.h"
25 
26 #include <stdlib.h>
27 #include <string.h>
28 
29 #include "living.h"
30 #include "object.h"
31 #include "sounds.h"
32 #include "spells.h"
33 #include "sproto.h"
34 
35 static int worship_forbids_use(object *op, object *exp_obj, uint32_t flag, const char *string);
36 static void stop_using_item(object *op, int type, int number);
37 static void update_priest_flag(const object *god, object *exp_ob, uint32_t flag);
38 static void god_intervention(object *op, const object *god, object *skill, object *altar);
39 static int god_examines_priest(object *op, const object *god);
40 static int god_examines_item(const object *god, object *item);
41 static const char *get_god_for_race(const char *race);
42 static void remove_special_prayers(object *op, const object *god);
43 
54 static int lookup_god_by_name(const char *name) {
55  int godnr = -1;
56  size_t nmlen = strlen(name);
57 
58  if (strcmp(name, "none")) {
59  godlink *gl;
60  for (gl = first_god; gl; gl = gl->next)
61  if (!strncmp(name, gl->name, MIN(strlen(gl->name), nmlen)))
62  break;
63  if (gl)
64  godnr = gl->id;
65  }
66  return godnr;
67 }
68 
80 const object *find_god(const char *name) {
81  godlink *gl;
82 
83  if (!name)
84  return NULL;
85 
86  for (gl = first_god; gl; gl = gl->next) {
87  if (!strcmp(name, gl->name))
88  return pntr_to_god_obj(gl);
89  }
90 
91  return NULL;
92 }
93 
106 const char *determine_god(object *op) {
107  int godnr = -1;
108  const char *godname;
109 
110  /* spells */
111  if ((op->type == SPELL || op->type == SPELL_EFFECT)
112  && op->title) {
113  if (lookup_god_by_name(op->title) >= 0)
114  return op->title;
115  }
116 
117  if (op->type != PLAYER && QUERY_FLAG(op, FLAG_ALIVE)) {
118  /* find a god based on race */
119  if (!op->title) {
120  if (op->race != NULL) {
121  godname = get_god_for_race(op->race);
122  if (godname != NULL) {
123  op->title = add_string(godname);
124  }
125  }
126  }
127 
128  /* find a random god */
129  if (!op->title) {
130  godlink *gl = first_god;
131 
132  godnr = rndm(1, gl->id);
133  while (gl) {
134  if (gl->id == godnr)
135  {
136  // This used to be after the loop, but if we do not find a god,
137  // it would have made a null pointer dereference. Moved here
138  // for better clarity and (hopefully) fewer bugs.
139  // SilverNexus 2018-01-17
140  op->title = add_string(gl->name);
141 
142  break;
143  }
144  gl = gl->next;
145  }
146  }
147 
148  return op->title;
149  }
150 
151  /* The god the player worships is in the praying skill (native skill
152  * not skill tool). Since a player can only have one instance of
153  * that skill, once we find it, we can return, either with the
154  * title or "none".
155  */
156  if (op->type == PLAYER) {
157  object *tmp;
158 
160  if (tmp != NULL) {
161  return tmp->title != NULL ? tmp->title : "none";
162  }
163  }
164  return ("none");
165 }
166 
175 static int same_string(const char *s1, const char *s2) {
176  if (s1 == NULL)
177  return s2 == NULL;
178  else
179  return s2 != NULL && strcmp(s1, s2) == 0;
180 }
181 
197 static void follower_remove_given_items(object *pl, object *op, const object *god) {
198  const char *given_by;
199 
200  /* search the inventory */
202  given_by = object_get_value(tmp, "divine_giver_name");
203  if (given_by == god->name) {
204  char name[HUGE_BUF];
205 
207  /* Send the client a message. */
208  if (tmp->nrof > 1)
210  "The %s crumble to dust!",
211  name);
212  else
214  "The %s crumbles to dust!",
215  name);
216 
217  object_remove(tmp); /* remove obj from players inv. */
219  } else if (tmp->inv)
221  } FOR_INV_FINISH();
222 }
223 
233 static int follower_has_similar_item(object *op, object *item) {
235  if (tmp->type == item->type
236  && same_string(tmp->name, item->name)
237  && same_string(tmp->title, item->title)
238  && tmp->msg == item->msg
239  && same_string(tmp->slaying, item->slaying))
240  return 1;
241  if (tmp->inv && follower_has_similar_item(tmp, item))
242  return 1;
243  } FOR_INV_FINISH();
244  return 0;
245 }
246 
259 static int god_gives_present(object *op, const object *god, treasure *tr) {
260  object *tmp;
261  char name[HUGE_BUF];
262 
264  return 0;
265 
266  tmp = arch_to_object(tr->item);
267 
268  /*
269  * Give inventory if needed, for instance Lythander's pipe.
270  * Use high level and magic so something IS put in inventory.
271  */
272  fix_generated_item(tmp, NULL, 120, 120, GT_ONLY_GOOD);
273 
274  /* And just in case nothing was put and something is needed, bail out. */
275  if ((tmp->type == ROD || tmp->type == WAND) && (tmp->inv == NULL)) {
276  object_free(tmp, 0);
277  return 0;
278  }
279 
282  "%s lets %s appear in your hands.",
283  god->name, name);
287  object_set_value(tmp, "divine_giver_name", god->name, TRUE);
289  return 1;
290 }
291 
296 static bool try_leave_cult(object* pl, object* skill, int angry) {
297  const uint64_t loss = angry * (skill->stats.exp / 10);
298  if (loss)
300 
301  /* random chance based on our current level
302  * note it gets harder the higher we get
303  */
304  if ((angry == 1) && !(random_roll(0, skill->level, pl, PREFER_LOW))) {
305  return true;
306  } else {
307  return false;
308  }
309 }
310 
322 void pray_at_altar(object *pl, object *altar, object *skill) {
323  const object *pl_god = find_god(determine_god(pl));
324 
326  return;
327 
328  /* If non consecrate altar, don't do anything */
329  if (!altar->other_arch)
330  return;
331 
332  /* hmm. what happend depends on pl's current god, level, etc */
333  if (!pl_god) { /*new convert */
334  become_follower(pl, &altar->other_arch->clone);
335  return;
336  }
337 
338  if (!strcmp(pl_god->name, altar->other_arch->clone.name)) {
339  /* pray at your gods altar */
340  int bonus = (pl->stats.Wis+skill->level)/10;
341 
342  /* we can get neg grace up faster */
343  if (pl->stats.grace < 0)
344  pl->stats.grace += (bonus > -1*(pl->stats.grace/10) ? bonus : -1*(pl->stats.grace/10));
345  /* we can super-charge grace to 2x max */
346  if (pl->stats.grace < (2*pl->stats.maxgrace)) {
347  pl->stats.grace += bonus/2;
348  }
349  if (pl->stats.grace > (2*pl->stats.maxgrace)) {
350  pl->stats.grace = (2*pl->stats.maxgrace);
351  }
352 
353  /* Every once in a while, the god decides to checkup on their
354  * follower, and may intervene to help them out.
355  */
356  bonus = MAX(1, bonus+MAX(pl->stats.luck, -3)); /* -- DAMN -- */
357 
358  if (((random_roll(0, 399, pl, PREFER_LOW))-bonus) < 0)
359  god_intervention(pl, pl_god, skill, altar);
360  } else { /* praying to another god! */
361  int angry = 1;
362 
363  /* I believe the logic for detecting opposing gods was completely
364  * broken - I think it should work now. altar->other_arch
365  * points to the god of this altar (which we have
366  * already verified is non null). pl_god->other_arch
367  * is the opposing god - we need to verify that exists before
368  * using its values.
369  */
370  if (pl_god->other_arch
371  && (altar->other_arch->name == pl_god->other_arch->name)) {
372  angry = 2;
373  if (random_roll(0, skill->level+2, pl, PREFER_LOW)-5 > 0) {
374  object *tmp;
375 
376  /* you really screwed up */
377  angry = 3;
379  "Foul Priest! %s punishes you!",
380  pl_god->name);
382  cast_magic_storm(pl, tmp, pl_god->level+20);
383  } else
385  "Foolish heretic! %s is livid!",
386  pl_god->name);
387  } else
389  "Heretic! %s is angered!",
390  pl_god->name);
391 
392  if (try_leave_cult(pl, skill, angry)) {
393  become_follower(pl, &altar->other_arch->clone);
394  } else {
395  /* toss this player off the altar. He can try again. */
397  "A divine force pushes you off the altar.");
398 
399  move_player(pl, absdir(pl->facing+4)); /* back him off the way he came. */
400  }
401  }
402 }
403 
414 static void remove_special_prayers(object *op, const object *god) {
415  treasure *tr;
416  int remove = 0;
417 
418  if (god->randomitems == NULL) {
419  LOG(llevError, "BUG: remove_special_prayers(): god %s without randomitems\n", god->name);
420  return;
421  }
422 
423 
424  /* Outer loop iterates over all special prayer marks */
426  /* we mark special prayers with the STARTEQUIP flag, so if it isn't
427  * in that category, not something we need to worry about.
428  */
429  if (tmp->type != SPELL || !QUERY_FLAG(tmp, FLAG_STARTEQUIP))
430  continue;
431 
432  /* Inner loop tries to find the special prayer in the god's treasure
433  * list. We default that the spell should not be removed.
434  */
435  remove = 0;
436  for (tr = god->randomitems->items; tr; tr = tr->next) {
437  if (tr->item == NULL)
438  continue;
439 
440  /* Basically, see if the matching spell is granted by this god. */
441 
442  if (tr->item->clone.type == SPELL && tr->item->clone.name == tmp->name) {
443  remove = 1;
444  break;
445  }
446  }
447  if (remove) {
448  /* just do the work of removing the spell ourselves - we already
449  * know that the player knows the spell
450  */
453  "You lose knowledge of %s.",
454  tmp->name);
455  player_unready_range_ob(op->contr, tmp);
458  }
459  } FOR_INV_FINISH();
460 }
461 
477 int become_follower(object *op, const object *new_god) {
478  /* take away any special god-characteristic items. */
480  /* remove all invisible startequip items which are
481  * not skill, exp or force
482  */
484  && item->invisible
485  && (item->type != SKILL)
486  && (item->type != FORCE)
487  && (item->type != SPELL)) {
491  }
492  } FOR_INV_FINISH();
493 
494  /* remove any items given by the old god */
495  const object *old_god = find_god(determine_god(op));
496  if (old_god) {
497  /* Changed to use the new "divine_giver_name" key_value
498  * so it can reliably delete enchanted items. Now it loops
499  * through the player's inventory, instead of the god's
500  * treasure list.
501  */
502  follower_remove_given_items(op, op, old_god);
503  remove_special_prayers(op, old_god);
504  }
505 
506  if (!op || !new_god)
507  return 0;
508 
509  if (op->race && new_god->slaying && strstr(op->race, new_god->slaying)) {
511  "Fool! %s detests your kind!",
512  new_god->name);
513  if (random_roll(0, op->level-1, op, PREFER_LOW)-5 > 0) {
514  object *tmp = create_archetype(LOOSE_MANA);
515  cast_magic_storm(op, tmp, new_god->level+10);
516  }
517  return 0;
518  }
519 
520  /* give the player any special god-characteristic-items. */
521  for (treasure *tr = new_god->randomitems->items; tr != NULL; tr = tr->next) {
522  if (tr->item
523  && tr->item->clone.invisible
524  && tr->item->clone.type != SPELLBOOK
525  && tr->item->clone.type != BOOK
526  && tr->item->clone.type != SPELL)
527  god_gives_present(op, new_god, tr);
528  }
529 
531  "You become a follower of %s!",
532  new_god->name);
533 
535  /* Player has no skill - give them the skill */
536  if (!skop) {
537  /* The archetype should always be defined - if we crash here because it doesn't,
538  * things are really messed up anyways.
539  */
542  }
543 
544  int sk_applied = QUERY_FLAG(skop, FLAG_APPLIED); /* save skill status */
545 
546  int undeadified = 0; /* Turns to true if changing god can changes the undead
547  * status of the player.*/
548  /* Clear the "undead" status. We also need to force a call to change_abil,
549  * so I set undeadified for that.
550  * - gros, 21th July 2006.
551  */
552  if ((old_god) && (QUERY_FLAG(old_god, FLAG_UNDEAD))) {
553  CLEAR_FLAG(skop, FLAG_UNDEAD);
554  undeadified = 1;
555  }
556 
557  if (skop->title) { /* get rid of old god */
559  "%s's blessing is withdrawn from you.",
560  skop->title);
561 
562  /* The point of this is to really show what abilities the player just lost */
563  if (sk_applied || undeadified) {
564  CLEAR_FLAG(skop, FLAG_APPLIED);
565  (void)change_abil(op, skop);
566  }
567  free_string(skop->title);
568  }
569 
570  /* now change to the new gods attributes to exp_obj */
571  skop->title = add_string(new_god->name);
572  skop->path_attuned = new_god->path_attuned;
573  skop->path_repelled = new_god->path_repelled;
574  skop->path_denied = new_god->path_denied;
575  /* copy god's resistances */
576  memcpy(skop->resist, new_god->resist, sizeof(new_god->resist));
577 
578  /* make sure that certain immunities do NOT get passed
579  * to the follower!
580  */
581  for (int i = 0; i < NROFATTACKS; i++)
582  if (skop->resist[i] > 30
583  && (i == ATNR_FIRE || i == ATNR_COLD || i == ATNR_ELECTRICITY || i == ATNR_POISON))
584  skop->resist[i] = 30;
585 
586  skop->stats.hp = (int16_t)new_god->last_heal;
587  skop->stats.sp = (int16_t)new_god->last_sp;
588  skop->stats.grace = (int16_t)new_god->last_grace;
589  skop->stats.food = (int16_t)new_god->last_eat;
590  skop->stats.luck = (int8_t)new_god->stats.luck;
591  /* gods may pass on certain flag properties */
592  update_priest_flag(new_god, skop, FLAG_SEE_IN_DARK);
593  update_priest_flag(new_god, skop, FLAG_REFL_SPELL);
594  update_priest_flag(new_god, skop, FLAG_REFL_MISSILE);
595  update_priest_flag(new_god, skop, FLAG_STEALTH);
596  update_priest_flag(new_god, skop, FLAG_MAKE_INVIS);
597  update_priest_flag(new_god, skop, FLAG_UNDEAD);
598  update_priest_flag(new_god, skop, FLAG_BLIND);
599  update_priest_flag(new_god, skop, FLAG_XRAYS); /* better have this if blind! */
600  update_priest_flag(new_god, skop, FLAG_USE_WEAPON);
601  update_priest_flag(new_god, skop, FLAG_USE_ARMOUR);
602  update_priest_flag(new_god, skop, FLAG_USE_SHIELD);
603 
605  "You are bathed in %s's aura.",
606  new_god->name);
607 
608  /* Weapon/armour use are special...handle flag toggles here as this can
609  * only happen when gods are worshipped and if the new priest could
610  * have used armour/weapons in the first place.
611  *
612  * This also can happen for monks which cannot use weapons. In this case
613  * do not allow to use weapons even if the god otherwise would allow it.
614  */
615  if (!object_present_in_ob_by_name(FORCE, "no weapon force", op)) {
616  if (worship_forbids_use(op, skop, FLAG_USE_WEAPON, "weapons"))
618  }
619  update_priest_flag(new_god, skop, FLAG_USE_ARMOUR);
620 
621  if (worship_forbids_use(op, skop, FLAG_USE_ARMOUR, "armour")) {
624  stop_using_item(op, BOOTS, 1);
626  }
627 
628  if (worship_forbids_use(op, skop, FLAG_USE_SHIELD, "shield"))
630 
631  SET_FLAG(skop, FLAG_APPLIED);
632  (void)change_abil(op, skop);
633 
634  /* return to previous skill status */
635  if (!sk_applied)
636  CLEAR_FLAG(skop, FLAG_APPLIED);
637 
638  return 1;
639 }
640 
654 static int worship_forbids_use(object *op, object *exp_obj, uint32_t flag, const char *string) {
655  if (QUERY_FLAG(&op->arch->clone, flag)) {
656  if (QUERY_FLAG(op, flag) != QUERY_FLAG(exp_obj, flag)) {
657  update_priest_flag(exp_obj, op, flag);
658  if (QUERY_FLAG(op, flag))
660  "You may use %s again.",
661  string);
662  else {
664  "You are forbidden to use %s.",
665  string);
666  return 1;
667  }
668  }
669  }
670  return 0;
671 }
672 
684 static void stop_using_item(object *op, int type, int number) {
686  if (tmp->type == type && QUERY_FLAG(tmp, FLAG_APPLIED)) {
688  number--;
689  if (number <= 0)
690  break;
691  }
692  FOR_INV_FINISH();
693 }
694 
707 static void update_priest_flag(const object *god, object *exp_ob, uint32_t flag) {
708  if (QUERY_FLAG(god, flag) && !QUERY_FLAG(exp_ob, flag))
709  SET_FLAG(exp_ob, flag);
710  else if (QUERY_FLAG(exp_ob, flag) && !QUERY_FLAG(god, flag)) {
711  /* When this is called with the exp_ob set to the player,
712  * this check is broken, because most all players arch
713  * allow use of weapons. I'm not actually sure why this
714  * check is here - I guess if you had a case where the
715  * value in the archetype (wisdom) should over ride the restrictions
716  * the god places on it, this may make sense. But I don't think
717  * there is any case like that.
718  */
719 
720 /* if (!(QUERY_FLAG(&(exp_ob->arch->clone), flag)))*/
721  CLEAR_FLAG(exp_ob, flag);
722  }
723 }
724 
725 
739 archetype *determine_holy_arch(const object *god, const char *type) {
740  treasure *tr;
741  int count;
742  object *item;
743 
744  if (!god || !god->randomitems) {
745  LOG(llevError, "BUG: determine_holy_arch(): no god or god without randomitems\n");
746  return NULL;
747  }
748 
749  count = 0;
750  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
751  if (!tr->item)
752  continue;
753  item = &tr->item->clone;
754  if (item->type == BOOK && item->invisible && item->name == type)
755  count++;
756  }
757  if (count == 0) {
758  return NULL;
759  }
760 
761  count = rndm(1, count);
762 
763  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
764  if (!tr->item)
765  continue;
766  item = &tr->item->clone;
767  if (item->type == BOOK && item->invisible && item->name == type) {
768  count--;
769  if (count == 0)
770  return item->other_arch;
771  }
772  }
773 
774  return NULL;
775 }
776 
787 static int god_removes_curse(object *op, int remove_damnation) {
788  int success = 0;
789 
791  if (tmp->invisible)
792  continue;
793  if (QUERY_FLAG(tmp, FLAG_DAMNED) && !remove_damnation)
794  continue;
796  success = 1;
800  if (op->type == PLAYER)
802  }
803  } FOR_INV_FINISH();
804 
805  if (success)
807  "You feel like someone is helping you.");
808  return success;
809 }
810 
820 static int follower_level_to_enchantments(int level, int difficulty) {
821  if (difficulty < 1) {
822  LOG(llevError, "follower_level_to_enchantments(): difficulty %d is invalid\n", difficulty);
823  return 0;
824  }
825 
826  if (level <= 20)
827  return level/difficulty;
828  if (level <= 40)
829  return (20+(level-20)/2)/difficulty;
830  return (30+(level-40)/4)/difficulty;
831 }
832 
851 static int improve_weapon_magic(object *op, object *tr, object *weapon, object *skill) {
852  int tmp = follower_level_to_enchantments(skill->level, tr->level);
853 
854  if (weapon->magic < tmp) {
856  "A phosphorescent glow envelops your weapon!");
857  weapon->magic++;
858  if (op->type == PLAYER)
859  esrv_update_item(UPD_NAME, op, weapon);
860  weapon->item_power++;
861  return 1;
862  }
863 
864  return 0;
865 }
866 
884 static int god_enchants_weapon(object *op, const object *god, object *tr, object *skill) {
885  char buf[MAX_BUF];
886  object *weapon;
887  uint32_t attacktype;
888 
890  if (weapon == NULL)
892  if (weapon == NULL || god_examines_item(god, weapon) <= 0)
893  return 0;
894 
895  if (weapon->item_power >= MAX_WEAPON_ITEM_POWER) {
897  "%s considers your %s is not worthy to be enchanted any more.",
898  god->name,
899  weapon->name);
900  return 0;
901  }
902 
903  /* If personalized_blessings is activated, then the god's name is
904  * associated with the weapon, as well as the owner (the one who blesses it),
905  * and a "weapon willpower", which is equivalent to the owner's experience
906  * in praying when the weapon is blessed.
907  * Those values are used later, when another player attempts to wield the
908  * weapon - nasty things may happen to those who do not deserve to use it ! :)
909  */
911  const char *divine_owner = object_get_value(weapon, "divine_blessing_name");
912  const char *owner = object_get_value(weapon, "item_owner");
913  object *skillop = NULL;
914 
915  if (divine_owner != NULL && strcmp(divine_owner, god->name) != 0) {
916  /* Huho... Another god already blessed this one ! */
918  "Your %s already belongs to %s !",
919  weapon->name, divine_owner);
920  return 0;
921  }
922 
923  if ((owner != NULL) && (strcmp(owner, op->name) != 0)) {
924  /* Maybe the weapon itself will not agree ? */
926  "The %s is not yours, and is magically protected against such changes !",
927  weapon->name);
928  return 0;
929  }
930  skillop = find_skill_by_number(op, SK_PRAYING);
931  if (skillop == NULL) {
932  LOG(llevError, "god_enchants_weapon: no praying skill object found ?!\n");
933  snprintf(buf, sizeof(buf), "%d", 1);
934  } else
935  snprintf(buf, sizeof(buf), "%"FMT64, skillop->stats.exp);
936  object_set_value(weapon, "divine_blessing_name", god->name, TRUE);
937  object_set_value(weapon, "item_owner", op->name, TRUE);
938  object_set_value(weapon, "item_willpower", buf, TRUE);
939  }
940 
941  /* First give it a title, so other gods won't touch it */
942  if (!weapon->title) {
943  snprintf(buf, sizeof(buf), "of %s", god->name);
944  weapon->title = add_string(buf);
945  if (op->type == PLAYER)
946  esrv_update_item(UPD_NAME, op, weapon);
948  "Your weapon quivers as if struck!");
949  }
950 
951  /* Allow the weapon to slay enemies */
952  if (!weapon->slaying && god->slaying) {
953  weapon->slaying = add_string(god->slaying);
955  "Your %s now hungers to slay enemies of your god!",
956  weapon->name);
957  weapon->item_power++;
958  return 1;
959  }
960 
961  /* Add the gods attacktype */
962  attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype;
963  if ((attacktype&god->attacktype) != god->attacktype) {
965  "Your weapon suddenly glows!");
966  weapon->attacktype = attacktype|god->attacktype;
967  weapon->item_power++;
968  return 1;
969  }
970 
971  /* Higher magic value */
972  return improve_weapon_magic(op, tr, weapon, skill);
973 }
974 
990 static void god_intervention(object *op, const object *god, object *skill, object *altar) {
991  treasure *tr;
992 
993  if (!god || !god->randomitems) {
994  LOG(llevError, "BUG: god_intervention(): no god or god without randomitems\n");
995  return;
996  }
997 
998  /* lets do some checks of whether we are kosher with our god */
999  if (god_examines_priest(op, god) < 0)
1000  return;
1001 
1003  "You feel a holy presence!");
1004 
1005  if (altar->anim_suffix != NULL)
1006  apply_anim_suffix(altar, altar->anim_suffix);
1007 
1008  for (tr = god->randomitems->items; tr != NULL; tr = tr->next) {
1009  object *item;
1010 
1011  if (tr->chance <= random_roll(0, 99, op, PREFER_HIGH))
1012  continue;
1013 
1014  /* Treasurelist - generate some treasure for the follower */
1015  if (tr->name) {
1016  treasurelist *tl = find_treasurelist(tr->name);
1017  if (tl == NULL)
1018  continue;
1019 
1021  "Something appears before your eyes. You catch it before it falls to the ground.");
1022 
1024  return;
1025  }
1026 
1027  if (!tr->item) {
1028  LOG(llevError, "BUG: empty entry in %s's treasure list\n", god->name);
1029  continue;
1030  }
1031  item = &tr->item->clone;
1032 
1033  /* Grace limit */
1034  if (item->type == BOOK && item->invisible
1035  && strcmp(item->name, "grace limit") == 0) {
1036  if (op->stats.grace < item->stats.grace
1037  || op->stats.grace < op->stats.maxgrace) {
1038  object *tmp;
1039 
1040  /* Follower lacks the required grace for the following
1041  * treasure list items. */
1042 
1044  cast_change_ability(op, op, tmp, 0, 1);
1046  return;
1047  }
1048  continue;
1049  }
1050 
1051  /* Restore grace */
1052  if (item->type == BOOK && item->invisible
1053  && strcmp(item->name, "restore grace") == 0) {
1054  if (op->stats.grace >= 0)
1055  continue;
1056  op->stats.grace = random_roll(0, 9, op, PREFER_HIGH);
1058  "You are returned to a state of grace.");
1059  return;
1060  }
1061 
1062  /* Heal damage */
1063  if (item->type == BOOK && item->invisible
1064  && strcmp(item->name, "restore hitpoints") == 0) {
1065  if (op->stats.hp >= op->stats.maxhp)
1066  continue;
1068  "A white light surrounds and heals you!");
1069  op->stats.hp = op->stats.maxhp;
1070  return;
1071  }
1072 
1073  /* Restore spellpoints */
1074  if (item->type == BOOK
1075  && item->invisible
1076  && strcmp(item->name, "restore spellpoints") == 0) {
1077  int max = op->stats.maxsp*(item->stats.maxsp/100.0);
1078  /* Restore to 50 .. 100%, if sp < 50% */
1079  int new_sp = random_roll(1000, 1999, op, PREFER_HIGH)/2000.0*max;
1080  if (op->stats.sp >= max/2)
1081  continue;
1083  "A blue lightning strikes your head but doesn't hurt you!");
1084  op->stats.sp = new_sp;
1085  }
1086 
1087  /* Various heal spells */
1088  if (item->type == BOOK && item->invisible
1089  && strcmp(item->name, "heal spell") == 0) {
1090  object *tmp;
1091  int success;
1092 
1094 
1095  success = cast_heal(op, op, tmp, 0);
1097  if (success)
1098  return;
1099 
1100  continue;
1101  }
1102 
1103  /* Remove curse */
1104  if (item->type == BOOK && item->invisible
1105  && strcmp(item->name, "remove curse") == 0) {
1106  if (god_removes_curse(op, 0))
1107  return;
1108 
1109  continue;
1110  }
1111 
1112  /* Remove damnation */
1113  if (item->type == BOOK && item->invisible
1114  && strcmp(item->name, "remove damnation") == 0) {
1115  if (god_removes_curse(op, 1))
1116  return;
1117 
1118  continue;
1119  }
1120 
1121  /* Heal depletion */
1122  if (item->type == BOOK && item->invisible
1123  && strcmp(item->name, "heal depletion") == 0) {
1124  if (remove_depletion(op, -1)) {
1126  "Shimmering light surrounds and restores you!");
1127  }
1128  }
1129 
1130  /* Voices */
1131  if (item->type == BOOK && item->invisible
1132  && strcmp(item->name, "voice_behind") == 0) {
1134  "You hear a voice from behind you, but you don't dare to "
1135  "turn around:");
1137  item->msg);
1138  return;
1139  }
1140 
1141  /* Messages */
1142  if (item->type == BOOK && item->invisible
1143  && strcmp(item->name, "message") == 0) {
1145  item->msg);
1146  return;
1147  }
1148 
1149  /* Enchant weapon */
1150  if (item->type == BOOK && item->invisible
1151  && strcmp(item->name, "enchant weapon") == 0) {
1152  if (god_enchants_weapon(op, god, item, skill))
1153  return;
1154 
1155  continue;
1156  }
1157 
1158  /* Spellbooks - works correctly only for prayers */
1159  if (item->type == SPELL) {
1160  if (check_spell_known(op, item->name))
1161  continue;
1162  if (item->level > skill->level)
1163  continue;
1164 
1166  "%s grants you use of a special prayer!",
1167  god->name);
1168  do_learn_spell(op, item, 1);
1169  return;
1170  }
1171 
1172  /* Other gifts */
1173  if (!item->invisible) {
1174  if (god_gives_present(op, god, tr))
1175  return;
1176 
1177  continue;
1178  }
1179  /* else ignore it */
1180  }
1181 
1183  "You feel rapture.");
1184 }
1185 
1198 static int god_examines_priest(object *op, const object *god) {
1199  int reaction = 1;
1200  object *skop;
1201 
1203  if (QUERY_FLAG(item, FLAG_APPLIED)) {
1204  reaction += god_examines_item(god, item)*(item->magic ? abs(item->magic) : 1);
1205  }
1206  FOR_INV_FINISH();
1207 
1208  /* well, well. Looks like we screwed up. Time for god's revenge */
1209  if (reaction < 0) {
1210  int loss = 10000000;
1211  int angry = abs(reaction);
1212 
1214  if (skop)
1215  loss = 0.05*(float)skop->stats.exp;
1216  change_exp(op, -random_roll(0, loss*angry-1, op, PREFER_LOW), skop ? skop->skill : "none", SK_SUBTRACT_SKILL_EXP);
1217  if (random_roll(0, angry, op, PREFER_LOW)) {
1218  object *tmp = create_archetype(LOOSE_MANA);
1219 
1220  cast_magic_storm(op, tmp, op->level+(angry*3));
1221  }
1223  "%s becomes angry and punishes you!",
1224  god->name);
1225  }
1226  return reaction;
1227 }
1228 
1245 static int god_examines_item(const object *god, object *item) {
1246  char buf[MAX_BUF];
1247 
1248  if (!god || !item)
1249  return 0;
1250 
1251  if (!item->title)
1252  return 1; /* unclaimed item are ok */
1253 
1254  snprintf(buf, sizeof(buf), "of %s", god->name);
1255  if (!strcmp(item->title, buf))
1256  return 1; /* belongs to that God */
1257 
1258  if (god->title) { /* check if we have any enemy blessed item*/
1259  snprintf(buf, sizeof(buf), "of %s", god->title);
1260  if (!strcmp(item->title, buf)) {
1261  if (item->env) {
1262  char name[MAX_BUF];
1263 
1266  "Heretic! You are using %s!",
1267  name);
1268  }
1269  return -1;
1270  }
1271  }
1272  return 0; /* item is sacred to a non-enemy god/or is otherwise magical */
1273 }
1274 
1285 static const char *get_god_for_race(const char *race) {
1286  godlink *gl = first_god;
1287  const char *godname = NULL;
1288 
1289  if (race == NULL)
1290  return NULL;
1291  while (gl) {
1292  if (gl->arch->clone.race && !strcasecmp(gl->arch->clone.race, race)) {
1293  godname = gl->name;
1294  break;
1295  }
1296  gl = gl->next;
1297  }
1298  return godname;
1299 }
1300 
1312 int tailor_god_spell(object *spellop, object *caster) {
1313  const object *god = find_god(determine_god(caster));
1314  int caster_is_spell = 0;
1315 
1316  if (caster->type == SPELL_EFFECT || caster->type == SPELL)
1317  caster_is_spell = 1;
1318 
1319  /* if caster is a rune or the like, it doesn't worship anything. However,
1320  * if this object is owned by someone, then the god that they worship
1321  * is relevant, so use that.
1322  */
1323  if (!god && object_get_owner(caster))
1324  god = find_god(determine_god(object_get_owner(caster)));
1325 
1326  if (!god || (spellop->attacktype&AT_HOLYWORD && !god->race)) {
1327  if (!caster_is_spell)
1329  "This prayer is useless unless you worship an appropriate god");
1330  else
1331  LOG(llevError, "BUG: tailor_god_spell(): no god\n");
1332  object_free_drop_inventory(spellop);
1333  return 0;
1334  }
1335 
1336  /* either holy word or godpower attacks will set the slaying field */
1337  if (spellop->attacktype&AT_HOLYWORD || spellop->attacktype&AT_GODPOWER) {
1338  if (spellop->slaying) {
1339  free_string(spellop->slaying);
1340  spellop->slaying = NULL;
1341  }
1342  if (!caster_is_spell)
1343  spellop->slaying = god->slaying ? add_string(god->slaying) : NULL;
1344  else if (caster->slaying)
1345  spellop->slaying = add_string(caster->slaying);
1346  }
1347 
1348  /* only the godpower attacktype adds the god's attack onto the spell */
1349  if (spellop->attacktype&AT_GODPOWER)
1350  spellop->attacktype = spellop->attacktype|god->attacktype;
1351 
1352  /* tack on the god's name to the spell */
1353  if (spellop->attacktype&AT_HOLYWORD || spellop->attacktype&AT_GODPOWER) {
1354  if (spellop->title)
1355  free_string(spellop->title);
1356  spellop->title = add_string(god->name);
1357  if (spellop->title) {
1358  char buf[MAX_BUF];
1359 
1360  snprintf(buf, sizeof(buf), "%s of %s", spellop->name, spellop->title);
1361  FREE_AND_COPY(spellop->name, buf);
1362  FREE_AND_COPY(spellop->name_pl, buf);
1363  }
1364  }
1365 
1366  return 1;
1367 }
treasurestruct::item
struct archt * item
Definition: treasure.h:64
treasurestruct::chance
uint8_t chance
Definition: treasure.h:70
god_removes_curse
static int god_removes_curse(object *op, int remove_damnation)
Definition: gods.c:787
PLAYER
@ PLAYER
Definition: object.h:107
global.h
object_free
void object_free(object *ob, int flags)
Definition: object.c:1565
add_string
sstring add_string(const char *str)
Definition: shstr.c:124
MSG_TYPE_SKILL_PRAY
#define MSG_TYPE_SKILL_PRAY
Definition: newclient.h:591
object_remove
void object_remove(object *op)
Definition: object.c:1806
BOW
@ BOW
Definition: object.h:118
llevError
@ llevError
Definition: logger.h:11
find_skill_by_number
object * find_skill_by_number(object *who, int skillno)
Definition: main.c:376
WAND
@ WAND
Definition: object.h:220
FLAG_UNDEAD
#define FLAG_UNDEAD
Definition: define.h:270
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
tailor_god_spell
int tailor_god_spell(object *spellop, object *caster)
Definition: gods.c:1312
GLOVES
@ GLOVES
Definition: object.h:213
FLAG_STARTEQUIP
#define FLAG_STARTEQUIP
Definition: define.h:268
MSG_TYPE_SKILL
#define MSG_TYPE_SKILL
Definition: newclient.h:407
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
FLAG_REFL_MISSILE
#define FLAG_REFL_MISSILE
Definition: define.h:273
obj::race
sstring race
Definition: object.h:319
glnk::arch
struct archt * arch
Definition: god.h:14
glnk::id
int id
Definition: god.h:15
do_learn_spell
void do_learn_spell(object *op, object *spell, int special_prayer)
Definition: apply.c:484
FLAG_SEE_IN_DARK
#define FLAG_SEE_IN_DARK
Definition: define.h:337
same_string
static int same_string(const char *s1, const char *s2)
Definition: gods.c:175
AT_PHYSICAL
#define AT_PHYSICAL
Definition: attack.h:76
obj::path_attuned
uint32_t path_attuned
Definition: object.h:346
pl
Definition: player.h:92
ARMOUR
@ ARMOUR
Definition: object.h:120
PREFER_LOW
#define PREFER_LOW
Definition: define.h:564
WEAPON
@ WEAPON
Definition: object.h:119
determine_god
const char * determine_god(object *op)
Definition: gods.c:106
LOOSE_MANA
#define LOOSE_MANA
Definition: spells.h:162
SK_PRAYING
@ SK_PRAYING
Definition: skills.h:49
liv::hp
int16_t hp
Definition: living.h:40
MSG_TYPE_ATTRIBUTE
#define MSG_TYPE_ATTRIBUTE
Definition: newclient.h:405
GT_ONLY_GOOD
@ GT_ONLY_GOOD
Definition: treasure.h:34
MIN
#define MIN(x, y)
Definition: compat.h:21
move_player
int move_player(object *op, int dir)
Definition: player.c:2912
SKILL
@ SKILL
Definition: object.h:143
object_find_by_type_applied
object * object_find_by_type_applied(const object *who, int type)
Definition: object.c:4091
find_treasurelist
treasurelist * find_treasurelist(const char *name)
Definition: assets.cpp:257
obj::path_denied
uint32_t path_denied
Definition: object.h:348
Ice.tmp
int tmp
Definition: Ice.py:207
NDI_NAVY
#define NDI_NAVY
Definition: newclient.h:244
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
HOLY_POSSESSION
#define HOLY_POSSESSION
Definition: spells.h:168
random_roll64
int64_t random_roll64(int64_t min, int64_t max, const object *op, int goodbad)
Definition: utils.c:77
create_treasure
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
Definition: treasure.c:242
FLAG_APPLIED
#define FLAG_APPLIED
Definition: define.h:235
remove_special_prayers
static void remove_special_prayers(object *op, const object *god)
Definition: gods.c:414
FLAG_STEALTH
#define FLAG_STEALTH
Definition: define.h:312
events_execute_object_event
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Definition: events.cpp:259
FLAG_BLIND
#define FLAG_BLIND
Definition: define.h:336
GT_STARTEQUIP
@ GT_STARTEQUIP
Definition: treasure.h:33
obj::randomitems
struct treasureliststruct * randomitems
Definition: object.h:389
HUGE_BUF
#define HUGE_BUF
Definition: define.h:37
treasurestruct
Definition: treasure.h:63
MAX
#define MAX(x, y)
Definition: compat.h:24
cast_magic_storm
void cast_magic_storm(object *op, object *tmp, int lvl)
Definition: spell_effect.c:46
archt
Definition: object.h:468
settings
struct Settings settings
Definition: init.c:39
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
obj::last_heal
int32_t last_heal
Definition: object.h:360
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.c:4354
obj::slaying
sstring slaying
Definition: object.h:320
free_string
void free_string(sstring str)
Definition: shstr.c:280
liv::luck
int8_t luck
Definition: living.h:39
god_gives_present
static int god_gives_present(object *op, const object *god, treasure *tr)
Definition: gods.c:259
object_find_by_type_subtype
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Definition: object.c:4309
liv::exp
int64_t exp
Definition: living.h:47
FMT64
#define FMT64
Definition: compat.h:16
PREFER_HIGH
#define PREFER_HIGH
Definition: define.h:563
cast_heal
int cast_heal(object *op, object *caster, object *spell, int dir)
Definition: spell_effect.c:1762
HELMET
@ HELMET
Definition: object.h:136
link_player_skills
void link_player_skills(object *op)
Definition: player.c:290
god_examines_item
static int god_examines_item(const object *god, object *item)
Definition: gods.c:1245
obj::name
sstring name
Definition: object.h:312
query_name
void query_name(const object *op, char *buf, size_t size)
Definition: item.c:584
FLAG_KNOWN_CURSED
#define FLAG_KNOWN_CURSED
Definition: define.h:320
obj::path_repelled
uint32_t path_repelled
Definition: object.h:347
glnk::name
const char * name
Definition: god.h:13
improve_weapon_magic
static int improve_weapon_magic(object *op, object *tr, object *weapon, object *skill)
Definition: gods.c:851
remove_depletion
int remove_depletion(object *op, int level)
Definition: living.c:756
obj::name_pl
sstring name_pl
Definition: object.h:316
stop_using_item
static void stop_using_item(object *op, int type, int number)
Definition: gods.c:684
glnk
Definition: god.h:12
ROD
@ ROD
Definition: object.h:109
MSG_TYPE_ITEM
#define MSG_TYPE_ITEM
Definition: newclient.h:412
SCRIPT_FIX_ALL
#define SCRIPT_FIX_ALL
Definition: global.h:367
query_short_name
void query_short_name(const object *op, char *buf, size_t size)
Definition: item.c:509
AP_IGNORE_CURSE
#define AP_IGNORE_CURSE
Definition: define.h:582
FLAG_MAKE_INVIS
#define FLAG_MAKE_INVIS
Definition: define.h:328
absdir
int absdir(int d)
Definition: object.c:3722
glnk::next
struct glnk * next
Definition: god.h:16
FREE_AND_COPY
#define FREE_AND_COPY(sv, nv)
Definition: global.h:202
worship_forbids_use
static int worship_forbids_use(object *op, object *exp_obj, uint32_t flag, const char *string)
Definition: gods.c:654
FLAG_DAMNED
#define FLAG_DAMNED
Definition: define.h:317
god_intervention
static void god_intervention(object *op, const object *god, object *skill, object *altar)
Definition: gods.c:990
UPD_FLAGS
#define UPD_FLAGS
Definition: newclient.h:315
FLAG_USE_SHIELD
#define FLAG_USE_SHIELD
Definition: define.h:237
god_enchants_weapon
static int god_enchants_weapon(object *op, const object *god, object *tr, object *skill)
Definition: gods.c:884
get_god_for_race
static const char * get_god_for_race(const char *race)
Definition: gods.c:1285
obj::other_arch
struct archt * other_arch
Definition: object.h:417
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:675
lookup_god_by_name
static int lookup_god_by_name(const char *name)
Definition: gods.c:54
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:4489
rndm
int rndm(int min, int max)
Definition: utils.c:162
disinfect.count
int count
Definition: disinfect.py:7
say.max
dictionary max
Definition: say.py:148
ATNR_POISON
#define ATNR_POISON
Definition: attack.h:59
FLAG_USE_WEAPON
#define FLAG_USE_WEAPON
Definition: define.h:296
sproto.h
liv::food
int32_t food
Definition: living.h:48
BOOK
@ BOOK
Definition: object.h:114
nlohmann::detail::void
j template void())
Definition: json.hpp:4099
follower_remove_given_items
static void follower_remove_given_items(object *pl, object *op, const object *god)
Definition: gods.c:197
follower_has_similar_item
static int follower_has_similar_item(object *op, object *item)
Definition: gods.c:233
MAX_BUF
#define MAX_BUF
Definition: define.h:35
fix_generated_item
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
Definition: treasure.c:877
obj::item_power
int8_t item_power
Definition: object.h:365
create_archetype
object * create_archetype(const char *name)
Definition: arch.cpp:281
ATNR_FIRE
#define ATNR_FIRE
Definition: attack.h:51
random_roll
int random_roll(int min, int max, const object *op, int goodbad)
Definition: utils.c:42
MSG_TYPE_ITEM_ADD
#define MSG_TYPE_ITEM_ADD
Definition: newclient.h:643
obj::title
sstring title
Definition: object.h:318
treasureliststruct::items
struct treasurestruct * items
Definition: treasure.h:89
become_follower
int become_follower(object *op, const object *new_god)
Definition: gods.c:477
sounds.h
FLAG_REFL_SPELL
#define FLAG_REFL_SPELL
Definition: define.h:275
altar_valkyrie.altar
altar
Definition: altar_valkyrie.py:27
obj::type
uint8_t type
Definition: object.h:341
obj::last_grace
int16_t last_grace
Definition: object.h:362
NDI_UNIQUE
#define NDI_UNIQUE
Definition: newclient.h:262
spells.h
obj::stats
living stats
Definition: object.h:371
archt::clone
object clone
Definition: object.h:472
find_god
const object * find_god(const char *name)
Definition: gods.c:80
apply_anim_suffix
void apply_anim_suffix(object *who, const char *suffix)
Definition: anim.c:149
FLAG_USE_ARMOUR
#define FLAG_USE_ARMOUR
Definition: define.h:295
item
Definition: item.py:1
MSG_TYPE_ITEM_REMOVE
#define MSG_TYPE_ITEM_REMOVE
Definition: newclient.h:642
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
create_archetype_by_object_name
object * create_archetype_by_object_name(const char *name)
Definition: arch.cpp:118
follower_level_to_enchantments
static int follower_level_to_enchantments(int level, int difficulty)
Definition: gods.c:820
check_spell_known
object * check_spell_known(object *op, const char *name)
Definition: spell_util.c:393
liv::grace
int16_t grace
Definition: living.h:44
give.op
op
Definition: give.py:33
Settings::personalized_blessings
uint8_t personalized_blessings
Definition: global.h:308
determine_holy_arch
archetype * determine_holy_arch(const object *god, const char *type)
Definition: gods.c:739
MSG_TYPE_ATTRIBUTE_GOD
#define MSG_TYPE_ATTRIBUTE_GOD
Definition: newclient.h:575
esrv_update_item
void esrv_update_item(int flags, object *pl, object *op)
Definition: main.c:360
SPELL_EFFECT
@ SPELL_EFFECT
Definition: object.h:215
obj::last_sp
int32_t last_sp
Definition: object.h:361
NDI_WHITE
#define NDI_WHITE
Definition: newclient.h:243
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
SK_SUBTRACT_SKILL_EXP
#define SK_SUBTRACT_SKILL_EXP
Definition: skills.h:81
apply_special
int apply_special(object *who, object *op, int aflags)
Definition: apply.c:1156
buf
StringBuffer * buf
Definition: readable.c:1606
change_exp
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Definition: living.c:2168
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.c:2820
obj::last_eat
int32_t last_eat
Definition: object.h:359
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:232
try_leave_cult
static bool try_leave_cult(object *pl, object *skill, int angry)
Definition: gods.c:296
update_priest_flag
static void update_priest_flag(const object *god, object *exp_ob, uint32_t flag)
Definition: gods.c:707
strcasecmp
int strcasecmp(const char *s1, const char *s2)
object_present_in_ob_by_name
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Definition: object.c:3153
UPD_NAME
#define UPD_NAME
Definition: newclient.h:318
obj::skill
sstring skill
Definition: object.h:322
treasurestruct::next
struct treasurestruct * next
Definition: treasure.h:66
pray_at_altar
void pray_at_altar(object *pl, object *altar, object *skill)
Definition: gods.c:322
draw_ext_info
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Definition: main.c:309
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1533
treasurestruct::name
const char * name
Definition: treasure.h:65
AT_GODPOWER
#define AT_GODPOWER
Definition: attack.h:96
get_archetype_by_type_subtype
archetype * get_archetype_by_type_subtype(int type, int subtype)
Definition: arch.cpp:101
pntr_to_god_obj
const object * pntr_to_god_obj(godlink *godlnk)
Definition: holy.c:122
cast_change_ability
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
Definition: spell_effect.c:1917
MSG_TYPE_ITEM_CHANGE
#define MSG_TYPE_ITEM_CHANGE
Definition: newclient.h:644
archt::name
sstring name
Definition: object.h:469
ATNR_COLD
#define ATNR_COLD
Definition: attack.h:53
god_examines_priest
static int god_examines_priest(object *op, const object *god)
Definition: gods.c:1198
FLAG_XRAYS
#define FLAG_XRAYS
Definition: define.h:300
say.item
dictionary item
Definition: say.py:149
GT_UPDATE_INV
@ GT_UPDATE_INV
Definition: treasure.h:35
AP_UNAPPLY
#define AP_UNAPPLY
Definition: define.h:575
obj::attacktype
uint32_t attacktype
Definition: object.h:345
BOOTS
@ BOOTS
Definition: object.h:212
MAX_WEAPON_ITEM_POWER
#define MAX_WEAPON_ITEM_POWER
Definition: define.h:459
give_skill_by_name
object * give_skill_by_name(object *op, const char *skill_name)
Definition: living.c:1779
TRUE
#define TRUE
Definition: compat.h:11
ATNR_ELECTRICITY
#define ATNR_ELECTRICITY
Definition: attack.h:52
first_god
EXTERN godlink * first_god
Definition: global.h:120
AT_HOLYWORD
#define AT_HOLYWORD
Definition: attack.h:97
change_abil
int change_abil(object *op, object *tmp)
Definition: living.c:395
SPELL
@ SPELL
Definition: object.h:214
liv::sp
int16_t sp
Definition: living.h:42
player_unready_range_ob
void player_unready_range_ob(player *pl, object *ob)
Definition: player.c:4410
SHIELD
@ SHIELD
Definition: object.h:135
FLAG_CURSED
#define FLAG_CURSED
Definition: define.h:316
living.h
obj::magic
int8_t magic
Definition: object.h:351
obj::resist
int16_t resist[NROFATTACKS]
Definition: object.h:344
if
if(!(yy_init))
Definition: loader.c:2589
SPELLBOOK
@ SPELLBOOK
Definition: object.h:203
MSG_TYPE_ITEM_INFO
#define MSG_TYPE_ITEM_INFO
Definition: newclient.h:645
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:668
FORCE
@ FORCE
Definition: object.h:224
draw_ext_info_format
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
Definition: main.c:319
object.h
obj::level
int16_t level
Definition: object.h:354
treasureliststruct
Definition: treasure.h:82
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
give.name
name
Definition: give.py:27
EVENT_APPLY
#define EVENT_APPLY
Definition: events.h:19
object_get_owner
object * object_get_owner(object *op)
Definition: object.c:797
level
Definition: level.py:1