Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ A better way to add BAB to smaug

A better way to add BAB to smaug

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kregor   (4 posts)  Bio
Date Thu 09 Nov 2006 09:15 PM (UTC)
Message
I've been working on a pet project, adding Open Gaming mechanics to a base MWSmaug 1.5. One of the things I've done is to add a BAB (Base Attack Bonus) table for each class, and then changed the multi_attack code to reflect the number of attacks based on the BAB bonus of the character (in other words, the skills for each attack are gone.) It works fairly well, except that the way I've reflected the BAB penalty for each successive attack, seems to be leaving the character's hitroll in the negative at times. I tried to apply a negative to the ch->hitroll before the one_hit command, then add it back after.

ch_ret multi_hit( CHAR_DATA * ch, CHAR_DATA * victim, int dt )
{
   int chance;
   ch_ret retcode;

<snip down to the important part>

   if( get_eq_char( ch, WEAR_DUAL_WIELD ) )
   {
      retcode = dual_hit( ch, victim, dt );
      if( retcode != rNONE || who_fighting( ch ) != victim )
         return retcode;
   }

   /*
    * NPC predetermined number of attacks         -Thoric
    */
   if( IS_NPC( ch ) && ch->numattacks > 0 )
   {
      for( chance = 0; chance < ch->numattacks; chance++ )
      {
         retcode = one_hit( ch, victim, dt );
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
      return retcode;
   }

   /*
    * Change to determine no. of hits by BAB - Kregor
    */
   if( BAB_BONUS( ch ) > 5 )
   {
      ch->hitroll -= 5;
      retcode = one_hit( ch, victim, dt );
      ch->hitroll += 5;
      if( retcode != rNONE || who_fighting( ch ) != victim )
         return retcode;
   }

   if( BAB_BONUS( ch ) > 10 )
   {
      ch->hitroll -= 10;
      retcode = one_hit( ch, victim, dt );
      ch->hitroll += 10;
      if( retcode != rNONE || who_fighting( ch ) != victim )
         return retcode;
   }

   if( BAB_BONUS( ch ) > 15 )
   {
      ch->hitroll -= 15;
      retcode = one_hit( ch, victim, dt );
      ch->hitroll += 15;
      if( retcode != rNONE || who_fighting( ch ) != victim )
         return retcode;
   }

   if( get_eq_char( ch, WEAR_DUAL_WIELD ) )
   {
      if( LEARNED( ch, gsn_improved_two_weapon ) )
      {
         ch->hitroll -= 5;
         retcode = dual_hit( ch, victim, dt );
         ch->hitroll += 5;
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
   }

   retcode = rNONE;

   chance = IS_NPC( ch ) ? ( int )( ch->level / 2 ) : 0;
   if( number_percent(  ) < chance )
      retcode = one_hit( ch, victim, dt );

   if( retcode == rNONE )
   {
      int move;

      if( !IS_AFFECTED( ch, AFF_FLYING ) && !IS_AFFECTED( ch, AFF_FLOATING ) )
         move = encumbrance( ch, movement_loss[UMIN( SECT_MAX - 1, ch->in_room->sector_type )] );
      else
         move = encumbrance( ch, 1 );
      if( ch->move )
         ch->move = UMAX( 0, ch->move - move );
   }
   return retcode;
}


any suggestions on how to make this penalty reflected in the one_hit and dual_hit (essentially a clone of the one_hit code for the offhand) without a write to the pfile?
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


7,680 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.