- [+] player should know about all cells in lof/los at start of game.
- [+] stop sprinting when you rest. - [+] show Injured on botl - [+] i got hit by a fire bolt spell while asleep, but never got told that it hit me!
This commit is contained in:
parent
e1b569f306
commit
5c4fb99162
2
data.c
2
data.c
|
@ -4119,7 +4119,7 @@ void initobjects(void) {
|
||||||
addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out");
|
addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out");
|
||||||
addflag(lastot->flags, F_REPLENISHABLE, B_TRUE, NA, NA, NULL);
|
addflag(lastot->flags, F_REPLENISHABLE, B_TRUE, NA, NA, NULL);
|
||||||
|
|
||||||
addot(OT_LOCKPICK, "lockpick", "An angled piece of metal, used to open locks.", MT_METAL, 0.05, OC_TOOLS, SZ_TINY);
|
addot(OT_LOCKPICK, "lockpick", "An angled piece of metal, used to open locks. Even those unskilled in lockpicking can attempt to use this item, although success in this case may be unlikely.", MT_METAL, 0.05, OC_TOOLS, SZ_TINY);
|
||||||
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_RARITY, H_ALL, 75, NA, NULL);
|
addflag(lastot->flags, F_RARITY, H_ALL, 75, NA, NULL);
|
||||||
addflag(lastot->flags, F_VALUE, 10, NA, NA, NULL);
|
addflag(lastot->flags, F_VALUE, 10, NA, NA, NULL);
|
||||||
|
|
BIN
data/hiscores.db
BIN
data/hiscores.db
Binary file not shown.
1
flag.c
1
flag.c
|
@ -613,6 +613,7 @@ int flagcausesstatredraw(lifeform_t *lf, enum FLAG fid) {
|
||||||
case F_HASNEWLEVEL:
|
case F_HASNEWLEVEL:
|
||||||
case F_HIDING:
|
case F_HIDING:
|
||||||
case F_ICESLIDE:
|
case F_ICESLIDE:
|
||||||
|
case F_INJURY:
|
||||||
case F_INVISIBLE:
|
case F_INVISIBLE:
|
||||||
case F_LEVITATING:
|
case F_LEVITATING:
|
||||||
case F_PARALYZED:
|
case F_PARALYZED:
|
||||||
|
|
5
io.c
5
io.c
|
@ -9377,6 +9377,11 @@ void drawstatus(void) {
|
||||||
wprintw(statwin, " Blind");
|
wprintw(statwin, " Blind");
|
||||||
unsetcol(statwin, C_RED);
|
unsetcol(statwin, C_RED);
|
||||||
}
|
}
|
||||||
|
if (lfhasflag(player, F_INJURY)) {
|
||||||
|
setcol(statwin, C_RED);
|
||||||
|
wprintw(statwin, " Injured");
|
||||||
|
unsetcol(statwin, C_RED);
|
||||||
|
}
|
||||||
|
|
||||||
if (lfhasflag(player, F_GRAVBOOSTED)) {
|
if (lfhasflag(player, F_GRAVBOOSTED)) {
|
||||||
setcol(statwin, C_RED);
|
setcol(statwin, C_RED);
|
||||||
|
|
6
lf.c
6
lf.c
|
@ -8925,7 +8925,7 @@ flag_t *giveskilllev(lifeform_t *lf, enum SKILL id, enum SKILLLEVEL slev) {
|
||||||
// give start objects from a particular flagpile
|
// give start objects from a particular flagpile
|
||||||
// only give EITHER lf OR targob
|
// only give EITHER lf OR targob
|
||||||
void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
|
void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
|
||||||
object_t *o;
|
object_t *o = NULL;
|
||||||
flag_t *f;
|
flag_t *f;
|
||||||
char buf[BUFLEN],buf2[BUFLEN];
|
char buf[BUFLEN],buf2[BUFLEN];
|
||||||
int db = B_FALSE;
|
int db = B_FALSE;
|
||||||
|
@ -9157,9 +9157,11 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
|
||||||
if (o) {
|
if (o) {
|
||||||
if (!obfits(o, op)) {
|
if (!obfits(o, op)) {
|
||||||
killob(o);
|
killob(o);
|
||||||
|
o = NULL;
|
||||||
} else if (op->parentob && hasflag(o->flags, F_CONTAINER)) {
|
} else if (op->parentob && hasflag(o->flags, F_CONTAINER)) {
|
||||||
// don't put containers in other containers
|
// don't put containers in other containers
|
||||||
killob(o);
|
killob(o);
|
||||||
|
o = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14199,6 +14201,8 @@ int startresting(lifeform_t *lf, int willtrain) {
|
||||||
// stop all spells
|
// stop all spells
|
||||||
stopallspells(lf);
|
stopallspells(lf);
|
||||||
|
|
||||||
|
stopsprinting(lf);
|
||||||
|
|
||||||
killflagsofid(lf->flags, F_INTERRUPTED);
|
killflagsofid(lf->flags, F_INTERRUPTED);
|
||||||
|
|
||||||
if (willtrain) {
|
if (willtrain) {
|
||||||
|
|
33
map.c
33
map.c
|
@ -4847,22 +4847,25 @@ void finalisemap(map_t *map, object_t *entryob) {
|
||||||
c = getcellat(map, x, y);
|
c = getcellat(map, x, y);
|
||||||
for (o = c->obpile->first ; o ; o = nexto) {
|
for (o = c->obpile->first ; o ; o = nexto) {
|
||||||
nexto = o->next;
|
nexto = o->next;
|
||||||
// doors which go nowhere?
|
if (c->room && c->room->vault) {
|
||||||
if (isdoor(o, NULL)) {
|
} else {
|
||||||
int dir, ok = B_FALSE;
|
// doors which go nowhere?
|
||||||
cell_t *c2;
|
if (isdoor(o, NULL)) {
|
||||||
// check all directions for a cell which isn't
|
int dir, ok = B_FALSE;
|
||||||
// part of this room.
|
cell_t *c2;
|
||||||
for (dir = DC_N; dir <= DC_NW; dir++) {
|
// check all directions for a cell which isn't
|
||||||
c2 = getcellindir(c, dir);
|
// part of this room.
|
||||||
if (c2 && cellwalkable(NULL, c2, NULL) && getroomid(c2) != getroomid(c)) {
|
for (dir = DC_N; dir <= DC_NW; dir++) {
|
||||||
ok = B_TRUE;
|
c2 = getcellindir(c, dir);
|
||||||
break;
|
if (c2 && cellwalkable(NULL, c2, NULL) && getroomid(c2) != getroomid(c)) {
|
||||||
|
ok = B_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ok) {
|
||||||
|
killob(o);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
killob(o);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// unlinked stairs? ie ones added from vaults. if so, link them.
|
// unlinked stairs? ie ones added from vaults. if so, link them.
|
||||||
|
|
529
move.c
529
move.c
|
@ -1109,71 +1109,85 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
||||||
|
|
||||||
getlfname(lf, lfname);
|
getlfname(lf, lfname);
|
||||||
|
|
||||||
if (isplayer(lf) || cansee(player, lf)) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
needredraw = B_TRUE;
|
if (isplayer(lf) || cansee(player, lf)) {
|
||||||
}
|
needredraw = B_TRUE;
|
||||||
|
|
||||||
if (newcell->map != lf->cell->map) {
|
|
||||||
changedlev = B_TRUE;
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
// remember the time which we exitted this map.
|
|
||||||
lf->cell->map->lastplayervisit = curtime;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// special effects when the player moves to a new map
|
if (newcell->map != lf->cell->map) {
|
||||||
if (changedlev && isplayer(lf)) {
|
changedlev = B_TRUE;
|
||||||
object_t *o;
|
if (isplayer(lf)) {
|
||||||
long barrierid = -1;
|
// remember the time which we exitted this map.
|
||||||
// mapentereffects will give all monster on the new map
|
lf->cell->map->lastplayervisit = curtime;
|
||||||
// a bunch of turns to simulate time passing while the player
|
}
|
||||||
// was away. to prevent them from blocking off the staircase cell
|
}
|
||||||
// where the player is about to arrive, place a magic barrier over it.
|
|
||||||
o = addobfast(newcell->obpile, OT_MAGICBARRIER);
|
|
||||||
if (o) barrierid = o->id;
|
|
||||||
|
|
||||||
mapentereffects(newcell->map);
|
|
||||||
|
|
||||||
// now remove the barrier
|
// special effects when the player moves to a new map
|
||||||
o = hasobid(newcell->obpile, barrierid);
|
if (changedlev && isplayer(lf)) {
|
||||||
if (o) killob(o);
|
object_t *o;
|
||||||
}
|
long barrierid = -1;
|
||||||
|
// mapentereffects will give all monster on the new map
|
||||||
|
// a bunch of turns to simulate time passing while the player
|
||||||
|
// was away. to prevent them from blocking off the staircase cell
|
||||||
|
// where the player is about to arrive, place a magic barrier over it.
|
||||||
|
o = addobfast(newcell->obpile, OT_MAGICBARRIER);
|
||||||
|
if (o) barrierid = o->id;
|
||||||
|
|
||||||
|
mapentereffects(newcell->map);
|
||||||
|
|
||||||
// remember current cell + room id
|
// now remove the barrier
|
||||||
prespeed = getmovespeed(lf);
|
o = hasobid(newcell->obpile, barrierid);
|
||||||
preroom = lf->cell->room;
|
if (o) killob(o);
|
||||||
v = getcellvault(lf->cell);
|
}
|
||||||
if (v && hasflag(v->flags, F_VAULTISSHOP)) {
|
|
||||||
preshop = getroomid(lf->cell);
|
// remember current cell + room id
|
||||||
|
prespeed = getmovespeed(lf);
|
||||||
|
preroom = lf->cell->room;
|
||||||
|
v = getcellvault(lf->cell);
|
||||||
|
if (v && hasflag(v->flags, F_VAULTISSHOP)) {
|
||||||
|
preshop = getroomid(lf->cell);
|
||||||
|
}
|
||||||
|
// getting out of water?
|
||||||
|
if (hasobwithflag(lf->cell->obpile, F_DEEPWATER)) {
|
||||||
|
prewater = B_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isplayer(lf) && cansee(player, lf)) {
|
||||||
|
preseenbyplayer = B_TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
prespeed = SP_NORMAL;
|
||||||
|
preroom = NULL;
|
||||||
|
preshop = B_FALSE;
|
||||||
|
prewater = B_FALSE;
|
||||||
|
preseenbyplayer = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getting out of water?
|
|
||||||
if (hasobwithflag(lf->cell->obpile, F_DEEPWATER)) {
|
|
||||||
prewater = B_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isplayer(lf) && cansee(player, lf)) {
|
|
||||||
preseenbyplayer = B_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// move out...
|
// move out...
|
||||||
lf->cell->lf = NULL;
|
lf->cell->lf = NULL;
|
||||||
|
|
||||||
// if required, relink lifeform to new map
|
// if required, relink lifeform to new map
|
||||||
if (newcell->map != lf->cell->map) {
|
if (newcell->map != lf->cell->map) {
|
||||||
if (isplayer(lf)) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
statdirty = B_TRUE;
|
if (isplayer(lf)) {
|
||||||
|
statdirty = B_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
relinklf(lf, newcell->map);
|
relinklf(lf, newcell->map);
|
||||||
if (isplayer(lf)) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
// clear map to force redraw.
|
if (isplayer(lf)) {
|
||||||
wclear(gamewin);
|
// clear map to force redraw.
|
||||||
|
wclear(gamewin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember previous cells
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
lf->prevcell[1] = lf->prevcell[0];
|
// remember previous cells
|
||||||
lf->prevcell[0] = lf->cell;
|
lf->prevcell[1] = lf->prevcell[0];
|
||||||
|
lf->prevcell[0] = lf->cell;
|
||||||
|
}
|
||||||
|
|
||||||
// update lifeform
|
// update lifeform
|
||||||
lf->cell = newcell;
|
lf->cell = newcell;
|
||||||
|
@ -1182,208 +1196,210 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
||||||
assert(!newcell->lf);
|
assert(!newcell->lf);
|
||||||
|
|
||||||
// remember new room...
|
// remember new room...
|
||||||
postroom = lf->cell->room;
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
postspeed = getmovespeed(lf);
|
postroom = lf->cell->room;
|
||||||
|
postspeed = getmovespeed(lf);
|
||||||
|
}
|
||||||
|
|
||||||
// update new cell
|
// update new cell
|
||||||
newcell->lf = lf;
|
newcell->lf = lf;
|
||||||
|
|
||||||
// update light
|
|
||||||
if ((isplayer(lf) && changedlev) || lfproduceslight(lf)) {
|
|
||||||
calclight(lf->cell->map);
|
|
||||||
}
|
|
||||||
setlosdirty(lf);
|
setlosdirty(lf);
|
||||||
//precalclos(lf);
|
|
||||||
|
|
||||||
if (isplayer(lf) || cansee(player, lf)) {
|
|
||||||
needredraw = B_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
didmsg = moveeffects(lf);
|
|
||||||
|
|
||||||
killflagsofid(lf->flags, F_HIDING);
|
|
||||||
|
|
||||||
// remove grabs (but not attached things)
|
|
||||||
// Note: only remove this from the person _being grabbed_.
|
|
||||||
// if the grabb_er_ moves away, they'll drag the grabee with them.
|
|
||||||
f = lfhasflag(lf, F_GRABBEDBY);
|
|
||||||
if (f) {
|
|
||||||
lifeform_t *grabber;
|
|
||||||
grabber = findlf(NULL, f->val[0]);
|
|
||||||
assert(grabber);
|
|
||||||
if (getcelldist(lf->cell, grabber->cell) > 1) {
|
|
||||||
killflagsofid(grabber->flags, F_GRABBING);
|
|
||||||
killflagsofid(lf->flags, F_GRABBEDBY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// passwall ends when you walk onto a non-solid cell.
|
|
||||||
f = lfhasflag(lf, F_NONCORPOREAL);
|
|
||||||
if (f && (f->obfrom == OT_S_PASSWALL)) {
|
|
||||||
enum ERROR err;
|
|
||||||
cellwalkable(lf, lf->cell, &err);
|
|
||||||
if (err == E_OK) {
|
|
||||||
stopspell(lf, OT_S_PASSWALL);
|
|
||||||
killflag(f);
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
if (prewater && !hasobwithflag(newcell->obpile, F_DEEPWATER)) {
|
|
||||||
// getitng out of water?
|
|
||||||
statdirty = B_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check ground objects
|
|
||||||
if (!isairborne(lf)) {
|
|
||||||
for (o = newcell->obpile->first ; o ; o = nexto ) {
|
|
||||||
nexto = o->next;
|
|
||||||
|
|
||||||
f = hasflag(o->flags, F_DEEPWATER);
|
|
||||||
if (f) {
|
|
||||||
if (checkfordrowning(lf, o)) {
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
if (isdead(lf)) return B_TRUE;
|
|
||||||
}
|
|
||||||
// did you just enter the water?
|
|
||||||
if (!prewater) {
|
|
||||||
if ((getobdepth(o, lf) >= DP_WAIST) && getskill(lf, SK_SWIMMING)) {
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
msg("You start swimming.");
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
statdirty = B_TRUE;
|
|
||||||
} else if (cansee(player, lf)) {
|
|
||||||
msg("%s starts swimming.", lfname);
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
}
|
|
||||||
// put out fires
|
|
||||||
extinguishlf(lf);
|
|
||||||
|
|
||||||
// stop sprinting
|
|
||||||
stopsprinting(lf);
|
|
||||||
|
|
||||||
noise(lf->cell, NULL, NC_OTHER, SV_TALK, "a splash.", NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f = hasflag(o->flags, F_SHARP);
|
|
||||||
if (f && hasbp(lf, BP_FEET) && !lfhasflag(lf, F_SNEAK)) {
|
|
||||||
object_t *boots;
|
|
||||||
// has boots on?
|
|
||||||
boots = getequippedob(lf->pack, BP_FEET);
|
|
||||||
if (!boots) {
|
|
||||||
// take damage
|
|
||||||
getobname(o, obname, 1);
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
msg("Ow - you step on %s!",obname);
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
} else if (haslos(player, newcell)) {
|
|
||||||
msg("%s steps on %s!",lfname, obname);
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
}
|
|
||||||
snprintf(buf, BUFLEN, "stepping on %s", obname);
|
|
||||||
losehp(lf, rnd(f->val[0],f->val[1]), DT_SLASH, NULL, buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f = hasflag(o->flags, F_CRUSHABLE);
|
|
||||||
if (f && !lfhasflag(lf, F_SNEAK)) {
|
|
||||||
enum LFSIZE crushsize;
|
|
||||||
crushsize = f->val[0];
|
|
||||||
|
|
||||||
if (getlfsize(lf) >= crushsize) {
|
|
||||||
// crunch it broken glass
|
|
||||||
getobname(o, obname, 1);
|
|
||||||
|
|
||||||
// special case
|
|
||||||
if (o->type->id == OT_BROKENGLASS) {
|
|
||||||
if (o->amt > 1) {
|
|
||||||
char *newname;
|
|
||||||
// we want 'xx steps on some pieces of broken glass'
|
|
||||||
// not 'xx steps on 5 pieces of broken glass'
|
|
||||||
newname = makeplural(obname);
|
|
||||||
newname = strrep(newname, "a ", "some ", NULL);
|
|
||||||
strcpy(obname, newname);
|
|
||||||
free(newname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
msg("You crush %s underfoot.",obname);
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
} else if (haslos(player, newcell)) {
|
|
||||||
msg("%s crushes %s.",lfname, obname);
|
|
||||||
didmsg = B_TRUE;
|
|
||||||
}
|
|
||||||
// kill object which is being crushed.
|
|
||||||
removeob(o, o->amt);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} // end if crushable
|
|
||||||
|
|
||||||
if ((o->type->id == OT_VINE) && !hasjob(lf, J_DRUID)) {
|
|
||||||
char obname[BUFLEN];
|
|
||||||
getobname(o,obname,o->amt);
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
msg("%s grab%s you!",obname,OBS1(o));
|
|
||||||
} else if (cansee(player, lf)) {
|
|
||||||
msg("%s grab%s %s!",obname, OBS1(o), lfname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end foreach object in cell
|
|
||||||
} // end if !flying
|
|
||||||
|
|
||||||
// update where player knows
|
|
||||||
// (but without a map you will then slowly forget it)
|
|
||||||
if (isplayer(lf)) {
|
|
||||||
updateknowncells();
|
|
||||||
|
|
||||||
// TODO: not sure about this next bit yet...
|
|
||||||
// it definitely won't work for non-square rooms
|
|
||||||
// or rooms with pillars. would be better to fix
|
|
||||||
// haslos() code to handle looking along walls
|
|
||||||
// instead.
|
|
||||||
// if you walked into a new fully lit room, which
|
|
||||||
// ISNT a vault, reveal it.
|
|
||||||
//
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ((getskill(lf, SK_CARTOGRAPHY) >= PR_NOVICE) && (!lf->cell->vault)) {
|
|
||||||
if ((postroom > 0) && (postroom != preroom)) {
|
|
||||||
cell_t *c[MAX_MAPW*MAX_MAPH];
|
|
||||||
int ncells;
|
|
||||||
int i,alllit = B_TRUE,allknown = B_TRUE;
|
|
||||||
|
|
||||||
// is the whole room lit?
|
|
||||||
getroomcells(lf->cell->map, postroom, c, &ncells);
|
|
||||||
for (i = 0; i < ncells; i++) {
|
|
||||||
if (!islit(c[i])) {
|
|
||||||
alllit = B_FALSE;
|
|
||||||
}
|
|
||||||
if (!c[i]->known) {
|
|
||||||
allknown = B_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alllit && !allknown) {
|
|
||||||
// make the all known
|
|
||||||
for (i = 0; i < ncells; i++) {
|
|
||||||
setcellknown(c[i], B_FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gamemode == GM_GAMESTARTED) {
|
if (gamemode == GM_GAMESTARTED) {
|
||||||
|
// update light
|
||||||
|
if ((isplayer(lf) && changedlev) || lfproduceslight(lf)) {
|
||||||
|
calclight(lf->cell->map);
|
||||||
|
}
|
||||||
|
//precalclos(lf);
|
||||||
|
|
||||||
|
if (isplayer(lf) || cansee(player, lf)) {
|
||||||
|
needredraw = B_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
didmsg = moveeffects(lf);
|
||||||
|
|
||||||
|
killflagsofid(lf->flags, F_HIDING);
|
||||||
|
|
||||||
|
// remove grabs (but not attached things)
|
||||||
|
// Note: only remove this from the person _being grabbed_.
|
||||||
|
// if the grabb_er_ moves away, they'll drag the grabee with them.
|
||||||
|
f = lfhasflag(lf, F_GRABBEDBY);
|
||||||
|
if (f) {
|
||||||
|
lifeform_t *grabber;
|
||||||
|
grabber = findlf(NULL, f->val[0]);
|
||||||
|
assert(grabber);
|
||||||
|
if (getcelldist(lf->cell, grabber->cell) > 1) {
|
||||||
|
killflagsofid(grabber->flags, F_GRABBING);
|
||||||
|
killflagsofid(lf->flags, F_GRABBEDBY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// passwall ends when you walk onto a non-solid cell.
|
||||||
|
f = lfhasflag(lf, F_NONCORPOREAL);
|
||||||
|
if (f && (f->obfrom == OT_S_PASSWALL)) {
|
||||||
|
enum ERROR err;
|
||||||
|
cellwalkable(lf, lf->cell, &err);
|
||||||
|
if (err == E_OK) {
|
||||||
|
stopspell(lf, OT_S_PASSWALL);
|
||||||
|
killflag(f);
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
if (prewater && !hasobwithflag(newcell->obpile, F_DEEPWATER)) {
|
||||||
|
// getitng out of water?
|
||||||
|
statdirty = B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check ground objects
|
||||||
|
if (!isairborne(lf)) {
|
||||||
|
for (o = newcell->obpile->first ; o ; o = nexto ) {
|
||||||
|
nexto = o->next;
|
||||||
|
|
||||||
|
f = hasflag(o->flags, F_DEEPWATER);
|
||||||
|
if (f) {
|
||||||
|
if (checkfordrowning(lf, o)) {
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
if (isdead(lf)) return B_TRUE;
|
||||||
|
}
|
||||||
|
// did you just enter the water?
|
||||||
|
if (!prewater) {
|
||||||
|
if ((getobdepth(o, lf) >= DP_WAIST) && getskill(lf, SK_SWIMMING)) {
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
msg("You start swimming.");
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
statdirty = B_TRUE;
|
||||||
|
} else if (cansee(player, lf)) {
|
||||||
|
msg("%s starts swimming.", lfname);
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
}
|
||||||
|
// put out fires
|
||||||
|
extinguishlf(lf);
|
||||||
|
|
||||||
|
// stop sprinting
|
||||||
|
stopsprinting(lf);
|
||||||
|
|
||||||
|
noise(lf->cell, NULL, NC_OTHER, SV_TALK, "a splash.", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f = hasflag(o->flags, F_SHARP);
|
||||||
|
if (f && hasbp(lf, BP_FEET) && !lfhasflag(lf, F_SNEAK)) {
|
||||||
|
object_t *boots;
|
||||||
|
// has boots on?
|
||||||
|
boots = getequippedob(lf->pack, BP_FEET);
|
||||||
|
if (!boots) {
|
||||||
|
// take damage
|
||||||
|
getobname(o, obname, 1);
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
msg("Ow - you step on %s!",obname);
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
} else if (haslos(player, newcell)) {
|
||||||
|
msg("%s steps on %s!",lfname, obname);
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
}
|
||||||
|
snprintf(buf, BUFLEN, "stepping on %s", obname);
|
||||||
|
losehp(lf, rnd(f->val[0],f->val[1]), DT_SLASH, NULL, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f = hasflag(o->flags, F_CRUSHABLE);
|
||||||
|
if (f && !lfhasflag(lf, F_SNEAK)) {
|
||||||
|
enum LFSIZE crushsize;
|
||||||
|
crushsize = f->val[0];
|
||||||
|
|
||||||
|
if (getlfsize(lf) >= crushsize) {
|
||||||
|
// crunch it broken glass
|
||||||
|
getobname(o, obname, 1);
|
||||||
|
|
||||||
|
// special case
|
||||||
|
if (o->type->id == OT_BROKENGLASS) {
|
||||||
|
if (o->amt > 1) {
|
||||||
|
char *newname;
|
||||||
|
// we want 'xx steps on some pieces of broken glass'
|
||||||
|
// not 'xx steps on 5 pieces of broken glass'
|
||||||
|
newname = makeplural(obname);
|
||||||
|
newname = strrep(newname, "a ", "some ", NULL);
|
||||||
|
strcpy(obname, newname);
|
||||||
|
free(newname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
msg("You crush %s underfoot.",obname);
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
} else if (haslos(player, newcell)) {
|
||||||
|
msg("%s crushes %s.",lfname, obname);
|
||||||
|
didmsg = B_TRUE;
|
||||||
|
}
|
||||||
|
// kill object which is being crushed.
|
||||||
|
removeob(o, o->amt);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} // end if crushable
|
||||||
|
|
||||||
|
if ((o->type->id == OT_VINE) && !hasjob(lf, J_DRUID)) {
|
||||||
|
char obname[BUFLEN];
|
||||||
|
getobname(o,obname,o->amt);
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
msg("%s grab%s you!",obname,OBS1(o));
|
||||||
|
} else if (cansee(player, lf)) {
|
||||||
|
msg("%s grab%s %s!",obname, OBS1(o), lfname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end foreach object in cell
|
||||||
|
} // end if !flying
|
||||||
|
|
||||||
|
// update where player knows
|
||||||
|
// (but without a map you will then slowly forget it)
|
||||||
|
if (isplayer(lf)) {
|
||||||
|
updateknowncells();
|
||||||
|
|
||||||
|
// TODO: not sure about this next bit yet...
|
||||||
|
// it definitely won't work for non-square rooms
|
||||||
|
// or rooms with pillars. would be better to fix
|
||||||
|
// haslos() code to handle looking along walls
|
||||||
|
// instead.
|
||||||
|
// if you walked into a new fully lit room, which
|
||||||
|
// ISNT a vault, reveal it.
|
||||||
|
//
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ((getskill(lf, SK_CARTOGRAPHY) >= PR_NOVICE) && (!lf->cell->vault)) {
|
||||||
|
if ((postroom > 0) && (postroom != preroom)) {
|
||||||
|
cell_t *c[MAX_MAPW*MAX_MAPH];
|
||||||
|
int ncells;
|
||||||
|
int i,alllit = B_TRUE,allknown = B_TRUE;
|
||||||
|
|
||||||
|
// is the whole room lit?
|
||||||
|
getroomcells(lf->cell->map, postroom, c, &ncells);
|
||||||
|
for (i = 0; i < ncells; i++) {
|
||||||
|
if (!islit(c[i])) {
|
||||||
|
alllit = B_FALSE;
|
||||||
|
}
|
||||||
|
if (!c[i]->known) {
|
||||||
|
allknown = B_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alllit && !allknown) {
|
||||||
|
// make the all known
|
||||||
|
for (i = 0; i < ncells; i++) {
|
||||||
|
setcellknown(c[i], B_FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
if (isplayer(lf) && !isblind(lf)) {
|
if (isplayer(lf) && !isblind(lf)) {
|
||||||
// see the vault
|
// see the vault
|
||||||
if (!preroom && postroom && postroom->vault) {
|
if (!preroom && postroom && postroom->vault) {
|
||||||
|
@ -1399,7 +1415,6 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
||||||
for (l = newcell->map->lf ; l ; l = l->next) {
|
for (l = newcell->map->lf ; l ; l = l->next) {
|
||||||
if (l != lf) {
|
if (l != lf) {
|
||||||
flag_t *alarm;
|
flag_t *alarm;
|
||||||
//if (haslos(l, newcell)) {
|
|
||||||
if (cansee(l, lf)) {
|
if (cansee(l, lf)) {
|
||||||
int dointerrupt = B_FALSE;
|
int dointerrupt = B_FALSE;
|
||||||
|
|
||||||
|
@ -1412,11 +1427,9 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
||||||
if (isplayer(l)) {
|
if (isplayer(l)) {
|
||||||
if (areenemies(lf, l) && !isplayer(lf)) {
|
if (areenemies(lf, l) && !isplayer(lf)) {
|
||||||
if (!preseenbyplayer) {
|
if (!preseenbyplayer) {
|
||||||
//if (lfhasflag(l, F_RUNNING) || lfhasflag(l, F_TRAINING)) {
|
|
||||||
// TODO: also check for isresting(l), if we have allies standing watch
|
// TODO: also check for isresting(l), if we have allies standing watch
|
||||||
getlfnamea(lf, lfname);
|
getlfnamea(lf, lfname);
|
||||||
msg("%s comes into view.", lfname);
|
msg("%s comes into view.", lfname);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
dointerrupt = B_TRUE;
|
dointerrupt = B_TRUE;
|
||||||
// mark the observed race as known.
|
// mark the observed race as known.
|
||||||
|
@ -1483,19 +1496,17 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (preseenbyplayer && !cansee(player, lf) && !changedlev) {
|
||||||
|
if (areenemies(player, lf)) {
|
||||||
if (preseenbyplayer && !cansee(player, lf) && !changedlev) {
|
real_getlfnamea(lf, lfname, B_FALSE);
|
||||||
if (areenemies(player, lf)) {
|
msg("%s moves out of view.", lfname);
|
||||||
real_getlfnamea(lf, lfname, B_FALSE);
|
}
|
||||||
msg("%s moves out of view.", lfname);
|
|
||||||
}
|
}
|
||||||
}
|
// status bar
|
||||||
|
if ((prespeed != postspeed) && isplayer(lf)) {
|
||||||
// status bar
|
statdirty = B_TRUE;
|
||||||
if ((prespeed != postspeed) && isplayer(lf)) {
|
}
|
||||||
statdirty = B_TRUE;
|
} // end if gamestarted
|
||||||
}
|
|
||||||
|
|
||||||
return didmsg;
|
return didmsg;
|
||||||
}
|
}
|
||||||
|
|
4
nexus.c
4
nexus.c
|
@ -462,7 +462,6 @@ int main(int argc, char **argv) {
|
||||||
for (x = 0; x < player->cell->map->w; x++) {
|
for (x = 0; x < player->cell->map->w; x++) {
|
||||||
c = getcellat(player->cell->map, x, y);
|
c = getcellat(player->cell->map, x, y);
|
||||||
if (c && (haslos(player, c) || haslof(player->cell, c, LOF_WALLSTOP, NULL))) {
|
if (c && (haslos(player, c) || haslof(player->cell, c, LOF_WALLSTOP, NULL))) {
|
||||||
setcellknown(c, slev);
|
|
||||||
if (c->lf && !isplayer(c->lf) && !ispetof(c->lf, player)) {
|
if (c->lf && !isplayer(c->lf) && !ispetof(c->lf, player)) {
|
||||||
killlf(c->lf);
|
killlf(c->lf);
|
||||||
}
|
}
|
||||||
|
@ -480,18 +479,21 @@ int main(int argc, char **argv) {
|
||||||
calclight(player->cell->map);
|
calclight(player->cell->map);
|
||||||
|
|
||||||
// make player face the direction which gives them the most visibility
|
// make player face the direction which gives them the most visibility
|
||||||
|
// as we check, set all cells around us to start off known.
|
||||||
if (newworld) {
|
if (newworld) {
|
||||||
int bestdir = D_NONE;
|
int bestdir = D_NONE;
|
||||||
int bestlos = -1;
|
int bestlos = -1;
|
||||||
for (i = DC_N; i <= DC_NW; i++) {
|
for (i = DC_N; i <= DC_NW; i++) {
|
||||||
setfacing(player, i);
|
setfacing(player, i);
|
||||||
precalclos(player);
|
precalclos(player);
|
||||||
|
updateknowncells();
|
||||||
if (player->nlos > bestlos) {
|
if (player->nlos > bestlos) {
|
||||||
bestlos = player->nlos;
|
bestlos = player->nlos;
|
||||||
bestdir = i;
|
bestdir = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player->facing = bestdir;
|
player->facing = bestdir;
|
||||||
|
|
||||||
precalclos(player);
|
precalclos(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4511,7 +4511,7 @@ char *getobextrainfo(object_t *o, char *buf) {
|
||||||
} else if (ismagical(o) && (getskill(player, SK_CHANNELING) >= PR_MASTER)) {
|
} else if (ismagical(o) && (getskill(player, SK_CHANNELING) >= PR_MASTER)) {
|
||||||
flagknown = B_TRUE;
|
flagknown = B_TRUE;
|
||||||
}
|
}
|
||||||
if (!hasflag(o->flags, F_DONTSHOWCHARGES)) {
|
if (flagknown && !hasflag(o->flags, F_DONTSHOWCHARGES)) {
|
||||||
char chargestr[BUFLEN];
|
char chargestr[BUFLEN];
|
||||||
if (o->type->obclass->id == OC_GODSTONE) {
|
if (o->type->obclass->id == OC_GODSTONE) {
|
||||||
if (f->val[0] == f->val[1]) {
|
if (f->val[0] == f->val[1]) {
|
||||||
|
|
2
shops.c
2
shops.c
|
@ -763,7 +763,7 @@ enum SHOPRETURN shopresize(lifeform_t *lf, object_t *vm, int starty, char *topte
|
||||||
mvwprintw(mainwin, y, 0, "For just $%d per item, we can resize weapons or armour to fit you.", resizecost); y ++;
|
mvwprintw(mainwin, y, 0, "For just $%d per item, we can resize weapons or armour to fit you.", resizecost); y ++;
|
||||||
mvwprintw(mainwin, y, 0, "(item quality will not be affected)"); y += 2;
|
mvwprintw(mainwin, y, 0, "(item quality will not be affected)"); y += 2;
|
||||||
if (countmoney(player->pack) < resizecost) {
|
if (countmoney(player->pack) < resizecost) {
|
||||||
msg("Sadly, you cannot afford the resizing fee.", resizecost);
|
mvwprintw(mainwin, y, 0, "Sadly, you cannot afford the resizing fee.");
|
||||||
getch();
|
getch();
|
||||||
return SR_BACK;
|
return SR_BACK;
|
||||||
} else {
|
} else {
|
||||||
|
|
6
spell.c
6
spell.c
|
@ -5772,10 +5772,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
||||||
// check if it hits
|
// check if it hits
|
||||||
if (skillcheck(target, SC_DODGE, 20 + (power*2), 0)) {
|
if (skillcheck(target, SC_DODGE, 20 + (power*2), 0)) {
|
||||||
// miss
|
// miss
|
||||||
msg("A dart of flame misses %s.",lfname);
|
if (isplayer(target) || cansee(player, target)) {
|
||||||
|
msg("A dart of flame misses %s.",lfname);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// hit
|
// hit
|
||||||
if (cansee(player, target)) {
|
if (isplayer(target) || cansee(player, target)) {
|
||||||
msg("A dart of flame hits %s.",lfname);
|
msg("A dart of flame hits %s.",lfname);
|
||||||
}
|
}
|
||||||
losehp(target, rnd(1,6) + power, DT_FIRE, caster, "a dart of flame");
|
losehp(target, rnd(1,6) + power, DT_FIRE, caster, "a dart of flame");
|
||||||
|
|
Loading…
Reference in New Issue