talent.c

cm3/src/talent.c · 193.0 KB

From the archive cm3.tar.gz

Download the archive   « Back to the archive contents

/*
 *	Talents
 *	=======
 *	Abilities and handling
 *	Written by Keolah and Triskal for Rogue Winds
 *
 *	You may not use or distribute any of this code without the
 *	explicit permission of the code maintainer, Heather Dunn (Keolah)
 */

#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#ifdef sun
  #include <strings.h>
#endif
#include <time.h>
#include "mud.h"

/* from birth.c */
extern void set_race(CHAR_DATA *ch, bool died);

/* from handler.c */
extern SPECIES_DATA *find_species(char *name);
extern char *munch_colors(char *word);

/* from update.c */
extern void check_bodyparts(CHAR_DATA *ch);

/* from interp.c */
extern bool check_social(CHAR_DATA *ch, char *command, char *argument);

/* from mud_comm.c */
extern int get_color(char *argument);

/* from combat.c */
extern void ranged_attack(CHAR_DATA *ch, OBJ_DATA *obj, char *argument);
extern bool can_gain_exp(CHAR_DATA *ch, CHAR_DATA *victim);

/* from bodyparts.c */
extern void add_part(CHAR_DATA *ch, int loc, int to_loc);

/* from misc.c */
extern sh_int get_full(CHAR_DATA *ch);

/* Trade in Talent points for Talents 
	tradein <amount> <Talent name> */
void do_tradein(CHAR_DATA *ch, char *argument) {
	char buf[MAX_STRING_LENGTH];
	int amount;
	char arg[MAX_INPUT_LENGTH];
	DEITY_DATA *talent;	
	bool inborn;

	if (IS_NPC(ch)) {
		huh(ch);
		return;
	}

	if (!argument || argument[0] == '\0') {
		for (talent = first_deity; talent; talent = talent->next) {
			sprintf(buf, "&Y%-20s: %-3d  &CCost per point: %d\r\n", 
				talent->name, 
				(ch->talent[talent->index] > 0 ? ch->talent[talent->index] : 0),
				talent->cost);
			send_to_char(buf, ch);
		}
		ch_printf(ch, "&YYou have %d points remaining to spend.\r\n", ch->pcdata->points);
		ch_printf(ch, "&YSyntax: tradein <# of points to raise> <talent to raise>&w\r\n");
		ch_printf(ch, "&YSyntax: tradein <points> <attribute>\n\r");
		ch_printf(ch, "&YSyntax: tradein inborn <talent>&w\n\r");
		return;
	}
	argument = one_argument(argument, arg);

	inborn = FALSE;
	if (!str_cmp(arg, "inborn"))
		inborn = TRUE;
	else if (!is_number(arg)) {
		send_to_char("That isn't a number!\n\r", ch);
		return;
	}
	amount = atoi(arg);

	argument = one_argument(argument, arg);
	if (!arg || arg[0] == '\0') {
		send_to_char("Trade into what?\n\r", ch);
		return;
	}
	
	for (talent = first_deity; talent; talent = talent->next) {
		if ( toupper(arg[0]) == toupper(talent->name[0])
	    &&   !str_prefix( arg, talent->name ) )
			break;
	}

	if (!talent && arg && arg[0] != '\0') {
		if (amount < 1) {
			send_to_char("You wish you could do that.\n\r", ch);
			return;
		}
		if (ch->pcdata->points < amount) {
			send_to_char("You don't have enough points for that.\n\r", ch);
			return;
		}
		if (!str_prefix(arg, "strength"))
			ch->perm_str += amount;
		else if (!str_prefix(arg, "dexterity"))
			ch->perm_dex += amount;
		else if (!str_prefix(arg, "constitution"))
			ch->perm_con += amount;
		else if (!str_prefix(arg, "willpower"))
			ch->perm_wis += amount;
		else if (!str_prefix(arg, "intelligence"))
			ch->perm_int += amount;
		else if (!str_prefix(arg, "perception"))
			ch->perm_cha += amount;
                else if (!str_prefix(arg, "endurance"))
                        ch->perm_lck += amount;
		else {
			send_to_char("You know of no such Talent or attribute.\r\n", ch);
			return;
		}
		ch->pcdata->points -= amount;
		send_to_char("&YDone.\n\r", ch);
		return;
	}

	if (inborn) {
	    if (ch->pcdata->inborn > -1) {
		send_to_char("You already have been inborn with a Talent.\n\r", ch);
		return;
	    } else {
		ch_printf(ch, "You have been inborn with the %s Talent.\n\r",
		talent->name);
		ch->pcdata->inborn = talent->index;
		return;
	    }
	}
	
	if (amount * talent->cost > ch->pcdata->points) {
		send_to_char("You don't have that many points to spend.\r\n", ch);
		return;
	}

	if (amount < 1) {
		send_to_char("You'd like to do that, wouldn't you?\r\n", ch);
		return;
	}
	
	if (ch->talent[talent->index] + amount > 200) {
		send_to_char("You may only raise a Talent to 200 points.\r\n", ch);
		return;
	}

	if (ch->talent[talent->index] < 0)
		ch->talent[talent->index] = 0;

	if (ch->curr_talent[talent->index] < 0)
		ch->curr_talent[talent->index] = 1;

	ch->pcdata->points -= amount * talent->cost;
	ch->talent[talent->index] += amount;
	talent->count += amount;
	save_deity(talent);

	ch_printf(ch, "Your %s power raises by %d to %d.\r\n",
		talent->name, amount, ch->talent[talent->index]);
}

/* see if they can travel to the victim -keo */
bool can_travel(int i, CHAR_DATA *ch, CHAR_DATA *victim) {
    if (TALENT(ch, TAL_MOTION) >= 200)
	return TRUE;

    if (!ch->in_room
    ||  (IS_SET(ch->in_room->room_flags, ROOM_NO_SUMMON)
    &&  (TALENT(ch, TAL_MOTION) < i
    ||   IS_SET(ch->in_room->area->flags, AFLAG_NOBYPASS)
    ||   IS_SET(ch->in_room->runes, RUNE_WARD)))
    ||  (IS_SET(victim->in_room->room_flags, ROOM_NO_ASTRAL)
    &&  (TALENT(ch, TAL_MOTION) < i
    ||   IS_SET(victim->in_room->area->flags, AFLAG_NOBYPASS)
    ||   IS_SET(victim->in_room->runes, RUNE_WARD)))
    ||  (IS_AFFECTED(ch, AFF_DREAMWORLD)
    &&   IS_SET(victim->in_room->room_flags, ROOM_NO_DREAM))
    ||  (ch != victim && !IS_NPC(ch)
    &&   TALENT(ch, TAL_SEEKING) < TALENT(victim, TAL_SECURITY)
    &&   !IS_NPC(victim) && IS_SET(victim->pcdata->flags, PCFLAG_NOSUMMON)))
	return FALSE;

    if (ch->curr_talent[TAL_MOTION] > 0)
        return TRUE;

	return FALSE;
}


/* I was very reluctant to make this command, but I'm sick of
 * doing it manually -keo
 */
void do_talent_advance(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;
	char arg1[MAX_STRING_LENGTH];
	int tal;
	int amt;

	argument = one_argument(argument, arg1);
	victim = get_char_world(ch, arg1);
	if (!victim) {
		send_to_char("They aren't here.\n\r", ch);
		return;
	}

	argument = one_argument(argument, arg1);
	if (!is_number(arg1) || !is_number(argument)) {
		ch_printf(ch, "&w%s, %s\n\r", arg1, argument);
		send_to_char("That's not a number.\n\r", ch);
		return;
	} else {
		tal = atoi(arg1);
		amt = atoi(argument);
	}
	if (tal > MAX_DEITY) {
		send_to_char("There is no such talent.\n\r", ch);
		return;
	}
	victim->curr_talent[tal] = amt;
	send_to_char("You change their magic.\n\r", ch);
	send_to_char("You feel your magic change.\n\r", victim);
	SET_BIT(victim->pcdata->flags, PCFLAG_CHEAT);
}

void do_deduct(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
        int amt;
        char arg2[MAX_STRING_LENGTH];

        argument = one_argument(argument, arg2);

        victim = get_char_world(ch, arg2);
        if (!victim) {
                send_to_char("They aren't here.\n\r", ch);
                return;
        }

        if (IS_NPC(victim) || IS_NPC(ch)) {
                send_to_char("Mobs have no use for talents.\n\r", ch);
                return;
        }

        if (victim == ch) {
                send_to_char("Awarding yourself? How conceited!\n\r", ch);
                return;
        }

        if (!is_number(argument)) {
                send_to_char("Invalid number of points.\n\r", ch);
                return;
        }

        amt = atoi(argument);

        ch_printf(ch, "You deduct %d talent points from %s.\n\r",
                amt, victim->name);
        ch_printf(victim, "You lose %d talent points!\n\r", amt);
        victim->pcdata->points -= amt;
}

void do_award(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;
	int amt;
	char arg2[MAX_STRING_LENGTH];

	argument = one_argument(argument, arg2);

	victim = get_char_world(ch, arg2);
	if (!victim) {
		send_to_char("They aren't here.\n\r", ch);
		return;
	}

	if (IS_NPC(victim) || IS_NPC(ch)) {
		send_to_char("Mobs have no use for talents.\n\r", ch);
		return;
	}

	if (victim == ch) {
		send_to_char("Awarding yourself? How conceited!\n\r", ch);
		return;
	}

	if (!is_number(argument)) {
		send_to_char("Invalid number of points.\n\r", ch);
		return;
	}

	amt = atoi(argument);

	ch_printf(ch, "You award %s with %d talent points.\n\r",
		victim->name, amt);
	ch_printf(victim, "You gain %d talent points!\n\r", amt);
	victim->pcdata->points += amt;
}

/* sense use of magic in the room. the more magic being used,
 * the easier it is to detect -keo
 */
void sense_magic(CHAR_DATA *ch, int tal, int mana) {
        CHAR_DATA *rch;
	if (mana < 1) mana = 1;

	if (!ch->in_room) return;

    for (rch=ch->in_room->first_person;rch;rch=rch->next_in_room) {
        if (IS_NPC(rch)) continue;
	if (rch == ch) continue;

        if (mana > 1200 - TALENT(ch, TAL_SEEKING)*5)
                ch_printf(rch, "&BYou sense %s magic.\n\r",
                talent_name[tal]);
    }
}

void learn_talent(CHAR_DATA *ch, int tal) {
	if (IS_NPC(ch)) return;

        if (ch->curr_talent[tal] < 200 && ch->talent[tal] > 0) {
	      ch->pcdata->talent_exp[tal] += (int) ch->exp / 5;
	      ch->exp -= (int) ch->exp / 5;
            if (ch->pcdata->talent_exp[tal] + talent_exp(ch, ch->curr_talent[tal], tal)
                >= talent_exp(ch, ch->curr_talent[tal]+1, tal)) {

                ch->pcdata->talent_exp[tal] -= (talent_exp(ch, ch->curr_talent[tal]+1, tal)
		- talent_exp(ch, ch->curr_talent[tal], tal));
		ch->curr_talent[tal]++;
		update_aris(ch);
		ch_printf(ch, "&BYou feel your skill at %s magic has improved.\n\r",
			talent_name[tal]);
		if (ch->curr_talent[tal] == 100) {
			ch_printf(ch, "&BYou have mastered the magic of %s.\n\r",
				talent_name[tal]);
		}
		if (ch->curr_talent[tal] == 200) {
			ch_printf(ch, "&BYou have truly mastered the magic of %s.\n\r",
				talent_name[tal]);
		}
	    }
        }
}

void mana_from_char(CHAR_DATA *ch, int i) {
	ch->mana -= UMAX(0, i);
	ch->in_room->area->weather->mana += (int)i/100;
	if (ch->mana < -1000) {
		send_to_char("Your life force is drained into the spell!\n\r", ch);
		lose_hp(ch, i/10);
	}
	check_rebirth(ch, i);
}


void use_magic(CHAR_DATA *ch, int tal, int mana) {
	if (IS_NPC(ch)) return;

	mana -= ch->pcdata->noncombat[SK_CHANNEL];
	if (number_range(1,5) == 1) learn_noncombat(ch, SK_CHANNEL);
	if (mana < 0) mana = 0;

	learn_talent(ch, tal);
	sense_magic(ch, tal, mana);
	if (ch->pcdata->magiclink) {
		mana_from_char(ch->pcdata->magiclink, mana/2);
		mana_from_char(ch, mana/2);
	} else
		mana_from_char(ch, mana);
}

CHAR_DATA *find_target(CHAR_DATA *ch, char *argument, bool offense) {

	CHAR_DATA *victim = NULL;

        if (!argument || argument[0] == '\0') {
	    if (!offense)
                victim = ch;
	    else if (ch->last_hit && ch->last_hit->in_room ?
	    ch->last_hit->in_room == ch->in_room : FALSE)
		victim = ch->last_hit;
        } else {
		victim = get_char_room(ch, argument);
	}

	if (!victim || victim == NULL) {
	    if (!offense && ch->curr_talent[TAL_MOTION] >= 100
	    && ch->curr_talent[TAL_SEEKING] >= 100) {
		victim = get_char_world(ch, argument);
		if (!victim) {
			send_to_char("You are unable to find anyone like that.\n\r", ch);
			return NULL;
		}
	    } else {
		send_to_char("They aren't here.\n\r", ch);
		return NULL;
	    }
	}

	if (!IS_SAME_PLANE(ch, victim)) {
		send_to_char("You can't seem to affect them.\n\r", ch);
		victim = NULL;
	}

	return victim;
}

