DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T b

⟦7e35a20e6⟧ TextFile

    Length: 6866 (0x1ad2)
    Types: TextFile
    Names: »blood.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Abermud/blood.c« 

TextFile

/*
**  The combat system, This is one piece of code where mobile player
**  differences still show up a lot.
**  in_fight and pfighting should be player properties for quick reference
*/
#include "kernel.h"
#ifdef	RCSID
static char RCS[] =
	"$Header: blood.c,v 1.1 89/03/13 09:35:34 rsalz Exp $";
#endif	/* RCSID */



/*
**  Calculate damage done by an item
*/
int 
dambyitem(it)
    int it;
{
    if (it == -1)
	return 8;
    return !otstbit(it, 15) ? -1 : obyte(it, 0) + 8;
}


/*
**  Command function block to handle wielding of weapons.  On full
**  database version of system, you should use a parameter for the
**  item to wield
*/
weapcom()
{
    int a;

    if ((a = ob1) == -1)
	bprintf("Whats a %s?\n", item1);
    else if (dambyitem(a) < 0) {
	bprintf("Thats not a weapon\n");
	setpwpn(mynum, -1);
	error();
    }
    else
	setpwpn(mynum, a);
}


/*
**  Routine to hit a player, not just the kill command - lower level
 */
hitplayer(victim, wpn)
    int victim, wpn;
{
    int x[4];
    int cth, ddn, res;
    char ms[80];

    /* Catch case of victim being ex'd or quiting etc */
    if (EMPTY(pname(victim)))
	return;
    /* Bloody special cases, they get everywhere! */
    if (plev(mynum) < 11 && EQ(pname(victim), "Chicken") && !psex(victim)) {
	bprintf("As you look up you see the sky is somehow different\n");
	bprintf("The next second you're crushed to death as the sky hits you\n");
	sprintf(ms, "You see %s squashed as they attack Chicken Licken\n",
		pname(mynum));
	sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms);
	loseme();
	crapup("Chicken Licken was right\n");
    }
    if (testpeace())
	return;
    if (!iscarrby(wpn, mynum) && wpn != -1) {
	bprintf("You belatedly realise you dont have the %s,\nand are forced to use your hands instead..\n", oname(wpn));
	if (pwpn(mynum) == wpn)
	    setpwpn(mynum, -1);
	wpn = -1;
    }
    setpwpn(mynum, wpn);
    if (wpn == 32 && iscarrby(16, victim)) {
	bprintf("The runesword flashes back away from its target, growling in anger!\n");
	return;
    }
    if (dambyitem(wpn) < 0) {
	bprintf("That's no good as a weapon\n");
	setpwpn(mynum, -1);
	error();
	return;
    }
    if (in_fight) {
	bprintf("You are already fighting!\n");
	error();
	return;
    }
    fighting = victim;
    setpfighting(mynum, victim);
    in_fight = 300;
    res = randperc();
    /* Shields still hard wired - needs changing to armour table */
    cth = 57;
    if (iswornby(89, victim) || iswornby(113, victim) || iswornby(114, victim))
	cth -= 10;
    if (cth < 0)
	cth = 0;
    if (cth > res) {
	bprintf("You hit \001p%s\001 ", pname(victim));
	if (wpn != -1)
	    bprintf("with the %s", oname(wpn));
	bprintf("\n");
	ddn = randperc() % (1 + dambyitem(wpn));
	x[0] = mynum;
	x[1] = ddn;
	x[2] = wpn;
	if (pstr(victim) - ddn < 0) {
	    bprintf("Your last blow did the trick\n");
	    if (pstr(victim) >= 0) {
		/* Bonus ? */
		if (victim < 16)
		    setpscore(mynum,
	  pscore(mynum) + (plev(victim) * plev(victim) * plev(victim) * 10));
		else
		    setpscore(mynum, pscore(mynum) + 10 * damof(victim));
	    }
	    setpstr(victim, -1);	/* MARK ALREADY DEAD */
	    in_fight = 0;
	    fighting = -1;
	    setpfighting(mynum, -1);
	}
	sendsys(pname(victim), pname(mynum), -10021, ploc(mynum), (char *) x);
	if (victim > 15)
	    woundmn(victim, ddn);
	setpscore(mynum, pscore(mynum) + ddn * 2);
	calibme();
	return;
    }
    bprintf("You missed \001p%s\001\n", pname(victim));
    x[0] = mynum;
    x[1] = -1;
    x[2] = wpn;
    sendsys(pname(victim), pname(mynum), -10021, ploc(mynum), (char *) x);
    if (victim > 15)
	woundmn(victim, 0);
}


