- [+] 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:
Rob Pearce 2012-01-09 06:53:52 +00:00
parent e1b569f306
commit 5c4fb99162
11 changed files with 309 additions and 281 deletions

2
data.c
View File

@ -4119,7 +4119,7 @@ void initobjects(void) {
addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out");
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_RARITY, H_ALL, 75, NA, NULL);
addflag(lastot->flags, F_VALUE, 10, NA, NA, NULL);

Binary file not shown.

1
flag.c
View File

@ -613,6 +613,7 @@ int flagcausesstatredraw(lifeform_t *lf, enum FLAG fid) {
case F_HASNEWLEVEL:
case F_HIDING:
case F_ICESLIDE:
case F_INJURY:
case F_INVISIBLE:
case F_LEVITATING:
case F_PARALYZED:

5
io.c
View File

@ -9377,6 +9377,11 @@ void drawstatus(void) {
wprintw(statwin, " Blind");
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)) {
setcol(statwin, C_RED);

6
lf.c
View File

@ -8925,7 +8925,7 @@ flag_t *giveskilllev(lifeform_t *lf, enum SKILL id, enum SKILLLEVEL slev) {
// give start objects from a particular flagpile
// only give EITHER lf OR targob
void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
object_t *o;
object_t *o = NULL;
flag_t *f;
char buf[BUFLEN],buf2[BUFLEN];
int db = B_FALSE;
@ -9157,9 +9157,11 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
if (o) {
if (!obfits(o, op)) {
killob(o);
o = NULL;
} else if (op->parentob && hasflag(o->flags, F_CONTAINER)) {
// don't put containers in other containers
killob(o);
o = NULL;
}
}
@ -14199,6 +14201,8 @@ int startresting(lifeform_t *lf, int willtrain) {
// stop all spells
stopallspells(lf);
stopsprinting(lf);
killflagsofid(lf->flags, F_INTERRUPTED);
if (willtrain) {

3
map.c
View File

@ -4847,6 +4847,8 @@ void finalisemap(map_t *map, object_t *entryob) {
c = getcellat(map, x, y);
for (o = c->obpile->first ; o ; o = nexto) {
nexto = o->next;
if (c->room && c->room->vault) {
} else {
// doors which go nowhere?
if (isdoor(o, NULL)) {
int dir, ok = B_FALSE;
@ -4865,6 +4867,7 @@ void finalisemap(map_t *map, object_t *entryob) {
continue;
}
}
}
// unlinked stairs? ie ones added from vaults. if so, link them.
if (hasflag(o->flags, F_CLIMBABLE) && !hasflag(o->flags, F_MAPLINK)) {
linkstairs(o, NULL);

29
move.c
View File

@ -1109,6 +1109,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
getlfname(lf, lfname);
if (gamemode == GM_GAMESTARTED) {
if (isplayer(lf) || cansee(player, lf)) {
needredraw = B_TRUE;
}
@ -1146,7 +1147,6 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
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;
@ -1155,25 +1155,39 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
if (!isplayer(lf) && cansee(player, lf)) {
preseenbyplayer = B_TRUE;
}
} else {
prespeed = SP_NORMAL;
preroom = NULL;
preshop = B_FALSE;
prewater = B_FALSE;
preseenbyplayer = B_FALSE;
}
// move out...
lf->cell->lf = NULL;
// if required, relink lifeform to new map
if (newcell->map != lf->cell->map) {
if (gamemode == GM_GAMESTARTED) {
if (isplayer(lf)) {
statdirty = B_TRUE;
}
}
relinklf(lf, newcell->map);
if (gamemode == GM_GAMESTARTED) {
if (isplayer(lf)) {
// clear map to force redraw.
wclear(gamewin);
}
}
}
if (gamemode == GM_GAMESTARTED) {
// remember previous cells
lf->prevcell[1] = lf->prevcell[0];
lf->prevcell[0] = lf->cell;
}
// update lifeform
lf->cell = newcell;
@ -1182,17 +1196,20 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
assert(!newcell->lf);
// remember new room...
if (gamemode == GM_GAMESTARTED) {
postroom = lf->cell->room;
postspeed = getmovespeed(lf);
}
// update new cell
newcell->lf = lf;
setlosdirty(lf);
if (gamemode == GM_GAMESTARTED) {
// update light
if ((isplayer(lf) && changedlev) || lfproduceslight(lf)) {
calclight(lf->cell->map);
}
setlosdirty(lf);
//precalclos(lf);
if (isplayer(lf) || cansee(player, lf)) {
@ -1383,7 +1400,6 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
*/
}
if (gamemode == GM_GAMESTARTED) {
if (isplayer(lf) && !isblind(lf)) {
// see the 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) {
if (l != lf) {
flag_t *alarm;
//if (haslos(l, newcell)) {
if (cansee(l, lf)) {
int dointerrupt = B_FALSE;
@ -1412,11 +1427,9 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
if (isplayer(l)) {
if (areenemies(lf, l) && !isplayer(lf)) {
if (!preseenbyplayer) {
//if (lfhasflag(l, F_RUNNING) || lfhasflag(l, F_TRAINING)) {
// TODO: also check for isresting(l), if we have allies standing watch
getlfnamea(lf, lfname);
msg("%s comes into view.", lfname);
//}
}
dointerrupt = B_TRUE;
// 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)) {
real_getlfnamea(lf, lfname, B_FALSE);
msg("%s moves out of view.", lfname);
}
}
// status bar
if ((prespeed != postspeed) && isplayer(lf)) {
statdirty = B_TRUE;
}
} // end if gamestarted
return didmsg;
}

View File

@ -462,7 +462,6 @@ int main(int argc, char **argv) {
for (x = 0; x < player->cell->map->w; x++) {
c = getcellat(player->cell->map, x, y);
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)) {
killlf(c->lf);
}
@ -480,18 +479,21 @@ int main(int argc, char **argv) {
calclight(player->cell->map);
// 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) {
int bestdir = D_NONE;
int bestlos = -1;
for (i = DC_N; i <= DC_NW; i++) {
setfacing(player, i);
precalclos(player);
updateknowncells();
if (player->nlos > bestlos) {
bestlos = player->nlos;
bestdir = i;
}
}
player->facing = bestdir;
precalclos(player);
}

View File

@ -4511,7 +4511,7 @@ char *getobextrainfo(object_t *o, char *buf) {
} else if (ismagical(o) && (getskill(player, SK_CHANNELING) >= PR_MASTER)) {
flagknown = B_TRUE;
}
if (!hasflag(o->flags, F_DONTSHOWCHARGES)) {
if (flagknown && !hasflag(o->flags, F_DONTSHOWCHARGES)) {
char chargestr[BUFLEN];
if (o->type->obclass->id == OC_GODSTONE) {
if (f->val[0] == f->val[1]) {

View File

@ -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, "(item quality will not be affected)"); y += 2;
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();
return SR_BACK;
} else {

View File

@ -5772,10 +5772,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
// check if it hits
if (skillcheck(target, SC_DODGE, 20 + (power*2), 0)) {
// miss
if (isplayer(target) || cansee(player, target)) {
msg("A dart of flame misses %s.",lfname);
}
} else {
// hit
if (cansee(player, target)) {
if (isplayer(target) || cansee(player, target)) {
msg("A dart of flame hits %s.",lfname);
}
losehp(target, rnd(1,6) + power, DT_FIRE, caster, "a dart of flame");