void magic_damage(CHAR_DATA *victim, CHAR_DATA *ch, int dam, int type, int talent, bool dont_wait) {
	if (check_manastorm(ch)) return;

	if (!victim || victim == NULL) {
		send_to_char("Attack whom?\n\r", ch);
		return;
	}

	if (char_died(victim)) return;

        if (IS_NPC(victim) && xIS_SET(victim->act, ACT_PACIFIST)) return;

        if (!IS_SAME_PLANE(ch, victim)) {
	    if (CAN_SEE_PLANE(ch, victim))
                send_to_char("That appears to have no affect.\n\r", ch);
            return;
        }

        if (IS_NPC(ch))
                dam = get_curr_int(ch);
        use_magic(ch, talent, dam);
	if (!dont_wait) {
		STRFREE(ch->last_taken);
		ch->last_taken = STRALLOC("channeling");
		WAIT_STATE(ch, PULSE_VIOLENCE);
	}

	if (victim->shield == type) {
	        act(AT_MAGIC, "Your $t bounces off $N's shield!", ch,
        	        magic_table[type], victim, TO_CHAR);
        	act(AT_MAGIC, "$n's $t bounces off $N's shield!", ch,
        	        magic_table[type], victim, TO_NOTVICT);
        	act(AT_MAGIC, "$n's $t bounces off your shield!", ch,
                	magic_table[type], victim, TO_VICT);
		/* don't keep them bouncing back and forth */
		if (ch->shield == type) {
		act(AT_MAGIC, "Your $t fizzles out harmlessly.", ch,
                        magic_table[type], NULL, TO_CHAR);
                act(AT_MAGIC, "$n's $t fizzles out harmlessly", ch,
                        magic_table[type], NULL, TO_ROOM);
			return;
		}
		/* send it back at them */
		magic_damage(ch, victim, dam, type, talent, TRUE);
		return;
	}

	if (check_displacement(ch, victim)) return;
	if (check_antimagic(ch, victim)) return;

        dam = number_range(dam, dam*5);
        dam = URANGE(1, dam, 5000);
	dam = (100 - TALENT(victim, talent)) * dam / 100;

	if (dam <= 0) {
		act(AT_MAGIC, "The magic has no effect.", victim, NULL, NULL, TO_ROOM);
		act(AT_MAGIC, "The magic has no effect.", victim, NULL, NULL, TO_CHAR);

		if (IS_NPC(ch) && number_range(20,50) < get_curr_int(ch))
			xSET_BIT(ch->act, ACT_MAG_FAIL);
		return;
	}

	act(AT_MAGIC, "Your $t hits $N!", ch,
		magic_table[type], victim, TO_CHAR);
	act(AT_MAGIC, "$n's $t hits $N!", ch,
		magic_table[type], victim, TO_NOTVICT);
	act(AT_MAGIC, "$n's $t hits you!", ch,
		magic_table[type], victim, TO_VICT);
	victim->last_hit = ch;
	ch->last_hit = victim;
        if (can_gain_exp(ch, victim))
                gain_exp(ch, get_exp_worth(victim) * dam / 100);
	direct_damage(victim, dam);
	if (char_died(victim)) return;
	pain(victim, dam);
	climate_affect(victim, type);
}

void do_status(CHAR_DATA *ch, char *argument) {

	if (IS_NPC(ch)) {
		send_to_char("Don't worry about it, you're fine.\n\r", ch);
		return;
	}

	send_to_char("&BYour current status:\n\r", ch);
	if (ch->pcdata->condition[COND_FULL] == -1)
		ch_printf(ch, "You don't need to eat.\n\r");
	else if (ch->pcdata->condition[COND_FULL] == 0)
		ch_printf(ch, "You are starving to death.\n\r");
	else if (ch->pcdata->condition[COND_FULL] < get_full(ch)/5)
		ch_printf(ch, "You are really hungry.\n\r");
	else if (ch->pcdata->condition[COND_FULL] < get_full(ch)/4)
		ch_printf(ch, "You are hungry.\n\r");
	else if (ch->pcdata->condition[COND_FULL] < get_full(ch)/3)
		ch_printf(ch, "You are a mite peckish.\n\r");
	if (ch->pcdata->condition[COND_THIRST] == -1)
		ch_printf(ch, "You don't need to drink.\n\r");
	else if (ch->pcdata->condition[COND_THIRST] == 0)
		ch_printf(ch, "You are dying of thirst.\n\r");
	else if (ch->pcdata->condition[COND_THIRST] < get_full(ch)/5)
		ch_printf(ch, "You are really thirsty.\n\r");
	else if (ch->pcdata->condition[COND_THIRST] < get_full(ch)/4)
		ch_printf(ch, "You are thirsty.\n\r");
	else if (ch->pcdata->condition[COND_THIRST] < get_full(ch)/3)
		ch_printf(ch, "You could use something to drink.\n\r");
	if (ch->mental_state == 100)
		ch_printf(ch, "Reality is slipping away.\n\r");
	else if (ch->mental_state > 50)
		ch_printf(ch, "You are hallucinating.\n\r");
	else if (ch->mental_state > 0)
		ch_printf(ch, "You are light-headed.\n\r");
	else if (ch->mental_state == -100)
		ch_printf(ch, "You can't keep your eyes open.\n\r");
	else if (ch->mental_state < -50)
		ch_printf(ch, "You are extremely drousy.\n\r");
	else if (ch->mental_state < 0)
		ch_printf(ch, "You are tired.\n\r");
	if (ch->pcdata->condition[COND_DRUNK] > 50)
		ch_printf(ch, "You are drunk.\n\r");
	else if (ch->pcdata->condition[COND_DRUNK] > 10)
		ch_printf(ch, "You are a bit tipsy.\n\r");
	if (ch->pcdata->inborn == -1)
		ch_printf(ch, "You do not have an inborn Talent.\n\r");
	else
		ch_printf(ch, "You have been inborn with the %s Talent.\n\r",
		talent_name[ch->pcdata->inborn]);
	if (ch->pcdata->consenting)
		ch_printf(ch, "You give consent to %s.\n\r",
			ch->pcdata->consenting->name);
	if (ch->pcdata->mindlink)
		ch_printf(ch, "You are mindlinked to %s.\n\r",
			ch->pcdata->mindlink->name);
	if (ch->pcdata->magiclink)
		ch_printf(ch, "Your magic is linked to %s.\n\r",
			ch->pcdata->magiclink->name);
        if (ch->shield)
                ch_printf(ch, "You are surrounded by a shield of %s.\n\r",
                	magic_table[ch->shield]);
	if (ch->pcdata->were_race) {
                if (has_bodypart(ch, BP_RHAND)) {
                        ch_printf(ch, "You are a were-%s.\n\r", ch->pcdata->were_race);
                } else {
                        ch_printf(ch, "You are a were-%s.\n\r", ch->species);
		}
	}
        if (ch->pcdata->name_disguise)
                ch_printf(ch, "You are disguised as %s.\n\r",
                        ch->pcdata->name_disguise);
        if (ch->singing)
                ch_printf(ch, "You are singing a song of %s.\n\r",
	                song_name[ch->singing]);
	if (ch->pcdata->wizinvis)
	        ch_printf(ch, "Invisibility &C[&W%s&C][&W%d&C]&B\n\r",
        	xIS_SET(ch->act, PLR_WIZINVIS) ? "*" : " ",
		ch->pcdata->wizinvis);
}

void do_heal(CHAR_DATA *ch, char *argument) {
	PART_DATA *part;
	CHAR_DATA *victim;
	int amt;

	if (ch->curr_talent[TAL_HEALING] <= 0) {
		huh(ch);
		return;
	}

	victim = find_target(ch, argument, FALSE);
	if (!victim) return;

	if (IS_AFFECTED(victim, AFF_UNDEAD)) {
	        magic_damage(victim, ch, TALENT(ch, TAL_HEALING)*3
		+ TALENT(ch, TAL_DEATH),
	        MAG_DRAIN, TAL_HEALING, FALSE);
		return;
	}

	if (IS_AFFECTED(victim, AFF_CONSTRUCT)) {
		send_to_char("For some reason, that doesn't work.\n\r", ch);
		return;
	}

    if (victim == ch) {
	act(AT_MAGIC, "You close your eyes and relax, focusing on healing.",
		ch, NULL, NULL, TO_CHAR);
	act(AT_MAGIC, "$n closes $s eyes and breathes deeply, $s wounds closing.",
		ch, NULL, NULL, TO_ROOM);
    } else {
	act(AT_MAGIC, "$n concentrates on you, and pain eases out of your body",
		ch, NULL, victim, TO_VICT);
	act(AT_MAGIC, "$n concentrates on $N, whose wounds begin to close.",
		ch, NULL, victim, TO_NOTVICT);
	act(AT_MAGIC, "You concentrate on $N, easing $S pain and healing $S wounds.",
		ch, NULL, victim, TO_CHAR);
    }
	amt = number_range(TALENT(ch, TAL_HEALING),
		TALENT(ch, TAL_HEALING)*5);
	/* take mana first so the bonus doesn't cost more */
	use_magic(ch, TAL_HEALING, amt);
	if (IS_AFFECTED(ch, AFF_UNHOLY) && amt != 0) amt /= 2;
	if (IS_AFFECTED(ch, AFF_HOLY)) amt *= 2;
	if (victim == ch) amt *= 2;
	if (!IS_FIGHTING(ch)) amt *= 2;
	victim->hit += amt;
	for (part = victim->first_part;part;part = part->next) {
	    if (part->flags == PART_SEVERED
	    && part->cond == PART_WELL
	    && (part->connect_to
	    ?   part->connect_to->flags != PART_SEVERED
	    :   TRUE)
	    &&  amt > 300) {
		act(AT_MAGIC, "Your $t grows back!",
			victim, part_locs[part->loc], NULL, TO_CHAR);
		act(AT_MAGIC, "$n's $t grows back!",
			victim, part_locs[part->loc], NULL, TO_ROOM);
		part->flags = PART_WELL;
		return; /* No more healing after a part is regened */
	    } else {
                part->cond = UMIN(PART_WELL, part->cond+amt/10);
	    }
	}
	if (victim != ch && ch->curr_talent[TAL_DEATH] > 0) {
		amt = number_range(TALENT(ch, TAL_DEATH),
		TALENT(ch, TAL_DEATH)*5);
		mana_from_char(victim, amt);
		if (!IS_FIGHTING(ch)) amt *= 2;
		victim->hit += amt;
	}
	if (victim->hit > victim->max_hit)
		victim->hit = victim->max_hit;
	WAIT_STATE(ch, PULSE_VIOLENCE);
}

/* moved from skills.c and modified -keo */
void do_recall(CHAR_DATA *ch, char *argument) {
	int slot;
	int mem;
	ROOM_INDEX_DATA *location;

	if (ch->curr_talent[TAL_MOTION] <= 0) {
		huh(ch);
		return;
	}

    location = NULL;
    if (!argument || argument[0] == '\0')
	slot = 0;
    else
	slot = atoi(argument);

    if (!str_cmp(argument, "nexus")) {
	if (IS_SET(ch->in_room->area->flags, AFLAG_FREEKILL))
		location = get_room_index(ROOM_VNUM_PKILL);
	else
		location = get_room_index(ROOM_VNUM_NEXUS);
    } else if (!str_cmp(argument, "area")) {
		location = get_room_index(ch->in_room->area->hi_soft_range);
    } else {

	mem = (ch->curr_talent[TAL_MOTION] -20) / 10;
	if (mem > 7) mem = 7;
	if (mem < 0 && ch->curr_talent[TAL_MOTION] > 0)
		mem = 0;

    if (slot > mem) {
		send_to_char("You cannot recall the details of that location.\n\r", ch);
		return;
    }

    if (IS_NPC(ch)) {
        if (IS_AFFECTED(ch, AFF_CHARM) && ch->master && !IS_NPC(ch->master)) {
          location = get_room_index( ch->master->pcdata->memorize[slot] );
        } else {
          return;
        }
    } else {
        location = get_room_index( ch->pcdata->memorize[slot] );
    }
    }

    if ( !location )
       location = get_room_index( ROOM_VNUM_NEXUS );

    if ( !location )
    {
        send_to_char( "You are completely lost.\n\r", ch );
        return;
    }

    if ( ch->in_room == location ) {
	send_to_char("You are already here!\n\r", ch);
        return;
    }

    if ( IS_AFFECTED(ch, AFF_DREAMWORLD)
    &&   IS_SET(location->room_flags, ROOM_NO_DREAM)) {
	send_to_char("A mysteriously shield prevents you from recalling.\n\r", ch);
	return;
    }

    if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
	&& ch->curr_talent[TAL_MOTION] < 80) {
        send_to_char( "For some strange reason... nothing happens.\n\r", ch);
        return;
    }

    if (IS_AFFECTED(ch, AFF_CURSE)
	&& ch->curr_talent[TAL_MOTION] < 70) {
        send_to_char("You are cursed and cannot recall!\n\r", ch);
        return;
    }

    if (IS_FIGHTING(ch) && ch->curr_talent[TAL_MOTION] < 60) {
        send_to_char("You cannot recall from combat!\r\n", ch);
        return;
    }

    use_magic(ch, TAL_MOTION, ch->mount ? 50 : 25);

    act( AT_ACTION, "$n disappears in a swirl of mist.",
	ch, NULL, NULL, TO_ROOM);
    char_from_room(ch);
    ch->in_obj = NULL;
    char_to_room(ch, location);
    if (ch->mount) {
        char_from_room(ch->mount);
        char_to_room(ch->mount, location);
	do_look(ch->mount, "auto");
    }
    act( AT_ACTION, "$n appears in the room, a ring of mist dissipating around $m.",
	ch, NULL, NULL, TO_ROOM );
    do_look(ch, "auto");
	WAIT_STATE(ch, PULSE_VIOLENCE);
}

