|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 6549 (0x1995)
Types: TextFile
Names: »mobile.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Abermud/mobile.c«
/*
** Timing event stuff
*/
#include "kernel.h"
#ifdef RCSID
static char RCS[] =
"$Header: mobile.c,v 1.1 89/03/13 09:36:54 rsalz Exp $";
#endif /* RCSID */
static char *exnam[6] = {
"north", "east", "south", "west", "up", "down"
};
on_timing()
{
int ct;
for (ct = 16; ct < 64; ct++) {
if (!ptstflg(ct, 14) && pstr(ct) > 0)
consid_move(ct); /* Maybe move it */
}
if (randperc() < 20)
onlook();
}
/*
** Look and timing fight controller
*/
onlook()
{
chkfight(fpbns("shazareth"));
if (!iscarrby(45, mynum))
chkfight(fpbns("wraith"));
chkfight(fpbns("bomber"));
chkfight(fpbns("lavaman"));
chkfight(fpbns("guard"));
chkfight(fpbns("efreet"));
chkfight(fpbns("djinni"));
chkfight(fpbns("owin"));
chkfight(fpbns("glowin"));
chkfight(fpbns("smythe"));
chkfight(fpbns("dio"));
if (!iscarrby(45, mynum))
chkfight(fpbns("zombie"));
chkfight(fpbns("rat"));
chkfight(fpbns("ghoul"));
chkfight(fpbns("ogre"));
chkfight(fpbns("riatha"));
chkfight(fpbns("yeti"));
chkfight(fpbns("guardian"));
chkfight(fpbns("elf"));
chkfight(fpbns("minotaur"));
chkfight(fpbns("wolf"));
chkfight(fpbns("beast"));
chkfight(fpbns("flame"));
if (iscarrby(32, mynum))
dorune();
if (phelping(mynum) != -1)
helpchkr();
}
chkfight(x)
int x;
{
if (ptstflg(x, 14) || x < 0 || EMPTY(pname(x))
|| ploc(x) != ploc(mynum) || pstr(x) < 0 || pvis(mynum))
return;
if (x == fpbns("Wolf") || x == fpbns("Beast") || x == fpbns("Shazareth"))
;
else if (randperc() > 30)
return;
if (shimge[0] || ptstflg(mynum, 12))
return;
if (x == fpbns("yeti") && ohany((1 << 13))) {
bprintf("\001syeti\001The yeti seems disturbed by naked flame, and keeps its distance\n\001");
return;
}
if (pfighting(x) == -1)
woundmn(x, 0);
}
consid_move(x)
int x;
{
int ct;
if (EMPTY(pname(x)) || randperc() > 10 / tscale())
return;
for (ct = 0; ct < 64; ct++)
if (pfighting(ct) == x)
return;
if (fpbns("shazareth") == x || fpbns("wraith") == x
|| fpbns("figure") == x || fpbns("dragon") == x
|| fpbns("golem") == x || fpbns("beast") == x)
return;
if (fpbns("minotaur") == x && randperc() < 50)
shiftstuff(x);
else
movemob(x);
if (fpbns("chicken") == x && randperc() < 20)
sendsys("Chicken Licken", "Chicken Licken", -10003,
ploc(x), "The sky is about to fall in");
}
crashcom()
{
if (plev(mynum) < 10) {
bprintf("Hmmm....\n");
bprintf("I expect it will sometime\n");
return;
}
bprintf("Bye Bye Cruel World...\n");
sendsys("", "", -666, 0, "");
rescom();
}
singcom()
{
if (!chkdumb()) {
sillycom("\001P%s\001\001d sings in Gaelic\n\001");
bprintf("You sing\n");
}
}
spraycom()
{
int a;
if (vichere(&a) == -1)
return;
if (brkword() == -1) {
bprintf("With what ?\n");
return;
}
if (EQ(wordbuf, "with")) {
if (brkword() == -1) {
bprintf("With what ?\n");
return;
}
}
if (fobna(wordbuf) == -1) {
bprintf("With what ?\n");
return;
}
bprintf("You can't do that\n");
}
dircom()
{
int a;
char b[40];
char d[40];
int c;
if (plev(mynum) < 10) {
bprintf("That's a wiz command\n");
return;
}
for (a = 0; a < numobs; a++) {
c = findzone(oloc(a), b);
sprintf(d, "%s%d", b, c);
if (ocarrf(a))
strcpy(d, "CARRIED");
if (ocarrf(a) == 3)
strcpy(d, "IN ITEM");
bprintf("%-13s%-13s", oname(a), d);
if (a % 3 == 2)
bprintf("\n");
if (a % 18 == 17)
pbfr();
}
bprintf("\n");
}
sys_reset()
{
FILE *fl;
int i;
time_t t;
long u;
if (tscale() != 1) {
bprintf("There are other people on.... So it wont work!\n");
return;
}
time(&t);
if (fl = openlock(RESET_N, "r")) {
fscanf(fl, "%ld", &u);
closelock(fl);
if (u < t && t < u + 3600) {
bprintf("Sorry at least an hour must pass between resets\n");
return;
}
}
i = plev(mynum);
setplev(mynum, 10);
rescom();
setplev(mynum, i);
}
dorune()
{
int ct;
if (in_fight)
return;
for (ct = 0; ct < 32; ct++) {
if (ct == mynum || EMPTY(pname(ct)) || plev(ct) > 9)
continue;
if (ploc(ct) == ploc(mynum))
break;
}
if (ct == 32)
return;
if (randperc() < 9 * plev(mynum) || fpbns(pname(ct)) == -1)
return;
bprintf("The runesword twists in your hands lashing out savagely\n");
hitplayer(ct, 32);
}
dragget()
{
int l;
if (plev(mynum) > 9 || (l = fpbns("dragon")) == -1
|| ploc(l) != ploc(mynum))
return 0;
bprintf("The dragon makes it quite clear that he doesnt want his treasure borrowed\n");
return 1;
}
helpchkr()
{
int x;
if (!i_setup)
return;
x = phelping(mynum);
if (EMPTY(pname(x)) || ploc(x) != ploc(mynum)) {
bprintf("You can no longer help \001c%s\001\n", pname(x));
setphelping(mynum, -1);
}
}
said_eight()
{
if (ploc(mynum) != oloc(242))
return;
broad("\001dThere is an almighty crack of thunder!\n\001");
if (ail_deaf == 0) {
ail_deaf = 1;
bprintf("There is an almighty crack of thunder!\n");
bprintf("The noise has sent you deaf!\n");
}
}
movemob(x)
int x;
{
int n;
char v[80];
int r;
if (shimge[3])
return;
r = randperc() % 6;
if ((n = getexit(ploc(x), r)) > 9999)
/* MSG FLG ZONE - Unimplemented */
return;
if (n > 999) {
if (state(n - 1000))
return;
n = oloc((n - 1000) ^ 1);
}
/* Those are the things to avoid */
if (n >= 0 || n == -660 || n == -169 || n == -901 || n == -900 || n == -654
|| n == -1124 || n == -600)
return;
sprintf(v, "\001s%s\001%s has gone %s .\n\001",
pname(x), pname(x), exnam[r]);
sendsys(pname(x), pname(x), -10000, ploc(x), v);
setploc(x, n);
sprintf(v, "\001s%s\001%s has arrived.\n\001", pname(x), pname(x));
sendsys(pname(x), pname(x), -10000, ploc(x), v);
}
stopcom()
{
if (plev(mynum) < 10) {
bprintf("I don't know that verb.\n");
return;
}
shimge[3] = 1;
bprintf("Mobiles STOPped\n");
}
startcom()
{
if (plev(mynum) < 10) {
bprintf("I don't know that verb.\n");
return;
}
shimge[3] = 0;
bprintf("Mobiles STARTed\n");
}
shiftstuff(m)
int m;
{
int a;
char x[200];
for (a = 0; a < numobs; a++)
if (ocarrf(a) == 0 && oloc(a) == ploc(m) && !oflannel(a)) {
sprintf(x, "\001sminotaur\001The Minotaur takes the %s.\n\001",
oname(a));
sendsys("minotaur", "minotaur", -10000, ploc(m), x);
setoloc(a, m, 1);
return;
}
}