rare books store tribute

This commit is contained in:
nhmall
2015-03-18 21:47:18 -04:00
parent debdf7ca48
commit d01bec9fae
11 changed files with 143 additions and 9 deletions

View File

@@ -10,7 +10,7 @@
STATIC_DCL boolean FDECL(veggy_item, (struct obj *obj,int));
STATIC_DCL int NDECL(shkveg);
STATIC_DCL void FDECL(mkveggy_at, (int,int));
STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *,int,int));
STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *,int,int,BOOLEAN_P));
STATIC_DCL void FDECL(nameshk, (struct monst *,const char * const *));
STATIC_DCL int FDECL(shkinit, (const struct shclass *,struct mkroom *));
@@ -357,15 +357,26 @@ int sx, sy;
}
STATIC_OVL void
mkshobj_at(shp, sx, sy)
mkshobj_at(shp, sx, sy, mkspecl)
/* make an object of the appropriate type for a shop square */
const struct shclass *shp;
int sx, sy;
boolean mkspecl;
{
struct monst *mtmp;
int atype;
struct permonst *ptr;
/* 3.6 tribute */
if (mkspecl && !strcmp(shp->name, "rare books")) {
int novidx = -1; /* -1 triggers random noveltitle() */
struct obj *novel=mksobj_at(SPE_NOVEL, sx, sy, FALSE, FALSE);
if (novel) novel = oname(novel, noveltitle(&novidx));
context.tribute.bookidx = novidx;
context.tribute.book = 1;
return;
}
if (rn2(100) < depth(&u.uz) &&
!MON_AT(sx, sy) && (ptr = mkclass(S_MIMIC,0)) &&
(mtmp = makemon(ptr,sx,sy,NO_MM_FLAGS)) != 0) {
@@ -572,7 +583,8 @@ register struct mkroom *sroom;
* shop-style placement (all squares except a row nearest the first
* door get objects).
*/
register int sx, sy, sh;
int sx, sy, sh;
int stockcount = 0, specialspot = 0;
char buf[BUFSZ];
int rmno = (int)((sroom - rooms) + ROOMOFFSET);
const struct shclass *shp = &shtypes[shp_indx];
@@ -608,6 +620,29 @@ register struct mkroom *sroom;
make_engr_at(m, n, buf, 0L, DUST);
}
if (context.tribute.enabled && !context.tribute.book) {
/*
* Out of the number of spots where we're actually
* going to put stuff, randomly single out one in particular.
*/
for (sx = sroom->lx; sx <= sroom->hx; sx++)
for (sy = sroom->ly; sy <= sroom->hy; sy++) {
if (sroom->irregular) {
if (levl[sx][sy].edge || (int)levl[sx][sy].roomno != rmno ||
distmin(sx, sy, doors[sh].x, doors[sh].y) <= 1)
continue;
}
else if ((sx == sroom->lx && doors[sh].x == sx - 1) ||
(sx == sroom->hx && doors[sh].x == sx + 1) ||
(sy == sroom->ly && doors[sh].y == sy - 1) ||
(sy == sroom->hy && doors[sh].y == sy + 1)) continue;
stockcount++;
}
specialspot = rnd(stockcount);
stockcount = 0;
}
for(sx = sroom->lx; sx <= sroom->hx; sx++)
for(sy = sroom->ly; sy <= sroom->hy; sy++) {
if(sroom->irregular) {
@@ -618,7 +653,8 @@ register struct mkroom *sroom;
(sx == sroom->hx && doors[sh].x == sx+1) ||
(sy == sroom->ly && doors[sh].y == sy-1) ||
(sy == sroom->hy && doors[sh].y == sy+1)) continue;
mkshobj_at(shp, sx, sy);
stockcount++;
mkshobj_at(shp, sx, sy, ((stockcount) && (stockcount == specialspot)));
}
/*