/* Each attack command must find its own target so that some of them
 * can optionally do other things to the victim, such as mindflay's
 * affect on mentalstate -keo
 */
void do_burn(CHAR_DATA *ch, char *argument) {
	AFFECT_DATA af;
        CHAR_DATA *victim;

	if (ch->curr_talent[TAL_FIRE] < 1 && !IS_NPC(ch)) {
		huh(ch);
		return;
	}

	act(AT_FIRE, "Flames fly from your $t!",
		ch, hands(ch), NULL, TO_CHAR);
	act(AT_FIRE, "Flames fly from $n's $t!",
		ch, hands(ch), NULL, TO_ROOM);

	if (!str_cmp(argument, "room")
	&& ch->curr_talent[TAL_FIRE] >= 60) {
		if (ch->in_room->curr_vegetation < 10) {
			send_to_char("There is no vegetation here to burn.\n\r", ch);
			return;
		}
		if (ch->in_room->curr_water > 30) {
			send_to_char("The vegetation is too damp to burn.\n\r", ch);
			return;
		}
                use_magic(ch, TAL_FIRE, 300);
		act(AT_FIRE, "You set fire to the room!", ch, NULL, NULL, TO_CHAR);
		act(AT_FIRE, "$n sets fire to the room!", ch, NULL, NULL, TO_ROOM);
		SET_BIT(ch->in_room->room_flags, ROOM_BURNING);
		return;
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	magic_damage(victim, ch,
	IS_UNDERWATER(ch) ?
	TALENT(ch, TAL_FIRE)/2 : TALENT(ch, TAL_FIRE),
	MAG_FIRE, TAL_FIRE, FALSE);

        if (ch->curr_talent[TAL_FIRE] >= 50 &&
        !IS_SET(victim->immune, RIS_FIRE) &&
	!(IS_NPC(ch) && xIS_SET(ch->act, ACT_PACIFIST))) {
           af.type      = gsn_sticky_flame;
           af.duration  = 20;
           af.location  = APPLY_NONE;
           af.modifier  = 0;
           af.bitvector = meb(AFF_FLAMING);
           affect_join( victim, &af );
        }
}

void do_poisoncloud(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
        CHAR_DATA *next_vict;
	AFFECT_DATA af;

	if (ch->curr_talent[TAL_DEATH]
	+   ch->curr_talent[TAL_WIND] < 200) {
                huh(ch);
                return;
        }

        act(AT_DGREEN, "A cloud of poisonous gas erupts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_DGREEN, "A cloud if poisonous gas erupts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

    for ( victim=ch->in_room->first_person; victim; victim=next_vict ) {
        next_vict=victim->next_in_room;

        magic_damage(victim, ch, (TALENT(ch, TAL_DEATH)
		+ TALENT(ch, TAL_WIND)),
                MAG_POISON, TAL_DEATH, FALSE);
        if (char_died(ch))
                return;
        if (ch->curr_talent[TAL_DEATH] >= 10 &&

        !IS_SET(victim->immune, RIS_POISON)) {
           af.type      = gsn_poison;
           af.duration  = 20;
           af.location  = APPLY_STR;
           af.modifier  = -2;
           af.bitvector = meb(AFF_POISON);
           affect_join( victim, &af );
           victim->mental_state = URANGE( 20, victim->mental_state, 100 );
        }
    }
}

void do_quake(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
        CHAR_DATA *next_vict;

	if ((ch->curr_talent[TAL_EARTH] < 20 && !IS_NPC(ch))
	|| IS_SET(ch->in_room->room_flags, ROOM_NOFLOOR)) {
		huh(ch);
		return;
	}

	act(AT_HUNGRY, "The earth trembles at your command!",
		ch, NULL, NULL, TO_CHAR);
	act(AT_HUNGRY, "The ground begins to tremble and shake!",
		ch, NULL, NULL, TO_ROOM);
    for ( victim = ch->in_room->first_person; victim; victim = next_vict ) {
        next_vict = victim->next_in_room;

	if (IS_AFFECTED(victim, AFF_FLYING)
	&& !IS_SET(ch->in_room->room_flags, ROOM_INDOORS))
		continue;

        magic_damage(victim, ch, TALENT(ch, TAL_EARTH),
		MAG_BLUNT, TAL_EARTH, FALSE);
	if (char_died(ch))
		return;
    }
}

void do_telekinetics(CHAR_DATA *ch, char *argument) {
	int n;
        CHAR_DATA *victim;
        CHAR_DATA *next_vict;

	if (!IS_NPC(ch) && (ch->curr_talent[TAL_MOTION] < 20
	||  ch->curr_talent[TAL_MIND] < 10)) {
		huh(ch);
		return;
	}

        if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

        learn_talent(ch, TAL_MIND);
        magic_damage(victim, ch,
        (ch->curr_talent[TAL_MIND] + ch->curr_talent[TAL_MOTION])/2,
        MAG_PSIONIC, TAL_MOTION, FALSE);

        }
        use_magic(ch, TAL_MOTION, n*TALENT(ch, TAL_MOTION));
        return;
        }

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        learn_talent(ch, TAL_MIND);
        magic_damage(victim, ch,
        TALENT(ch, TAL_MIND) + TALENT(ch, TAL_MOTION),
        MAG_PSIONIC, TAL_MOTION, FALSE);
}

void do_sandstorm(CHAR_DATA *ch, char *argument) {
	AFFECT_DATA af;
        CHAR_DATA *victim;
        CHAR_DATA *next_vict;
        int n=0;

        if (ch->curr_talent[TAL_WIND] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_ORANGE, "Blasting sand swirls from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_ORANGE, "Blasting sand swirls from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
        n++;

        if ( victim == ch )
           continue;

        learn_talent(ch, TAL_EARTH);
        magic_damage(victim, ch,
        (TALENT(ch, TAL_WIND) + TALENT(ch, TAL_EARTH))/2,
        MAG_WIND, TAL_WIND, FALSE);

        }
        use_magic(ch, TAL_WIND, n*TALENT(ch, TAL_WIND));
        return;
        }

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        learn_talent(ch, TAL_EARTH);
        magic_damage(victim, ch,
        TALENT(ch, TAL_EARTH) + TALENT(ch, TAL_WIND),
        MAG_WIND, TAL_WIND, FALSE);

        if (number_range(50,300) < TALENT(ch, TAL_EARTH)) {
           af.type      = gsn_blindness;
           af.duration  = 20;
           af.location  = APPLY_HITROLL;
           af.modifier  = -2;
           af.bitvector = meb(AFF_BLIND);
           affect_join( victim, &af );
        }
}


void do_magma(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;
	CHAR_DATA *next_vict;
	int n=0;

        if ((ch->curr_talent[TAL_EARTH] < 1
	||  ch->curr_talent[TAL_FIRE] < 1) && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_FIRE, "Molten lava pours from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_FIRE, "Molten lava pours from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

	if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

        learn_talent(ch, TAL_FIRE);
        magic_damage(victim, ch,
        (TALENT(ch, TAL_FIRE) + TALENT(ch, TAL_EARTH))/2,
        MAG_FIRE, TAL_EARTH, FALSE);

	}
	use_magic(ch, TAL_FIRE, n*TALENT(ch, TAL_FIRE));
	return;
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	learn_talent(ch, TAL_EARTH);
        magic_damage(victim, ch,
	TALENT(ch, TAL_EARTH) + TALENT(ch, TAL_FIRE),
        MAG_FIRE, TAL_FIRE, FALSE);
}

void do_flare(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;
        CHAR_DATA *next_vict;
	int n=0;

        if (ch->curr_talent[TAL_ILLUSION] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_YELLOW, "Searing light radiates from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "Searing light radiates from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

        learn_talent(ch, TAL_CATALYSM);
        magic_damage(victim, ch,
        (TALENT(ch, TAL_CATALYSM) + TALENT(ch, TAL_ILLUSION))/2,
        MAG_LIGHT, TAL_ILLUSION, FALSE);

        }
        use_magic(ch, TAL_ILLUSION, n*TALENT(ch, TAL_ILLUSION));
        return;
        }

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        learn_talent(ch, TAL_CATALYSM);
        magic_damage(victim, ch,
        TALENT(ch, TAL_CATALYSM) + TALENT(ch, TAL_ILLUSION),
        MAG_LIGHT, TAL_ILLUSION, FALSE);
}

void do_antimatter(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_VOID] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_DGREY, "Crackling black antimatter streams from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_DGREY, "Crackling black antimatter streams from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch, TALENT(ch, TAL_VOID),
        MAG_ANTIMATTER, TAL_VOID, FALSE);
}

void do_chainlightning(CHAR_DATA *ch, char *argument) {
	int zaps;
        CHAR_DATA *victim = NULL;
	CHAR_DATA *next_vict = NULL;

        if (ch->curr_talent[TAL_LIGHTNING] < 50 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_YELLOW, "Chain lightning streaks from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "Chain lightning streaks from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

	zaps = number_range(1, TALENT(ch, TAL_LIGHTNING)/25);
	if (ch->in_room->curr_water > 60) zaps *= 2;
	use_magic(ch, TAL_LIGHTNING, zaps*100);
	while (zaps--) {
		victim = next_vict;
		if (!next_vict) victim = ch->in_room->first_person;
		next_vict = victim->next_in_room;
	        magic_damage(victim, ch, 100,
	        MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
	}
}

void do_electrocute(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_LIGHTNING]
        +   ch->curr_talent[TAL_WIND] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)
        ||  ch->in_room->area->weather->precip < 100
        ||  ch->in_room->area->weather->temp < 100) {
                send_to_char("The weather isn't stormy enough here to call lightning.\n\r", ch);
                return;
        }
        act(AT_YELLOW, "A dozen bolts of electricity merge in the sky and shoot down a powerful bolt!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_YELLOW, "A dozen bolts of electricity merge in the sky and shoot down a powerful bolt!",
                ch, NULL, NULL, TO_ROOM);
        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch, TALENT(ch, TAL_WIND) +
	TALENT(ch, TAL_LIGHTNING)*5,
        MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
}

void do_flamingrain(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
	CHAR_DATA *next_vict;

        if (ch->curr_talent[TAL_FIRE]
        +   ch->curr_talent[TAL_WIND] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)) {
                send_to_char("You can't call flaming rain indoors.\n\r", ch);
                return;
        }

        act(AT_FIRE, "The sky turns red as fire rains from the heavens.",
                ch, NULL, NULL, TO_CHAR);
        act(AT_FIRE, "The sky turns red as fire rains from the heavens.",
		ch, NULL, NULL, TO_ROOM);

    for ( victim = ch->in_room->first_person; victim; victim = next_vict ) {
        next_vict = victim->next_in_room;

        magic_damage(victim, ch, TALENT(ch, TAL_WIND) +
        TALENT(ch, TAL_FIRE) + ch->in_room->area->weather->temp,
        MAG_FIRE, TAL_FIRE, FALSE);
    }
}

void do_manastorm(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
	CHAR_DATA *next_vict;

        if (ch->curr_talent[TAL_CATALYSM]
        +   ch->curr_talent[TAL_WIND] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)) {
                send_to_char("You can't call a manastorm indoors.\n\r", ch);
                return;
        }

        act(AT_PURPLE, "You make the energy rage in a manastorm!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_PURPLE, "The energy in the air rages in a manastorm!",
                ch, NULL, NULL, TO_ROOM);

    for ( victim = ch->in_room->first_person; victim; victim = next_vict ) {
        next_vict = victim->next_in_room;

        magic_damage(victim, ch, TALENT(ch, TAL_WIND) +
	TALENT(ch, TAL_CATALYSM) + ch->in_room->area->weather->mana,
        MAG_ENERGY, TAL_CATALYSM, FALSE);
    }
}

void do_meteor(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_EARTH]
        +   ch->curr_talent[TAL_VOID] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }
	if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)) {
		send_to_char("You can't call a meteor indoors.\n\r", ch);
		return;
	}

        act(AT_DGREY, "A meteor streaks from the sky!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_DGREY, "A meteor streaks from the sky!",
                ch, NULL, NULL, TO_ROOM);
        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch,
        (TALENT(ch, TAL_EARTH) + TALENT(ch, TAL_VOID))*2,
        MAG_BLUNT, TAL_EARTH, FALSE);
}

void do_sonics(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
	CHAR_DATA *next_vict;

        if (ch->curr_talent[TAL_SPEECH] < 100 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }
	if (ch->in_room->curr_water >= 100) {
		send_to_char("There is not enough air here.\n\r", ch);
		return;
	}
        act(AT_YELLOW, "You make the air vibrate loudly!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_YELLOW, "The very air seems to hum loudly!",
                ch, NULL, NULL, TO_ROOM);

    for ( victim = ch->in_room->first_person; victim; victim = next_vict ) {
        next_vict = victim->next_in_room;

	learn_talent(ch, TAL_WIND);
        magic_damage(victim, ch, TALENT(ch, TAL_SPEECH) +
        TALENT(ch, TAL_MOTION) + TALENT(ch, TAL_WIND),
        MAG_SOUND, TAL_SPEECH, FALSE);
    }
}

