home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / d-linux.zip / dm-dist / doc / spells.doc < prev    next >
Text File  |  1991-03-01  |  3KB  |  86 lines

  1. /* ************************************************************************
  2. *  Copyright (C) 1990, 1991 - see 'license.doc' for complete information. *
  3. ************************************************************************* */
  4.  
  5.                       OUT OF DATE I THINK (MS)
  6.  
  7.  
  8.  
  9. Description of affected_type structure:
  10.  
  11. struct affected_type
  12. {
  13.   byte type;           /* The type of spell that caused this      */
  14.   byte duration;       /* For how long its effects will last      */
  15.   byte modifier;       /* This is added to apropriate ability     */
  16.   byte location;       /* Tells which ability to change(APPLY_XXX)*/
  17.   long bitvector;      /* Tells which bits to set (AFF_XXX)       */
  18.  
  19.   struct affected_type *next;
  20. };
  21.  
  22. The type is set to the constants defined in spells.h. These are any of
  23. SPELL_XXX, ei. SPELL_ARMOR.
  24.  
  25. Duration will be decreased at each time update.
  26.  
  27. Location is determined by the APPLY_XXX, ei. APPLY_STR to change strength.
  28.  
  29. Modifier will be added to the apropriate APPLY_XXX
  30.  
  31. Bitvector will set bits in the char_data->char_special_data.affected_by
  32.  
  33. ---------------------------------
  34.  
  35. Description of handler.c routines:
  36.  
  37.  
  38. void affect_location_apply ( struct char_data *ch,
  39.          struct affected_type *af, int type);
  40.  
  41. /* This procedure will (depending on type) Apply or Remove a characters */
  42. /* special bonus to abilities, which have been gained by spells         */
  43.  
  44. When Type is 1, Modifier will be added to an ability, and Bitvector will
  45. set bits in the "char_data->char_special_data.affected_by" bitvector. When
  46. Type == 0, Modifier is subtracted, and bits are removed.
  47.  
  48.  
  49.  
  50. void affect_to_char( struct char_data *ch, struct affected_type *af )
  51.  
  52. This procedure allocates new memory for an affected_type structure, and 
  53. inserts a copy of "*af" in the char_data->affected linked list. After
  54. insertion, the "affect_location_apply" is called, with type == 1.
  55.  
  56.  
  57.  
  58.  
  59. void affect_remove( struct char_data *ch, struct affected_type *af )
  60.  
  61. This procedure is the reverse of affect_to_char. Upon calling "af" MUST
  62. point to the structure(element) in the linked list that is to be removed.
  63. If not, the program will do an "exit()". Memory used is released, and
  64. "affect_location_apply" is called, with type == 0.
  65. BEWARE! Some spells may have several structures, since they must change
  66. more than one attribute! Calling affect_from_char does not mean that you
  67. have removed every occurence of a certain spell. But you can be sure that
  68. bits are masked out! Use affect_from_char below.
  69. ---------------------------------
  70.  
  71.  
  72.  
  73. void affect_from_char( struct char_data *ch, byte skill )
  74.  
  75. This fixes the warning above, by calling affect_remove with every
  76. structure that has same spelltype set as skill.
  77.  
  78.  
  79.  
  80.  
  81. bool affected_by_spell( struct char_data *ch, byte skill )
  82.  
  83. This procedure will check if a character is affected by a spell (the
  84. SPELL_XXX constants are used). Returns FALSE if not, otherwise TRUE.
  85.  
  86.