From c59662360384fb8fcbb13523dadd4fabd2cd3b0d Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Tue, 22 Nov 2011 00:38:01 +0000 Subject: [PATCH] - [+] monk fist damage not increasing. - [+] RANDOM MONSTER BUGS - [+] levle 1: always getting goblins/kobolds - [+] levle 2: always getting poltergeists - [+] debug getrandomrace().... - [+] enforce f_rarity val[2] != NA!! - [+] empty levels - [+] whenever we pick rr=frquent, we're getting no monsters - [+] start MONSTER randomness at COMMON - [+] bug: i lost f_size when i died when polymorphed! - [+] yumi should only hate killing helpless things, not ANYTHNIG! - [+] make armour more common than weapons, since this tends to get damaged - [+] bookshelf (contains scrolls/books) - [+] wardrobe (contains armour) - [+] coffin sometimes contains corpses - [+] not getting enough objects now ?? --- attack.c | 2 +- data.c | 66 +++++++++++++++++++-------- data/hiscores.db | Bin 12288 -> 12288 bytes defs.h | 2 + flag.c | 6 +++ io.c | 6 +-- lf.c | 115 ++++++++++++++++++++++++----------------------- objects.c | 12 +++-- save.c | 2 +- 9 files changed, 128 insertions(+), 83 deletions(-) diff --git a/attack.c b/attack.c index 88be3dc..6c95f89 100644 --- a/attack.c +++ b/attack.c @@ -185,7 +185,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) { // anyone there? if so just attack. if (c->lf) { if (!force && isplayer(lf) && isprone(lf)) { - if (!warnabout("Really attack while prone (-40% accuracy)?")) { + if (!warnabout("Really attack while prone (-4 accuracy)?")) { return B_TRUE; } } diff --git a/data.c b/data.c index 7aac00a..1eaff5f 100644 --- a/data.c +++ b/data.c @@ -1117,13 +1117,13 @@ void initobjects(void) { addflag(lastobjectclass->flags, F_SHOP, B_TRUE, NA, NA, NULL); addflag(lastobjectclass->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); addoc(OC_DFEATURE, "Dungeon Features", "Doors, etc.", '\\', C_GREY, RR_RARE); - addoc(OC_FURNITURE, "Furniture", "Various kinds of mundane (or not so mundane) furnishings.", '\\', C_BROWN, RR_COMMON); + addoc(OC_FURNITURE, "Furniture", "Various kinds of mundane (or not so mundane) furnishings.", '\\', C_BROWN, RR_FREQUENT); addocnoun(lastobjectclass, "furniture"); addflag(lastobjectclass->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addoc(OC_TERRAIN, "Terrain", "Water, etc.", '\\', C_GREY, RR_NEVER); addoc(OC_TRAP, "Trap", "Fiendish traps.", '^', C_GREY, RR_RARE); addocnoun(lastobjectclass, "trap"); - addoc(OC_MONEY, "Money", "The standard currency of Nexus.", '$', C_GREY, RR_COMMON); + addoc(OC_MONEY, "Money", "The standard currency of Nexus.", '$', C_GREY, RR_UNCOMMON); addoc(OC_SCROLL, "Scrolls", "An arcane roll of parchment, inscribed with many magical glyphs.", '?', C_GREY, RR_UNCOMMON); addocnoun(lastobjectclass, "scroll"); addflag(lastobjectclass->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL); @@ -1161,7 +1161,7 @@ void initobjects(void) { addflag(lastobjectclass->flags, F_ENCHANTABLE, B_TRUE, NA, NA, NULL); addflag(lastobjectclass->flags, F_CANHAVEOBMOD, OM_MASTERWORK, 17, NA, NULL); addflag(lastobjectclass->flags, F_CANHAVEOBMOD, OM_SHODDY, 34, NA, NULL); - addoc(OC_ARMOUR, "Armour/Clothing", "Protective gear.", '[', C_GREY, RR_COMMON); + addoc(OC_ARMOUR, "Armour/Clothing", "Protective gear.", '[', C_GREY, RR_FREQUENT); addocnoun(lastobjectclass, "armour"); addocnoun(lastobjectclass, "clothing"); addocnoun(lastobjectclass, "clothes"); @@ -4414,9 +4414,35 @@ void initobjects(void) { // furniture + addot(OT_ARMOURRACK, "armour rack", "An upright metal rack made for armour storage.", MT_METAL, 150, OC_FURNITURE, SZ_HUMAN); + addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL); + addflag(lastot->flags, F_GLYPH, C_GREY, NA, NA, "\\"); + addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_STARTOB, 80, NA, NA, "random armour"); + addflag(lastot->flags, F_STARTOB, 60, NA, NA, "random armour"); + addflag(lastot->flags, F_STARTOB, 50, NA, NA, "good armour"); + addflag(lastot->flags, F_STARTOB, 50, NA, NA, "great armour"); + + addot(OT_BOOKSHELF, "bookshelf", "A set of wooden shelves, sized for book storage.", MT_WOOD, 150, OC_FURNITURE, SZ_HUMAN); + addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL); + addflag(lastot->flags, F_GLYPH, C_GREY, NA, NA, "\\"); + addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_STARTOB, 90, NA, NA, "random scroll"); + addflag(lastot->flags, F_STARTOB, 80, NA, NA, "random scroll"); + addflag(lastot->flags, F_STARTOB, 70, NA, NA, "random scroll"); + addflag(lastot->flags, F_STARTOB, 60, NA, NA, "random scroll"); + addflag(lastot->flags, F_STARTOB, 60, NA, NA, "random book"); + addflag(lastot->flags, F_STARTOB, 50, NA, NA, "random book"); + addot(OT_CANDELABRUM, "candelabrum", "A large (and heavy) decorative candle, about human height.", MT_METAL, 60, OC_FURNITURE, SZ_HUMAN); addflag(lastot->flags, F_GLYPH, C_YELLOW, NA, NA, "\\"); - addflag(lastot->flags, F_RARITY, H_DUNGEON, 85, NA, NULL); + addflag(lastot->flags, F_RARITY, H_DUNGEON, 85, RR_COMMON, NULL); addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_ACTIVATEPREFIX, NA, NA, NA, "lit"); @@ -4429,17 +4455,19 @@ void initobjects(void) { addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out"); addot(OT_COFFIN, "coffin", "A wooden coffin, made for holding the dead.", MT_WOOD, 100, OC_FURNITURE, SZ_HUMAN); - addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_RARE, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, NULL); addflag(lastot->flags, F_GLYPH, C_GREY, NA, NA, "|"); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_STARTOB, 80, NA, NA, "3-4 piles of ash"); - addflag(lastot->flags, F_STARTOB, 80, NA, NA, "5-10 bones"); + addflag(lastot->flags, F_STARTOB, 80, NA, NA, "corpse"); + addflag(lastot->flags, F_STARTOB, 70, NA, NA, "3-4 piles of ash"); + addflag(lastot->flags, F_STARTOB, 70, NA, NA, "5-10 bones"); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL); addot(OT_FIREPLACE, "fireplace", "A roaring fireplace.", MT_STONE, 200, OC_FURNITURE, SZ_LARGE); + addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL); addflag(lastot->flags, F_GLYPH, C_RED, NA, NA, "\\"); addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, IFACTIVE, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); @@ -4447,8 +4475,9 @@ void initobjects(void) { addflag(lastot->flags, F_ONFIRE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_IMPASSABLE, SZ_MIN, SZ_MAX, NA, NULL); + addot(OT_WEAPONRACK, "weapon rack", "A large matel frame, made to store weapons.", MT_METAL, 150, OC_FURNITURE, SZ_HUMAN); - addflag(lastot->flags, F_RARITY, H_ALL, 80, RR_RARE, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 80, RR_UNCOMMON, NULL); addflag(lastot->flags, F_GLYPH, C_GREY, NA, NA, "\\"); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); @@ -4460,8 +4489,7 @@ void initobjects(void) { addflag(lastot->flags, F_STARTOB, 50, NA, NA, "great weapon"); addot(OT_WOODENBARREL, "wooden barrel", "A solid wooden barrel.", MT_WOOD, 40, OC_FURNITURE, SZ_HUMAN); - addflag(lastot->flags, F_RARITY, H_VILLAGE, 75, RR_COMMON, NULL); - addflag(lastot->flags, F_RARITY, H_ALL, 75, NA, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_GLYPH, NA, NA, NA, "("); addflag(lastot->flags, F_IMPASSABLE, SZ_MIN, SZ_LARGE, NA, NULL); addflag(lastot->flags, F_CRUSHABLE, SZ_HUGE, NA, NA, NULL); @@ -4482,7 +4510,7 @@ void initobjects(void) { addflag(lastot->flags, F_STARTOBCLASS, 50, OC_FOOD, NA, NULL); addot(OT_WOODENTABLE, "wooden table", "A waist-height wooden table.", MT_WOOD, 25, OC_FURNITURE, SZ_HUMAN); - addflag(lastot->flags, F_RARITY, H_ALL, 70, NA, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 70, RR_COMMON, NULL); addflag(lastot->flags, F_GLYPH, C_BROWN, NA, NA, "\\"); addflag(lastot->flags, F_IMPASSABLE, SZ_MIN, SZ_HUMAN, NA, NULL); addflag(lastot->flags, F_CRUSHABLE, SZ_LARGE, NA, NA, NULL); @@ -4495,7 +4523,7 @@ void initobjects(void) { addflag(lastot->flags, F_DTVULN, DT_CHOP, NA, NA, NULL); addot(OT_WOODENSTOOL, "wooden footstool", "A small, wooden footstool.", MT_WOOD, 5, OC_FURNITURE, SZ_MEDIUM); - addflag(lastot->flags, F_RARITY, H_ALL, 83, NA, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 83, RR_COMMON, NULL); addflag(lastot->flags, F_GLYPH, NA, NA, NA, "\\"); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); @@ -7271,11 +7299,11 @@ void initrace(void) { addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL); addflag(lastrace->flags, F_CANWILL, OT_A_FEIGNDEATH, NA, NA, NULL); addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL); - addflag(lastrace->flags, F_RARITY, H_DUNGEON, 87, NA, NULL); - addflag(lastrace->flags, F_RARITY, H_FOREST, 87, NA, NULL); - addflag(lastrace->flags, F_RARITY, H_SWAMP, 87, NA, NULL); + addflag(lastrace->flags, F_RARITY, H_DUNGEON, 87, RR_COMMON, NULL); + addflag(lastrace->flags, F_RARITY, H_FOREST, 87, RR_COMMON, NULL); + addflag(lastrace->flags, F_RARITY, H_SWAMP, 87, RR_COMMON, NULL); addflag(lastrace->flags, F_SIZE, SZ_MEDIUM, NA, NA, NULL); - addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "2d4+3"); + addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "1d4+3"); addflag(lastrace->flags, F_EVASION, 10, NA, NA, NULL); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, NULL); addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, ""); @@ -7294,7 +7322,7 @@ void initrace(void) { addflag(lastrace->flags, F_DODGES, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_PACKATTACK, 2, DT_SLASH, 3, NULL); addflag(lastrace->flags, F_HUMANOID, B_TRUE, NA, NA, NULL); - addflag(lastrace->flags, F_STARTJOB, 25, J_ROGUE, NA, NULL); + addflag(lastrace->flags, F_STARTJOB, 10, J_ROGUE, NA, NULL); addflag(lastrace->flags, F_STARTSKILL, SK_PERCEPTION, PR_NOVICE, NA, NULL); addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_MORALE, 0, NA, NA, NULL); @@ -7472,8 +7500,8 @@ void initrace(void) { addrace(R_KOBOLD, "kobold", 18, 'k', C_BROWN, MT_FLESH, RC_HUMANOID, "An evil humanoid race with doglike features, kobolds are known for their cowardace and prefer to attack from a distance if at all possible."); addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL); addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL); - addflag(lastrace->flags, F_RARITY, H_DUNGEON, 95, NA, NULL); - addflag(lastrace->flags, F_RARITY, H_SWAMP, 95, NA, NULL); + addflag(lastrace->flags, F_RARITY, H_DUNGEON, 95, RR_COMMON, NULL); + addflag(lastrace->flags, F_RARITY, H_SWAMP, 95, RR_COMMON, NULL); addflag(lastrace->flags, F_POISONCORPSE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NUMAPPEAR, 1, 3, NA, ""); addflag(lastrace->flags, F_SIZE, SZ_MEDIUM, NA, NA, NULL); diff --git a/data/hiscores.db b/data/hiscores.db index 2fdb6da406627a5500414972f1a539a209d9ccee..61d90f5f69675cb6d25ccb7f7cbb02d081bee048 100644 GIT binary patch delta 851 zcmYL{TS!z<6o%L3%sBTn%~EGZ&9ND8GfrAjHfB#z*qt&f%P~#Ma!SR40&{{wx{8Y~ zR7@h&gBcWu9-@1J6%k|w;e*gqPx)j)6jA5Q2y!<6{#k49@85fK`WpKh2Xb)Zedo87 z>@jG@Qak_Q2Yj2aa6k8QHy`9$E)tK)E9*_3oD=*C@8Jl4<4L@VgLsb4<7w=}W7sVN zrqH~f7^hFz!Cz=Qk5ewc)j#=cx`~ga+gz*|7)XZAN7m&)!oxKxo^j6=2HZ>4VCdCd zgD$&u*+pBxuv2&Sy6n)Uj>0qBp2}`ZPf8N@NG2>rxz?FZoO8huw(7BsBG$>cy;PwncvW;X zqM0XP6Q;WY0m+{;Ut)81C;;G;f6Gr6^iusrolfp?sVMJ7xi9;RZa356MH@sGnZbZ(h!aInM9Yg&E^$ z(b9r|=|#&!f^L`G@mW+)=2t_832Ojra14J@2@TK~O|ws3;M|V5OCqi^g&Lq(9db1r zO*Uu)ZN$alaZ9o1wwczzC5;$bq!Ux4;qI2sysnOLdy5|{VX+*|^Q)DG?~Pu*1*vd~ zsDSF|0zIXFT*>?RBmTgb+K;gZT`&a?;gtAF8?3?DY9o*awH}qB^c*=;=tv93YLYeM zXlJCUwr8=V70!1ybw;8cGkImPRYv`C%l6MMnA;VOwswZQy8P9#>O{AG(CwD9fov@# zlmx;BEyN|hfXz}CTbV>0PrOfUrr8pRRV7MQTlJE&=};unoYxkPw);zCD-wVTn3@fg nBaRde9n?D|Rk&H6``l`+zdrHyCHnEo6dj~AM_T>zAyEDw3~j_V delta 692 zcmXYtO-NKx6vyv5=e?PE^JdggD|JR^baXx(9Y-fZYC>&QNSNTa(o88>mWB=nL8dOk zMWuA;gOW+4S{Q-#2x=2iV6@S=A1utz8=2^6;#5^w=SLQTl( z7#XPV`=#Xf~q)^+q*FJ8w$MLgJ_wz@4up~dDPRlz{i5e=& zWOt~Ey}C=0DL3jv@RlFxt~~mX=|7VVjlK%i#v8idro*CuMc8J$qtK{uECJN;nlr4F zYZhTZRsu93L<{7)BN6sy@8YTKPVRB~T~2BdI?M~0hZXpR5lrALzQXV1r5lDTX9=`u zjYUB2p1MQqDJ<6aSm5-%h>H|2Z-{ByGjYPn}ZhI{T91Z z3<~q40omaz=CJRc1~E}-x21Y$&!^xomKJBS9V&$tAzqy` z{7W%9LHB7LzTpHu!7o%m-89RAa39A*nvoM~g`oN9pt)>S7mbb_Zyt|&%%D~VdqpN_ n92*=;j-KS@tU^6HWqt4*N3ZkJyQJ-QF58? diff --git a/defs.h b/defs.h index 5fa23f2..9009eff 100644 --- a/defs.h +++ b/defs.h @@ -1485,6 +1485,8 @@ enum OBTYPE { // tech l6 // none yet. // furniture + OT_ARMOURRACK, + OT_BOOKSHELF, OT_CANDELABRUM, OT_COFFIN, OT_FIREPLACE, diff --git a/flag.c b/flag.c index fbfd929..4dffce5 100644 --- a/flag.c +++ b/flag.c @@ -58,6 +58,7 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3, int redrawstatatend = B_FALSE; int i; + // identified things mean all new flags are autmaticlaly known. if (hasflag(fp, F_IDENTIFIED)) { known = B_KNOWN; @@ -73,6 +74,11 @@ flag_t *addflag_real(flagpile_t *fp, enum FLAG id, int val1, int val2, int val3, return NULL; } + // overrite NA rarity + if ((id == F_RARITY) && (val3 == NA)) { + val3 = RR_COMMON; + } + // auto-increment order for EXTRADESC flag if ((id == F_EXTRADESC) && (val1 == NA)) { flag_t *retflag[MAXCANDIDATES]; diff --git a/io.c b/io.c index b9600b7..32dda6e 100644 --- a/io.c +++ b/io.c @@ -4134,7 +4134,7 @@ void doeat(obpile_t *op) { int dowear(obpile_t *op) { object_t *o; int rv; - o = askobject(op, "Wear what", NULL, 'W', AO_WEARABLE); + o = askobject(op, "Wear what", NULL, '\0', AO_WEARABLE); if (o) { if (isunknownbadobject(o) && skillcheck(player, A_WIS, 30, 0)) { if (!confirm_badfeeling(o)) { @@ -9289,7 +9289,7 @@ void showlfstats(lifeform_t *lf, int showall) { xpneeded = getxpforlev(lf->level + 1) - lf->xp; wprintw(mainwin, "%d (%ld XP, %ld for next)", lf->level, lf->xp, xpneeded); y++; } else { - wprintw(mainwin, "%d", lf->level); y++; + wprintw(mainwin, "%d", gethitdice(lf)); y++; } if (isplayer(lf)) { int attpoints; @@ -9753,7 +9753,7 @@ void showlfstats(lifeform_t *lf, int showall) { //mvwprintw(mainwin, y, 0, "Threat rating: %0.1f",comparelfs(player, lf)); wrapprint(mainwin, &y, &x, "%s ", buf); unsetcol(mainwin, lorecol); - y++; + y++; x = 0; } } diff --git a/lf.c b/lf.c index 38e0fed..9c177da 100644 --- a/lf.c +++ b/lf.c @@ -2280,7 +2280,7 @@ void die(lifeform_t *lf) { } // mercy god doesn't like killing - angergodmaybe(R_GODMERCY, 1, GA_MURDER); + //angergodmaybe(R_GODMERCY, 1, GA_MURDER); } } @@ -2780,7 +2780,7 @@ void dumplev(void) { int min,max,prevmin,prevmax; gethitdicerange(i-1, &prevmin, &prevmax, RARITYVARIANCELF, B_FALSE); gethitdicerange(i, &min, &max, RARITYVARIANCELF, B_FALSE); - fprintf(logfile, "Dlev %d (hd >= %d): ",i,min); + fprintf(logfile, "Dlev %d (hd %d-%d): ",i,min,max); for (r = firstrace ; r; r = r->next) { int hd = 0; hd = gethitdicerace(r); @@ -2954,7 +2954,7 @@ int eat(lifeform_t *lf, object_t *o) { // uncooked meat? if (iscorpse(o) && isplayer(lf)) { if (!hasflag(o->flags, F_PREPARED)) { - if (getskill(lf, SK_COOKING)) { + if (!lfhasflag(lf, F_EATING) && getskill(lf, SK_COOKING)) { int ch; char ques[BUFLEN]; more(); @@ -3555,45 +3555,38 @@ void enhanceskills(lifeform_t *lf) { // enhance fist strength f = lfhasflagval(lf, F_HASATTACK, OT_FISTS, NA, NA, NULL); if (f) { - char newtext[BUFLEN]; - strcpy(newtext, f->text); + int newdr; + //newdr = ((lf->level+1) / 2) + 2; + newdr = lf->level+2; + /* switch(lf->level) { case 2: - strcpy(newtext,"1d6"); - break; + newdr = 4; break; case 3: + newdr = 5; break; case 4: - strcpy(newtext,"1d6+1"); - break; + newdr = 6; break; case 5: - strcpy(newtext,"2d4"); - break; + newdr = 7; break; case 6: + newdr = 8; break; case 7: - strcpy(newtext,"3d3"); - break; + newdr = 9; break; case 8: - strcpy(newtext,"2d6"); - break; + newdr = 10; break; case 9: case 10: - strcpy(newtext,"3d4"); - break; + newdr = 11; break; case 11: - strcpy(newtext,"3d4+1"); - break; case 12: + newdr = 12; break; case 13: - strcpy(newtext,"4d4"); - break; case 14: - strcpy(newtext,"4d4+1"); - break; + newdr = 13; break; case 15: - strcpy(newtext,"5d4"); - break; case 16: case 17: + newdr = 14; break; strcpy(newtext,"4d6"); break; case 18: @@ -3609,8 +3602,11 @@ void enhanceskills(lifeform_t *lf) { strcpy(newtext,"6d6"); break; } - if (!streq(newtext, f->text)) { - changeflagtext(f, newtext); + */ + if (newdr != f->val[1]) { + //if (!streq(newtext, f->text)) { + // changeflagtext(f, newtext); + f->val[1] = newdr; if (isplayer(lf)) msg("^gYour unarmed attack damage has increased!"); } } @@ -5766,16 +5762,17 @@ int getlfaccuracy(lifeform_t *lf, object_t *wep) { } // agi scaling on weapon - getflags(wep->flags, retflag, &nretflags, F_ATTREQ, F_NONE); - for (i = 0; i < nretflags; i++) { - if (retflag[i]->val[0] == A_AGI) { - int pctmod; - meetsattreq(lf, retflag[i], wep, &pctmod); - acc += pctmod; + if (wep) { + getflags(wep->flags, retflag, &nretflags, F_ATTREQ, F_NONE); + for (i = 0; i < nretflags; i++) { + if (retflag[i]->val[0] == A_AGI) { + int pctmod; + meetsattreq(lf, retflag[i], wep, &pctmod); + acc += pctmod; + } } } - // modify for nausea if (lfhasflag(lf, F_NAUSEATED)) { acc -= 25; @@ -6694,7 +6691,10 @@ char *real_getlfnamea(lifeform_t *lf, char *buf, int usevis) { enum LFSIZE getlfsize(lifeform_t *lf) { flag_t *f; f = hasflag(lf->flags, F_SIZE); - assert(f); + if (!f) f = hasflag(lf->race->flags, F_SIZE); + if (!f) { + return SZ_HUMAN; + } return f->val[0]; } @@ -7009,7 +7009,7 @@ race_t *getrandomrace(cell_t *c, int forcedepth) { race_t *poss[MAXRANDOMLFCANDIDATES]; int nposs = 0; int selidx; - int db = B_FALSE; + int db = B_TRUE; int depth; int hdmin,hdmax; enum RARITY wantrr = RR_FREQUENT; @@ -7029,7 +7029,7 @@ race_t *getrandomrace(cell_t *c, int forcedepth) { // pick rr... wantrr = pickrr(TT_MONSTER); - if (db) dblog("finding random lf with hitdice %d-%d and rr <= %d\n",hdmin,hdmax, wantrr); + if (db) dblog("finding random lf with hitdice %d-%d and rr <= %d (for depth %d)\n",hdmin,hdmax, wantrr, depth); // try to find a lf of this type which will // fit in the map's habitat @@ -7061,7 +7061,7 @@ race_t *getrandomrace(cell_t *c, int forcedepth) { if (rarflag) { if ((rarflag->val[2] == NA) || (rarflag->val[2] <= wantrr)) { - if (db) dblog("%s has correct rarity rr (%d <= wantr(%d)).",r->name, rarflag->val[2], wantrr); + if (db) dblog("%s has correct rarity rr (%d <= wantrr(%d)).",r->name, rarflag->val[2], wantrr); valid = B_TRUE; thisrr = rarflag->val[2]; } else { @@ -7099,17 +7099,22 @@ race_t *getrandomrace(cell_t *c, int forcedepth) { // nothing found? if (nposs == 0) { - // already at lowest hitdice? - if ((hdmax >= maxmonhitdice) && (hdmin <= 0)) { - // give up - if (db) dblog("no possible lf at all! giving up."); - return NULL; - } + // at frequency "FREQUENT"? Try COMMON. + if (wantrr == RR_FREQUENT) { + if (db) dblog("no possible lfs like this. trying again with rr_common instead of frequent.\n"); + wantrr = RR_COMMON; + } else { + if ((hdmax >= maxmonhitdice) && (hdmin <= 0)) { + // give up + if (db) dblog("no possible lf at all! giving up."); + return NULL; + } - // expand range and try again - hdmax ++; if (hdmax > maxmonhitdice) hdmax = maxmonhitdice; - hdmin --; if (hdmin < 0) hdmin = 0; - if (db) dblog("no possible lfs like this. trying again with hitdice %d-%d\n",hdmin,hdmax); + // expand range and try again + hdmax++; if (hdmax > maxmonhitdice) hdmax = maxmonhitdice; + hdmin--; if (hdmin < 0) hdmin = 0; + if (db) dblog("no possible lfs like this. trying again with hitdice %d-%d\n",hdmin,hdmax); + } } } @@ -7844,14 +7849,14 @@ void givejob(lifeform_t *lf, enum JOB jobid) { f = lfhasflagval(lf, F_HASATTACK, OT_FISTS, NA, NA, NULL); if (f) { // monk fists do more damage - changeflagtext(f, "1d4"); + f->val[1] = 3; } } else if (j->id == J_PIRATE) { flag_t *f; f = lfhasflagval(lf, F_HASATTACK, OT_FISTS, NA, NA, NULL); if (f) { f->val[0] = OT_HOOKHAND; - changeflagtext(f, "1d4"); + f->val[1] = 4; } } else if (j->id == J_SHOPKEEPER) { // shopkeepers are not hostile. @@ -14302,18 +14307,18 @@ void startlfturn(lifeform_t *lf) { } // suffocate? if (lfhasflag(lf, F_NEEDSWATER) && !hasobwithflag(lf->cell->obpile, F_DEEPWATER)) { + int dam; if (isplayer(lf)) { msg("^BYou are suffocating without water to breath!"); } else if (cansee(player, lf)) { - int dam; char lfname[BUFLEN]; getlfname(lf, lfname); msg("^%c%s is suffocating!", getlfcol(lf, CC_VBAD), lfname); - dam = lf->maxhp / 3; - limit(&dam, 1, NA); - losehp(lf, dam, DT_DIRECT, NULL, "suffocation"); - if (isdead(lf)) return; } + dam = lf->maxhp / 3; + limit(&dam, 1, NA); + losehp(lf, dam, DT_DIRECT, NULL, "suffocation"); + if (isdead(lf)) return; } // vampire in sunlight? if ((lf->race->id == R_VAMPIRE) && isoutdoors(lf->cell->map) && !isnighttime()) { diff --git a/objects.c b/objects.c index 3edbb76..2ec8c0d 100644 --- a/objects.c +++ b/objects.c @@ -5129,7 +5129,7 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, int amt; flag_t *f; int db = B_FALSE; - int partdb = B_TRUE; + int partdb = B_FALSE; char *pluralname; char brandname[BUFLEN]; char cursestr[BUFLEN]; @@ -8422,18 +8422,22 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) { enum RARITY pickrr(int whatfor) { enum RARITY wantrr = RR_FREQUENT; - int chance = 3; + int chance = 2; + int mod = 0; if ((gamemode == GM_GAMESTARTED) && hasflag(player->flags, F_EXTRALUCK)) { if (whatfor == TT_OBJECT) { - chance = 2; + wantrr++; } else if (whatfor == TT_MONSTER) { - chance = 4; + mod = 1; } } + // pick rr... while ((wantrr < RR_VERYRARE) && onein(chance)) { wantrr++; + //chance = wantrr + 1 + mod; + chance = 2 + mod; } return wantrr; } diff --git a/save.c b/save.c index e0562b8..2547fa8 100644 --- a/save.c +++ b/save.c @@ -1122,7 +1122,7 @@ int writehiscore(lifeform_t *lf, int *rank) { // add escapes escaped = strdup(killedby); - escaped = strrep(escaped, "'", "\\'", NULL); + escaped = strrep(escaped, "'", "''", NULL); if (!lfhasflag(lf, F_NOSCORE)) { asprintf(&cmd, "insert into 'hiscores' (score,name,job,killedby) VALUES (%ld, '%s', '%s', '%s')", score, pname, jobname, escaped);