void do_steam(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_WATER]
        +   ch->curr_talent[TAL_FIRE] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }
        act(AT_BLUE, "A burst of steam blasts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_BLUE, "A burst of steam blasts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);
        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	learn_talent(ch, TAL_FIRE);
        magic_damage(victim, ch,
        (TALENT(ch, TAL_FIRE) + TALENT(ch, TAL_WATER))*
	(IS_UNDERWATER(ch) ? 2 : 1),
        MAG_FIRE, TAL_WATER, FALSE);
}

void do_blizzard(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
	CHAR_DATA *next_vict;

        if (ch->curr_talent[TAL_FROST]
        +   ch->curr_talent[TAL_WIND] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)
        ||  ch->in_room->area->weather->precip < 50
	||  ch->in_room->area->weather->temp > -100) {
                send_to_char("The weather isn't right here to call a blizzard.\n\r", ch);
                return;
        }
        act(AT_FROST, "A swirling blizzard blasts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_FROST, "A swirling blizzard blasts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

    for ( victim = ch->in_room->first_person; victim; victim = next_vict ) {
        next_vict = victim->next_in_room;

	learn_talent(ch, TAL_WIND);
	magic_damage(victim, ch,
        (TALENT(ch, TAL_WIND) + TALENT(ch, TAL_FROST))*2,
        MAG_COLD, TAL_FROST, FALSE);
    }
}

void do_sunstroke(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_ILLUSION]
        +   ch->curr_talent[TAL_FIRE] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

	if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)
	||  ch->in_room->area->weather->precip > 0
	||  time_info.hour<6 || time_info.hour>=18
	||  get_light_room(ch->in_room) < 0) {
		send_to_char("There isn't enough sunlight here.\n\r", ch);
		return;
	}

        act(AT_YELLOW, "Your $t beam a ray of searing sunlight!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "$n's $t beam a ray of searing sunlight!",
                ch, hands(ch), NULL, TO_ROOM);
        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	learn_talent(ch, TAL_FIRE);
	magic_damage(victim, ch,
        (TALENT(ch, TAL_ILLUSION) + TALENT(ch, TAL_FIRE))*2,
        MAG_LIGHT, TAL_ILLUSION, FALSE);
}

void do_soulfire(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_DEATH]
        +   ch->curr_talent[TAL_FIRE] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_DGREY, "Black fire streaks from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_DGREY, "Black fire streaks from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);
        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        if (!IS_AFFECTED(victim, AFF_UNHOLY)
	&&  !IS_AFFECTED(victim, AFF_UNDEAD)
        &&  !IS_AFFECTED(victim, AFF_NONLIVING)) {
		learn_talent(ch, TAL_FIRE);
	        magic_damage(victim, ch,
	        (TALENT(ch, TAL_DEATH) + TALENT(ch, TAL_FIRE))*1.5,
	        MAG_UNHOLY, TAL_DEATH, FALSE);
        } else {
                act(AT_DGREY, "$N is unaffected.", ch, NULL, victim, TO_CHAR);
        }
}

void do_unholyblast(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_DEATH]
        +   ch->curr_talent[TAL_SECURITY] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_DGREY, "Unholy energy blasts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_DGREY, "Unholy energy blasts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        if (IS_AFFECTED(victim, AFF_HOLY)
        ||  IS_AFFECTED(victim, AFF_ANGEL)) {
		learn_talent(ch, TAL_SECURITY);
	        magic_damage(victim, ch,
	        (TALENT(ch, TAL_DEATH) + TALENT(ch, TAL_SECURITY))*2,
	        MAG_UNHOLY, TAL_DEATH, FALSE);
        } else {
                act(AT_DGREY, "$N is unaffected.", ch, NULL, victim, TO_CHAR);
        }
}

void do_sworddance(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (IS_NPC(ch) || ch->curr_talent[TAL_TIME] + ch->curr_talent[TAL_VOID]
        +   ch->curr_talent[TAL_CATALYSM] + ch->pcdata->weapon[SK_SWORD] < 200) {
                huh(ch);
                return;
        }

	if (!ch->main_hand || ch->main_hand->value[5] != SK_SWORD) {
		send_to_char("You must be holding a sword in your main hand to use the Sword Dance.\n\r", ch);
		return;
	}

        act(AT_WHITE, "You dance with the sword, and a dozen other swords dance with you.",
                ch, NULL, NULL, TO_CHAR);
        act(AT_WHITE, "$n dances, a dozen whirling swords slashing around $n!",
                ch, NULL, NULL, TO_ROOM);

	lose_ep(ch, 100);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch,
        ch->main_hand->value[2] + ch->pcdata->weapon[SK_SWORD]
	+ ch->curr_talent[TAL_CATALYSM],
        MAG_SLASH, TAL_CATALYSM, FALSE);
	learn_talent(ch, TAL_VOID);
	learn_talent(ch, TAL_TIME);
	learn_weapon(ch, SK_SWORD);
}

void do_pyrokinetics(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_MIND]
        +   ch->curr_talent[TAL_FIRE] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_BLUE, "Blazing blue psionic flames streak from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_BLUE, "Blazing blue psionic flames streak from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        if (IS_AFFECTED(victim, AFF_CONSTRUCT)
        ||  IS_AFFECTED(victim, AFF_UNDEAD)) {
                magic_damage(victim, ch, TALENT(ch, TAL_FIRE),
                MAG_FIRE, TAL_FIRE, FALSE);
        } else {
		learn_talent(ch, TAL_FIRE);
                magic_damage(victim, ch,
                (TALENT(ch, TAL_MIND) + TALENT(ch, TAL_FIRE))*2,
                MAG_PSIONIC, TAL_MIND, FALSE);
		learn_talent(ch, TAL_FIRE);
        }
}

void do_geyser(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_FIRE] + ch->curr_talent[TAL_WATER]
        +   ch->curr_talent[TAL_EARTH] < 100 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

	if (IS_SET(ch->in_room->room_flags, ROOM_NOFLOOR)) {
		send_to_char("There is no ground to make a geyser erupt from here.\n\r",ch);
		return;
	}

        act(AT_BLUE, "A geyser erupts from the ground!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_BLUE, "A geyser erupts from the ground!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	learn_talent(ch, TAL_FIRE);
	learn_talent(ch, TAL_EARTH);
        magic_damage(victim, ch, TALENT(ch, TAL_EARTH) +
        TALENT(ch, TAL_WATER) + TALENT(ch, TAL_FIRE),
        MAG_WATER, TAL_WATER, FALSE);
}

void do_brainshock(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_MIND]
        +   ch->curr_talent[TAL_LIGHTNING] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_YELLOW, "A surge of psionic lightning bursts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "A surge of psionic lightning bursts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (IS_AFFECTED(victim, AFF_CONSTRUCT)
	||  IS_AFFECTED(victim, AFF_UNDEAD)) {
		magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING),
		MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
	} else {
		learn_talent(ch, TAL_LIGHTNING);
	        magic_damage(victim, ch,
        	(TALENT(ch, TAL_MIND) + TALENT(ch, TAL_LIGHTNING))*2,
        	MAG_ELECTRICITY, TAL_MIND, FALSE);
	}
}

void do_smite(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_HEALING] + ch->curr_talent[TAL_LIGHTNING]
        +   ch->curr_talent[TAL_SECURITY] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_WHITE, "Holy lightning erupts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_WHITE, "Holy lightning erupts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        if (IS_AFFECTED(victim, AFF_UNHOLY)
        ||  IS_AFFECTED(victim, AFF_UNDEAD)
        ||  IS_AFFECTED(victim, AFF_DEMON)) {
        	magic_damage(victim, ch,
        	TALENT(ch, TAL_HEALING)*3 + (TALENT(ch, TAL_LIGHTNING)
		+ TALENT(ch, TAL_SECURITY))*2,
  		MAG_HOLY, TAL_HEALING, FALSE);
		learn_talent(ch, TAL_LIGHTNING);
		learn_talent(ch, TAL_SECURITY);
        } else {
        	magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING)*2,
        	MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
        }
}

void do_holyblast(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_HEALING]
	+   ch->curr_talent[TAL_SECURITY] < 200 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_WHITE, "Holy energy blasts from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_WHITE, "Holy energy blasts from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (IS_AFFECTED(victim, AFF_UNHOLY)
	||  IS_AFFECTED(victim, AFF_UNDEAD)
	||  IS_AFFECTED(victim, AFF_DEMON)) {
	        magic_damage(victim, ch,
		(TALENT(ch, TAL_HEALING) + TALENT(ch, TAL_SECURITY))*2,
	        MAG_HOLY, TAL_HEALING, FALSE);
		learn_talent(ch, TAL_SECURITY);
	} else {
		act(AT_WHITE, "$N is unaffected.", ch, NULL, victim, TO_CHAR);
	}
}

void do_lightning(CHAR_DATA *ch, char *argument) {
	OBJ_DATA *bullet;
	int amt;

        if (ch->curr_talent[TAL_LIGHTNING] < 30 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_YELLOW, "A bolt of lightning flies from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "A bolt of lightning flies from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

bullet = create_object( get_obj_index( 50 ), 0 ); /* blast */

        if (!bullet) {
                send_to_char("Your weapon jams mysteriously.\n\r", ch);
                bug("Do_shoot: Cannot find type for projectile.", 0);
                return;
        }

	amt = number_range(TALENT(ch, TAL_LIGHTNING),
	TALENT(ch, TAL_LIGHTNING) * 5);
	use_magic(ch, TAL_LIGHTNING, amt);
        bullet->value[2] = amt;
        ranged_attack(ch, bullet, argument);
}

void do_chill(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_FROST] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_FROST, "Frigid snow flies from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_FROST, "Frigid snow flies from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        learn_talent(ch, TAL_WATER);
        magic_damage(victim, ch, TALENT(ch, TAL_FROST) +
        TALENT(ch, TAL_WATER),
        MAG_COLD, TAL_FROST, FALSE);
}

void do_frostbite(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (IS_NPC(ch) || ch->curr_talent[TAL_FROST]
	+   ch->pcdata->weapon[SK_FANG] < 150) {
                huh(ch);
                return;
        }

        act(AT_FROST, "You snap your teeth with the chill of frost!",
                ch, NULL, NULL, TO_CHAR);
        act(AT_FROST, "$n snaps $s glistening icy teeth!",
                ch, NULL, NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        learn_weapon(ch, SK_FANG);
        magic_damage(victim, ch, (TALENT(ch, TAL_FROST) +
        ch->pcdata->weapon[SK_FANG])*2,
        MAG_COLD, TAL_FROST, FALSE);
}


void do_taint(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;
	AFFECT_DATA af;

        if (ch->curr_talent[TAL_DEATH] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_DGREEN, "Noxious fumes burst from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_DGREEN, "Noxious fumes burst from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

	victim = find_target(ch, argument, TRUE);
	if (!victim) return;

	if (ch->curr_talent[TAL_DEATH] >= 10 &&
	!IS_SET(victim->immune, RIS_POISON)) {
           af.type      = gsn_poison;
           af.duration  = 20;
           af.location  = APPLY_STR;
           af.modifier  = -2;
           af.bitvector = meb(AFF_POISON);
           affect_join( victim, &af );
           victim->mental_state = URANGE( 20, victim->mental_state, 100 );
	}

	magic_damage(victim, ch, TALENT(ch, TAL_DEATH),
	MAG_POISON, TAL_DEATH, FALSE);
}

void do_splash(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_WATER] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

	if (ch->curr_talent[TAL_EARTH] < 1) {
        act(AT_BLUE, "Water shoots from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_BLUE, "Water shoots fly from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);
	} else {
        act(AT_GREEN, "Acid sprays from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_GREEN, "Acid sprays from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

    if (ch->curr_talent[TAL_EARTH] < 1)
        magic_damage(victim, ch, TALENT(ch, TAL_WATER),
        MAG_WATER, TAL_WATER, FALSE);
    else
	magic_damage(victim, ch,
	TALENT(ch, TAL_EARTH) + TALENT(ch, TAL_WATER),
	MAG_ACID, TAL_WATER, FALSE);
}

void do_distort(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_CHANGE] > 0
        ||  ch->curr_talent[TAL_VOID] > 0
        ||  ch->curr_talent[TAL_TIME] > 0) {
                act(AT_FIRE, "Ripples of distortion radiate from your $t!",
                        ch, hands(ch), NULL, TO_CHAR);
                act(AT_FIRE, "Ripples of distortion radiate from $n's $t!",
                        ch, hands(ch), NULL, TO_ROOM);
        }

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (ch->curr_talent[TAL_CHANGE] > 0)
	        magic_damage(victim, ch, TALENT(ch, TAL_CHANGE),
	        MAG_CHANGE, TAL_CHANGE, FALSE);
	if (ch->curr_talent[TAL_TIME] > 0)
		magic_damage(victim, ch, TALENT(ch, TAL_TIME),
		MAG_CHANGE, TAL_TIME, FALSE);
	if (ch->curr_talent[TAL_VOID] > 0)
	        magic_damage(victim, ch, TALENT(ch, TAL_VOID),
		MAG_CHANGE, TAL_VOID, FALSE);
}

void do_nightmare(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

	if (!IS_AFFECTED(ch, AFF_DREAMWORLD)) {
		send_to_char("Only in the dreamworld.\n\r", ch);
		return;
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch, 2 * (TALENT(ch, TAL_DREAM) +
	TALENT(ch, TAL_MIND) + TALENT(ch, TAL_ILLUSION)),
        MAG_DREAM, TAL_DREAM, FALSE);
}

void do_wail(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *next_vict;
        CHAR_DATA *victim;
	int n=0;

	if (IS_SET(ch->in_room->room_flags, ROOM_SILENCE)
	|| (ch->curr_talent[TAL_SPEECH] < 1 && !IS_NPC(ch))) {
		huh(ch);
		return;
	}

        act(AT_YELLOW, "You emit a high pitched wail!", ch, NULL, NULL, TO_CHAR);
        act(AT_YELLOW, "$n emits a high pitched wail!", ch, NULL, NULL, TO_ROOM);

        if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

        magic_damage(victim, ch, TALENT(ch, TAL_SPEECH),
        MAG_SOUND, TAL_SPEECH, FALSE);

	}
        use_magic(ch, TAL_SPEECH, n*TALENT(ch, TAL_SPEECH));
	return;
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch, TALENT(ch, TAL_SPEECH),
        MAG_SOUND, TAL_SPEECH, FALSE);
}

