Turn Undead/sandbox

Turn Undead checks
Turning undead consists of the following checks:
 * 1) Turning check: This determines the maximum number of Hit Dice a monster can have and still be affected from your turn undead attempt. If this check does not produce a number equal or higher to the monster near you that has the lowest hit dice, then you will not be able to turn at all and a message pops up saying "You lack conviction to turn the target".
 * 2) Turning damage: This determines the number of total Hit Dice you will be able to turn. This means that the sum of the affected monsters' hit dice must be less or equal to that number. To determine which monsters you turn, the game starts from the monster with the lowest HD (hit dice) and works its way up. For example: If you can turn 30 total hit dice and you have monsters with (5, 7, 10, 15) HD around you, you will turn the ones with (5, 7, 10) for a total of 22 hit dice and not the (15, 10, 5) that would utilize all 30 of your hit dice.

Before making the checks, your effective turning level is calculated. This consists of: The checks add the following things to produce the final number:
 * 1) The sum of your inherent turning levels. Your inherent turning level starts to increase from the level you receive the Turn Undead feat. For clerics, their cleric level is their inherent turning level. For paladins, their level minus 3 is their inherent turning level. A character with both cleric and paladin levels will add their inherent turning levels.
 * 2) Any bonus to your turn level from other sources.
 * 1) Turning check:
 * 2) Your effective turning level.
 * 3) A die roll (1d20 + your charisma modifier) that adds a positive/negative bonus (from -4 to +4) according to the table on the right.
 * 4) Any bonus to your maximum hit dice from other sources.
 * 5) Turning damage:
 * 6) Your effective turning level.
 * 7) A die roll (2d6 + your charisma modifier) that adds the result as is (unlike the die roll of the turning check).
 * 8) Any bonus to your total hit dice from other sources.

Turn Undead effects
When a monster is affected by your turn attempt, one of the following may happen to it:

Cowering undead: That's the default behavior of turn undead. The monster cowers in place for a period of time. It is not in a helpless state. Once the timer expires, the monster will resume attacking.

Destroying undead: When a monster is affected by your turn attempt, its hit dice are compared to your turning check result. If your turning check result is at least double the monster's hit dice, then the monster is destroyed instead of turned. This effect, in contrast to the cowering effect, is negated by deathblock or deathward. Having the Mighty Turning enhancement means this effect is always applied instead of the cower effect.

Cleric domains may augment Turn Undead to produce more effects. Some of those affecting nearby allies.

Bonuses to Turning
There are also items, spells, and enhancements which can help increase your turning ability by boosting your effective cleric level for turning or the number of maximum hit dice you can affect or the number of total hit dice you can turn. These bonuses, according to their type, are added to their respective parts of the turn undead calculations (some in more than one place).

Note: Levels gained in Epic Destiny of any Divine Sphere do not add to your Effective Cleric Levels for purposes of Turn Undead.

Bonuses to Turning Level
Note 1: The feat Aureon's Instruction cannot be taken by Sun Elf. Note 2: The Radiant Servant enhancements stack with the Knight of the Chalice enhancements.
 * (+2 normal bonus)
 * Eternal Faith items
 * (+2 insightful bonus)
 * Insightful Faith items
 * (+3 exceptional bonus)
 * The spell Seek Eternal Rest will add a stacking +4 sacred bonus to your turning level.
 * The enhancement Improved Turning (RS/KotC) can add from 1 to 3 points to your turning level.
 * The feat Improved Turning will add 1 to your turning level.
 * The feat Aureon's Instruction grants +2 to your effective level for Turn Undead.
 * The enhancement Bane of the Restless (Sun Elf) grants +6 to your turning level.
 * The Past Life: Cleric can add from 2 to 6 turning levels.
 * Death Domain adds +2 to your turning level.
 * The filigree Embraced by Light: Turn Undead adds +2 to your turning level (unconfirmed).
 * The filigree Embraced by Light: Turn Undead adds +2 to your turning level (unconfirmed).

