Potion Code

From: Franco (awe@mt.arias.net)
Date: 07/23/96


        Ok, due to overwhelming responses, I'm posting the mix code here.
However, if I see this anywhere else, with someone elses name on it, I
will personally hunt your punk ass down and kick it real hard. Just give
me credit.

make sure whatever file you put this in, it contains this:

extern char *spells[];

Now, what you've all been waiting for....

void make_potion(struct char_data *ch, int potion, struct obj_data *container)
{
	struct obj_data *final_potion;
	int can_make = FALSE, mana, dam;

        /* Modify this list to suit which spells you
           want to be able to mix. */
	switch (potion) {
	case SPELL_SHIELD:
	case SPELL_CURE_BLIND:
	case SPELL_CURE_LIGHT:
	case SPELL_CURE_CRITIC:
	case SPELL_DETECT_MAGIC:
	case SPELL_DETECT_INVIS:
	case SPELL_DETECT_POISON:
	case SPELL_REMOVE_POISON:
	case SPELL_REMOVE_CURSE:
	case SPELL_STRENGTH:
	case SPELL_WORD_OF_RECALL:
	case SPELL_SENSE_LIFE:
	case SPELL_WATERWALK:
	case SPELL_FLY:
	case SPELL_HASTE:
	case SPELL_INFRAVISION:
	case SPELL_ENLARGE:
	case SPELL_REGENERATION:
	case SPELL_HEAL:
		can_make = TRUE;
		break;
	default:
		break;
	}
	if (can_make == FALSE) {
		send_to_char("You that spell cannot be mixed into a potion.\r\n", ch);
		return;
	}
	else if (number(1, 3) == 3) {
		send_to_char("As you begin mixing the potion, it violently explodes!\r\n",
ch);
		act("$n begins to mix a potion, and it suddenly explodes!", FALSE, ch, 0,
0, TO_ROOM);
		extract_obj(container);
		dam = number(5, 50);
		GET_HIT(ch) -= dam;
		update_pos(ch);
		return;
	}
        /* requires x3 mana to mix a potion than the spell */
	mana = mag_manacost(ch, potion) * 3;

	if (GET_MANA(ch) - mana > 0) {
		GET_MANA(ch) -= mana;
		sprintf(buf, "You create a potion labeled '%s'.\r\n", spells[potion]);
		send_to_char(buf, ch);
		act("$n creates a potion!", FALSE, ch, 0, 0, TO_ROOM);
		extract_obj(container);
	}
	else {
		send_to_char("You don't have enough mana for mixing that potion!\r\n", ch);
		return;
	}
	
	final_potion = create_obj();

    final_potion->item_number = NOTHING;
	final_potion->in_room = NOWHERE;
	final_potion->name = str_dup("potion");

	sprintf(buf2, "A potion labeled '%s' lies here.", spells[potion]);
	final_potion->description = str_dup(buf2);

	sprintf(buf2, "A potion labeled '%s'", spells[potion]);
        final_potion->short_description = str_dup(buf2);

	GET_OBJ_TYPE(final_potion) = ITEM_POTION;
	GET_OBJ_WEAR(final_potion) = ITEM_WEAR_TAKE;
	GET_OBJ_EXTRA(final_potion) = ITEM_NORENT;
	GET_OBJ_VAL(final_potion, 0) = GET_LEVEL(ch);
	GET_OBJ_VAL(final_potion, 1) = potion;
	GET_OBJ_VAL(final_potion, 2) = -1;
	GET_OBJ_VAL(final_potion, 3) = -1;
	GET_OBJ_WEIGHT(final_potion) = 1;
	GET_OBJ_RENT(final_potion) = 0;
	
	obj_to_char(final_potion, ch);
}

ACMD(do_brew)
{
	struct obj_data *container;
	struct obj_data *obj, *next_obj;
	char bottle_name[MAX_STRING_LENGTH];
	char spell_name[MAX_STRING_LENGTH];
	int potion, found = FALSE;

	two_arguments(argument, bottle_name, spell_name);

	if ((GET_CLASS(ch) == CLASS_WARRIOR || GET_CLASS(ch) == CLASS_THIEF) &&
GET_LEVEL(ch) < LVL_IMMORT) {
		send_to_char("You have no idea how to mix potions!\r\n", ch);
		return;
	}
	if (!*bottle_name || !*spell_name) {
		send_to_char("What do you wish to mix in where?\r\n", ch);
		return;
	}

	for (obj = ch->carrying; obj; obj = next_obj) {
		next_obj = obj->next_content;
		if (obj == NULL)
			return;
		else if (!(container = get_obj_in_list_vis(ch, bottle_name, ch->carrying))) 
			continue;
		else
			found = TRUE;
	}
	if (found != FALSE && (GET_OBJ_TYPE(container) != ITEM_CONTAINER &&
		GET_OBJ_TYPE(container) != ITEM_DRINKCON)) {
		send_to_char("That item is not a container!\r\n", ch);
		return;
	}
	if (found == FALSE) {
		sprintf(buf, "You don't have %s in your inventory!\r\n", bottle_name);
		send_to_char(buf, ch);
		return;
	}

	potion = find_skill_num(spell_name);	

	if ((potion < 1) || (potion > MAX_SPELLS)) {
		send_to_char("Mix what spell?!?\r\n", ch);
		return;
	}
	if (GET_LEVEL(ch) < spell_info[potion].min_level[(int) GET_CLASS(ch)]) {
		 send_to_char("You do not know how to make that potion!\r\n", ch);
		return;
	}
	if (GET_SKILL(ch, potion) == 0) {
		 send_to_char("You are unfamiliar potion.\r\n", ch);
		return;
	}

	make_potion(ch, potion, container);
}