void do_shock(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_LIGHTNING] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_YELLOW, "Lightning crackles from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_YELLOW, "Lightning crackles from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (IS_UNDERWATER(ch) || ch->in_room->curr_water > 30) {
		act(AT_YELLOW, "The electricity surges alarmingly through the water!",
			ch, NULL, NULL, TO_CHAR);
		act(AT_YELLOW, "$n's electricity surges alarmingly through the water!",
			ch, NULL, NULL, TO_ROOM);
		if (!IS_NPC(ch))
		magic_damage(ch, ch, TALENT(ch, TAL_LIGHTNING),
		MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
		magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING)*2,
		MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
	} else {
        	magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING),
		MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
	}
}

/* creates a storm from a hybrid of wind and whichever talents of
 * fire, water, frost, lightning, or catalysm that they have -keo
 */
void do_storm(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;
	CHAR_DATA *next_vict;
	int last_attack;
	int n=0;

	if (ch->curr_talent[TAL_WIND] < 10 && !IS_NPC(ch)) {
		huh(ch);
		return;
	}

        if (ch->in_room->curr_water >= 100) {
                act(AT_CYAN, "There isn't enough air here.",
                        ch, NULL, NULL, TO_CHAR);
                act(AT_CYAN, "Some air bubbles float up toward the surface.",
                        ch, NULL, NULL, TO_ROOM);
                return;
        }


        act(AT_CYAN, "An elemental storm rages around you!", ch, NULL, NULL, TO_CHAR);
        act(AT_CYAN, "An elemental storm rages around $n!", ch, NULL, NULL, TO_ROOM);

	if (!str_cmp(argument, "all")) {
	last_attack = 0;
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
	next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

	if (last_attack == TAL_FIRE) {
		last_attack = TAL_WIND;
	        magic_damage(victim, ch, TALENT(ch, TAL_WIND),
        	MAG_WIND, TAL_WIND, FALSE);
		continue;
	}

	if (last_attack == TAL_WIND) {
	    last_attack = TAL_WATER;
	    if (ch->curr_talent[TAL_WATER] > 0) {
		magic_damage(victim, ch, TALENT(ch, TAL_WATER),
		MAG_WATER, TAL_WATER, FALSE);
		continue;
	    }
	}

	if (last_attack == TAL_WATER) {
	    last_attack = TAL_FROST;
            if (ch->curr_talent[TAL_FROST] > 0) {
                magic_damage(victim, ch, TALENT(ch, TAL_FROST),
                MAG_COLD, TAL_FROST, FALSE);
		continue;
	    }
	}
	if (last_attack == TAL_FROST) {
	    last_attack = TAL_LIGHTNING;
            if (ch->curr_talent[TAL_LIGHTNING] > 0) {
                magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING),
                MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
		continue;
	    }
	}
	if (last_attack == TAL_LIGHTNING) {
	   last_attack = TAL_CATALYSM;
           if (ch->curr_talent[TAL_CATALYSM] > 0) {
                magic_damage(victim, ch, TALENT(ch, TAL_CATALYSM),
                MAG_ENERGY, TAL_CATALYSM, FALSE);
		continue;
	   }
	}
        if (last_attack == TAL_CATALYSM) {
            last_attack = TAL_FIRE;
	    if (ch->curr_talent[TAL_FIRE] > 0) {
                magic_damage(victim, ch, TALENT(ch, TAL_FIRE),
                MAG_FIRE, TAL_FIRE, FALSE);
                continue;
	    }
        }
        if (last_attack == TAL_FIRE) {
                last_attack = TAL_WIND;
                magic_damage(victim, ch, TALENT(ch, TAL_WIND),
                MAG_WIND, TAL_WIND, FALSE);
                continue;
        }

    }
        use_magic(ch, TAL_WIND, n*TALENT(ch, TAL_WIND));
	return;
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch, TALENT(ch, TAL_WIND),
	MAG_WIND, TAL_WIND, FALSE);
	if (char_died(victim)) return;
        if (ch->curr_talent[TAL_WATER] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_WATER),
                MAG_WATER, TAL_WATER, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_FROST] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_FROST),
                MAG_COLD, TAL_FROST, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_LIGHTNING] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING),
                MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_FIRE] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_FIRE),
                MAG_FIRE, TAL_FIRE, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_CATALYSM] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_WIND),
                MAG_ENERGY, TAL_CATALYSM, FALSE);
}

void do_wind(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

        if (ch->curr_talent[TAL_WIND] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

	if (ch->in_room->curr_water >= 100) {
		act(AT_CYAN, "There isn't enough air here.",
			ch, NULL, NULL, TO_CHAR);
		act(AT_CYAN, "Some air bubbles float up toward the surface.",
			ch, NULL, NULL, TO_ROOM);
		return;
	}


        act(AT_CYAN, "Strong winds blow from your $t!",
                ch, hands(ch), NULL, TO_CHAR);
        act(AT_CYAN, "Strong winds blow from $n's $t!",
                ch, hands(ch), NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	magic_damage(victim, ch, 
	(TALENT(ch, TAL_WIND)*2 + ch->in_room->area->weather->wind)/3,
	MAG_WIND, TAL_WIND, FALSE);
}

void do_vines(CHAR_DATA *ch, char *argument) {

	CHAR_DATA *victim;

        if (ch->curr_talent[TAL_EARTH] < 1 && !IS_NPC(ch)) {
                huh(ch);
                return;
        }

        act(AT_GREEN, "Thorny vines coil like snakes!", ch, NULL, NULL, TO_CHAR);
        act(AT_GREEN, "Thorny vines coil like snakes!", ch, NULL, NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	magic_damage(victim, ch,
	(TALENT(ch, TAL_EARTH)*2 + ch->in_room->curr_vegetation)/3,
	MAG_EARTH, TAL_EARTH, FALSE);
}

/* a destructive blast of fire, lightning, and/or catalysm - keo */
void do_blast(CHAR_DATA *ch, char *argument) {

        CHAR_DATA *victim;

	if (ch->curr_talent[TAL_CATALYSM] > 0
	||  ch->curr_talent[TAL_FIRE] > 0
	||  ch->curr_talent[TAL_LIGHTNING] > 0) {
		act(AT_FIRE, "A blast of energy bursts from your $t!",
			ch, hands(ch), NULL, TO_CHAR);
		act(AT_FIRE, "A blast of energy bursts from $s $t!",
			ch, hands(ch), NULL, TO_ROOM);
	}

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (ch->curr_talent[TAL_CATALYSM] > 0)
		magic_damage(victim, ch, TALENT(ch, TAL_CATALYSM),
		MAG_ENERGY, TAL_CATALYSM, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_FIRE] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_FIRE),
                MAG_FIRE, TAL_FIRE, FALSE);
       if (char_died(victim)) return;
        if (ch->curr_talent[TAL_LIGHTNING] > 0)
                magic_damage(victim, ch, TALENT(ch, TAL_LIGHTNING),
                MAG_ELECTRICITY, TAL_LIGHTNING, FALSE);
}

void do_mindflay(CHAR_DATA *ch, char *argument) {

	CHAR_DATA *victim;

        act(AT_PURPLE, "You concentrate.", ch, NULL, NULL, TO_CHAR);
        act(AT_PURPLE, "$n concentrates.", ch, NULL, NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if ((ch->curr_talent[TAL_MIND] > 40 || IS_NPC(ch))
	&& !IS_SET(victim->resistant, RIS_PSIONIC))
		victim->mental_state +=
		number_range(0, ch->curr_talent[13] / 10);

	if (ch->curr_talent[TAL_MIND] >= 1)
		magic_damage(victim, ch,
		TALENT(ch, TAL_MIND) + victim->perm_int - victim->perm_wis,
		MAG_PSIONIC, TAL_MIND, FALSE);
	if (ch->curr_talent[TAL_DREAM] >= 1)
		magic_damage(victim, ch, TALENT(ch, TAL_DREAM),
		MAG_DREAM, TAL_DREAM, FALSE);
	if (ch->curr_talent[TAL_ILLUSION] >= 1)
		magic_damage(victim, ch, TALENT(ch, TAL_ILLUSION),
		MAG_LIGHT, TAL_ILLUSION, FALSE);
}

void do_flood(CHAR_DATA *ch, char *argument) {
        CHAR_DATA *victim;
	CHAR_DATA *next_vict;
	int n=0;

	if (IS_SET(ch->in_room->room_flags, ROOM_NOFLOOR)
	|| (ch->curr_talent[TAL_WATER] < 1 && !IS_NPC(ch))) {
		huh(ch);
		return;
	}

	if (ch->curr_talent[TAL_WATER] > 10
	&& ch->in_room->curr_water < 100) {
		act(AT_BLUE, "Water floods the room!",
			ch, NULL, NULL, TO_CHAR);
		act(AT_BLUE, "Water floods the room!",
			ch, NULL, NULL, TO_ROOM);
		if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS))
	   ch->in_room->curr_water += TALENT(ch, TAL_WATER) / 10;
	}

        if (!str_cmp(argument, "all")) {
    for ( victim = ch->in_room->first_person; victim; victim = next_vict )
    {
        next_vict = victim->next_in_room;
	n++;

        if ( victim == ch )
           continue;

        magic_damage(victim, ch, TALENT(ch, TAL_WATER),
        MAG_WATER, TAL_WATER, FALSE);

        }
        use_magic(ch, TAL_WATER, n*TALENT(ch, TAL_WATER));
        return;
        }

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

        magic_damage(victim, ch,
	(TALENT(ch, TAL_WATER)*2 + ch->in_room->curr_water)/3,
	MAG_WATER, TAL_WATER, FALSE);
}

/* if someone has both death and catalysm, they will end up with
 * a double energy drain. -keo
 */
void do_drain(CHAR_DATA *ch, char *argument) {
	PART_DATA *part;
	CHAR_DATA *victim;
	int amt;

        if (ch->curr_talent[TAL_DEATH] < 1 && !IS_NPC(ch)
	&&  ch->curr_talent[TAL_CATALYSM] < 1 
	&&  ch->curr_talent[TAL_HEALING] < 1) {
                huh(ch);
                return;
        }

        act(AT_DGREY, "Tendrils of darkness surround you.", ch, NULL, NULL, TO_CHAR);
        act(AT_DGREY, "Tendrils of darkness surround $n.", ch, NULL, NULL, TO_ROOM);

        victim = find_target(ch, argument, TRUE);
        if (!victim) return;

	if (IS_AFFECTED(victim, AFF_UNDEAD)) {
	    if (ch != victim && IS_FIGHTING(victim)) {
		magic_damage(ch, victim,
		TALENT(ch, TAL_DEATH) + TALENT(ch, TAL_HEALING),
		MAG_DRAIN, TAL_DEATH, TRUE);
	    }
		amt = number_range(TALENT(ch, TAL_DEATH) +
		TALENT(ch, TAL_HEALING),
		(TALENT(ch, TAL_DEATH) +
		TALENT(ch, TAL_HEALING))*10);
		use_magic(ch, TAL_DEATH, amt);
		learn_talent(ch, TAL_HEALING);
        	if (!IS_SET(ch->immune, RIS_DRAIN)
		|| ch == victim) {
			act(AT_MAGIC, "Your undead flesh repairs itself.",
				victim, NULL, NULL, TO_CHAR);
			act(AT_MAGIC, "$n's undead flesh repairs itself.",
				victim, NULL, NULL, TO_ROOM);
			if (IS_AFFECTED(ch, AFF_UNHOLY)) amt *= 2;
			if (IS_AFFECTED(ch, AFF_HOLY) && amt != 0) amt /= 2;
               		victim->hit += amt;
                	if (victim->hit > victim->max_hit)
        	                victim->hit = victim->max_hit;
        for (part = victim->first_part;part;part = part->next) {
            if (part->flags == PART_SEVERED
            && part->cond == PART_WELL
            && (part->connect_to
            ?   part->connect_to->flags != PART_SEVERED
            :   TRUE)
            &&  amt > 300) {
                act(AT_MAGIC, "Your $t grows back!",
                        victim, part_locs[part->loc], NULL, TO_CHAR);
                act(AT_MAGIC, "$n's $t grows back!",
                        victim, part_locs[part->loc], NULL, TO_ROOM);
                part->flags = PART_WELL;
                return; /* No more healing after a part is regened */
            } else {
                part->cond = UMIN(PART_WELL, part->cond+amt/10);
            }
	}
		WAIT_STATE(ch, PULSE_VIOLENCE);
                if (IS_NPC(ch) && number_range(1,40) < get_curr_int(ch))
                        xSET_BIT(ch->act, ACT_MAG_FAIL);
		return;
	}
	}

    if (ch->curr_talent[TAL_DEATH] > 0) {
	magic_damage(victim, ch,
	TALENT(ch, TAL_DEATH) + TALENT(ch, TAL_HEALING),
	MAG_DRAIN, TAL_DEATH, FALSE);
       	amt = number_range(1, TALENT(ch, TAL_DEATH) + TALENT(ch, TAL_HEALING));
	use_magic(ch, TAL_HEALING, amt);
	if (!IS_SET(victim->immune, RIS_DRAIN)
	&&  TALENT(victim, TAL_DEATH) < 100) {
		if (IS_AFFECTED(ch, AFF_UNHOLY)) amt *= 2;
		if (IS_AFFECTED(victim, AFF_UNHOLY)) amt *= 2;
		if (IS_AFFECTED(ch, AFF_HOLY) && amt != 0) amt /= 2;
		if (IS_AFFECTED(victim, AFF_HOLY) && amt != 0) amt /= 2;
        	ch->hit += amt;
        	if (ch->hit > ch->max_hit)
                	ch->hit = ch->max_hit;
	}
    }
	if (char_died(victim)) return;

    if (ch->curr_talent[TAL_CATALYSM] > 0) {
	magic_damage(victim, ch, 1, MAG_DRAIN, TAL_CATALYSM, FALSE);
	amt = number_range(TALENT(ch, TAL_CATALYSM), TALENT(ch, TAL_CATALYSM)*5);
	if (!IS_SET(victim->immune, RIS_DRAIN)) {
		victim->mana -= amt;
		ch->mana += amt;
	}
	learn_talent(ch, TAL_CATALYSM);
	/* no extra mana cost from mana drain (that would be pointless) */
    }
}

