From 499ef0c0e1a480ea04026213c4e132668b62f6fb Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 20 Jan 2012 02:46:34 +0000 Subject: [PATCH] - [+] weapon/armour shop: - [+] pay to repair. 3 gold per hp. then modify total by speech. - [+] "splash of water" shouldn't stop you from running. at the moment when your boots are wet you can never run because you keep dropping water! - [+] make delvers vuln to light - [+] reduce potion of growth rarity - [+] make resist poison skillcheck difficulty harder. - [+] make holycircle/pentagram detect cursed/blessed items too - [+] "your %s feels warm/cold" - [+] spear shoudl have f_rodshaped - [+] light not blinding creatures for long enough - [+] The area is lit by a magical light! The skeleton is blinded! The skeleton turns to flee from you! The skeleton can see again. --- attack.c | 2 +- data.c | 16 +++++++---- data/hiscores.db | Bin 13312 -> 13312 bytes defs.h | 3 ++ lf.c | 2 +- map.c | 6 ++-- objects.c | 14 +++++++-- shops.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++ shops.h | 1 + spell.c | 6 ++-- 10 files changed, 107 insertions(+), 15 deletions(-) diff --git a/attack.c b/attack.c index 7478e09..42b6ddb 100644 --- a/attack.c +++ b/attack.c @@ -2398,7 +2398,7 @@ void wepeffects(flagpile_t *fp, cell_t *where, flag_t *damflag, int dam) { if (f->val[1] != NA) { int scdiff; if (f->val[2] == NA) { - scdiff = 20; // default + scdiff = 30; // default } else { scdiff = f->val[2]; } diff --git a/data.c b/data.c index 7638ad8..a7c9d03 100644 --- a/data.c +++ b/data.c @@ -962,7 +962,7 @@ void initobjects(void) { addobmod(OM_SHODDY,"shoddy"); addflag_real(lastobmod->flags, F_SHODDY, B_TRUE, NA, NA, NULL, PERMENANT, B_KNOWN, -1); addobmod(OM_POISONED,"poisoned"); - addflag_real(lastobmod->flags, F_HITCONFER, F_POISONED, SC_POISON, 25, "15-30", PERMENANT, B_KNOWN, -1); + addflag_real(lastobmod->flags, F_HITCONFER, F_POISONED, SC_POISON, 30, "15-30", PERMENANT, B_KNOWN, -1); addflag_real(lastobmod->flags, F_HITCONFERVALS, P_VENOM, 1, NA, NULL, PERMENANT, B_KNOWN, -1); addobmod(OM_WET1,"damp"); addflag_real(lastobmod->flags, F_WET, W_DAMP, NA, NA, NULL, PERMENANT, B_KNOWN, -1); @@ -1471,8 +1471,9 @@ void initobjects(void) { addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_SHOPMENU, 0, MA_GOTOMENU, SM_PURCHASEITEMS, "a:buy something"); addflag(lastot->flags, F_SHOPMENU, 1, MA_GOTOMENU, SM_DONATE, "d:donate something"); - addflag(lastot->flags, F_SHOPMENU, 2, MA_GOTOMENU, SM_RESIZE, "r:resize equipment"); - addflag(lastot->flags, F_SHOPMENU, 3, MA_QUIT, NA, "q:leave"); + addflag(lastot->flags, F_SHOPMENU, 2, MA_GOTOMENU, SM_REPAIR, "r:repair equipment"); + addflag(lastot->flags, F_SHOPMENU, 3, MA_GOTOMENU, SM_RESIZE, "s:resize equipment"); + addflag(lastot->flags, F_SHOPMENU, 4, MA_QUIT, NA, "q:leave"); for (i = 0; i < 10; i++) { addflag(lastot->flags, F_STARTOBCLASS, 100, OC_ARMOUR, RANDOM, NULL); } @@ -1571,7 +1572,7 @@ void initobjects(void) { addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "."); - addflag(lastot->flags, F_REPELBLESSED, B_CURSED, NA, NA, NULL); + addflag(lastot->flags, F_REPELBLESSED, B_CURSED, B_BLESSED, NA, NULL); addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL); addot(OT_PENTAGRAM, "pentagram", "A area imbued with evil.", MT_NOTHING, 0, OC_DFEATURE, SZ_LARGE); @@ -1580,7 +1581,7 @@ void initobjects(void) { addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "."); - addflag(lastot->flags, F_REPELBLESSED, B_BLESSED, NA, NA, NULL); + addflag(lastot->flags, F_REPELBLESSED, B_BLESSED, B_CURSED, NA, NULL); addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL); @@ -2214,7 +2215,7 @@ void initobjects(void) { addot(OT_POT_CANINETRACKING, "potion of canine tracking", "Mimics the effects of a 'canine tracking' spell.", MT_GLASS, 1, OC_POTION, SZ_TINY); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addot(OT_POT_GROWTH, "potion of growth", "A magical liquid which causes the imbiber's body to instantly undergo rapid growth.", MT_GLASS, 1, OC_POTION, SZ_TINY); - addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL); addflag(lastot->flags, F_VALUE, 50, NA, NA, NULL); addot(OT_POT_HEALINGMIN, "potion of minor healing", "Restores 1-10 health to whoever drinks it.", MT_GLASS, 1, OC_POTION, SZ_TINY); @@ -4766,6 +4767,7 @@ void initobjects(void) { addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DTVULN, DT_FIRE, NA, NA, "0d1+100"); addflag(lastot->flags, F_LINKOB, OT_POT_WATER, NA, NA, NULL); + addflag(lastot->flags, F_COSMETIC, B_TRUE, NA, NA, NULL); addot(OT_MUDPOOL, "pool of mud", "A large puddle of wet mud.", MT_WATER, 60, OC_MISC, SZ_MEDIUM); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL); @@ -6517,6 +6519,7 @@ void initobjects(void) { addflag(lastot->flags, F_USESSKILL, SK_POLEARMS, NA, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 50, 5, NULL); addflag(lastot->flags, F_CRITCHANCE, 1, NA, NA, NULL); + addflag(lastot->flags, F_RODSHAPED, B_TRUE, NA, NA, NULL); addot(OT_TRIDENT, "trident", "A three-pronged stabbing weapon.", MT_METAL, 5, OC_WEAPON, SZ_HUMAN); addflag(lastot->flags, F_RARITY, H_DUNGEON, 75, NA, NULL); addflag(lastot->flags, F_RARITY, H_CAVE, 75, NA, NULL); @@ -7268,6 +7271,7 @@ void initrace(void) { addflag(lastrace->flags, F_STARTSKILL, SK_METALWORK, PR_NOVICE, NA, NULL); // penalties addflag(lastrace->flags, F_MPMOD, -3, NA, NA, NULL); + addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, "1d6"); addflag(lastrace->flags, F_TAMABLE, 35, NA, NA, NULL); diff --git a/data/hiscores.db b/data/hiscores.db index 89e21b093300100425a7ce1f90c9123564981e55..579f9de739c8791fd37001c37944468c89523bd3 100644 GIT binary patch delta 1179 zcmZA0e@s7|-I`20(H{Y{;-t)Y_&Uv=? ziBw0b_dc8yF#k8(%dr(B$OxbvUXXwoMlgszOk)h)Xm_*XE+FiSrg)Qa8$JBd7mcye zqUf`BL#2oBsRRs}opRFPHs&ycNpEuuKVblu(dC_d4sAG&Rvg9we2!)`p%L}ig9t*X zMGdO416#2f6?hJ12%-c9ScP0&W7hdqesJTPu>1}$8{!9O%H|ZR`L1*b-bcRmTKj{>m zq<_!}`a2z`V_|l`(O>Cx`U{QGYxFApnU2z7`Xe2pgY*g=p#8L$UZ$655BASgY_{2qz(excNTs9;R~1NXbzd;kCd delta 1636 zcmZ{keN2^A9LLY^_q)%9d*uRlWAZv4H$hE7(3dk1ml&6Gd7 zpv`K76+WBNi`A0MHSwi8ZJBNuTA(JCWno$h1zJ`{issAgoZo%eTwC{SpL@RF-^)4Y zd3K&AZY&?7ru}0VmrQojo5%|umqRDA-IVF z>W01W0S!SrY{ph-f<~yv7>a{(SV3)22)VQhvLF+t2jBqir>AHcU5B?YnR>}dYV&4Eu^X zTX8Ywz-98$6dZ*XIEKGdGNsGmll|1_0OujOybz!#9R&jV>mYIDKpA=d# zdw=Jd-iYeD63fgj{H$aVR+{oCzAUt5$}3cOLSd;wK%oE)Gw&7LCbWFzEntK~o(Jc0E-7viy%9}-t%!(g5+8q;m zVxLMCK=B5fx5u92D9bxpW`{3W{^1c8^2n6;RKrQ^9Via9+0SY>Z8R6T&ieE9W`oaE zMLc~cBIBr4Xt8n@dgdJ}FChMsHLTruWym0R6F*I6m%w~iPuz5QuY?d)6q0n%s}Tfm)On? zW*S3j$;MSjrcIu<1e{Y{YmJHVNzrxnzS`BEbZO3z<{Ymy6YS+xe!p9<^4HZF6C+(l z&4XFGgWAP7ST0~Wya725?!G)>Hl9<=`Z(Jxr6td5FX}`tJ&djFf8$Im>sB7P$zhxJs3GDgN(V(D5J@_ z^Z}XUlCLH$yKby^uyb-z_%!K{7mb4YXd6}1Y_iI4`6evH7`Q0E*^Q776U2bnEmIb? VEldjLXPg8}R&$*-7?(K={{m(BO3nZP diff --git a/defs.h b/defs.h index 34be441..ee48b39 100644 --- a/defs.h +++ b/defs.h @@ -2033,6 +2033,7 @@ enum FLAG { F_STARTBLESSED, // v0 = b_blessed or b_cursed F_REPELBLESSED, // v0 = b_blessed or b_cursed. repels other obejcts // of this blesstype. + // if v1 == b_blessed or b_cursed, will ID these blessings/curses F_TRAIL, // this object denotes the trail left by a lf. // v0 = raceid of lf who left it // v1 = direction the lf moved out of this cell @@ -2067,6 +2068,7 @@ enum FLAG { // v0 is either NA (white) or colourid (C_xxx). F_NOGLYPH, // this object doesn't appear normally F_COSMETIC, // this object is mostly cosmetic, don't say 'you see xx' + // also don't stop the player running past it. F_INVISOB, // this object cannot be seen F_NOPICKUP, // cannot pick this up F_ATTACKABLE, // can attack this with 'A' @@ -3937,6 +3939,7 @@ enum SHOPMENU { SM_REST = -7, // weapon/armour shops SM_RESIZE = -8, + SM_REPAIR = -9, }; enum SHOPRETURN { diff --git a/lf.c b/lf.c index 3beae5d..caf46da 100644 --- a/lf.c +++ b/lf.c @@ -12620,7 +12620,7 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml } } else if (damtype == DT_POISONGAS) { if (amt > 0) { - if (!skillcheck(lf, SC_POISON, 25, 0)) { + if (!skillcheck(lf, SC_POISON, 35, 0)) { // HARD. poison(lf, rnd(5,10), P_GAS, 2, "poison gas"); } } diff --git a/map.c b/map.c index a494560..b9c59d0 100644 --- a/map.c +++ b/map.c @@ -6697,8 +6697,10 @@ void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong) { if (gamemode == GM_GAMESTARTED) { lifeform_t *lf; for (lf = c->map->lf ; lf ; lf = lf->next) { - //if (haslos(lf, c) || haslosdark(lf, c)) { - if (distfunc(lf->cell,c) <= (radius + MAXVISRANGE)) { + //OLD: if (haslos(lf, c) || haslosdark(lf, c)) { + // need to verify lf->cell because it might be NULL if we're + // swapping places with someone else. + if (lf->cell && (distfunc(lf->cell,c) <= (radius + MAXVISRANGE))) { setlosdirty(lf); } } diff --git a/objects.c b/objects.c index 0ce7356..fb0d602 100644 --- a/objects.c +++ b/objects.c @@ -5061,7 +5061,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan case OT_RING_STR: f = hasflag(o->flags, F_EQUIPCONFER); if (f) { - snprintf(buf2, BUFLENSMALL, "%s%d ",(f->val[2] < 0) ? "-" : "+", abs(f->val[2])); + snprintf(buf2, BUFLENSMALL, "%s%d ",(f->val[2] < 0) ? "-" : "+", abs(f->val[2])/5); strcat(localbuf, buf2); } break; @@ -12408,7 +12408,7 @@ void timeeffectsob(object_t *o) { } } - // sacred ground? + // sacred ground object repel sg = hasobwithflagval(location->obpile, F_REPELBLESSED, o->blessed, NA, NA, NULL); if (sg) { char sgname[BUFLEN]; @@ -12454,6 +12454,16 @@ void timeeffectsob(object_t *o) { return; } } + if (isplayer(o->pile->owner)) { + // sacred ground bless/curse detect + sg = hasobwithflagval(location->obpile, F_REPELBLESSED, NA, o->blessed, NA, NULL); + if (sg && !o->blessknown) { + // announce + msg("Your %s feels very %s!", noprefix(obname), (o->blessed == B_BLESSED) ? "warm" : "cold"); + // player now knows that this is blessed/cursed + o->blessknown = B_TRUE; + } + } if (hasflag(o->flags, F_TANGLEMISSILE)) { if (!location || !location->lf) { diff --git a/shops.c b/shops.c index 2547d86..06218ba 100644 --- a/shops.c +++ b/shops.c @@ -22,6 +22,7 @@ #define DEF_BLESSCOST 50 #define DEF_SURCHARGE 15 #define DEF_RESIZECOST 80 +#define DEF_REPAIRCOSTPERHP 5 extern enum GAMEMODE gamemode; extern prompt_t prompt; @@ -162,6 +163,9 @@ void shop(lifeform_t *lf, object_t *vm) { } else if (curmenu == SM_RESIZE) { shopfunc = shopresize; shoparg = &ndonated; + } else if (curmenu == SM_REPAIR) { + shopfunc = shoprepair; + shoparg = &ndonated; } if (shopfunc) { @@ -789,6 +793,74 @@ enum SHOPRETURN shoppurchase(lifeform_t *lf, object_t *vm, int starty, char *top return SR_CONTINUE; } +enum SHOPRETURN shoprepair(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *ndonated) { + object_t *o; + char ch,buf[BUFLEN]; + int y,hpcost; + char obname[BUFLEN]; + flag_t *f; + y = starty; + + hpcost = DEF_REPAIRCOSTPERHP; + + + // get list of objects to repair + sprintf(buf, "Repair which object (you have $%d)?", countmoney(lf->pack)); + initprompt(&prompt, buf); + for (o = player->pack->first ; o ; o = o->next) { + if (isarmour(o) && isdamaged(o)) { + char desc[BUFLEN]; + int thiscost; + + // determine cost... + f = hasflag(o->flags, F_OBHP); + thiscost = applyshoppricemod((f->val[1] - f->val[0]) * hpcost, lf); + // add to prompt + getobname(o, obname, o->amt); + sprintf(desc, "%s ($%d)", obname,thiscost); + addchoice(&prompt, o->letter, desc, desc, o, NULL); + } + } + addchoice(&prompt, '-', "(nothing)", NULL, NULL, NULL); + + + mvwprintw(mainwin, y, 0, "We offer repair services for most kinds armour."); y+=2; + if (prompt.nchoices == 1) { + mvwprintw(mainwin, y, 0, "You have no armour in need of repair."); y += 2; + mvwprintw(mainwin, y, 0, "[Press any key]"); + } else { + mvwprintw(mainwin, y, 0, "Pay to repair your armour (you have $%d) [yn]? ", countmoney(lf->pack)); + } + + ch = getch(); + if ((prompt.nchoices == 1) || (ch != 'y')) { + return SR_BACK; + } + + + // ask which object + ch = getchoice(&prompt); + + o = (object_t *)prompt.result; + if (o) { + int thiscost; + // determine cost... + f = hasflag(o->flags, F_OBHP); + thiscost = applyshoppricemod((f->val[1] - f->val[0]) * hpcost, lf); + if (thiscost > countmoney(player->pack)) { + msg("You can't afford to repair that item!"); more(); + return SR_CONTINUE; + } + msg("You hand over $%d.", thiscost); more(); + givemoney(player, NULL, thiscost); + f->val[0] = f->val[1]; + getobname(o, obname, o->amt); + msg("Your %s %s completely repaired.", obname, (o->amt == 1) ? "is" : "are"); more(); + } + + return SR_CONTINUE; +} + enum SHOPRETURN shopresize(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *ndonated) { object_t *o; char ch,buf[BUFLEN]; diff --git a/shops.h b/shops.h index 360805c..9967acc 100644 --- a/shops.h +++ b/shops.h @@ -9,6 +9,7 @@ enum SHOPRETURN shopdonate(lifeform_t *lf, object_t *vm, int starty, char *topte enum SHOPRETURN shopdetectcurse(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); enum SHOPRETURN shopmiracle(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); enum SHOPRETURN shoppurchase(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); +enum SHOPRETURN shoprepair(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); enum SHOPRETURN shopresize(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); enum SHOPRETURN shoprest(lifeform_t *lf, object_t *vm, int starty, char *toptext, int *npurchased); diff --git a/spell.c b/spell.c index da0dad0..2405e2f 100644 --- a/spell.c +++ b/spell.c @@ -1905,7 +1905,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // announce if (cansee(player, target)) { - msg("%s suck%s blood from %s!", username, isplayer(user) ? "" : "s", targetname); + msg("^%c%s suck%s blood from %s!", getlfcol(target, CC_BAD), username, isplayer(user) ? "" : "s", targetname); } // fixed damage? @@ -7710,11 +7710,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // if you don't have eyes, your'e safe! if (!lfhasflagval(l, F_NOBODYPART, BP_EYES, NA, NA, NULL)) { // blind for 1-3 turns - addtempflag(l->flags, F_BLIND, B_TRUE, NA, NA, NULL, rnd(1,3)); + addtempflag(l->flags, F_BLIND, B_TRUE, NA, NA, NULL, rnd(3,5)); } } // undead will flee from light - if (isundead(l)) { + if (isundead(l) && !skillcheck(l, SC_WILL, 20, 0)) { // runs away from caster addtempflag(l->flags, F_FLEEFROM, caster->id, NA, NA, NULL, 20); }