From 14eb81566c7ef20e8b342b214ded5d72bfa18bdd Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Fri, 1 Jul 2011 04:05:06 +0000 Subject: [PATCH] - [+] when i pick up an object, if i'm invisible, i need to redraw my cell. - [+] bug: You pour a potion of water onto a cursed -3 pair of leather gloves. A cursed -3 pair of leather gloves gets wet. Your cursed -3 pair of leather gloves gets wet. - [+] -xx weapon shoudll reduce and accuracy(5 each) too - [+] evasion skill helps too much? only increse by 5, not 10?? - [+] test monk #attacks again. * [+] MONK MPDIEC BUG: * [+] put lighting in Jimbo's room! --- defs.h | 1 + io.c | 18 ++++++++++++++ lf.c | 3 ++- objects.c | 62 +++++++++++++++++++++++++++++++++++++++++------- vaults/jimbo.vlt | 5 ++-- 5 files changed, 78 insertions(+), 11 deletions(-) diff --git a/defs.h b/defs.h index 27feb42..65d9f96 100644 --- a/defs.h +++ b/defs.h @@ -1135,6 +1135,7 @@ enum OBTYPE { OT_BLANKET, OT_BLINDFOLD, OT_BUGLAMP, + OT_CANDELABRUM, OT_CANDLE, OT_GUNPOWDER, OT_LAMPOIL, diff --git a/io.c b/io.c index e79fb16..cdbf248 100644 --- a/io.c +++ b/io.c @@ -4672,6 +4672,24 @@ void domsghist(void) { void dooperate(obpile_t *op) { object_t *o; + // operable objects here? + for (o = player->cell->obpile->first; o ; o = o->next) { + if (isoperable(o)) { + char obname[BUFLEN],buf[BUFLEN]; + int ch; + getobname(o, obname, o->amt); + sprintf(buf, "There %s %s here. Operate %s", + (o->amt == 1) ? "is" : "are", + obname, + (o->amt == 1) ? "it" : "one"); + ch = askchar(buf, "yn","n", B_TRUE); + if (ch == 'y') { + operate(player, o, NULL); + return; + } + } + } + // ask which object to read o = askobject(op, "Operate what", NULL, AO_OPERABLE); if (o) { diff --git a/lf.c b/lf.c index da98c77..f55c7d6 100644 --- a/lf.c +++ b/lf.c @@ -3835,7 +3835,8 @@ int getevasion(lifeform_t *lf) { ev += gethitdice(lf); // skill based - ev += (getskill(lf, SK_EVASION)*10); + //ev += (getskill(lf, SK_EVASION)*10); + ev += (getskill(lf, SK_EVASION)*5); // now get object penalties/bonuses for (o = lf->pack->first ; o ; o = o->next) { diff --git a/objects.c b/objects.c index 9c7274c..3433bee 100644 --- a/objects.c +++ b/objects.c @@ -421,6 +421,7 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int wantlinkholes int n; int bookcontents = -1; enum DEPTH wantdepth = DP_MAX; + int wantlit = B_FALSE; int wantrarity = RR_NONE; int wantgoodness = G_NA; int donesomething; @@ -560,6 +561,11 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int wantlinkholes doorflag[ndoorflags++] = F_SECRET; p += strlen("secret "); donesomething = B_TRUE; + // tool flags + } else if (strstarts(p, "lit ")) { + wantlit = B_TRUE; + p += strlen("lit "); + donesomething = B_TRUE; // rarity } else if (strstarts(p, "common ")) { wantrarity = RR_COMMON; @@ -959,6 +965,11 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int wantlinkholes } } + // tool flags + if (o && hasflag(o->flags, F_LIGHTSOURCE) && wantlit) { + turnon(NULL, o); + } + // fill in book types if (o && (o->type->obclass->id == OC_BOOK)) { hiddenname_t *hn,*selhn = NULL; @@ -2893,9 +2904,6 @@ int getobaccuracy(object_t *wep, lifeform_t *weilder) { acc = 100; // default accuracy of 100% if (wep) { - // blessed weapons have better base accuracy - if (wep->blessed == B_BLESSED) acc += 50; - // override with weapon's (lack of) accuracy f = hasflag(wep->flags, F_ACCURACY); if (f) { @@ -2905,6 +2913,11 @@ int getobaccuracy(object_t *wep, lifeform_t *weilder) { acc = f->val[0]; } + // blessed weapons have better base accuracy + if (wep->blessed == B_BLESSED) acc += 50; + + acc += (getobbonus(wep)*5); + if (weilder) { skill_t *sk; // modify for weilder's skill @@ -3887,6 +3900,8 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan sprintf(basename, "%s water", getwaterdepthname(getobdepth(o, player))); } else { strcpy(basename, ""); + + // show "lit candle" etc if (isactivated(o) && hasflag(o->flags, F_ACTIVATEPREFIX)) { f = hasflag(o->flags, F_ACTIVATEPREFIX); sprintf(basename, "%s ", f->text); @@ -6985,6 +7000,21 @@ void initobjects(void) { addflag(lastot->flags, F_HOLDCONFER, F_PRODUCESLIGHT, 2, IFKNOWN, NULL); addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "a flask"); + /// TODO: should we make a new object class "furniture" for this? + addot(OT_CANDELABRUM, "candelabrum", "A large (and heavy) decorative candle, about human height.", MT_METAL, 60, OC_TOOLS); + addflag(lastot->flags, F_GLYPH, C_YELLOW, NA, NA, "\\"); + addflag(lastot->flags, F_RARITY, H_DUNGEON, 85, NA, 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"); + addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 4, NA, NULL); + addflag(lastot->flags, F_PRODUCESLIGHT, 4, NA, IFACTIVE, NULL); + addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL); + addflag(lastot->flags, F_RODSHAPED, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_CHARGELOWMSG, B_TRUE, NA, NA, "flickers"); + addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out"); + addot(OT_CANDLE, "candle", "A short wax candle.", MT_WAX, 0.2, OC_TOOLS); addflag(lastot->flags, F_RARITY, H_DUNGEON, 90, NA, NULL); addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL); @@ -7064,6 +7094,9 @@ void initobjects(void) { addflag(lastot->flags, F_DAM, DT_FIRE, NA, NA, "1d4"); addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL); addflag(lastot->flags, F_USESSKILL, SK_CLUBS, NA, NA, NULL); + addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL); + addflag(lastot->flags, F_CHARGELOWMSG, B_TRUE, NA, NA, "flickers"); + addflag(lastot->flags, F_CHARGEOUTMSG, B_TRUE, NA, NA, "goes out"); addot(OT_TOWEL, "towel", "An large absorbent cloth used for drawing off moisture.", MT_CLOTH, 1.5, OC_TOOLS); addflag(lastot->flags, F_RARITY, H_DUNGEON, 73, NA, NULL); @@ -9723,9 +9756,18 @@ object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok) { } } - if (o && dst->where && !dst->where->lf && !hasflag(o->flags, F_NOGLYPH) && haslos(player, dst->where)) { - needredraw = B_TRUE; - drawscreen(); + if (o && dst->where && !hasflag(o->flags, F_NOGLYPH) && haslos(player, dst->where)) { + if ((dst->where->lf) && !cansee(player, dst->where->lf)) { + // we can see the floor here + // someone invisible there who we can't see + needredraw = B_TRUE; + drawscreen(); + } else { + // we can see the floor here + // noone there + needredraw = B_TRUE; + drawscreen(); + } } // special effects when an object moves @@ -10972,7 +11014,11 @@ int pour(lifeform_t *lf, object_t *o) { } else { // default if (isplayer(lf)) { msg("You pour %s onto %s.", obname,dstname); - msg("%s gets wet.", dstname); + if (!hasflag(dst->flags, F_CANGETWET)) { + msg("%s gets wet.", dstname); + // if it DOES have this flag, then we'll announce this + // during takedamage. + } } takedamage(dst, 0, DT_WATER); } @@ -12484,7 +12530,7 @@ int real_takedamage(object_t *o, unsigned int howmuch, int damtype, int wantanno // catches on fire? if (damtype == DT_FIRE) { - if ( ((o->type->id == OT_CANDLE) || (o->type->id == OT_TORCH)) && + if ( ((o->type->id == OT_CANDLE) || (o->type->id == OT_TORCH) || (o->type->id == OT_CANDELABRUM)) && !isactivated(o)) { cell_t *c; c = getoblocation(o); diff --git a/vaults/jimbo.vlt b/vaults/jimbo.vlt index 1059b15..c239785 100644 --- a/vaults/jimbo.vlt +++ b/vaults/jimbo.vlt @@ -3,11 +3,11 @@ @map ############ -#........|,# +#....c...|,# #....-/-.### +......@.|,# #..-/-...### -#........|,# +#....c...|,# ############ @end @@ -18,6 +18,7 @@ +:ob:wooden door /:ob:wooden table -:ob:wooden footstool +c:ob:lit candelabrum @:mon:Jimbo @end