void seek_object(CHAR_DATA *ch, char *argument) {
    char buf[MAX_INPUT_LENGTH];
    OBJ_DATA *obj;
    OBJ_DATA *in_obj;
    int cnt, found = 0;

    for ( obj = first_object; obj; obj = obj->next )
    {
        if ( !can_see_obj( ch, obj ) ||
        !nifty_is_name( argument, obj->name ) )
            continue;
        if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) ||
              IS_OBJ_STAT( obj, ITEM_NOLOCATE ) ||
		IS_OBJ_STAT( obj, ITEM_ARTIFACT ) ||
		IS_OBJ_STAT(obj, ITEM_GEM) ||
	      number_percent() > TALENT(ch, TAL_SEEKING) )
            continue;

        found++;

        for ( cnt = 0, in_obj = obj;
              in_obj->in_obj && cnt < 100;
              in_obj = in_obj->in_obj, ++cnt )
            ;
        if ( cnt >= MAX_NEST )
        {
            sprintf( buf, "seek_object: object [%d] %s is nested more than %d times!",
                obj->pIndexData->vnum, obj->short_descr, MAX_NEST );
            bug( buf, 0 );
            continue;
        }

        if ( in_obj->carried_by )
        {
	    if (TALENT(ch, TAL_SEEKING) < 30)
            sprintf( buf, "%s is carried by %s.\n\r",
                   obj_short(obj), PERS(in_obj->carried_by, ch) );
	    else if (TALENT(ch, TAL_SEEKING) < 60)
	    sprintf( buf, "%s is carried by %s, in %s.\n\r",
		   obj_short(obj), PERS(in_obj->carried_by, ch),
		   in_obj->carried_by->in_room->name);
	    else
	    sprintf( buf, "%s is carried by %s, in %s in %s.\n\r",
		   obj_short(obj), PERS(in_obj->carried_by, ch),
		   in_obj->carried_by->in_room->name,
		   in_obj->carried_by->in_room->area->name);
        }
        else
        {
	    if (in_obj->in_room == NULL)
	    	sprintf( buf, "%s is somewhere\n\r", obj_short(obj));
	    else if (TALENT(ch, TAL_SEEKING) < 50)
            	sprintf( buf, "%s is in %s.\n\r",
                obj_short(obj), in_obj->in_room->name );
	    else
            	sprintf( buf, "%s is in %s, in %s.\n\r",
            	obj_short(obj), 
		in_obj->in_room->name, in_obj->in_room->area->name );
        }

        buf[0] = UPPER(buf[0]);
        set_char_color( AT_MAGIC, ch );
        send_to_char( buf, ch );
    }

    if ( !found )
    {
	send_to_char("You were unable to locate anything like that.\n\r", ch);
    }
    mana_from_char(ch, 10);
    learn_talent(ch, TAL_SEEKING);
    return;
}


void do_seek( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;

    if (ch->curr_talent[TAL_SEEKING] < 20) {
	send_to_char("You are unable to find anything.\n\r", ch);
	return;
    }

    if (TALENT(ch, TAL_SEEKING) < 50)
    for ( victim = first_char; victim; victim = victim->next )
    {
	if ( victim->in_room
	&&   can_see(ch, victim)
	&&   nifty_is_name( argument, victim->name ) )
	{
	    pager_printf( ch, "%s is in %s\n\r",
		PERS(victim, ch),
		victim->in_room->name );
	}
    }
    else
    for ( victim = first_char; victim; victim = victim->next )
    {
	if ( victim->in_room
	&&   can_see(ch, victim)
	&&   nifty_is_name( argument, victim->name ) )
	{
	    pager_printf( ch, "%s is in %s, in %s\n\r",
		PERS(victim, ch),
		victim->in_room->name,
		victim->in_room->area->name );
	}
    }

	seek_object(ch, argument);
    use_magic(ch, TAL_SEEKING, 120 - ch->curr_talent[TAL_SEEKING]);
}

void travel_teleport(CHAR_DATA *ch) {
    ROOM_INDEX_DATA *pRoomIndex;

    if (char_died(ch)) return;
    if (IS_NPC(ch) && xIS_SET(ch->act, ACT_SENTINEL)) return;

    if (IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
    && ch->curr_talent[TAL_MOTION] < 80) {
	send_to_char("For some reason, nothing happens.\n\r", ch);
	return;
    }

    for ( ;; )
    {
        pRoomIndex = get_room_index( number_range( 0, 1048576000 ) );
        if ( pRoomIndex )
        if ( !IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE)
        &&   !IS_SET(pRoomIndex->room_flags, ROOM_SOLITARY)
        &&   !IS_SET(pRoomIndex->room_flags, ROOM_NO_ASTRAL)
        &&   !IS_SET(pRoomIndex->area->flags, AFLAG_NOTELEPORT)
        &&   !IS_SET(pRoomIndex->room_flags, ROOM_PROTOTYPE)
        &&   !IS_SET(pRoomIndex->room_flags, ROOM_NO_RECALL) )
            break;
    }

	use_magic(ch, TAL_MOTION, ch->mount ? 50 : 25);

    act( AT_MAGIC, "Reality seems to twist for a moment, and your surroundings warp and change.", ch,
	NULL, NULL, TO_CHAR);
    act( AT_MAGIC, "Reality seems to twist for a moment, and $n vanishes.", ch,
	NULL, NULL, TO_ROOM);

        char_from_room( ch );
	ch->in_obj = NULL;
    char_to_room( ch, pRoomIndex );
    if (ch->mount) {
        char_from_room(ch->mount);
        char_to_room(ch->mount, pRoomIndex);
    }
        act( AT_MAGIC, "Reality ripples for a moment, and $n suddenly appears.",
		ch, NULL, NULL, TO_ROOM);
        do_look( ch, "auto" );
	WAIT_STATE(ch, PULSE_VIOLENCE);
}

void do_travel(CHAR_DATA *ch, char *argument) {
    CHAR_DATA *victim;
    DEITY_DATA *talent;
    AREA_DATA *pArea;
    ROOM_INDEX_DATA *pRoomIndex;
	EXPLORED_AREA *xarea;
     int i, vnum;

    if (IS_NPC(ch) && (xIS_SET(ch->act, ACT_PACIFIST)
	|| xIS_SET(ch->act, ACT_SENTINEL))) return;

    if (ch->curr_talent[TAL_MOTION] < 20 && !IS_NPC(ch)) {
	travel_teleport(ch);
	return;
    }

    if (!argument || argument[0] == '\0') {
	travel_teleport(ch);
	return;
    }

    if (IS_AFFECTED(ch, AFF_VOID)) {
	travel_teleport(ch);
	return;
    }

    if (IS_FIGHTING(ch) && ch->curr_talent[TAL_MOTION] < 60) {
	send_to_char("You can't travel in combat!\n\r", ch);
	return;
    }

	if (!can_travel(90, ch, ch)) {
		send_to_char("You feel trapped in this place.\n\r",ch);
		return;
	}
	/* Start travel to location */
        for(pArea = first_area; pArea; pArea = pArea->next)
        {
                if (nifty_is_name_prefix(argument, pArea->name)) {

	/* Only allow you to target areas you've been to already */
	xarea = ch->pcdata->first_explored;
	while (xarea) {
		if (xarea->index == pArea->low_soft_range) {
			ch_printf(ch, "&BYou bring to mind your memory of %s...\n\r", pArea->name);
			break;
		}
		xarea = xarea->next;
	}
	if (!xarea) {
		send_to_char("&BYou don't know what that area looks like yet.\n\r", ch);
		return;
	}

	if (IS_SET(pArea->flags, AFLAG_NOTRAVEL)) {
		send_to_char("&BStrong wards surround the area, blocking your magic.\n\r", ch);
		return;
	}

        for (i = 0;i <= 20;i++) {
		if (i == 20) {
			send_to_char("&BYou fail to penetrate the wards surrounding that area.\n\r", ch);
			return;
		}
                vnum = number_range(pArea->low_r_vnum, pArea->hi_r_vnum);
                if ((pRoomIndex = get_room_index(vnum)) == NULL)
                        continue;
		if (IS_SET(pRoomIndex->room_flags, ROOM_NO_ASTRAL)) {
			if (IS_SET(pRoomIndex->runes, RUNE_WARD))
				continue;
			if (IS_SET(pArea->flags, AFLAG_NOBYPASS))
				continue;
			if (TALENT(ch, TAL_MOTION) < 100)
				continue;
		}
		break;
	}

	if (!pRoomIndex) {
		send_to_char("You can't find a place to land.\n\r", ch);
		return;
	}

        use_magic(ch, TAL_MOTION, (250 - ch->curr_talent[TAL_MOTION]*2)
        * (ch->mount ? 2 : 1));

        if (ch->pcdata->inborn == -1)
                talent = get_talent_by_index(TAL_MOTION);
        else
                talent = get_talent_by_index(ch->pcdata->inborn);

        act(AT_MAGIC, "$T the room, and $n is gone.",
                ch, NULL, talent->message, TO_ROOM);
        act(AT_MAGIC, "$T the room, and you travel.",
                ch, NULL, talent->message, TO_CHAR);
    char_from_room( ch );
    ch->in_obj = NULL;
    char_to_room( ch, pRoomIndex);
    if (ch->mount) {
        char_from_room(ch->mount);
        char_to_room(ch->mount, pRoomIndex);
        do_look(ch->mount, "auto");
    }
        act( AT_MAGIC, "$T the room, and $n appears.",
                ch, NULL, talent->message, TO_ROOM);
    do_look( ch, "auto" );
    learn_talent(ch, TAL_MOTION);
    WAIT_STATE(ch, PULSE_VIOLENCE*2 - ch->curr_talent[TAL_MOTION]/5);

			return;
		} /* end travel to location */
	}
	if (ch->curr_talent[TAL_MOTION] < 50) {
	act( AT_MAGIC, "You are unable to locate anyplace like that.",
		ch, NULL, NULL, TO_CHAR);
	return;
	}

	/* start travel to person */
    if ( (victim = get_char_world(ch, argument)) == NULL
    || !can_travel(90, ch, victim)
    || (TALENT(victim, TAL_SECURITY) > TALENT(ch, TAL_SEEKING)))
    {
	send_to_char("&BYou are unable to locate anyplace or anyone like that.\n\r", ch);
	return;
    }
	if (victim == ch) {
		send_to_char("That was a short trip!\n\r", ch);
		return;
	}

	if (victim == ch->mount) {
		send_to_char("You are riding them already!\n\r", ch);
		return;
	}

	use_magic(ch, TAL_MOTION, (250 - ch->curr_talent[TAL_MOTION]*2)
        * (ch->mount ? 2 : 1));

	if (ch->pcdata->inborn == -1)
		talent = get_talent_by_index(TAL_MOTION);
	else
		talent = get_talent_by_index(ch->pcdata->inborn);

        act(AT_MAGIC, "$T the room, and $n is gone.",
		ch, NULL, talent->message, TO_ROOM);
	act(AT_MAGIC, "$T the room, and you travel.",
		ch, NULL, talent->message, TO_CHAR);
    char_from_room( ch );
    ch->in_obj = NULL;
    char_to_room( ch, victim->in_room );
    if (ch->mount) {
        char_from_room(ch->mount);
        char_to_room(ch->mount, victim->in_room);
	do_look(ch->mount, "auto");
    }
        act( AT_MAGIC, "$T the room, and $n appears.",
		ch, NULL, talent->message, TO_ROOM);
    do_look( ch, "auto" );
    learn_talent(ch, TAL_MOTION);
    WAIT_STATE(ch, PULSE_VIOLENCE*2 - ch->curr_talent[TAL_MOTION]/5);
}