/*
**  The killing and hitting command
*/
killcom()
{
    if (pl1 == -1 && ob1 == -1) {
	bprintf("Kill who\n");
	error();
	return;
    }
    if (EQ(item1, "door")) {
	if (EQ(pname(mynum), "Moog"))
	    wreckdoor();
	else {
	    printf("Who do you think you are , Moog ?\n");
	    error();
	}
	return;
    }

    if (ob1 != -1) {
	breakitem(ob1);
	return;
    }
    if (pl1 == -1) {
	bprintf("You can't do that\n");
	error();
	return;
    }
    if (pl1 == mynum) {
	bprintf("Come on, it will look better tomorrow...\n");
	error();
	return;
    }
    if (ploc(pl1) != ploc(mynum)) {
	bprintf("They aren't here\n");
	error();
	return;
    }
    if (shimge[0]) {
	bprintf("Sorry its too peaceful for violence!\n");
	error();
	return;
    }
    if (ptstflg(pl1, 12)) {
	bprintf("Not them..\n");
	error();
	return;
    }

    if (ob2 == -1) {
	hitplayer(pl1, pwpn(mynum));
	return;
    }
    hitplayer(pl1, ob2);
}


/*
**  Receive a combat event
*/
bloodrcv(array, isme)
    int *array;
    int isme;
{
    char ms[128];

    if (!isme)
	return;				/* Hit views handled elsewhere */
    if (array[0] < 0)
	return;				/* Silly value dump */
    if (EMPTY(pname(array[0])))
	return;				/* Enemy has beem ex'd */
    fighting = array[0];
    setpfighting(mynum, array[0]);
    in_fight = 300;
    if (ploc(mynum) != ploc(array[0]))
	return;
    if (array[1] == -1) {
	bprintf("\001p%s\001 attacks you", pname(array[0]));
	if (array[2] != -1)
	    bprintf(" with the %s", oname(array[2]));
	bprintf("\n");
    }
    else {
	bprintf("You are wounded by \001p%s\001", pname(array[0]));
	if (array[2] > -1)
	    bprintf(" with the %s", oname(array[2]));
	bprintf("\n");
	if (plev(mynum) < 10) {
	    setpstr(mynum, pstr(mynum) - array[1]);
	    if (array[0] == 16) {
		setpscore(mynum, pscore(mynum) - 100 * array[1]);
		bprintf("You feel weaker, as the wraiths icy touch seems to drain your very life force\n");
		if (pscore(mynum) < 0)
		    setpstr(mynum, -1);
	    }
	}
	if (pstr(mynum) < 0) {
	    mudlog("%s slain by %s", pname(mynum), pname(array[0]));
	    dumpitems();
	    closeworld();
	    delpers(pname(mynum));
	    openworld();
	    sprintf(ms, "\001p%s\001 has just died.\n", pname(mynum));
	    sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms);
	    sprintf(ms, "[ \001p%s\001 has been slain by \001p%s\001 ]\n", pname(mynum), pname(array[0]));
	    sendsys(pname(mynum), pname(mynum), -10113, ploc(mynum), ms);
	    loseme();
	    crapup("Oh dear... you seem to be slightly dead\n");
	}
	me_cal = 1;			/* Queue an update when ready */
    }
}


breakitem(x)
{
    switch (x) {
    default:
	bprintf("You can't do that\n");
	break;
    case 171:
	sys_reset();
	break;
    case 93:
	bprintf("You smash it apart to reveal a gem inside\n");
	oclrbit(94, 0);
	setoloc(94, oloc(93), ocarrf(93));
	destroy(93);
	break;
    case -1:
	bprintf("What is that ?\n");
	break;
    }
}


wreckdoor()
{
    int a;

    if ((a = fobna("door")) == -1)
	bprintf("Sos Moogie, no doors here!\n");
    else if (state(a) == 0)
	bprintf("Its already open.\n");
    else {
	setobjstate(a, 0);
	bprintf("The door flies open!\n");
	broad(
	"\001dYou hear the distinctive crunch of Moog meeting door\n\001");
    }
}


testpeace()
{
    return shimge[0] ? 1 : 0;
}