Enhanced damage skill [by Gerold Fisher]
Snippet Posted Thursday, December 2nd @ 05:39:19 PM, by George Greer in the Players dept.
Gerold Fisher writes, "I wanted to give fighters a percentage chance to double the amount of damage they did per hit. This is how i did it, really simple i know, but i never claimed to be the world's greatest coder."
fight.c:
in int damage:
/* if players know enhanced damage, give  chance to double damage */
  if (GET_SKILL(ch, SKILL_ENHANCE_DAM)) {
  percent = number(1, 101);     /* 101% is a complete failure */
  prob = GET_SKILL(ch, SKILL_ENHANCE_DAM);
    dam *= 2;
** i simply stuck this under the check for 
aff_sanctuary **
also, make sure you add a } right before
dam = MAX(MIN(dam, 100), 0);

after that you simply set it up as you would any other skill, adding a define in spells.h and of course in the array in spell_parser.c etc. etc. etc. I know there isn't much to this code, but perhaps it will give someone what they are looking for.

Cain
anywhere.wolfpaw.net

<< Making staffs/wands usable in all eq positions [by Michael Gallagher] | Reply | View as text | Threaded | Help on adding room sectors [by Vestrial] >>

 


Related Links
  Gerold Fisher
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.
 
 


This is ugly:P
by Jerry Fisher (cainers@wolfpaw.net) on Tuesday, July 17th @ 11:54:34 AM
http://anywhere.wolfpaw.net
If anyone actually used this in the last year and a half i would like to apologize. It is simply hideous. I would instead suggest you do something like this:

in damage:

if (GET_SKILL(ch, SKILL_ENHANCE_DAM) &&
number(1, 101) GET_SKILL(ch,SKILL_ENHANCE_DAM))
dam *= 2;

then of course you would define the skill in spells.h etc etc etc.

Again, sorry for how sloppy and just plain wrong this code was to begin with. I really had no clue what i was doing at the time.
[ Reply to this comment ]