void do_summon(CHAR_DATA *ch, char *argument) {
    CHAR_DATA *victim = NULL;
    char buf[MAX_STRING_LENGTH];

    if (ch->curr_talent[TAL_MOTION] < 40 && !IS_NPC(ch)) {
        travel_teleport(ch);
        return;
    }

    if (IS_SET(ch->in_room->area->flags, AFLAG_NOBYPASS)) {
	huh(ch);
	return;
    }

    if (IS_AFFECTED(ch, AFF_VOID)) {
	travel_teleport(ch);
	return;
    }

    victim = get_char_world(ch, argument);

	if (!victim
	|| (IS_NPC(victim) && !xIS_SET(victim->act, ACT_NAMED)))
		victim = generate_mob_nation(argument);

	if (!victim) {
		send_to_char("You cannot find anything like that.\n\r",ch);
		return;
	}

        if (victim == ch) {
                send_to_char("That was a short trip!\n\r", ch);
                return;
        }

	if (victim->in_room && !can_travel(100, ch, victim)) {
		send_to_char("Something prevents you from opening a rift.\n\r", ch);
		return;
	}

	use_magic(ch, TAL_MOTION, 500 - (ch->curr_talent[TAL_MOTION]*4));

    if (!IS_NPC(victim)) {
        sprintf( buf, "%s summoned %s to %s (%d).", ch->name,
              victim->name, ch->in_room->name, ch->in_room->vnum );
        to_channel( buf, "Spell", PERMIT_SECURITY);
    }
	if (victim->in_room) {
    act( AT_MAGIC, "A swirling rift opens for a moment, sucking $n through.",
                victim, NULL, ch, TO_ROOM);
    act(AT_MAGIC, "A swirling rift opens suddenly, and $n pulls you through!",
                ch, NULL, victim, TO_VICT);
	}
    act(AT_MAGIC, "You open a swirling rift and pull $N through.",
		ch, NULL, victim, TO_CHAR);
    act(AT_MAGIC, "$n opens a swirling rift and pulls $N through.",
		ch, NULL, victim, TO_ROOM);
    if (victim->in_room) char_from_room(victim);
    victim->in_obj = NULL;
    char_to_room( victim, ch->in_room );
    do_look( victim, "auto" );
    WAIT_STATE(ch, PULSE_VIOLENCE);
    WAIT_STATE(victim, PULSE_VIOLENCE);
}

void do_morph(CHAR_DATA *ch, char* argument) {
        NATION_DATA *newrace;
        SPECIES_DATA *species;
        OBJ_DATA *obj;

        if (ch->curr_talent[TAL_CHANGE] < 10) {
		huh(ch);
                return;
        }

        if (IS_NPC(ch)) {
		huh(ch);
                return;
        }

	if (argument && !ch->pcdata->were_race) {
		/* if they dont have a morph, set it to the argument */
		newrace = find_nation(argument);

        if (!newrace) {
                send_to_char("There is no such race.\n\r", ch);
                return;
        }

        if (IS_SET(newrace->flags, NAT_NPC)) {
                send_to_char("You cannot change into that!", ch);
                return;
        }

		if (has_bodypart(ch, BP_RHAND)
		&& IS_SET(newrace->parts, PART_HANDS)) {
			send_to_char("That race is too similar, pick one without hands.\n\r", ch);
			return;
		}
		if (!has_bodypart(ch, BP_RHAND)
		&& !IS_SET(newrace->parts, PART_HANDS)) {
			send_to_char("That race is too similar, pick one with hands.\n\r", ch);
			return;
		}
		if (has_bodypart(ch, BP_RHAND))
			ch_printf(ch, "You are now a were-%s.\n\r", newrace->name);
		else
			ch_printf(ch, "You are now a were-%s.\n\r", ch->species);
		ch->pcdata->were_race = STRALLOC(newrace->name);
                return;
        }

        if (ch->mount) {
                send_to_char("And scare your mount?\n\r", ch);
                return;
        }

        if (IS_AFFECTED(ch, AFF_MOUNTED))
                throw_rider(ch);

        if (ch->mana <= 0)
        {
                send_to_char("You do not have enough mana to change.\n\r",ch);
                return;
        }

      newrace = find_nation(ch->pcdata->were_race);
	STRFREE(ch->pcdata->were_race);
	if (IS_AFFECTED(ch, AFF_ANTHRO))
		ch->pcdata->were_race = STRALLOC("anthro");
	else
		ch->pcdata->were_race = STRALLOC(ch->species);

        if (!newrace) {
                send_to_char("Select your were-race first with morph <race>.", ch);
                return;
        }

        use_magic(ch, TAL_CHANGE, 100);

        de_equip_char(ch);

        if (IS_AFFECTED(ch, AFF_FLYING))
                do_land(ch, "");

        species = find_species(newrace->species);
        if (!species) {
                bug("do_morph: cannot find species!");
                send_to_char("You suddenly forget what one of those is.",ch);
                return;
        }
        act( AT_MAGIC, "Your body changes and warps, and you become $t.",
                ch, aoran(newrace->name), NULL, TO_CHAR);
        act( AT_MAGIC, "$n's body changes and warps, and $e becomes $t.",
                ch, aoran(newrace->name), NULL, TO_ROOM);

	if (IS_AFFECTED(ch, AFF_ANTHRO)) {
		xREMOVE_BIT(ch->pcdata->perm_aff, AFF_ANTHRO);
                STRFREE(ch->pcdata->type);
		if (IS_AFFECTED(ch, AFF_UNDEAD))
			ch->pcdata->type = STRALLOC("undead");
		else
	                ch->pcdata->type = STRALLOC("living");
	}
        ch->nation = newrace;
        set_race(ch, FALSE);
	if (!can_use_bodypart(ch, BP_RHAND)) {
	    if (ch->main_hand) {
		obj_unaffect_ch(ch, ch->main_hand);
	        ch->main_hand = NULL;
	    }
	    if (ch->off_hand) {
		obj_unaffect_ch(ch, ch->off_hand);
	        ch->off_hand = NULL;
	    }		
	}
        if (ch->curr_talent[TAL_CHANGE] >= 50) {
           for (obj = ch->first_carrying; obj; obj = obj->next_content) {
                obj->size = ch->height;
           }
        }
        re_equip_char(ch);
	update_aris(ch);
		ch->max_hit = UMAX(20, ch->nation->hit * get_curr_con(ch) + ch->base_hit);
		ch->max_mana = UMAX(20, ch->nation->mana * get_curr_int(ch) + ch->base_mana);
		ch->max_move = UMAX(20, 25 * get_curr_end(ch) + ch->base_move);
		ch->mana = ch->max_mana;
}

void do_change(CHAR_DATA *ch, char* argument) {
        NATION_DATA *newrace;
        SPECIES_DATA *species;
	char arg[MAX_STRING_LENGTH];
	CHAR_DATA *victim;
	OBJ_DATA *obj;

	if (ch->curr_talent[TAL_CHANGE] < 1) {
		huh(ch);
		return;
	}

        if (IS_NPC(ch)) {
		huh(ch);
                return;
        }

        if (!argument || argument[0] == '\0') {
                send_to_char("Change into what?\n\r", ch);
                return;
        }

	if (ch->mount) {
		send_to_char("And scare your mount?\n\r", ch);
		return;
	}

	if (IS_AFFECTED(ch, AFF_MOUNTED))
		throw_rider(ch);

	if (ch->mana <= 0)
	{
		send_to_char("You do not have enough mana to change.\n\r",ch);
		return;
	}

	argument = one_argument(argument, arg);

	victim = find_target(ch, arg, FALSE);
	if (!victim) return;

        if (IS_NPC(victim)) {
                send_to_char("You can't change that!\n\r", ch);
                return;
        }

	if (!str_cmp(argument, "anthro")) {
                if (has_bodypart(victim, BP_RHAND)) {
                        send_to_char("They already have hands.\n\r", ch);
                        return;
                }
                if (victim->height > 100) {
                        send_to_char("They are too large to become an anthropomorphic form.\n\r", ch);
                        return;
                }
		xSET_BIT(victim->pcdata->perm_aff, AFF_ANTHRO);
		check_bodyparts(victim);
                if (victim->height < 60)
                        victim->height = number_range(36,60);
                else
                        victim->height = number_range(60,76);
		victim->weight = get_height_weight(victim);
                STRFREE(victim->pcdata->type);
                victim->pcdata->type = STRALLOC("anthropomorphic");
                act(AT_MAGIC, "Your body warps into an anthropomorphic form.", victim, NULL, NULL, TO_CHAR);
                act(AT_MAGIC, "$n's body warps into an anthropomorphic form.", ch, NULL, NULL, TO_NOTVICT);
		if (victim != ch)
			act(AT_MAGIC, "You warp $N's body into an anthropomorphic form.", ch, NULL, victim, TO_CHAR);
		return;
	}

	if (ch->curr_talent[TAL_CHANGE] < 30 || !argument) {
		send_to_char("Your Changing magic goes awry...\n\r", ch);
		if (!add_mutation(victim, 0))
			send_to_char("However, there is no effect.\n\r", ch);
		return;
	}

	if (victim != ch) {

		if (TALENT(ch, TAL_CHANGE) < 80) {
			send_to_char("You are not strong enough to change others yet.\n\r", ch);
			return;
		}

		if (!IS_CONSENTING(victim, ch)
		&&   TALENT(ch, TAL_CHANGE) < 400) {
			send_to_char("You cannot do that without their consent.\n\r", ch);
			return;
		}

	}

        newrace = find_nation(argument);

        if (!newrace) {
                send_to_char("You can't change into any such thing.", ch);
                return;
        }

	if (str_cmp(newrace->species, victim->nation->species)
	&&  (ch->curr_talent[TAL_CHANGE] < 60)) {
		send_to_char("You are not skilled enough to make such a drastic change.\n\r", ch);
		return;
	}

	use_magic(ch, TAL_CHANGE, 300);

	de_equip_char(victim);

	if (IS_AFFECTED(victim, AFF_FLYING))
		do_land(victim, "");

	species = find_species(newrace->species);
        if (!species) {
                bug("do_change: cannot find species!");
                send_to_char("You suddenly forget what one of those is.",ch);
                return;
        }
        ch_printf(victim, "Your body changes and warps, and you become %s.\n\r",
                aoran(newrace->name));
        act( AT_MAGIC, "$N's body changes and warps, and $E becomes $t.",
                ch, aoran(newrace->name), victim, TO_NOTVICT);
	if (ch != victim) {
		act( AT_MAGIC, "You change and warp $N's body into $t.",
			ch, aoran(newrace->name), victim, TO_CHAR);
	}

	if (IS_AFFECTED(victim, AFF_ANTHRO)) {
		xREMOVE_BIT(victim->pcdata->perm_aff, AFF_ANTHRO);
                STRFREE(victim->pcdata->type);
		if (IS_AFFECTED(victim, AFF_UNDEAD))
			victim->pcdata->type = STRALLOC("undead");
		else
	                victim->pcdata->type = STRALLOC("living");
	}
      victim->nation = newrace;
	set_race(victim, FALSE);
        if (!IS_SET(newrace->parts, PART_HANDS)) {
            if (ch->main_hand) {
                obj_unaffect_ch(ch, ch->main_hand);
                ch->main_hand = NULL;
            }
            if (ch->off_hand) {
                obj_unaffect_ch(ch, ch->off_hand);
                ch->off_hand = NULL;
            }
        }
	if (ch->curr_talent[TAL_CHANGE] >= 50) {
           for (obj = victim->first_carrying; obj; obj = obj->next_content) {
		obj->size = victim->height;
	   }
	}
	re_equip_char(victim);
	update_aris(victim);
	victim->max_hit = UMAX(20, victim->nation->hit * get_curr_con(victim) + victim->base_hit);
	victim->max_mana = UMAX(20, victim->nation->mana * get_curr_int(victim) + victim->base_mana);
	victim->max_move = UMAX(20, 25 * get_curr_end(victim) + victim->base_move);
	victim->mana = UMIN(victim->max_mana, victim->mana);
}

