[CODE] A happy response and weapon improvement

From: Chuck Reed (master@I-55.COM)
Date: 08/15/98


>Hmm ok, I have no involvement in it, I'm just very attentive to who sends
>stuff ;)
>
>was just curious
>ill be quiet now and stop wasting bandwith/sending useless messages to 400
>people

Hey, check out what I'm about to do:
   |
   |
   V
  ObCircle:
-------------
I've been milling around on having players get better with certain types of
weapons (slashing weapons, piercing weapons, etc) as they use them.  I've
come up with a pretty decent system that is working well, and I thought I'd
throw the basic functionality at people and see what they thought.  If
anyone likes the look of it and is further interested, just drop me a mail
at master@i-55.com telling me, and I'll see what I can whip together to
show you.  Anyhow, there first section simply defines your weapon types and
how many you have (I've grouped some together):

#define NUM_ATTACK_CLASSES           8
/* The above define is set up like so:
     0) Hit / Punch / Claw
     1) Stab / Pierce
     2) Bludgeon / Crush / Pound / Maul
     3) Sting
     4) Whip / Thrash
     5) Blast
     6) Slash
     7) Bite
 */
#define IMPROVE_CHAR(ch, i)             ((ch)->player_specials->saved.improve[i])
#define CHAR_IMPROVE_RANK(ch, i)
((ch)->player_specials->saved.char_improve[i])

Now, the above to macros point to this here variable stuff: (yea, I'm
trying to sound stupid)

   long improve[NUM_ATTACK_CLASSES];
   long char_improve[NUM_ATTACK_CLASSES];

This one simply finds the type of weapon being used and gives the proper
index number for IMPROVE_CHAR and CHAR_IMPROVE_RANK.

int weapon_class(int type)
{
   if(!type)
      return FALSE;

   switch(type) {
      case TYPE_HIT:
      case TYPE_PUNCH:
      case TYPE_CLAW:
         return 0;
         break;
      case TYPE_STAB:
      case TYPE_PIERCE:
         return 1;
         break;
      case TYPE_BLUDGEON:
      case TYPE_CRUSH:
      case TYPE_POUND:
      case TYPE_MAUL:
         return 2;
         break;
      case TYPE_STING:
         return 3;
         break;
      case TYPE_WHIP:
      case TYPE_THRASH:
         return 4;
         break;
      case TYPE_BLAST:
         return 5;
         break;
      case TYPE_SLASH:
         return 6;
         break;
      case TYPE_BITE:
         return 7;
         break;
      default:
         log("Weapon improvement case statement reached default.");
         return 0;
         break;
     }
}

Now this is called every time someone gets off a successful hit (at least
on my mud), and slowly advances them according to the mobs exp.  It also
uses my system for left and right handed players, so you will need to
change some things where you see on_hand, etc.

void improve_weapon_hit(struct char_data *ch, struct char_data *victim)
{
   int x, on_hand;

   if(GET_HAND(ch))
      on_hand = WEAR_RIGHT_HAND;
   else
      on_hand = WEAR_LEFT_HAND;

   if(GET_EQ(ch, on_hand)) {
      x = GET_OBJ_VAL(GET_EQ(ch, on_hand), 3);
     }
   else
      x = 0;

   IMPROVE_CHAR(ch, weapon_class(x + TYPE_HIT)) += GET_EXP(victim) * 0.01;

   if(IMPROVE_CHAR(ch, weapon_class(x + TYPE_HIT)) >= 2000000)
     if(CHAR_IMPROVE_RANK(ch, weapon_class(x + TYPE_HIT)) >= 5)
        return;
     else
       CHAR_IMPROVE_RANK(ch, weapon_class(x + TYPE_HIT)) += 1;
}

There's tons of stuff I plan on expanding upon, but this is an early
project, so I thought I'd get some ideas or suggestions.

chuck


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST