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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ [Help] AC, Thac0, Thac32 and "Chance to Hit" calculations.

[Help] AC, Thac0, Thac32 and "Chance to Hit" calculations.

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


Posted by Oblisgr   (123 posts)  Bio
Date Sat 23 Apr 2016 11:05 AM (UTC)
Message
Hello,
I have played AD&D as player and DM so i can understand om basic point in battle calculation.

I can see that each mob/race has an AC, Thac0 and Thac32 stats. I can understand that the AC represends the way the mob will avoid the attck of the enemy. And the Thac0 the try the player has to put (in dice roll) to hit the mob. Actuall AD&D stuff.

Just a few questions:

1. The Thac32 does the same with as Thac0 just for AC=32?

2. The way the battle is calculated?

I imagine that the engine rolls a d20 at every attack and does thac0-roll to get the AC that can be hit like AD&D right?

I see in AreaEditor that a mob of level 1 has near 100 AC, and every level above has lower (like AD&D) and here i get confused. if AC=100 how the hell the attack chance is calculated. Because this way the AD&D formula will now work.

In AD&D level 1 mob without armor and bonus got AC=10 and not AC=100. So...?

If someone want to write me the actual SMAUG battle formula of "chance to hit", please do to help go further in understanding.

Thanks in advance
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 24 Apr 2016 02:08 AM (UTC)
Message
I suggest you look at the source. I don't know for sure what the code does with them. I found this in fight.c:


   thac0 = interpolate( ch->level, thac0_00, thac0_32 ) - GET_HITROLL( ch );
   victim_ac = UMAX( -19, ( int )( GET_AC( victim ) / 10 ) );


...

   if( diceroll == 0 || ( diceroll != 19 && diceroll < thac0 - victim_ac ) )
   {
      /*
       * Miss. 
       */
      if( prof_gsn != -1 )
         learn_from_failure( ch, prof_gsn );
      damage( ch, victim, 0, dt );
      tail_chain(  );
      return rNONE;
   }


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


11,033 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.