My campaigns are RP heavy, and the players fight NPC's as often as monsters. Hence, how could I calculate the CR of something with class levels?
The Challenge Rating of a creature with class levels equals the creature's listed Challenge Rating plus the creature's levels in associated classes and half (mostly) the creature's levels in nonassociated classes
For many creatures, the DM picks whether a creature's class levels are associated or nonassociated, but sometimes the creature's description will indicate what classes are associated and which are nonassociated.
The Monster Manual on Associated Class Levels says
Class levels that increase a monster’s existing strengths are known as associated class levels. Each associated class level a monster has increases its CR by 1.
Barbarian, fighter, paladin, and ranger are associated classes for a creature that relies on its fighting ability. For example, if you add a level of fighter, barbarian, ranger, or paladin to a frost giant, this directly improves the monster’s existing strengths and is therefore an associated class level.
Rogue and ranger are associated classes for a creature that relies on stealth to surprise its foes, or on skill use to give itself an advantage. The babau demon, for example, is “sneaky and sly” and has sneak attack as a special ability. Rogue is an associated class for this creature.
A spellcasting class is an associated class for a creature that already has the ability to cast spells as a character of the class in question, since the monster’s levels in the spellcasting class stack with its innate spellcasting ability. A rakshasa, for example, casts spells as a 7th-level sorcerer. If it picks up a level of sorcerer, it casts spells as an 8th-level sorcerer. (294)
And on Nonassociated Class Levels says
If you add a class level that doesn’t directly play to a creature’s strength (such as adding a sorcerer level to a frost giant), the class level is considered nonassociated, and things get a little more complicated. Adding a nonassociated class level to a monster increases its CR by 1/2 per level until one of its nonassociated class levels equals its original Hit Dice. At that point, each additional level of the same class or a similar one is considered associated and increases the monster’s CR by 1.
For example, frost giants have 14 HD. After you add 14 levels of sorcerer to a frost giant (and +7 to its CR), any further sorcerer class levels are considered associated. Adding one more sorcerer level increases this particular frost giant’s CR by 1.
Levels in NPC classes are always treated as nonassociated. (ibid.)
For example, let's take the bugbear:
- A bugbear sorcerer 3 is CR 3 (2 from bugbear + (3 from sorcerer / 2 nonassociated = 1.5 rounded down)).
- A bugbear bugbear sorcerer 10 is CR 10 (2 from bugbear + (3 from sorcerer / 2 nonassociated = 1.5 rounded down) + 7 from sorcerer).
- A bugbear ranger 3 is CR 5 (2 from bugbear + 3 from ranger).
- A bugbear ranger 10 is CR 12 (2 from bugbear + 10 from ranger).
- A bugbear ranger 3 / sorcerer 3 is CR 6 (2 from bugbear + 3 + (3 from sorcerer / 2 nonassociated = 1.5 rounded down)).
- A bugbear ranger 10 / Sorcerer 10 is CR 20 (2 from bugbear + 10 + (3 from sorcerer / 2 nonassociated = 1.5 rounded down) +7 from sorcerer).
- A bugbear sorcerer 20 is CR 20 (2 from bugbear + (3 from sorcerer / 2 nonassociated = 1.5 rounded down) + 17 from sorcerer).
This can get weird at high levels with a liberal DM, who can determine that, for example, a storm giant's 15 psion levels are nonassociated making the storm giant psion 15 CR 20, which, to some, might seem a little low. But, really, when using these rules, at the levels a storm giant psion 15 or a like monster could be appropriate, it's for the DM's to determine whether a creature is actually an appropriate challenge for the PCs, the system, at that point, only providing guidelines.
As the other answers have mentioned,
- The DMG describes a way of calculating an NPC's challenge rating - +1 CR for every associated class level, +1/2 CR for every unassociated class level up to the monster's racial HD, and then +1 thereafter.
- That way is a stupid way. Part of this is because CR in general is little less than a rough guess at the monster's power. There are CR2s that comfortably stand alongside CR5s, and CR20s that are mocked by CR15s for being weak. Part of this is because each party's capabilities will differ, so "challenge rating 5" could be tough for one 5th level party of four, and trivial for another.
Given that D&D 3.5 is 13 years old, it shouldn't surprise you that the community has come up with a solution, of sorts.
Vorpal Tribble's CR formula
I will stress again that this is an unofficial (one might call it homebrew) approach. On the other hand, it works for recalculating the CRs of both NPCs and regular monsters.
From Vorpal Tribble's monster making guide:
A challenge rating is how tough an encounter with this beast will be. Generally a creature of, say, a CR of 5 should be a standard challenge for a party of 4-5 5th level characters. To defeat this creature will cause them to use up roughly 1/4th to 1/3 their daily resources such as spells, potions, etc. This depends on the build of the party, their items, terrain, and many other factors, but in general it is more or less accurate.
Figuring out this challenge rating is the real fun part, and probably the most challenging bit of monster making. Its as much guestimating as anything, and there are no true rules to determine it exactly. Here is the closest method I've been able to come up with, though creatures with an enormous ammount of hit points or really low-leveled creatures will still be innacurate. The best way is to play-test the creature with parties of varying CR and find out which one most closely fits. Here though is the guestimator method:
- Divide creature's average HP by 4.5 to 6.5. 4.5 for 5 HD or lower, 5 for 6-10 HD, 5.5 for 11-15 HD, 6 for 16-20 HD., 6.5 for 20-25 HD.
- Add 1 for each five points above 10 its AC is, subtracting 1 for every 5 below.
- Add 1 for each special attack (+2 to +5 or more if its got a decent number of spells in its spell-like abilities).
- Add 1 for each quality unless you deem it worthy of more. Add 1 for each resistance and 10 points of DR it has, and 2 for each immunity. Subtract 1 for each vulnerability.
- Add 1 for every two bonus feats it has.
- Divide total by 3. This should be its rough CR.
Applying the formula
Given that the contention is "casters are stronger, fighters are weaker," let's see how two 10th level guys will come out in this calculator. We'll use an LA0 base because getting into the specifics of which race helps which class more is a lot of work. We will use the Elite Array for each NPC, with the 14 going to Constitution and 13 into Dexterity. 10th level NPC WBL is 16k gold.
10th level fighter
The party encounters an enemy champion, clad in steel. He utters an oath vaguely related to honor and glory, and charges them. Classic.
- A 10th level character gets 20 HP from a +2 CON bonus. The fighter's average HP from hit levels is 10+5.5*9, or 59.5. Added together and divided by 5, you get 15.9 for the factor contributing to CR.
- The fighter comes out the gate strong with full plate. Let's say he spends half of his NPC gold on AC, giving him a +1 full plate, a +1 heavy shield, a +1 ring of protection, and a +1 amulet of natural armor. He also has +1 from Dexterity. He ends up with AC of 25, which is 15 points above 10 and contributes +3 to the calculation, for 18.9 thus far.
- The fighter has no special attacks, which makes sense because fighters sort of exemplify "regular" attacks.
- The fighter has no special qualities, resistances, or damage reduction.
- The fighter has 6 bonus feats, which adds +3 to our calculation, for 21.9.
- Divided by 3, the CR of this fighter is just over 7. Since fighters live and die by their magic items, this makes sense - without the inflated wealth by level of a player character, the effectiveness of the fighter is greatly reduced.
10th level wizard
A wizard is never late, nor is he early. --Gandalf
The reason the wizard is never early, even though he can teleport, is because he was busy buffing himself. At 10th level, a humble 10 mins/lvl spell, after being extended, lasts for 3 hours, meaning that only stupid wizards show up to a fight without buffs. Just like the fighter's gear contributed to his CR, the wizard's buffs will contribute to his. The calculations below only take into account spells with durations measured in hours, which the wizard would have cast long before knowing he would have a battle.
- The wizard has 20 HP from his +2 CON, and 4+2.5*9 HP from levels, for 46.5. False life adds 10 more. Divided by 5, we get 11.3.
- The wizard also decides to spend no more than half of his gold on boosting his AC. He buys a +2 feycraft buckler for a cheap +3 to AC without any issues. +1 more comes from an amulet of natural AC, +1 more from a ring of protection, and gets +1 from his Dexterity. And then he looks at his spell list and goes "hm." Greater mage armor is an easy +6. Alter self into a troglodyte (and then disguise self back, to avoid suspicion) is +6 natural AC. Given that the wizard will probably be of opposed alignment to your party, magic circle against X gives +2 more. That's +20 AC total, which is +4 to our CR calculation, 14.3 so far.
- Oh boy. The wizard has a whole bunch of spells! He spent three on his AC so far, but he's got 25 per day. Since he's not likely to cast more than 10 spells in battle (5 regular, 5 quickened, fights generally don't go over 5 rounds) let's just give him +10 and move on. 24.3 so far.
- What special qualities does a wizard have? Well, whatever he feels like, because spells. Resist energy gives him 20 points of resistance to an energy type (whether or not it stacks with itself is contentious). Darkvision grants darkvision. Protection from energy grants immunity to another kind of energy. Oh, and he can fly with overland flight and see your party's invisible rogue with see invisibility. That's +6 from just these buffs. 30.3.
- Bonus feats! The wizard has three (scribe scroll, feat at 5, feat at 10). That's +1, for 31.3.
- Divided by 3, we get just over 11. The wizard is clearly a much greater threat than the fighter, and the math reflects that.
If the wizard has cause to know that there is danger (which he can, thanks to his magical minions and divinations) he will also have minute/level spells up (since they last 10 minutes, or 20 if extended, he has some leeway with timing the castings). Such a wizard should have a much higher CR even though it's the same guy, because of how many more defenses he has up. For example, he could polymorph into a dragon, and enjoy high natural AC, flight, and so forth all in one spell.
On the other hand, if your wizard is colossally stupid and has no buffs up at all, his real CR is much lower. And also someone's probably killed him already.
Note that spells cast during battle (or potions drunk, for the fighter) don't affect the CR, because that's just part of the creature's combat capabilities. Only things in effect before the dice roll count.
However, this is a flawed system. Monsters are often stronger than individual PCs, or have factors that cause them to appear to be more challenging (or tougher) than an equal level npc does when confronted by 4 PCs with nothing but his elite array and some class levels to protect him.
As you are using highly-modular components with vastly varying levels of power, the power of the npc is not a fixed constant either. Mu Sha Qui, the Majo of the Northern Dark, 7th level Wizard and his personal retinue of planar bound creatures, is probably a tougher challenge than Po Rin Qui, his older brother, a 7th level Fighter caught alone on a towertop without his Four Pillars to guard him. The damning thing is that with the wrong spells or tactics, that situation reverses. With the right build, Po Rin is an unstoppable whirlwind, and with the wrong spells or positioning, Mu Sha is a pushover (quite literally, with the right bullrush, a window, and the propensity for wizards to live in towers).
Even moreso than with monsters, using npcs as challenges depends on the GM's ability to 'judge' a situation and the strength of the individuals and either give the winds of chance a blow to the side that improves the story, or, communicate this to the PCs/have the NPCs realize this and act to try to redress the balance (two different styles of GMing).
CR isn't accurate at all when dealing with foes with class levels. There's a reason why the stronger GMs use npcs as foes a lot more, and it's because npcs as foes is hard.