Regen Objects [by Robert Sinland]
Snippet Posted Wednesday, August 12th @ 11:35:21 PM, by George Greer in the Objects dept.
Updated Jan 4, 1998. Click the link below to read it or download it.

From: Robert Sinland <rsinland@erskine.polaristel.net>
Subject: HP/Mana/Move Regen Items

   Plus HP and Mana regen items.
   By Robert Sinland
   With thanks to Chris Proctor for his advice, and Eduo for testing
   Update with New Flag From: Matt Roach <quinn@shiva.ml.org>

** structs.h

Search for struct char_special_data
    int
timer;


/* Timer for update


*/
  + sbyte hitgain;
  + sbyte managain;
  + sbyte movegain;

** handler.c

Search for void affect_modify
    case APPLY_HIT:
    GET_MAX_HIT(ch) += mod;
    break;

  + case APPLY_MANA_REGEN:
  + ch->char_specials.managain  += mod;
  +   break;

  + case APPLY_HIT_REGEN:
  + ch->char_specials.hitgain += mod;
  +  break;

  + case APPLY_MOVE_REGEN:
  + ch->char_specials.movegain += mod;
  +  break;


** limits.c

search for int hit_gain
  } else {
    gain = graf(age(ch).year, 8, 12, 20, 32, 16, 10, 4);
 +  gain = gain + ch->char_specials.hitgain;

search for int mana_gain
  } else {
    gain = graf(age(ch).year, 4, 8, 12, 16, 12, 10, 8);
 +  gain = gain + ch->char_specials.managain;

search for int move_gain
  } else {
    gain = graf(age(ch).year, 16, 20, 24, 20, 16, 12, 10);
  + gain = gain + cha->char_specials.movegain;


** db.c
note:  I dont know if this _has_ to be here, but it doesn't seem to
       hurt anything.

under void reset_char(struct char_data * ch)

    ch->char_specials.carry_weight = 0;
    ch->char_specials.carry_items = 0;
  + ch->char_specials.hitgain = 0;
  + ch->char_specials.managain = 0;
  + ch->char_specials.movegain = 0;


Now to be able to create those objects...

** Structs.h
    #define APPLY_SAVING_SPELL     24
/* Apply to save throw: spells
*/
    #define APPLY_RACE             25   /* Reserved                     */
  + #define APPLY_HIT_REGEN        26

  + #define APPLY_MANA_REGEN       27
  + #define APPLY_MOVE_REGEN       28
  Change your numbers to match your setup.

** constants.c
In const char *apply_types

   "SAVING_SPELL",
   "RACE",
 + "HIT_REGEN",
 + "MANA_REGEN",
 + "MOVE_REGEN",
   "\n"


<< Recharger For Wand And Staff [by David Carver] | Reply | View as text | Threaded | Regen Objects (Another Way) [by Mike Carpenter] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.