magic.c,v
./abermud/RCS/magic.c,v · 5.4 KB
From the archive abermud-89.tar.gz
Download the archive « Back to the archive contents
head 1.2;
access ;
symbols ;
locks ; strict;
comment @ * @;
1.2
date 89.07.03.08.17.56; author rsalz; state Exp;
branches ;
next 1.1;
1.1
date 89.03.13.09.36.47; author rsalz; state Exp;
branches ;
next ;
desc
@@
1.2
log
@Incorporate many fixes by Jussi <eloranta@@tukki.jyu.fi>,
and some minor tweaks by Rich.
@
text
@/*
**
*/
#include "kernel.h"
#ifdef RCSID
static char RCS[] =
"$Header: magic.c,v 1.1 89/03/13 09:36:47 rsalz Exp $";
#endif /* RCSID */
randperc()
{
return (rand() >> 3) % 100;
}
sumcom()
{
sumb(1);
}
transcom()
{
if (plev(mynum) < 11)
bprintf("You practise your transcendental meditation\n");
else
sumb(0);
}
sumb(n)
int n;
{
int a;
char seg[128];
char ms[128];
int c, d, x;
if (EMPTY(item1)) {
bprintf("Summon who ?\n");
return;
}
if ((a = fobn(item1)) != -1) {
if (plev(mynum) < 10) {
bprintf("You can only summon people\n");
return;
}
x = oloc(a);
if (ocarrf(a) > 0)
x = ploc(x);
sprintf(ms, "\001p%s\001 has summoned the %s\n",
pname(mynum), oname(a));
sendsys(pname(mynum), pname(mynum), -10000, x, ms);
bprintf("The %s flies into your hand\nIt was :", oname(a));
desrm(oloc(a), ocarrf(a));
setoloc(a, mynum, 1);
return;
}
if ((a = pl1) == -1) {
bprintf("I dont know who that is\n");
return;
}
if (plev(mynum) <= 9) {
if (pstr(mynum) < 10) {
bprintf("You are too weak\n");
return;
}
if (plev(mynum) < 10)
setpstr(mynum, pstr(mynum) - 2);
c = plev(mynum) * 2;
if (plev(mynum) > 9)
c = 101;
if (iscarrby(111, mynum))
c += plev(mynum);
if (iscarrby(121, mynum))
c += plev(mynum);
if (iscarrby(163, mynum))
c += plev(mynum);
d = randperc();
if (ploc(mynum) == -1067) {
bprintf("It is too small in here!\n");
return;
}
if (ploc(mynum) >= -999 && ploc(mynum) <= -900) {
bprintf("The boat is rolling too much.\n");
return;
}
if (iswornby(90, a) || c < d) {
bprintf("The spell fails....\n");
return;
}
if (a == fpbns("hermit") || a == fpbns("wraith") || (iscarrby(32,a)
|| iscarrby(159,a) || iscarrby(174,a) || ploc(a) == -8)) {
bprintf("Something stops your summoning from succeeding\n");
return;
}
if (a == mynum) {
bprintf("Seems a waste of effort to me....\n");
return;
}
if (ploc(mynum) >= -1082 && ploc(mynum) <= -1076) {
bprintf("Something about this place makes you fumble the magic\n");
return;
}
}
bprintf("You cast the summoning......\n");
if (a < 16) {
sendsys(pname(a), pname(mynum), -10020, ploc(mynum), n ? "1" : "0");
return;
}
if (n)
on_flee_mob(a);
sprintf(seg, "\001s%s\001%s has arrived\n\001", pname(a), pname(a));
sendsys("", "", -10000, ploc(mynum), seg);
setploc(a, ploc(mynum));
if (plev(mynum) < 10)
/* Monster regards summoning as a hostile action */
woundmn(a, 0);
return;
}
goloccom()
{
char n1[128];
char bf[128];
int a;
if (plev(mynum) < 10) {
bprintf("huh ?\n");
return;
}
if (brkword() == -1) {
bprintf("Go where ?\n");
return;
}
strcpy(n1, wordbuf);
if (brkword() == -1)
strcpy(wordbuf, "");
if ((a = roomnum(n1, wordbuf)) >= 0 || !exists(a)) {
bprintf("Unknown Room\n");
return;
}
sprintf(bf, "\001s%%s\001%%s %s\n\001", mout_ms);
sillycom(bf);
setploc(mynum, a);
trapch(a);
sprintf(bf, "\001s%%s\001%%s %s\n\001", min_ms);
sillycom(bf);
}
wizcom()
{
char bf[128];
if (plev(mynum) < 10) {
bprintf("Such advanced conversation is beyond you\n");
return;
}
getreinput(wordbuf);
sprintf(bf, "\001p%s\001 : %s\n", pname(mynum), wordbuf);
sendsys(pname(mynum), pname(mynum), -10113, ploc(mynum), bf);
rd_qd = 1;
}
viscom()
{
int ar[4];
if (plev(mynum) < 10) {
bprintf("You can't just do that sort of thing at will you know.\n");
return;
}
if (!pvis(mynum)) {
bprintf("You already are visible\n");
return;
}
setpvis(mynum, 0);
ar[0] = mynum;
ar[1] = pvis(mynum);
sendsys("", "", -9900, 0, (char *)ar);
bprintf("Ok\n");
pclrflg(mynum, 9);
sillycom("\001s%s\001%s suddenly appears in a puff of smoke\n\001");
}
inviscom()
{
int x;
int ar[4];
if (plev(mynum) < 10) {
bprintf("You can't just turn invisible like that!\n");
return;
}
x = plev(mynum) > 9999 ? 10000 : 10;
x = 10000;
if (op(pname(mynum)) && brkword() != -1)
x = atoi(wordbuf);
if (EQ(pname(mynum), "Wraistlyn") && brkword() != -1)
x = atoi(wordbuf);
if (pvis(mynum) == x) {
bprintf("You are already invisible\n");
return;
}
setpvis(mynum, x);
ar[0] = mynum;
ar[1] = pvis(mynum);
sendsys("", "", -9900, 0, (char *)ar);
bprintf("Ok\n");
psetflg(mynum, 9);
sillycom("\001c%s vanishes!\n\001");
}
ressurcom()
{
char bf[80];
int a;
if (plev(mynum) < 10) {
bprintf("Huh ?\n");
return;
}
if (EMPTY(item1)) {
bprintf("Yes but what ?\n");
return;
}
if ((a = fobn(item1)) == -1) {
bprintf("You can only ressurect objects\n");
return;
}
if (ospare(a) != -1) {
bprintf("That already exists\n");
return;
}
oclrbit(a, 0);
setoloc(a, ploc(mynum), 0);
sprintf(bf, "The %s suddenly appears\n", oname(a));
sendsys("", "", -10000, ploc(mynum), bf);
}
@
1.1
log
@Initial revision
@
text
@d1 4
a5 1
#ifdef RCSID
d7 1
a7 1
"$Header$";
d55 1
d217 1
a217 1
char bf[32];
d228 1
a228 1
if ((a = ob1) == -1) {
@