AC 101

Today I’ve decided to talk a bit about AC and how it actually works. We recently did a dive through all the hit/ac code and I thought it might be interesting to share.


First, a scenario! A level 50 monster takes a swing at a level 50 player (knight, no buffs) with -70ac. Lets walk through what happens.

First, the game asks “Is the player frozen?” If he is, the attack misses

Next, the game asks “Is the monster a summon AND is the player in town?” If both are true, the attack misses

Next, the game asks “Did the player’s doll proc a dodge?” If this is true, the attack misses

At this point, the game decides  the attack occurred in an environment that it can potentially succeed. It sets “hit rate” equal to the monster’s level. In this case, it’s 50.

If it’s a pet it adds bonuses based off pet armor to that “hit rate”, as well as any NPC hit bonuses. In this case, there are none.

Next, it creates an “attacker dice” value by rolling 1-20 and adding it to “hit rate”. This value is what will be compared later to determine if the attack was successful. The game has code that basically says if the monster rolled a 1 it automatically misses, and if it rolled a 20 it automatically hits, both regardless of the target’s AC. It does this by comparing “attacker dice” to “hit rate” (a miss/fumble) and “hit rate +20” (a hit/critical [the code calls it a critical but it is really just a normal hit]) later in the code. This means all players always have at least a 5% base chance to be hit and a 5% base chance to be missed no matter their ac or the monster attacking them. Our monster had a “hit rate” value of 50, so now he has an “attacker dice” between 50-70, but remember if he got a 50 he fumbles and a 70 he criticals.

The game takes that “attacker dice” value and modifies it by the target’s dodge and ndodge (subtracts dodge from “attacker dice”, adds ndodge). Dodge exists basically as two spells, uncanny dodge and mirror image. Both give “+5” dodge. ndodge is negative dodge, and it comes from resist fear. It gives “-5”. These abilities are incredibly powerful, because they impact the value of “attacker dice” BEFORE the game checks if the npc fumbled/critical. This means they influence how often a monster fumbles/criticals before it ever compares to AC (our monster’s 50-70 becomes a 45-65, but is still compared to <=50 or >=70). Uncanny Dodge and Mirror Image are essentially a flat 25% chance to avoid any melee attack, negates any chance the monster had to “critical” avoiding ac, and also provide some influence on attacks that make it to the AC check. On the flip side, Resist Fear does the opposite and makes it so no matter your ac, you will be hit by at least 25% MORE attacks. Since our player is a knight, he has no dodge abilities, so this doesn’t impact it.

Now, the game finally looks at the target’s AC. Everyone has a default “defender dice” value of 10. If your AC is positive (+10-+1, basically naked) it subtracts from 10 to get your “defender dice” value. If your AC is negative, it uses the formula below:

DefenderDice = 10 + _random.nextInt(“Target’s AC”) + 1

This essentially means your “Defender Dice” is between 1o and 1o+your ac. Our scenario, the player has defender dice between 10 and 80.

It’s at this point the game calculates fumble/crit (if the monster got a 50 or a 70), then if it was not either of those, compares “attacker dice” to “defender dice”. Our monster must be between 51-69, while our knight must be between 10-80. If they tied, the attack misses.

As you can see, odds favor the monster hitting. Our knight has about a 23.75% chance to avoid an attack that makes it to the AC check (26.25% overall factoring in crit/fumble) (58% of the time he rolls below the monster’s range and is hit and 12.5% of the time he rolls above the range and is missed.  Of the 22.5% of the time he rolls within that range, he will only be higher roughly 50%, meaning 12.25% of the time he is missed and 12.25% he is hit. These are not exact since it doesn’t factor in ties, but it’s fairly close).

Because AC doesn’t ever increase the lower bound of “defender dice”, you pretty much always have some chance to be hit by any monster above level 10, in addition to the inherent 5% critical chance. All AC does is reduce the chance of being hit, without ever negating it. The higher level a monster is, the better chance it has to hit you. If a monster is 30 levels above your ac, it will always hit you unless it rolls the 5% fumble chance.

Dark Elves and Illusionists are the only classes who can completely negate the “possible crit”. As a result, they are the only classes who could in theory make a level 10 or lower monster miss every time. Their dodge ability not only grants them essentially a 30% chance to avoid any attack (25%+5%), it also makes their AC more effective by lowering the monster’s “attacker dice” before it’s compared to their “defender dice”, essentially giving them 5 more effective AC. A dark elf with uncanny dodge and identical AC to our knight has a 57.5% chance to avoid an attack from the same monster. That is an astonishingly high difference.

Note, all of this only applies to melee. If the target is being hit with a ranged attack, the game does a very easy calculation instead. It rolls between 1-100. If your ER is < the roll you get hit, otherwise you are missed. That’s it. Ranged attacks don’t factor in anything else other that ER (for monsters). This means every point of ER is 1% chance to avoid a ranged attack.


I found all of this to be very interesting, hopefully you all do to (and hopefully it’s not too hard to follow)! Add another reason Illu/DE are going to be good!







9 thoughts on “AC 101

  1. Jay says:

    >Our monster had a “hit rate” value of 50, so now he has an “attacker dice” between 50-70, but remember if he got a 50 he fumbles and a 70 he criticals.

    Did you mean to say that he has an attacker dice of 51-71? 50 base and an added 1-20 roll gives a floor/ceiling of 51/71 respectively.

  2. Zen1337 says:

    I never had the chance to enjoy the orginal l1, have been playing on some potato private servers tho.

    Looking forward to this server, I hope the gamepley will be balanced, on all the servers I was playing so far, there was usualy just one class dominan, No magic no Archers, since fighters were always the most powerfull for farming etc.

    Wish the best for the project and make the game fair play for all classes.

  3. Puddles says:

    So, if I want to improve the general health of my computer and have a much smoother game play, I just play Illu and kiringku my way to victory?

  4. Puddles says:

    Stevie Nicks says get the server done. Hottest chick ever. I’m going to have to dedicate a song to the server until its finished.

    Stevie Nicks & Tom Petty – Stop Draggin’ My Heart Around

    Shout out to Tom Petty. He will be missed.

  5. XchaoX says:

    So as im dreaming about this game,
    Im wondering about options to play on multi windows or will i need to set up 2 computers if i want to play two characters at once?
    Will it be possible to play two characters on same account at same time instead of opening multi accounts?

  6. Dinin and so many more says:

    I seriously doubt that you could play 2 chars on the same account.. as for playing 2 chars on the same computer, sure you can do that but you can’t control them at the same time.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.