- [+] 's' = slowwalk(lf, dir). ask which dir if not given and player.
- [+] adds F_SNEAKING - [+] calls trymove - [+] removes F_SNEAKING - [+] effects: - [+] move slowly (2 times normal) - [+] never slip - [+] bonus on stealth check
This commit is contained in:
parent
aaf48355eb
commit
af0d8f244d
13
ai.c
13
ai.c
|
@ -385,7 +385,7 @@ flag_t *aigoto(lifeform_t *lf, cell_t *c, enum MOVEREASON why, void *data, int t
|
||||||
if (lfhasflagval(lf, F_IGNORECELL, c->x, c->y, NA, NULL)) {
|
if (lfhasflagval(lf, F_IGNORECELL, c->x, c->y, NA, NULL)) {
|
||||||
char lfname[BUFLEN];
|
char lfname[BUFLEN];
|
||||||
getlfname(lf, lfname);
|
getlfname(lf, lfname);
|
||||||
dblog(".oO { %s cannot go to targecell %d,%d due to f_ignorecell flag }", lfname, c->x, c->y);
|
if (db) dblog(".oO { %s cannot go to targecell %d,%d due to f_ignorecell flag }", lfname, c->x, c->y);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1492,16 +1492,17 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
|
||||||
flag_t *willflag;
|
flag_t *willflag;
|
||||||
flag_t *srflag;
|
flag_t *srflag;
|
||||||
int srange = 5;
|
int srange = 5;
|
||||||
srflag = lfhasflag(lf, F_SWOOPRANGE);
|
|
||||||
if (srflag) {
|
|
||||||
srange = srflag->val[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
willflag = lfhasflagval(lf, F_CANWILL, ot->id, NA, NA, NULL);
|
willflag = lfhasflagval(lf, F_CANWILL, ot->id, NA, NA, NULL);
|
||||||
if (willflag) {
|
if (willflag) {
|
||||||
texttospellopts(f->text, NULL, NULL, NULL, &srange);
|
texttospellopts(f->text, NULL, NULL, NULL, &srange);
|
||||||
if (!srange) srange = 5;
|
if (!srange) srange = 5;
|
||||||
}
|
}
|
||||||
|
// override...
|
||||||
|
srflag = lfhasflag(lf, F_SWOOPRANGE);
|
||||||
|
if (srflag) {
|
||||||
|
srange = srflag->val[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!haslof(lf->cell, victim->cell, LOF_NEED,NULL)) {
|
if (!haslof(lf->cell, victim->cell, LOF_NEED,NULL)) {
|
||||||
|
@ -1538,7 +1539,7 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!specificcheckok) {
|
if (!specificcheckok) {
|
||||||
dblog(".oO { cant cast %s - specific spell check failed }", ot ? ot->name : "?unkownspell?");
|
if (db) dblog(".oO { cant cast %s - specific spell check failed }", ot ? ot->name : "?unkownspell?");
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
defs.h
1
defs.h
|
@ -1792,6 +1792,7 @@ enum FLAG {
|
||||||
F_HOMELEVOB, // when this monster is auto generated on a level, place
|
F_HOMELEVOB, // when this monster is auto generated on a level, place
|
||||||
// between v0 and v1 objects of type 'text' somewhere on
|
// between v0 and v1 objects of type 'text' somewhere on
|
||||||
// the level.
|
// the level.
|
||||||
|
F_SNEAK, // moving slowly on purpose to avoid slipping.
|
||||||
F_AUTOCMD, // val0 = how many times to repeat this
|
F_AUTOCMD, // val0 = how many times to repeat this
|
||||||
F_LASTCMD, // text[0] = last command performed, v0/1 = x/y of cell, v2=various
|
F_LASTCMD, // text[0] = last command performed, v0/1 = x/y of cell, v2=various
|
||||||
F_CANLEARN, // lf is able to learn skill val0
|
F_CANLEARN, // lf is able to learn skill val0
|
||||||
|
|
17
flag.c
17
flag.c
|
@ -27,6 +27,8 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3,
|
||||||
lifeform_t *lf;
|
lifeform_t *lf;
|
||||||
flag_t *f;
|
flag_t *f;
|
||||||
map_t *redolight = NULL;
|
map_t *redolight = NULL;
|
||||||
|
int redrawscreenatend = B_FALSE;
|
||||||
|
int redrawstatatend = B_FALSE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// identified things mean all new flags are autmaticlaly known.
|
// identified things mean all new flags are autmaticlaly known.
|
||||||
|
@ -170,8 +172,8 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// player flags which cause a redraw
|
// player flags which cause a redraw
|
||||||
if (flagcausesredraw(f->pile->owner, f->id)) needredraw = B_TRUE;
|
if (flagcausesredraw(f->pile->owner, f->id)) redrawscreenatend = B_TRUE;
|
||||||
if (flagcausesstatredraw(f->pile->owner, f->id)) statdirty = B_TRUE;
|
if (flagcausesstatredraw(f->pile->owner, f->id)) redrawstatatend = B_TRUE;
|
||||||
} else if (f->pile->ob) {
|
} else if (f->pile->ob) {
|
||||||
if (announceobflaggain(f->pile->ob, f)) {
|
if (announceobflaggain(f->pile->ob, f)) {
|
||||||
f->known = B_TRUE;
|
f->known = B_TRUE;
|
||||||
|
@ -201,14 +203,17 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gamemode == GM_GAMESTARTED) && (needredraw || statdirty || redolight)) {
|
if ((gamemode == GM_GAMESTARTED) && (redrawscreenatend || redrawstatatend || redolight)) {
|
||||||
if (redolight) {
|
if (redolight) {
|
||||||
dblog("CALCINGLIGHT from flag\n");
|
dblog("CALCINGLIGHT from flag\n");
|
||||||
needredraw = B_TRUE;
|
redrawscreenatend = B_TRUE;
|
||||||
calclight(redolight);
|
calclight(redolight);
|
||||||
precalclos(player);
|
precalclos(player);
|
||||||
}
|
}
|
||||||
dblog("DRAWINGSCREEN from flag\n");
|
dblog("DRAWINGSCREEN from flag\n");
|
||||||
|
|
||||||
|
if (redrawscreenatend) needredraw = B_TRUE;
|
||||||
|
if (redrawstatatend) statdirty = B_TRUE;
|
||||||
drawscreen();
|
drawscreen();
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
|
@ -426,10 +431,6 @@ void killflag(flag_t *f) {
|
||||||
int redostat = B_FALSE;
|
int redostat = B_FALSE;
|
||||||
int redoscreen = B_FALSE;
|
int redoscreen = B_FALSE;
|
||||||
|
|
||||||
if (f->id == F_SIZE) {
|
|
||||||
dblog("xxx");
|
|
||||||
}
|
|
||||||
|
|
||||||
lf = f->pile->owner;
|
lf = f->pile->owner;
|
||||||
|
|
||||||
if (gamemode == GM_GAMESTARTED) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
|
|
8
io.c
8
io.c
|
@ -5064,7 +5064,7 @@ void drawlevelfor(lifeform_t *lf) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbtimestart("drawscreen");
|
//dbtimestart("drawscreen");
|
||||||
map = lf->cell->map;
|
map = lf->cell->map;
|
||||||
|
|
||||||
needredraw = B_FALSE;
|
needredraw = B_FALSE;
|
||||||
|
@ -5114,7 +5114,7 @@ void drawlevelfor(lifeform_t *lf) {
|
||||||
if (db) dblog("ending DRAWLEVEL");
|
if (db) dblog("ending DRAWLEVEL");
|
||||||
|
|
||||||
sprintf(buf, "end. ndrawn was %d",ndrawn);
|
sprintf(buf, "end. ndrawn was %d",ndrawn);
|
||||||
dbtimeend(buf);
|
//dbtimeend(buf);
|
||||||
// move cursor to the player's position and blit
|
// move cursor to the player's position and blit
|
||||||
if (ndrawn) {
|
if (ndrawn) {
|
||||||
drawcursor();
|
drawcursor();
|
||||||
|
@ -5815,6 +5815,7 @@ void handleinput(void) {
|
||||||
case 'n':
|
case 'n':
|
||||||
trymove(player, chartodir(ch), B_TRUE);
|
trymove(player, chartodir(ch), B_TRUE);
|
||||||
break;
|
break;
|
||||||
|
// running
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'J':
|
case 'J':
|
||||||
case 'K':
|
case 'K':
|
||||||
|
@ -5825,6 +5826,9 @@ void handleinput(void) {
|
||||||
case 'N':
|
case 'N':
|
||||||
tryrun(player, chartodir(ch));
|
tryrun(player, chartodir(ch));
|
||||||
break;
|
break;
|
||||||
|
case 's': // slowwalk
|
||||||
|
trysneak(player, D_NONE);
|
||||||
|
break;
|
||||||
case '.': // wait
|
case '.': // wait
|
||||||
addflag(player->flags, F_LASTCMD, NA, NA, NA, temp);
|
addflag(player->flags, F_LASTCMD, NA, NA, NA, temp);
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
|
|
11
lf.c
11
lf.c
|
@ -4207,10 +4207,16 @@ int getmovespeed(lifeform_t *lf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (lfhasflag(lf, F_SNEAK)) {
|
||||||
|
speed *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (speed < 1) speed = 1;
|
if (speed < 1) speed = 1;
|
||||||
|
|
||||||
adjustspeedforwater(lf, &speed);
|
adjustspeedforwater(lf, &speed);
|
||||||
|
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12048,6 +12054,11 @@ int real_skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod, int *r
|
||||||
sumflags(lf->flags, F_ENHANCESEARCH, &bonus, NULL, NULL);
|
sumflags(lf->flags, F_ENHANCESEARCH, &bonus, NULL, NULL);
|
||||||
othermod += bonus;
|
othermod += bonus;
|
||||||
} else if (ct == SC_STEALTH) {
|
} else if (ct == SC_STEALTH) {
|
||||||
|
if (attrib > 0) {
|
||||||
|
if (lfhasflag(lf, F_SNEAK)) {
|
||||||
|
othermod += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isairborne(lf)) {
|
if (isairborne(lf)) {
|
||||||
othermod += 5;
|
othermod += 5;
|
||||||
}
|
}
|
||||||
|
|
25
move.c
25
move.c
|
@ -1179,10 +1179,12 @@ int moveto(lifeform_t *lf, cell_t *newcell, int onpurpose, int dontclearmsg) {
|
||||||
object_t *o,*nexto;
|
object_t *o,*nexto;
|
||||||
object_t *slipob;
|
object_t *slipob;
|
||||||
|
|
||||||
|
if (!lfhasflag(lf, F_SNEAK)) {
|
||||||
slip = getslipperyness(newcell, &slipob);
|
slip = getslipperyness(newcell, &slipob);
|
||||||
if (slip && !skillcheck(lf, SC_SLIP, slip, 0)) {
|
if (slip && !skillcheck(lf, SC_SLIP, slip, 0)) {
|
||||||
slipon(lf, slipob);
|
slipon(lf, slipob);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// activate traps
|
// activate traps
|
||||||
for (o = newcell->obpile->first ; o ; o = nexto ) {
|
for (o = newcell->obpile->first ; o ; o = nexto ) {
|
||||||
|
@ -1476,6 +1478,26 @@ int tryrun(lifeform_t *lf, int dir) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int trysneak(lifeform_t *lf, int dir) {
|
||||||
|
if (dir == D_NONE) {
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
char ques[BUFLEN];
|
||||||
|
char ch;
|
||||||
|
sprintf(ques, "Carefully %s in which direction (- to cancel)", getmoveverb(lf));
|
||||||
|
ch = askchar(ques, "yuhjklbn.-","-", B_FALSE);
|
||||||
|
dir = chartodir(ch);
|
||||||
|
if (dir == D_NONE) return B_TRUE;
|
||||||
|
} else {
|
||||||
|
return B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addflag(lf->flags, F_SNEAK, NA, NA, NA, NULL);
|
||||||
|
trymove(lf, dir, B_TRUE);
|
||||||
|
killflagsofid(lf->flags, F_SNEAK);
|
||||||
|
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// try to pull lifeform towards cell c (or next to it)
|
// try to pull lifeform towards cell c (or next to it)
|
||||||
int pullnextto(lifeform_t *lf, cell_t *c) {
|
int pullnextto(lifeform_t *lf, cell_t *c) {
|
||||||
int dir;
|
int dir;
|
||||||
|
@ -1660,6 +1682,8 @@ int initiatemove(lifeform_t *lf, cell_t *cell, int *didmsg) {
|
||||||
if (!isairborne(lf)) {
|
if (!isairborne(lf)) {
|
||||||
int slip;
|
int slip;
|
||||||
object_t *slipob;
|
object_t *slipob;
|
||||||
|
|
||||||
|
if (!lfhasflag(lf, F_SNEAK)) {
|
||||||
slip = getslipperyness(lf->cell, &slipob);
|
slip = getslipperyness(lf->cell, &slipob);
|
||||||
if (slip && !skillcheck(lf, SC_SLIP, slip, 0)) {
|
if (slip && !skillcheck(lf, SC_SLIP, slip, 0)) {
|
||||||
slipon(lf, slipob);
|
slipon(lf, slipob);
|
||||||
|
@ -1669,6 +1693,7 @@ int initiatemove(lifeform_t *lf, cell_t *cell, int *didmsg) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check for cursed objects in new cell + animals
|
// check for cursed objects in new cell + animals
|
||||||
// do this AFTER checking if we will move, so that
|
// do this AFTER checking if we will move, so that
|
||||||
|
|
1
move.h
1
move.h
|
@ -27,5 +27,6 @@ void swapplaces(lifeform_t *lf1, lifeform_t *lf2, int onpurpose);
|
||||||
int teleportto(lifeform_t *lf, cell_t *c, int wantsmoke);
|
int teleportto(lifeform_t *lf, cell_t *c, int wantsmoke);
|
||||||
int trymove(lifeform_t *lf, int dir, int onpurpose);
|
int trymove(lifeform_t *lf, int dir, int onpurpose);
|
||||||
int tryrun(lifeform_t *lf, int dir);
|
int tryrun(lifeform_t *lf, int dir);
|
||||||
|
int trysneak(lifeform_t *lf, int dir);
|
||||||
int walkoffmap(lifeform_t *lf, int dir, int onpurpose);
|
int walkoffmap(lifeform_t *lf, int dir, int onpurpose);
|
||||||
int willmove(lifeform_t *lf, int dir, enum ERROR *error);
|
int willmove(lifeform_t *lf, int dir, enum ERROR *error);
|
||||||
|
|
Loading…
Reference in New Issue