From goamkows@kirk.geog.sc.edu Tue, 23 Jul 96 8:52:48 EDT
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 2831 (database)
From: goamkows <goamkows@kirk.geog.sc.edu>
To: circle <circle@pvv.ntnu.no>
Subject: Re: CODE: Races, Clans, Classes, Tribes, languages and a drunkspeech
Date: Tue, 23 Jul 96 08:52:00
Message-ID: <CMM.0.90.0.838126368.goamkows@janeway.geog.sc.edu>
Reply-To: goamkows@kirk.geog.sc.edu (goamkows)
X-POP3-Rcpt: lk4150@per
Return-Path: owner-circle@pvv.ntnu.no
Received: from flipper.pvv.ntnu.no (43@flipper.pvv.ntnu.no [129.241.210.200]) by per.cybercity.dk (8.6.12/8.6.12) with ESMTP id OAA15194 for <lk4150@krull.dk>; Tue, 23 Jul 1996 14:53:19 +0200
Received: (from majordomo@localhost) by flipper.pvv.ntnu.no (8.7.5/8.6.12) id OAA24064 for circle-outgoing; Tue, 23 Jul 1996 14:48:40 +0200
Received: from otis.cla.sc.edu (otis.cla.sc.edu [129.252.1.2]) by flipper.pvv.ntnu.no (8.7.5/8.6.12) with SMTP id OAA24058 for <circle@pvv.ntnu.no>; Tue, 23 Jul 1996 14:48:17 +0200
Received: from kirk.geog.sc.edu by otis.cla.sc.edu (4.1/SMI-4.1)id AA04610; Tue, 23 Jul 96 08:48:11 EDT
Received: from janeway.geog.sc.edu by kirk.geog.sc.edu (4.1/SMI-4.1)id AA29089; Tue, 23 Jul 96 07:43:20 EDT
Sender: owner-circle@pvv.ntnu.no
Precedence: bulk

:P > This is madness.  I think the best method of implementing languages is to
:P > keep them scrambled... if you've got a decent learn by use system going
:P > all that learn insanity will be taken care of automatically, and people 
:P > will generally understand more based upon their SKILL in the language...
:P > ie. it is scrambled 100 - SKILL percent.  The problem with making words
:P > recognizable is that a good chunk of mudders are also coders, and writing
:P > a small program or even a tintin script to decode languages based upon
:P > known words would be fairly simple... then the person passes that little
:P > tidbit to all his friends, it gets put up on an ftp site or web page, and
:P > everyone is seeing foriegn laguages in clear text... back to square one.

well, go to the library, get yourself a book on the german engima
machines and set up a similar procedure :)
it took a team of the best mathematicians in the world to figure it
out, so i think it should stop the average mudder from being able to
decode languages ;)  

<g>
 


From goamkows@kirk.geog.sc.edu Tue, 23 Jul 96 9:09:11 EDT
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 2832 (database)
From: goamkows <goamkows@kirk.geog.sc.edu>
To: circle <circle@pvv.ntnu.no>
Subject: problems adding in new files
Date: Tue, 23 Jul 96 09:09:00
Message-ID: <CMM.0.90.0.838127351.goamkows@janeway.geog.sc.edu>
Reply-To: goamkows@kirk.geog.sc.edu (goamkows)
X-POP3-Rcpt: lk4150@per
Return-Path: owner-circle@pvv.ntnu.no
Received: from flipper.pvv.ntnu.no (43@flipper.pvv.ntnu.no [129.241.210.200]) by per.cybercity.dk (8.6.12/8.6.12) with ESMTP id PAA15260 for <lk4150@krull.dk>; Tue, 23 Jul 1996 15:12:20 +0200
Received: (from majordomo@localhost) by flipper.pvv.ntnu.no (8.7.5/8.6.12) id PAA24225 for circle-outgoing; Tue, 23 Jul 1996 15:05:00 +0200
Received: from otis.cla.sc.edu (otis.cla.sc.edu [129.252.1.2]) by flipper.pvv.ntnu.no (8.7.5/8.6.12) with SMTP id PAA24213 for <circle@pvv.ntnu.no>; Tue, 23 Jul 1996 15:04:36 +0200
Received: from kirk.geog.sc.edu by otis.cla.sc.edu (4.1/SMI-4.1)id AA04806; Tue, 23 Jul 96 09:04:34 EDT
Received: from janeway.geog.sc.edu by kirk.geog.sc.edu (4.1/SMI-4.1)id AA29102; Tue, 23 Jul 96 07:59:42 EDT
Sender: owner-circle@pvv.ntnu.no
Precedence: bulk

with almost everything that adds in new files (event.c, extras.c,
alias.c, et.al.), whenever i add them, when i try to compile it gives
my 'conflicting definitions for qsort' or something to that effect.

only eric's ident files have worked without problem :)

i've tried moving the #includes for conf.h and sysdep.h to every
feasible location before, after and inbetween all the other includes,
as well as trying several other things, but nothing seems to work :(

anybody have any idea how to get around this?



This archive was generated by hypermail 2b30 : 12/07/00 PST