Bonuses to Max Hit Dice
Note 1: The first 2 normal (in lieu of an official word) bonuses do not stack. Note 2: The feat Aureon's Instruction cannot be taken by Sun Elf.
 * (+2 normal bonus)
 * Eternal Faith items
 * (+X normal bonus)
 * Hallowed items
 * (+2 insightful bonus)
 * Insightful Faith items
 * The feat Aureon's Instruction grants +4 to maximum Hit Dice affected when using Turn Undead.

Bonuses to Total Hit Dice
Note 1: The first 3 normal (in lieu of an official word) bonuses do not stack. Note 2: The feat Aureon's Instruction cannot be taken by Sun Elf. Note 3: The Radiant Servant enhancements stack with the Knight of the Chalice enhancements.
 * (+4 normal bonus)
 * Eternal Faith items
 * (+2 normal bonus)
 * Sacred items
 * (+6 normal bonus)
 * Silver Flame items
 * (+4 insightful bonus)
 * Insightful Faith items
 * The enhancement Improved Turning (RS/KotC) can add from 2 to 6 total hit dice.
 * Death Domain adds +2 to the hit dice of undead affected.
 * The feat Aureon's Instruction grants +4 to the total Hit Dice affected by Turn Undead.
 * The enhancement Bane of the Restless (Sun Elf) adds 6 to the number of hit dice you can turn.
 * The enhancement Bane of the Restless (Sun Elf) adds 6 to the number of hit dice you can turn.

Sources of Extra Turns
Note: The item enhancements do not stack with each other.
 * Lesser Turning items
 * Minor Turning items
 * Alchemical Conservation items
 * A Cleric or Paladin possessing Turn Undead gains additional charges equal to his/her charisma modifier.
 * The enhancement Extra Turning (RS/KotC) grants an additional +1 turning charge per rank.
 * The epic destiny enhancement Endless Turning grants an additional +1 turning charge per rank.
 * The feat Extra Turning grants an additional +4 turning charges, but can only be taken once.
 * The Endless Turning enhancements (RS/Divine Crusader), which returns one charge per 120 seconds, time between returned charges is reduced with additional ranks.
 * The epic destiny enhancement Endless Turning grants an additional +1 turning charge per rank.
 * The feat Extra Turning grants an additional +4 turning charges, but can only be taken once.
 * The Endless Turning enhancements (RS/Divine Crusader), which returns one charge per 120 seconds, time between returned charges is reduced with additional ranks.

Alternate uses of Turn Undead charges
Any ability which reads as "Channel divinity" requires a Turn Undead charge to activate. All abilities cost a single turn attempt to use, unless otherwise noted.

Paladin

 * Sacred Defender
 * Divine Righteousness, which grants temporary hit points equal to your charisma modifier, and grants a +100% sacred bonus to threat generation
 * Glorious Stand, which grants, absorption of negative and elemental energy, double incoming healing, and immunity to weapon effects.
 * Eternal Defender, which, whenever you are incapacitated but not killed, you expend 2 turn undead charges, and are healed for 250 positive energy.
 * Knight of the Chalice
 * Divine Light, which deals a medium amount of light damage to nearby undead.
 * Divine Might, which grants an insight bonus to strength equal to your charisma modifier for a short time.
 * Rally, which removes fear, grants a bonus to saves versus fear, and grants a small bonus to attack or damage.
 * Holy Retribution, which deals additional base damage and for evil creatures be destroyed or take 100 holy damage and -6 to all ability scores.

Cleric

 * Radiant Servant
 * Positive Energy Burst, which heals targets around you and removes negative levels and stat damage.
 * Divine Cleansing, which removes certain status effects from the target.
 * Divine Healing, which restores health over time.
 * Purge Dark Magic, which removes effects from the target.
 * Martyrdom, which when you are killed expends 4 turn undead charges, and heals nearby allies for a large amount.
 * Positive Energy Aura, which creates a healing over time zone around you.
 * Reactive Heal, which applies a buff which is consumed when the target drops below 50% hp, consumes itself and heals the target. It also grants immunity to its own effect for 3 minutes.
 * Divine Disciple
 * Divine Vitality, which restores spell points to the target.

Divine Crusader

 * Confront Any Foe, which inflicts extra light damage on a successful hit.