void do_alter(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	int i;

	if (ch->curr_talent[TAL_CHANGE] < 25) {
		huh(ch);
		return;
	}

        if (IS_NPC(ch)) {
		huh(ch);
                return;
        }

        if (!argument || argument[0] == '\0') {
                send_to_char("Alter what?\n\r", ch);
                return;
        }

	if (ch->mana <= 0)
	{
		send_to_char("You do not have enough mana to change.\n\r",ch);
		return;
	}

	argument = one_argument(argument, arg1);
	argument = one_argument(argument, arg2);

	victim = find_target(ch, arg1, FALSE);
	if (!victim) return;

        if (IS_NPC(victim)) {
                send_to_char("You can't change that!\n\r", ch);
                return;
        }

	if (victim != ch) {

		if (TALENT(ch, TAL_CHANGE) < 50) {
			send_to_char("You are not strong enough to change others yet.\n\r", ch);
			return;
		}

		if (!IS_CONSENTING(victim, ch)
		&&   TALENT(ch, TAL_CHANGE) < 100) {
			send_to_char("You cannot do that without their consent.\n\r", ch);
			return;
		}

	}

	if (!str_cmp(arg2, "height")) {
		i = atoi(argument);
		if (i >= victim->nation->height *
		(1 + TALENT(ch, TAL_CHANGE) / 100)) {
			send_to_char("You can't make them that tall.\n\r", ch);
			return;
		}
            if (i <= victim->nation->height -
		victim->nation->height *
                TALENT(ch, TAL_CHANGE) / 100
		|| victim->height <= 10) {
                        send_to_char("You can't make them that short.\n\r", ch);
                        return;
                }
		victim->height = i;
		if (victim != ch) {
		act(AT_MAGIC, "Your height changes.",
			ch, NULL, victim, TO_VICT);
		act(AT_MAGIC, "You make $N's height change.",
			ch, NULL, victim, TO_CHAR);
		} else
		act(AT_MAGIC, "You change your height.",
			ch, NULL, NULL, TO_CHAR);
		act(AT_MAGIC, "$N's height changes.",
			ch, NULL, victim, TO_NOTVICT);
	} else if (!str_cmp(arg2, "weight")) {
		i = atoi(argument);
                if (i >= victim->nation->weight *
                (1 + TALENT(ch, TAL_CHANGE) / 100)) {
                        send_to_char("You can't make them that heavy.\n\r", ch);
                        return;
                }
                if (i <= victim->nation->weight -
                victim->nation->weight *
                TALENT(ch, TAL_CHANGE) / 100
                || victim->weight <= 10) {
                        send_to_char("You can't make them that light.\n\r", ch);
                        return;
                }
                victim->weight = i;
                if (victim != ch) {
		if (victim != ch) {
		act(AT_MAGIC, "Your weight changes.",
			ch, NULL, victim, TO_VICT);
		act(AT_MAGIC, "You make $N's weight change.",
			ch, NULL, victim, TO_CHAR);
		} else
		act(AT_MAGIC, "You change your weight.",
			ch, NULL, NULL, TO_CHAR);
		act(AT_MAGIC, "$N's weight changes.",
			ch, NULL, victim, TO_NOTVICT);
		}
	} else if (!str_cmp(arg2, "sex")) {
                if (!str_prefix("f", argument)) victim->sex = SEX_FEMALE;
                else if (!str_prefix("m", argument)) victim->sex = SEX_MALE;
                else if (!str_prefix("n", argument)) victim->sex = SEX_NEUTRAL;
                else if (!str_prefix("h", argument)) victim->sex = SEX_HERMAPH;
                if (victim != ch) {
                act(AT_MAGIC, "You feel something strange change in your crotch.",
                        ch, NULL, victim, TO_VICT);
                act(AT_MAGIC, "You change $N's gender.",
                        ch, NULL, victim, TO_CHAR);
                } else
                act(AT_MAGIC, "You change your own sex.",
                        ch, NULL, NULL, TO_CHAR);
                act(AT_MAGIC, "$N's crotch seems to shift a little.",
                        ch, NULL, victim, TO_NOTVICT);
		    check_bodyparts(victim);
	} else if (victim->pcdata->eyes
	&&        !str_cmp("eyes", arg2)) {
		STRFREE(victim->pcdata->eyes);
		victim->pcdata->eyes = STRALLOC(argument);
		act(AT_MAGIC, "Your eyes itch.", victim, NULL, NULL, TO_CHAR);
		act(AT_MAGIC, "$n's eyes change to $T.", victim, NULL, argument, TO_ROOM);
	} else if (victim->pcdata->hair
	&&        !str_cmp("hair", arg2)) {
		STRFREE(victim->pcdata->hair);
		victim->pcdata->hair = STRALLOC(argument);
		act(AT_MAGIC, "Your hair shimmers for a moment.", victim, NULL, NULL, TO_CHAR);
		act(AT_MAGIC, "$n's hair changes to $T.", victim, NULL, argument, TO_ROOM);
	} else if (victim->pcdata->skin_type
	&&        !str_cmp(victim->pcdata->skin_type, arg2)) {
		STRFREE(victim->pcdata->skin_color);
		victim->pcdata->skin_color = STRALLOC(argument);
		act(AT_MAGIC, "Your $t shimmers for a moment.", victim, victim->pcdata->skin_type, NULL, TO_CHAR);
		act(AT_MAGIC, "$n's $t changes to $T.", victim, victim->pcdata->skin_type, argument, TO_ROOM);
	} else if (victim->pcdata->extra_type
	&&        !str_cmp(victim->pcdata->extra_type, arg2)) {
		STRFREE(victim->pcdata->extra_color);
		victim->pcdata->extra_color = STRALLOC(argument);
		act(AT_MAGIC, "Your $t shimmers for a moment.", victim, victim->pcdata->extra_type, NULL, TO_CHAR);
		act(AT_MAGIC, "$n's $t changes to $T.", victim, victim->pcdata->extra_type, argument, TO_ROOM);
	} else {
		send_to_char("They don't have that.\n\r", ch);
		return;
	}
	use_magic(ch, TAL_CHANGE, 50);
}


/*
 * Check for antimagic.
 */
bool check_antimagic( CHAR_DATA *ch, CHAR_DATA *victim )
{
    if (!victim)
        return FALSE;

    if (ch == victim)
        return FALSE;

    if ( !IS_AWAKE(victim) )
        return FALSE;

    if ( !IS_SET(victim->mood, MOOD_READY))
	return FALSE;

    if ( victim->curr_talent[TAL_VOID] < 10 )
      return FALSE;

    if (victim->mana < 100)
        return FALSE;

    if ( number_range(1,105) >
        (number_range(1, TALENT(victim, TAL_VOID) )))
    {
        return FALSE;
    }

	use_magic(victim, TAL_VOID, 100);

    act( AT_MAGIC, "You cast $n's magic into the Void.",
        ch, NULL, victim, TO_VICT );
    act( AT_MAGIC, "$N channels antimagic, stopping your attack.",
        ch, NULL, victim, TO_CHAR );
    act( AT_MAGIC, "$N channels antimagic, stopping $n's attack.",
        ch, NULL, victim, TO_NOTVICT );

    return TRUE;
}

/*
 * Check for blur.
 */
bool check_blur( CHAR_DATA *ch, CHAR_DATA *victim )
{
    if (!victim)
        return FALSE;

    if (ch == victim)
        return FALSE;

    if ( !IS_AWAKE(victim) )
        return FALSE;

    if ( !IS_SET(victim->mood, MOOD_READY))
	return FALSE;

    if ( victim->curr_talent[TAL_TIME] < 10 )
      return FALSE;

    if (victim->mana < 100)
        return FALSE;

    if ( number_range(1,200) >
        (number_range(1, TALENT(victim, TAL_TIME) - victim->encumberance)))
    {
        return FALSE;
    }

	use_magic(victim, TAL_TIME, 50);

    act( AT_MAGIC, "$n swings at you, but you blur out of the way.",
        ch, NULL, victim, TO_VICT );
    act( AT_MAGIC, "You swing at $N, but $E blurs out of the way.",
        ch, NULL, victim, TO_CHAR );
    act( AT_MAGIC, "$n swings at $N, but $E blurs out of the way.",
        ch, NULL, victim, TO_NOTVICT );

    return TRUE;
}

/*
 * Check for displacement.
 */
bool check_displacement( CHAR_DATA *ch, CHAR_DATA *victim )
{
    if (!victim)
	return FALSE;

    if (ch == victim)
	return FALSE;

    if ( !IS_AWAKE(victim) )
        return FALSE;

    if ( !IS_SET(victim->mood, MOOD_READY))
	return FALSE;

    if ( victim->curr_talent[TAL_ILLUSION] < 10 )
      return FALSE;

    if (victim->mana < 50)
	return FALSE;

    if ( number_range(1,100 + get_curr_per(ch)) >
	(number_range(1, TALENT(victim, TAL_ILLUSION) )))
    {
        return FALSE;
    }

	use_magic(victim, TAL_ILLUSION, 50);

    act( AT_MAGIC, "$n strikes at your displaced image, missing you.",
	ch, NULL, victim, TO_VICT );
    act( AT_MAGIC, "You strike at $N's displaced image, missing $M.",
	ch, NULL, victim, TO_CHAR );
    act( AT_MAGIC, "$n strikes at $N's displaced image, missing $M.",
	ch, NULL, victim, TO_NOTVICT );

    return TRUE;
}

void do_blink(CHAR_DATA *ch, char *argument) {

	if (ch->curr_talent[TAL_MOTION] < 50) {
		check_social(ch, "blink", argument);
		return;
	}

	use_magic(ch, TAL_MOTION, 20);

	act(AT_MAGIC, "You blink a short distance away.",
		ch, NULL, NULL, TO_CHAR);
	act(AT_MAGIC, "$n blinks out of existance.",
		ch, NULL, NULL, TO_ROOM);

	stop_fighting(ch, TRUE);
}

void do_pacify(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;

	if (IS_SILENT(ch)) {
		send_to_char("No sound comes out.\n\r", ch);
		return;
	}

	if (ch->curr_talent[TAL_SPEECH] < 60) {
		send_to_char("They don't seem overly impressed by your singing skills.", ch);
		return;
	}

	victim = find_target(ch, argument, TRUE);
	if (!victim) return;

	use_magic(ch, TAL_SPEECH, 1000 - ch->curr_talent[TAL_SPEECH]*9);

	stop_fighting(ch, FALSE);
	act(AT_SAY, "You hum a tranquil melody to $N.",
		ch, NULL, victim, TO_CHAR);
	act(AT_SAY, "$n hums a tranquil melody to $N.",
		ch, NULL, victim, TO_NOTVICT);
	act(AT_SAY, "$n hums a tranquil melody, and you feel at peace.",
		ch, NULL, victim, TO_VICT);
}

void do_purify(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;

	if (ch->curr_talent[TAL_HEALING] < 100) {
		huh(ch);
		return;
	}

	victim = find_target(ch, argument, FALSE);
	if (!victim) return;

	if (IS_NPC(victim)) {
		send_to_char("You cannot purify them!\n\r", ch);
		return;
	}

    if (victim != ch) {
	act(AT_WHITE, "You completely purify $N!", ch, NULL, victim, TO_CHAR);
	act(AT_WHITE, "A white aura surrounds $N as $n purifies $M.", ch, NULL, victim, TO_NOTVICT);
	act(AT_WHITE, "Your blood is cleansed and you feel purified.", ch, NULL, victim, TO_VICT);
    } else {
	act(AT_WHITE, "You completely purify yourself.", ch, NULL, NULL, TO_CHAR);
	act(AT_WHITE, "A white aura surrounds $n as $e purifies $mself.", ch, NULL, NULL, TO_ROOM);
    }
	victim->pcdata->condition[COND_FULL] = 10;
	victim->pcdata->condition[COND_THIRST] = 10;
	victim->pcdata->condition[COND_DRUNK] = 0;
    if ( is_affected( victim, gsn_poison ) )
        affect_strip( victim, gsn_poison );
    if ( is_affected( victim, gsn_corruption ) )
        affect_strip( victim, gsn_corruption );
    if ( is_affected( victim, gsn_curse ) )
        affect_strip( victim, gsn_curse );
    if ( is_affected( victim, gsn_blindness ) )
        affect_strip( victim, gsn_blindness );
    if ( is_affected( victim, gsn_weaken ) )
        affect_strip( victim, gsn_weaken );
    if ( is_affected( victim, gsn_disease ) )
        affect_strip( victim, gsn_disease );
    if ( is_affected( victim, gsn_mummy_rot ) )
        affect_strip( victim, gsn_mummy_rot );
	REMOVE_BIT(victim->pcdata->flags, PCFLAG_VAMPIRE);
}

void do_cure(CHAR_DATA *ch, char *argument) {
	CHAR_DATA *victim;
	char arg[MAX_STRING_LENGTH];

	if (!argument || argument[0] == '\0') {
		send_to_char("Cure whom of what?\n\r", ch);
		return;
	}

        argument = one_argument(argument, arg);

	victim = find_target(ch, argument, FALSE);
	if (!victim) return;

	if (!str_cmp(arg, "poison")
	&& ch->curr_talent[TAL_HEALING] >= 15) {
    if ( is_affected( victim, gsn_poison ) )
    {
        affect_strip( victim, gsn_poison );
        set_char_color( AT_MAGIC, victim);
        send_to_char( "A warm feeling runs through your body.\n\r", victim);
        victim->mental_state = URANGE( -100, victim->mental_state, -10 );
        if ( ch != victim )
        {
          act( AT_MAGIC, "A flush of health washes over $N.", ch, NULL, victim, TO_NOTVICT);
          act( AT_MAGIC, "You lift the poison from $N's body.", ch, NULL, victim, TO_CHAR);
        }
    }
    else
    {
        set_char_color( AT_MAGIC, ch );
        if ( ch != victim )
          send_to_char( "You work your cure, but it has no apparent effect.\n\r", ch);
        else
          send_to_char( "You don't seem to be poisoned.\n\r", ch );
    }

      } else if (!str_cmp(arg, "rot")
        && (ch->curr_talent[TAL_HEALING] >= 60)) {
    if ( !is_affected( victim, gsn_mummy_rot ) )
    {
        if ( ch != victim )
          send_to_char( "They don't seem to be rotting.\n\r", ch);
        else
          send_to_char( "You don't seem to be rotting.\n\r", ch );
        return;
    }
    affect_strip( victim, gsn_mummy_rot );
    set_char_color( AT_MAGIC, victim);
    send_to_char("Your flesh stops rotting.\n\r", victim );
    if ( ch != victim )
        send_to_char( "You restore the rotten flesh to normal.\n\r", ch );

      } else if (!str_cmp(arg, "plague")
        && (ch->curr_talent[TAL_HEALING] >= 75)) {
    if ( !is_affected( victim, gsn_disease ) )
    {
        if ( ch != victim )
   

Showing the first 100 KB of 193.0 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571