--------------------------------------------------------------------Explanation-
 This is a simple implementation of tension (the 'Psyche Up' command) from
 Dragon Quest VIII.  I thought it was a fun system, and had nothing to do, so
 I coded it.  Basically, when a player uses the tension command, they'll stop
 attacking, and become somewhat vulnerable.  Then, each combat round, their
 tension increases, granting them a bonus to their casting level, hitroll, and
 damroll.  If anything that can be construed as a combat action, including the
 use of items or changing of equipment, is performed, their tension returns to 
 normal, and the affects are cleared.  If tension is maxed out or the tension
 command is entered a second time, a round of attacks will be performed with
 the higher tension.  If the enemy isn't 5 or more levels higher than the
 psyching character, the chance of super high tension is greatly decreased,
 and a tension attack will be launched automatically on a failed psyche up,
 rather than continually trying for super high tension.
-------------------------------------------------------------------Installation-
violence_update() in fight.c:
replace
		if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
	        multi_hit (ch, victim, TYPE_UNDEFINED);
        else
            stop_fighting (ch, FALSE);
with
        if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
		{
			//Using 'Psyche Up'...
			if (ch->tension > 0)
			{
				AFFECT_DATA * af;

				//Tweak these to your liking.
				sh_int tension_data[5][3] =
				{
					{100,  0,  0},
					{100,  5,  0},
					{ 90, 10,  5},
					{ 80, 15, 10},
					{ 40, 20, 15},
				};

				//Super High Tension has lower chance in even battles.
				sh_int chance = tension_data[ch->tension][0];				
				if (ch->tension == 4 && ch->fighting->level - ch->level < 5)
					chance -= 10;

				//Tension increased.
				if (number_percent () < chance)
				{
					//Boost hitroll and damroll the easy way.
					af = new_affect ();
					af->where = TO_AFFECTS;
					af->type = gsn_tension;
					af->duration = -1;
					af->bitvector = 0;
					af->level = 0;

					af->location = APPLY_DAMROLL;
					af->modifier = tension_data[ch->tension][1];
					affect_to_char (ch, af);

					af->location = APPLY_HITROLL;
					af->modifier = tension_data[ch->tension][2];
					affect_to_char (ch, af);

					++ch->tension;

					//Send the proper message.
					if (ch->tension == 4)
					{
						act ("You reach a state of high tension!",
								ch, NULL, NULL, TO_CHAR);
						act ("$n reaches a state of high tension!",
								ch, NULL, NULL, TO_ROOM);
					}
					else if (ch->tension == 5)
					{
						act ("You reach a state of super high tension!",
								ch, NULL, NULL, TO_CHAR);
						act ("$n reaches a state of super high tension!",
								ch, NULL, NULL, TO_ROOM);
					}
					else
					{
						act ("Your tension increases!", ch, NULL, NULL, TO_CHAR);
						act ("$n's tension increases!", ch, NULL, NULL, TO_ROOM);
					}

					//Automatically blow it at Super High.
					if (ch->tension > 4)
						do_tension (ch, "");
				}
				else
				{
					//Failed Super High in an even match, use it up.
					if (ch->tension == 4 && ch->fighting->level - ch->level < 5)
						do_tension (ch, "");
					//Otherwise, let them keep trying.
					else
					{
						act ("You try to psyche yourself up, but nothing happens.",
								ch, NULL, NULL, TO_CHAR);
						act ("$n tries to increase $s tension, but nothing happens.",
								ch, NULL, NULL, TO_ROOM);
					}
				}
			}
			//Not using 'Psyche Up', act normally.
			else
	            multi_hit (ch, victim, TYPE_UNDEFINED);
		}
        else
            stop_fighting (ch, FALSE);

Also, add this line to the top:
#include "recycle.h"

Now, in stop_fighting(), add this line right after the update_pos() call:
			strip_tension (fch);

Add the following to check_parry, check_dodge, and check_shield_block:
	if (ch->tension != 0)
		chance = chance * 2 / 3;

At the end of do_berserk, do_zap, do_quaff, do_brandish, do_recite, do_wear,
do_remove, do_cast, and all combat commands, add:
	if (ch->position == POS_FIGHTING)
		strip_tension (ch);
You should know your code well enough to find the proper functions.

Now, in do_cast, add the following at the top of the function, under the
variable declarations:
	int level, chance;
	
	level = UMIN (65, ch->level + (ch->tension * 1.5));

Then, replace these lines:
        if (IS_NPC (ch) || class_table[ch->class].fMana)
            /* class has spells */
            (*skill_table[sn].spell_fun) (sn, ch->level, ch, vo, target);
        else
            (*skill_table[sn].spell_fun) (sn, 3 * ch->level / 4, ch, vo, target);
with these lines:
        if (IS_NPC (ch) || class_table[ch->class].fMana)
            /* class has spells */
            (*skill_table[sn].spell_fun) (sn, level, ch, vo, target);
        else
            (*skill_table[sn].spell_fun) (sn, 3 * level / 4, ch, vo, target);

And this line:
    if (number_percent () > get_skill (ch, sn))
with these lines:
	chance = get_skill (ch, sn) + (ch->tension * 5);
    if (number_percent () > chance)

Add a skill entry for "tension" that cannot be learned by any class, and add
gsn_tension.  This is pretty easy stuff you should be able to do on your own.

Add these prototypes to merc.h:
void strip_tension	(CHAR_DATA * ch);
void tension_hit	(CHAR_DATA * ch, CHAR_DATA * victim);

Add the command entry and declaration for do_tension, put tension.c into your
source directory (and, if applicable, makefile), and that should be it.
--------------------------------------------------------------------------------
This code was originally written for End of Time (eotmud.com port 4000, not yet
open as of 6/2/2006) but has been modified for QuickMUD and is free to use for 
any non-commercial MUD, providing my comments are left in tact, and you follow
all applicable licenses for your code.  Crediting me explicitly isn't required,
though it would be greatly appreciated.

                                Enjoy!  -- Midboss (eclipsing.souls@gmail.com)
--------------------------------------------------------------------------------