From 660481c27e62c82929752ae1560c696d116f1865 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Wed, 1 Feb 2012 20:56:07 +0000 Subject: [PATCH] - [+] show varpower spell effects in @E - [+] don't say "you hear xxx" for your pet's footsteps - [+] when hungry, ekrub likes eating animal corpses, rather than killing animals - [+] failed spells now always make spelleffect() return B_TRUE. - [+] stickstosnakes now works on non-wood objects. - [+] light spell can only blind people at high level - [+] amberon shouls accept sacfirice of evil corpses - [+] tweak potion rarity - [+] attacking helpless evil creatures shoudln't anger amberon --- attack.c | 35 ++++++- data.c | 16 ++-- data/hiscores.db | Bin 13312 -> 13312 bytes god.c | 117 +++++++++++++---------- io.c | 21 ++++- lf.c | 29 ++++-- spell.c | 238 ++++++++++++++++++++++++++++++++++------------- spell.h | 2 +- 8 files changed, 329 insertions(+), 129 deletions(-) diff --git a/attack.c b/attack.c index 2ae4a55..4c768a1 100644 --- a/attack.c +++ b/attack.c @@ -220,6 +220,39 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) { attackedpeaceful = B_TRUE; } + // above average wisdom will prvent you from annoying your god + if (getattrbracket(getattr(lf, A_WIS), A_WIS, NULL) >= AT_GTAVERAGE) { + if (!force && isplayer(lf)) { + enum HELPLESSTYPE how; + if (ishelplessvictim(c->lf, lf, &how)) { + int dowarning = B_FALSE; + if (godprayedto(R_GODPURITY) && (getalignment(c->lf) != AL_EVIL)) { + dowarning = B_TRUE; + } else if (godprayedto(R_GODMERCY)) { + dowarning = B_TRUE; + } + if (dowarning) { + char victimname[BUFLEN],buf[BUFLEN]; + getlfname(c->lf, victimname); + snprintf(buf, BUFLEN, "Really attack the %s %s?", + (how == HL_FLEEING) ? "fleeing" : "helpless", + noprefix(victimname)); + if (!warnabout(buf)) { + return B_TRUE; + } + } + } + } + if (!force && isplayer(lf) && (getraceclass(c->lf) == RC_PLANT) && godprayedto(R_GODNATURE)) { + char victimname[BUFLEN],buf[BUFLEN]; + getlfname(c->lf, victimname); + snprintf(buf, BUFLEN, "Really attack %s?",victimname); + if (!warnabout(buf)) { + return B_TRUE; + } + } + } + if (!force && isplayer(lf) && lfhasflag(lf, F_HASNEWLEVEL)) { if (!warnabout(TEXT_WARN_ATTACK_NOXP)) { return B_TRUE; @@ -510,8 +543,8 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) { } } else if (attackedhelpless) { angergodmaybe(R_GODMERCY, 50, GA_ATTACKHELPLESS); - angergodmaybe(R_GODPURITY, 50, GA_ATTACKHELPLESS); if (getalignment(attacktarget) != AL_EVIL) { + angergodmaybe(R_GODPURITY, 50, GA_ATTACKHELPLESS); pleasegodmaybe(R_GODTHIEVES, 5); pleasegodmaybe(R_GODDEATH, 10); } diff --git a/data.c b/data.c index 0a3ba7d..1dd3505 100644 --- a/data.c +++ b/data.c @@ -2326,10 +2326,10 @@ void initobjects(void) { addflag(lastot->flags, F_VALUE, 75, NA, NA, NULL); addot(OT_POT_ETHEREALNESS, "potion of etherealness", "Allows the walker to temporarily pass through walls.", MT_GLASS, 1, OC_POTION, SZ_TINY); - addflag(lastot->flags, F_RARITY, H_ALL, 70, NA, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 70, RR_RARE, NULL); addflag(lastot->flags, F_VALUE, 140, NA, NA, NULL); addot(OT_POT_EXPERIENCE, "potion of experience", "Instantly grants the imbiber the next experience level.", MT_GLASS, 1, OC_POTION, SZ_TINY); - addflag(lastot->flags, F_RARITY, H_ALL, 100, NA, NULL); + addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL); addflag(lastot->flags, F_AIBOOSTITEM, B_TRUE, 40, NA, NULL); addflag(lastot->flags, F_VALUE, 210, NA, NA, NULL); @@ -3554,6 +3554,7 @@ void initobjects(void) { addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL); addot(OT_S_LIGHT, "light area", "Creates a temporary light source centred on the caster.", MT_NOTHING, 0, OC_SPELL, SZ_TINY); addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At Power III, you can control where the light appears."); + addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At Power V, the light will blind creatures with night vision."); addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At Power VIII, the light becomes permenant."); addflag(lastot->flags, F_SPELLSCHOOL, SS_MODIFICATION, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_LIFE, NA, NA, NULL); @@ -6130,7 +6131,7 @@ void initobjects(void) { addflag(lastot->flags, F_ARMOURPIERCE, 90, NA, NA, ""); addflag(lastot->flags, F_DAM, DT_TOUCH, 1, NA, NULL); addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL); - addflag(lastot->flags, F_HITCONFER, F_PARALYZED, SC_CON, 22, "2-4"); + addflag(lastot->flags, F_HITCONFER, F_PARALYZED, SC_CON, 22, "1-2"); addflag(lastot->flags, F_HITCONFERVALS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_USESSKILL, SK_NONE, NA, NA, NULL); @@ -6139,7 +6140,7 @@ void initobjects(void) { addflag(lastot->flags, F_ARMOURPIERCE, 90, NA, NA, ""); addflag(lastot->flags, F_DAM, DT_TOUCH, 1, NA, NULL); addflag(lastot->flags, F_ACCURACY, 100, NA, NA, NULL); - addflag(lastot->flags, F_HITCONFER, F_PARALYZED, SC_CON, 30, "5-10"); + addflag(lastot->flags, F_HITCONFER, F_PARALYZED, SC_CON, 30, "3-5"); addflag(lastot->flags, F_HITCONFERVALS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOSTRDAMMOD, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_USESSKILL, SK_NONE, NA, NA, NULL); @@ -6592,8 +6593,8 @@ void initobjects(void) { addflag(lastot->flags, F_ATTREQ, A_AGI, 65, 80, "10"); addflag(lastot->flags, F_CRITCHANCE, 1, NA, NA, NULL); addot(OT_PITCHFORK, "pitchfork", "A multi-pronged agricultural tool designed to lift loose material. Works as a makeshift weapon.", MT_METAL, 5, OC_WEAPON, SZ_HUMAN); - addflag(lastot->flags, F_RARITY, H_DUNGEON, 85, RR_FREQUENT, NULL); - addflag(lastot->flags, F_RARITY, H_FOREST, 85, RR_FREQUENT, NULL); + addflag(lastot->flags, F_RARITY, H_DUNGEON, 85, RR_COMMON, NULL); + addflag(lastot->flags, F_RARITY, H_FOREST, 85, RR_COMMON, NULL); addflag(lastot->flags, F_DAM, DT_SLASH, 3, NA, NULL); addflag(lastot->flags, F_ALTDAM, DT_BASH, 3, NA, NULL); addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL); @@ -7653,6 +7654,7 @@ void initrace(void) { } } addflag(lastrace->flags, F_SACRIFICEOBBLESSED, B_CURSED, NA, 5, "OB explode#S in a shower of sparks!"); + addflag(lastrace->flags, F_SACRIFICEOB, OT_CORPSE, NA, 10, "OB IS consumed by a shaft of holy light."); addflag(lastrace->flags, F_CANWILL, OT_S_WISHLIMITED, NA, NA, "pw:10;"); addflag(lastrace->flags, F_CANWILL, OT_S_PLANESHIFT, NA, NA, "pw:1;"); @@ -7764,7 +7766,7 @@ void initrace(void) { } } addflag(lastrace->flags, F_GODPOISON, B_FALSE, 25, NA, NULL); - addflag(lastrace->flags, F_GODLIKES, NA, NA, NA, "killing animals when hungry"); + addflag(lastrace->flags, F_GODLIKES, NA, NA, NA, "eating animals when hungry"); addflag(lastrace->flags, F_GODLIKES, NA, NA, NA, "killing dragons"); addflag(lastrace->flags, F_GODLIKES, NA, NA, NA, "cooking"); addflag(lastrace->flags, F_GODLIKES, NA, NA, NA, "creating objects"); diff --git a/data/hiscores.db b/data/hiscores.db index 18f860a1f1290ba0a4af4a88046e5263a3e2f9a1..19eb638df403163ed1a7bebb9fe970e901b05ed1 100644 GIT binary patch delta 657 zcmYjNT}V@57=C|_XU9#^ZT{5MaRRH&&9&hwLM<=_!!(O7!fxE!%;|n;ZBo|7I4DMi zsGpD_1qD%8L7c8Ex`>35W_lwP-V}5x1VIo;bv7^R{a*Oq?|q-|d3fI3aBg^}uDlO+ zLNP9U=GtUM;T1L>X1z>$#j;VAYc{cF@|9{}#tn$zv@j_hqDR@cdxEY|n&LD_19X=9 zsGB;djSi7t%qZ33vEnJ?Dr%%AoGzT%OG|PI1EF2amv%@r1G4yB+NYqk*tH42c~Igz zMt9ykL0Bmqmbg?H={GIoio=36fHl~QQ@Dh`$VDL%^p^d6S9ex@A&kz|MlHMsK_I)Q z6;F#j)lM;8o2kD67RUqSk+B^!_!PfV4V|MOJj9E-bJqw-+zg}oZO1i4(3SdalZ>1P z&g<63Et<`3SpAw^Hdx)Qreo<;_~ckn^fx$M`!B1B(1ob49JURGWq@Tof@yq+pQwV4 z(*k{D8?W-JP+gnEC-mR09+HfGPKsVnf1wD72cAJU1)&m7fsvE&9KK@^M{p6>i6}<* zXq_8*fJKp~$-7s7>HUUDkY)FM@h>&^ywJe3H?qIz544T)R+u2{2HQAD=LPl}!c zYIimfN~)ddY%J0fi^ro8HGEYKsiUcIDjxCuWA^Rr=zn}yC=*TYz%LG`vTOsSRPO%T;)PMyrXYp%e8bW$l5 zF+GEd3R1cbmG>&8CtCZVV=%K8oGMMTt<@^zC!oC3~pO5a|& zMi%4UO=EE8pkq8`U!`2)zvM*R~x7{loi4gFy6N2X*5U6Z01&;;g@`uUyB;g zF7e52mztBO<=N_9{g~$?N{z`eS>IcK0>^Der)_W@Ad42mc?}=nGL?~^X6Xg3aW$Xf zJDf2NbVJ9czj+)m#5VLmT=Pv@bD!C;hn+d)MzO^R>kh%gyb+CR=edz!)L5g5P`qm- n7L0`Y)xI&qjzO(2VhKm9M%8#Q77oRQdv}Kr4I}!1_c{Fq!PK@$ diff --git a/god.c b/god.c index 54270c9..5ff7f4f 100644 --- a/god.c +++ b/god.c @@ -464,6 +464,16 @@ void dooffer(void) { } } } + + // special case - amberon only accepts evil corpses + if (validcorpse && (god->race->id == R_GODPURITY) && (o->type->id == OT_CORPSE)) { + flag_t *ff; + ff = hasflag(o->flags, F_ALIGNMENT); + if (!ff || (ff->val[0] != AL_EVIL)) { + validcorpse = B_FALSE; + } + } + if (validcorpse) { ok = B_TRUE; thispiety = f->val[2]; @@ -634,14 +644,10 @@ lifeform_t *getrandomgod(void) { // get a random god which player has prayed to lifeform_t *getrandomprayedgod(void) { - int i,nposs = 0; - lifeform_t *god,*poss[MAXGODS]; - for (i = 0; i < ngodlfs; i++) { - god = godlf[i]; - if (lfhasflag(god, F_PRAYEDTO)) { - poss[nposs++] = god; - } - } + int nposs; + lifeform_t *poss[MAXGODS]; + + getprayedgods(poss, &nposs); if (nposs == 0) { return NULL; } @@ -950,12 +956,9 @@ int godgiftmaybe(enum RACE rid, int fromtemple) { break; case R_GODPURITY: while (rollagain) { - int n,nposs,i; - object_t *poss[MAXCANDIDATES],*o; flag_t *f; - object_t *wep; rollagain = B_FALSE; - switch (rnd(1,6)) { + switch (rnd(1,4)) { case 1: snprintf(obtogive, BUFLEN, "2-4 blessed potions of water"); break; @@ -965,15 +968,7 @@ int godgiftmaybe(enum RACE rid, int fromtemple) { case 3: snprintf(obtogive, BUFLEN, "wand of turn undead"); break; - case 4: // bless your weapon - wep = getweapon(player); - if (wep && !isblessed(wep)) { - blessob(wep); - } else { - rollagain = B_TRUE; - } - break; - case 5: // holy aura + case 4: // holy aura if (lfhasflag(player, F_HOLYAURA)) { rollagain = B_TRUE; } else { @@ -983,23 +978,7 @@ int godgiftmaybe(enum RACE rid, int fromtemple) { f->obfrom = god->race->id; } break; - case 6: // bless 1-3 obs - nposs = 0; - n = rnd(1,3); // num to bless - for (o = player->pack->first ; o ; o = o->next) { - if (!isblessed(o)) { - poss[nposs++] = o; - } - } - if (nposs < n) n = nposs; - for (i = 0; i < n; i++) { - o = poss[rnd(0,nposs-1)]; - while (isblessed(o)) { - o = poss[rnd(0,nposs-1)]; - } - blessob(o); - } - break; + } } break; @@ -1377,18 +1356,55 @@ int prayto(lifeform_t *lf, lifeform_t *god) { blessob(o); } } - // smite evil - for (l = lf->cell->map->lf ; l ; l = l->next) { - if (getalignment(l) == AL_EVIL) { - if (haslof(lf->cell, l->cell, LOF_WALLSTOP, NULL)) { - // smite them - castspell(god, OT_S_SMITEEVIL, l, NULL, l->cell, NULL, NULL); + + // cure poison + if (ispoisoned(lf)) { + dospelleffects(god, OT_S_CUREPOISON, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_FALSE); + } + + if (isinbattle(lf, B_TRUE)) { + // smite evil + for (l = lf->cell->map->lf ; l ; l = l->next) { + if (getalignment(l) == AL_EVIL) { + if (haslof(lf->cell, l->cell, LOF_WALLSTOP, NULL)) { + // smite them + castspell(god, OT_S_SMITEEVIL, l, NULL, l->cell, NULL, NULL); + } + } + } + // turn undead + castspell(god, OT_S_TURNUNDEAD, lf, NULL, NULL, NULL, NULL); + } else { + object_t *wep; + int donesomething = B_FALSE; + wep = getweapon(player); + if (wep && !isblessed(wep)) { + blessob(wep); + donesomething = B_TRUE; + } + + if (!donesomething) { + int nposs = 0, n; + object_t *o,*poss[MAXCANDIDATES]; + // bless 1-3 obs + nposs = 0; + n = rnd(1,3); // num to bless + for (o = player->pack->first ; o ; o = o->next) { + if (!isblessed(o) && !hasflag(o->flags, F_NOBLESS)) { + poss[nposs++] = o; + } + } + if (nposs < n) n = nposs; + for (i = 0; i < n; i++) { + o = poss[rnd(0,nposs-1)]; + while (isblessed(o)) { + o = poss[rnd(0,nposs-1)]; + } + blessob(o); + donesomething = B_TRUE; } } } - // turn undead - castspell(god, OT_S_TURNUNDEAD, lf, NULL, NULL, NULL, NULL); - break; case R_GODDEATH: msg("\"Behold, the power of death!\""); @@ -1727,6 +1743,13 @@ int prayto(lifeform_t *lf, lifeform_t *god) { break; } + if (god->race->id == R_GODNATURE) { + addob(lf->cell->obpile, "flower"); + if (haslos(player, lf->cell)) { + msg("A beautiful flower grows from the ground."); + } + } + if (!godgiftmaybe(god->race->id, B_FALSE)) { // if you didn't get a gift, lower piety for this god diff --git a/io.c b/io.c index 8d98332..e238239 100644 --- a/io.c +++ b/io.c @@ -4848,8 +4848,15 @@ char *makedesc_god(lifeform_t *god, char *retbuf) { if (retflag[i]->val[1] == NA) { objecttype_t *ot; + char *text; ot = findot(retflag[i]->val[0]); - sprintf(thisline, "- %s\n", ot->name); + text = makeplural(ot->name); + sprintf(thisline, "- %s", text); + free(text); + if ((god->race->id == R_GODPURITY) && (retflag[i]->val[0] == OT_CORPSE)){ + strcat(thisline, " of evil creatures"); + } + strcat(thisline, "\n"); strncat(retbuf, thisline, HUGEBUFLEN); } else { raceclass_t *rc; @@ -11399,12 +11406,22 @@ void showlfstats(lifeform_t *lf, int showall) { objecttype_t *sp; sp = findot(f->val[0]); if (sp) { + char thisline[BUFLEN]; + char desc[BUFLEN]; if (nfound == 0) { mvwprintw(mainwin, y, 0, "%s %s the following spells active:", you(lf), isplayer(lf) ? "have" : "has"); y++; } - mvwprintw(mainwin, y, 0, " - %s %s (consuming %d MP)", sp->name, roman(f->val[2]), f->val[1]); + sprintf(thisline, " - %s %s (consuming %d MP", sp->name, roman(f->val[2]), f->val[1]); + getspelldesc(f->val[0], f->val[2], desc); + if (strlen(desc)) { + strcat(thisline, ", "); + strcat(thisline, desc); + } + strcat(thisline, ")"); + + mvwprintw(mainwin, y, 0, "%s", desc); y++; nfound++; } diff --git a/lf.c b/lf.c index e79cecd..a4702cf 100644 --- a/lf.c +++ b/lf.c @@ -1603,7 +1603,7 @@ int castspell(lifeform_t *lf, enum OBTYPE sid, lifeform_t *targlf, object_t *tar thiscost = getmpcost(lf, sid) * i; if (lf->mp >= thiscost) { snprintf(buf, BUFLEN, "Power %s (%d MP)", roman(i), thiscost); - getvarpowerspelldesc(sp->id, i, desc); + getspelldesc(sp->id, i, desc); if (strlen(desc)) { strcat(buf, "\t"); strcat(buf, desc); @@ -2551,11 +2551,6 @@ void die(lifeform_t *lf) { } switch (lf->race->raceclass->id) { - case RC_ANIMAL: - if (gethungerlevel(gethungerval(player)) > H_NONE) { - pleasegodmaybe(R_GODNATURE, 3); - } - break; case RC_DRAGON: pleasegodmaybe(R_GODNATURE, 50); break; @@ -2695,6 +2690,8 @@ void die(lifeform_t *lf) { copyflag(corpse->flags, lf->flags, F_DTVULN); copyflag(corpse->flags, lf->flags, F_DTRESIST); copyflag(corpse->flags, lf->flags, F_DTIMMUNE); + // inherit alighnment + copyflag(corpse->flags, lf->flags, F_ALIGNMENT); // some corpses will regenerate... if (copyflag(corpse->flags, lf->flags, F_REVIVETIMER)) { @@ -3537,6 +3534,21 @@ int eat(lifeform_t *lf, object_t *o) { } if (isplayer(lf)) makeknown(o->type->id); + + if (isplayer(lf)) { + flag_t *f; + f = hasflag(o->flags, F_CORPSEOF); + if (f) { + race_t *r; + r = findrace(f->val[0]); + if (r && (r->raceclass->id == RC_ANIMAL)) { + if (gethungerlevel(gethungerval(lf)) > H_NONE) { + pleasegodmaybe(R_GODNATURE, 5); + } + } + } + } + } // end if fullyeaten // take time @@ -13712,6 +13724,8 @@ int noise(cell_t *c, lifeform_t *noisemaker, enum NOISECLASS nclass, int volume, msg("%s", seetext); rv = B_TRUE; } + } else if (noisemaker && ispetof(noisemaker, player)) { + rv = B_FALSE; } else if (text && !isdeaf(l) && ((nclass != NC_MOVEMENT) || !lfhasflag(l, F_DONELISTEN))) { // this means you can only hear one 'walk' sound per turn char textnopunc[BUFLEN]; @@ -16096,7 +16110,8 @@ int real_skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod, int *r } // level modifier - levmod = (gethitdice(lf) / 3); + //levmod = (gethitdice(lf) / 3); + levmod = (gethitdice(lf) / 2); // other modifiers if (ct == SC_CLIMB) { diff --git a/spell.c b/spell.c index e582d5d..a2fb2b9 100644 --- a/spell.c +++ b/spell.c @@ -2812,6 +2812,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef msg("%s is now a %s.", lfname, j->name); } else { fizzle(user); + return B_TRUE; } } else { msg("There is nobody there!"); @@ -3475,6 +3476,17 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } + // worshipers of ekrub gain power from piety + if (isplayer(caster) && godprayedto(R_GODNATURE) && + (hasflagval(sp->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL))) { + enum PIETYLEV pl; + pl = getpietylev(R_GODNATURE, NULL, NULL); + if (pl >= PL_PLEASED) { + power += pl; + limit(&power, NA, 10); + } + } + // special: spit attacks need an animation casttype = lfhasflag(caster, F_CASTTYPE); if (casttype && (casttype->val[0] == CT_EYESPIT)) { @@ -3601,6 +3613,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ gainmp(caster, howmuch); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_AIRBLAST) { int dir; @@ -3695,6 +3708,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_ANIMATEMETAL) { object_t *o; @@ -3710,6 +3724,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("Your %s is not metal, therefore unaffected.", noprefix(obname)); } else { fizzle(caster); + return B_TRUE; } return B_FALSE; } else if (o->amt != 1) { @@ -3717,6 +3732,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("Your %s wobbles a little.", obname); } else { fizzle(caster); + return B_TRUE; } return B_FALSE; } @@ -3733,9 +3749,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_ANIMATESTATUE) { object_t *o; @@ -3749,7 +3767,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ return B_FALSE; } else { fizzle(caster); - return B_FALSE; + return B_TRUE; } } @@ -3763,7 +3781,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ f = hasflag(o->flags, F_CORPSEOF); if (!f) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // add it! getobname(o, obname, 1); @@ -3782,7 +3800,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster)) pleasegodmaybe(R_GODNATURE, 25); } else { fizzle(caster); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_APPORTATION) { int failed = B_FALSE; @@ -3847,6 +3865,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_AWARENESS) { flag_t *f; @@ -3888,14 +3907,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // does caster have a weapon? wep = getweapon(target); if (!wep) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (isplayer(target)) { if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -3910,7 +3929,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isblind(target)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (spellresisted(target, caster, spellid, power, seenbyplayer, B_FALSE)) { @@ -3936,6 +3955,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_BLINK) { cell_t *poss[MAXCANDIDATES]; @@ -4086,6 +4106,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ nothinghappens(); } else { fizzle(caster); + return B_TRUE; } } else { howlong = getspellduration(20,30,blessed) + (power*10); @@ -4104,7 +4125,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // which object to take? @@ -4153,6 +4174,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ moveob(targob, caster->pack, ALL); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_CALLLIGHTNING) { int failed = B_FALSE; @@ -4182,6 +4204,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_CALLWIND) { int failed = B_FALSE; @@ -4239,6 +4262,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_CALMANIMALS) { int i,ncalmed = 0; @@ -4289,6 +4313,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!donesomething) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_CALMINGSCENT) { // just announce @@ -4410,7 +4435,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (targcell->type->solid) { fizzle(caster); - return B_FALSE; + return B_TRUE; } radius = (power/4)+1; @@ -4427,7 +4452,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, targetname); @@ -4461,13 +4486,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (getallegiance(caster) == AL_PEACEFUL) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (ispetof(target, caster)) { if (isplayer(caster)) { msg("%s is already allied with you!",targetname); } - return B_FALSE; + return B_TRUE; } if (spellresisted(target, caster, spellid, power, seenbyplayer, B_TRUE)) { @@ -4494,14 +4519,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, targetname); // only animals if (getraceclass(target) != RC_ANIMAL) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (!ischarmable(target)) { @@ -4526,13 +4551,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (getallegiance(caster) == AL_PEACEFUL) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (ispetof(target, caster)) { if (isplayer(caster)) { msg("%s is already allied with you!",targetname); } - return B_FALSE; + return B_TRUE; } // no saving throw, just depends on hit dice. @@ -4564,7 +4589,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, lfname); @@ -4887,7 +4912,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!donesomething) { fizzle(caster); stopspell(caster, spellid); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_CRYSTALSHIELD) { @@ -4897,7 +4922,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (getequippedob(target->pack, BP_SECWEAPON)) { fizzle(caster); stopspell(caster, spellid); - return B_FALSE; + return B_TRUE; } o = addob(target->pack, "ice crystal shield"); if (o) { @@ -4931,17 +4956,18 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ killob(o); fizzle(caster); stopspell(caster, spellid); + return B_TRUE; } } else { fizzle(caster); stopspell(caster, spellid); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_CUREPOISON) { target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } killflagsofid(target->flags, F_POISONED); @@ -5370,6 +5396,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("Some nearby liquid evaporates!"); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_EXPLODEMETAL) { @@ -5401,6 +5428,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_DISPERSAL) { cell_t *c = NULL; @@ -5486,7 +5514,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ getlfname(target, lfname); } else { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (!isimmuneto(target->flags, DT_NECROTIC, B_FALSE)) { @@ -5619,6 +5647,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_FLASH) { if (isplayer(caster) || cansee(player, caster)) { @@ -5719,6 +5748,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_FORCESPHERE) { cell_t *retcell[MAXRETCELLS]; @@ -5895,6 +5925,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_FIREDART) { char lfname[BUFLEN]; @@ -5993,6 +6024,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_EARTHQUAKE) { cell_t *retcell[MAXRETCELLS],*c; @@ -6080,7 +6112,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } f = addtempflag(caster->flags, F_DTRESIST, DT_FIRE, NA, NA, NULL, FROMSPELL); @@ -6281,7 +6313,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, lfname); @@ -6347,7 +6379,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int radius; if (targcell->type->solid) { fizzle(caster); - return B_FALSE; + return B_TRUE; } radius = power/2; if (radius < 1) radius = 1; @@ -6419,6 +6451,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_HASTE) { int howlong = 15; @@ -6426,7 +6459,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (haslos(player, target->cell)) { @@ -6450,7 +6483,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // cure certain bad effects @@ -6656,6 +6689,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ nothinghappens(); } else { fizzle(caster); + return B_TRUE; } } } else if (spellid == OT_S_HOLDPORTAL) { @@ -6665,7 +6699,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!o) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // move any objects which are in the way (but not lfs) @@ -6689,7 +6723,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (isplayer(target)) { @@ -6722,14 +6756,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // does caster have a weapon? wep = getweapon(target); if (!wep) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getobname(wep, obname, wep->amt); @@ -6797,7 +6831,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!donesomething) { fizzle(caster); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_IDENTIFY) { @@ -6957,7 +6991,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("Your %s pulls away from you a little.", noprefix(buf)); } fizzle(caster); - return B_FALSE; + return B_TRUE; } } } @@ -7060,6 +7094,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ gainhp(caster, howmuch); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_MINDSCAN) { int failed = B_FALSE; @@ -7095,6 +7130,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_NULLIFY) { flag_t *retflag[MAXCANDIDATES],*poss[MAXCANDIDATES],*f; @@ -7102,6 +7138,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); + return B_TRUE; } if (isplayer(target)) { @@ -7373,7 +7410,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (lfhasflag(target, F_PAIN)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } if (spellresisted(target, caster, spellid, power, seenbyplayer, B_FALSE)) { @@ -7401,6 +7438,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_PETRIFY) { target = targcell->lf; @@ -7408,10 +7446,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // some thigns can't be stoned if (!lfcanbestoned(target)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } else if (lfhasflag(target, F_BEINGSTONED)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // savingthrow @@ -7461,7 +7499,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, targname); @@ -7632,6 +7670,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!donesomething) { fizzle(caster); + return B_TRUE; } } else if (targcell->obpile->first) { // no lifeform there targob = NULL; @@ -7654,9 +7693,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else { fizzle(caster); + return B_TRUE; } } } else if (spellid == OT_S_GATE) { @@ -7679,6 +7720,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if ((newdepth < min) || (newdepth > max)) { fizzle(caster); + return B_TRUE; } else { cell_t *srccell; object_t *srcportal,*dstportal; @@ -7687,7 +7729,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ srccell = real_getrandomadjcell(caster->cell, WE_WALKABLE, B_ALLOWEXPAND, LOF_NEED, NULL, caster); if (!srccell) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // create the source portal srcportal = addobfast(srccell->obpile, OT_PORTAL); @@ -7816,10 +7858,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } else if ( lfhasflag(target, F_INVISIBLE) ) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, targname); @@ -7851,6 +7893,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ losehp(target, dam, DT_ELECTRIC, caster, "a jolt of electricity"); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_KNOCK) { object_t *o; @@ -7903,6 +7946,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster)) pleasegodmaybe(R_GODTHIEVES, 5); } else { fizzle(caster); + return B_TRUE; } @@ -7949,11 +7993,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // (player last) for (l = caster->cell->map->lf ; l ; l = l->next) { if (!isplayer(l) && haslos(l, caster->cell)) { - if (lfhasflag(l, F_SEEINDARK)) { - // 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(3,5)); + if (power >= 5) { + if (lfhasflag(l, F_SEEINDARK)) { + // 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(3,5)); + } } } // undead will flee from light @@ -8079,6 +8125,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_LOCATEOBJECT) { char wantname[BUFLEN]; @@ -8088,7 +8135,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!isplayer(caster)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // ask for object askstring("Locate what kind of object", '?', wantname, BUFLEN, NULL); @@ -8189,7 +8236,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (prompt.nchoices == 0) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getchoice(&prompt); @@ -8202,7 +8249,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("New knowledge floods into your mind!"); } else { fizzle(caster); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_GRAVBOOST) { target = targcell->lf; @@ -8243,6 +8290,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addtempflag(target->flags, F_GRAVBOOSTED, B_TRUE, NA, NA, NULL, howlong); } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_GRAVLOWER) { flag_t *f; @@ -8433,7 +8481,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } getlfname(target, targetname); @@ -8754,12 +8802,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (!donesomething) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_QUENCH) { object_t *o,*nexto; int ndone = 0; if (!targcell) { fizzle(caster); + return B_TRUE; } if (targcell->lf) { @@ -8807,6 +8857,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (!ndone) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_QUICKENSTONE) { int howmany,i,n,sel,nposs = 0,nseen = 0; @@ -8857,7 +8908,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } for (f = target->flags->first ; f ; f = f->next) { @@ -8878,6 +8929,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); + return B_TRUE; } if (ndone && isplayer(caster) && !frompot) { pleasegodmaybe(R_GODMERCY, 3); @@ -8887,7 +8939,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } amttolose = power*2; if (isplayer(target)) { @@ -9091,6 +9143,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ snprintf(buf, BUFLEN, "%s%s shatter spell", castername, getpossessive(castername)); if (!shattercell(targcell, caster, buf)) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SIXTHSENSE) { if (isplayer(caster)) { @@ -9185,6 +9238,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SLIDE) { flag_t *f; @@ -9258,6 +9312,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SNOWBALL) { int failed = B_FALSE; @@ -9315,6 +9370,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SOFTENEARTH) { int seen = B_FALSE; @@ -9357,6 +9413,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SPARK) { object_t *o,*nexto; @@ -9531,8 +9588,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (cansee(caster, c->lf)) { for (o = c->lf->pack->first ; o ; o = nexto) { nexto = o->next; - if ((o->material->id == MT_WOOD) && - hasflag(o->flags, F_RODSHAPED) && + if ( hasflag(o->flags, F_RODSHAPED) && isequipped(o) && (o->blessed == B_UNCURSED) && !hasflag(o->flags, F_HASBRAND)) { @@ -9551,6 +9607,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ noprefix(obname)); killflagsofid(snake->flags, F_XPVAL); addflag(snake->flags, F_XPVAL, 0, NA, NA, NULL); + killflagsofid(snake->flags, F_FLEEONDAM); + killflagsofid(snake->flags, F_FLEEONHPPCT); + addflag(snake->flags, F_NOFLEE, B_TRUE, NA, NA, NULL); makefriendly(snake, PERMENANT); if (c->lf == caster) { char fullobname[BUFLEN]; @@ -9571,10 +9630,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { // ie. no lf there for (o = c->obpile->first ; o ; o = nexto) { + lifeform_t *snake = NULL; nexto = o->next; - if ((o->material->id == MT_WOOD) && hasflag(o->flags, F_RODSHAPED) && !isblessed(o)) { + if (hasflag(o->flags, F_RODSHAPED) && !isblessed(o)) { cell_t *newcell = NULL; - lifeform_t *snake; char obname[BUFLEN]; getobname(o, obname, o->amt); @@ -9593,6 +9652,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ killob(o); killflagsofid(snake->flags, F_XPVAL); addflag(snake->flags, F_XPVAL, 0, NA, NA, NULL); + killflagsofid(snake->flags, F_FLEEONDAM); + killflagsofid(snake->flags, F_FLEEONHPPCT); + addflag(snake->flags, F_NOFLEE, B_TRUE, NA, NA, NULL); makefriendly(snake, PERMENANT); ndone++; } @@ -9609,6 +9671,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_STUN) { target = targcell->lf; @@ -9654,6 +9717,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!donesomething) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SUCK) { target = targcell->lf; @@ -9683,6 +9747,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_SUPERHEAT) { char obname[BUFLEN]; @@ -9794,7 +9859,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ c = askcoords(buf, "Teleport->",TT_NONE, caster, UNLIMITED, LOF_DONTNEED, B_FALSE); if (!c) { fizzle(caster); - return B_FALSE; + return B_TRUE; } else if (!c->known) { // confirm ch = askchar("Are you sure to want to teleport into the unknown?", "yn", "n", B_TRUE, B_FALSE); @@ -9881,7 +9946,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ break; default: // should never happen fizzle(caster); - return B_FALSE; + return B_TRUE; } if (xmin < 0) xmin = 0; @@ -9901,7 +9966,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (nposs <= 0) { fizzle(caster); - return B_FALSE; + return B_TRUE; } @@ -9917,7 +9982,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ c = getrandomadjcell(c, WE_WALKABLE, B_ALLOWEXPAND); if (!c) { fizzle(caster); - return B_FALSE; + return B_TRUE; } } @@ -10051,6 +10116,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (failed) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_THORNS) { flag_t *f; @@ -10064,7 +10130,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ target = targcell->lf; if (!target) { fizzle(caster); - return B_FALSE; + return B_TRUE; } f = addtempflag(target->flags, F_TRUESTRIKE, power, NA, NA, NULL, FROMSPELL); f->obfrom = spellid; @@ -10236,7 +10302,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (getequippedob(target->pack, BP_WEAPON)) { fizzle(caster); stopspell(caster, spellid); - return B_FALSE; + return B_TRUE; } o = addob(target->pack, "energy blade"); if (o) { @@ -10268,11 +10334,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ killob(o); fizzle(caster); stopspell(caster, spellid); + return B_TRUE; } } else { fizzle(caster); stopspell(caster, spellid); - return B_FALSE; + return B_TRUE; } } else if (spellid == OT_S_WALLOFICE) { object_t *o; @@ -10299,7 +10366,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if ((vdist == 0) && (hdist == 0)) { fizzle(caster); - return B_FALSE; + return B_TRUE; } // select direction @@ -10448,6 +10515,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targcell) { fizzle(caster); + return B_TRUE; } if (targcell->lf) { @@ -10493,6 +10561,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (!ndone) { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_WEAKEN) { target = targcell->lf; @@ -10529,6 +10598,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); + return B_TRUE; } } else if (spellid == OT_S_WEB) { char numbuf[BUFLEN]; @@ -11251,7 +11321,9 @@ char *getspellname(enum OBTYPE spellid, lifeform_t *lf, char *buf, int forcepowe } } else if (spellid == OT_S_LIGHT) { if (power >= 8) { - strcat(buf, "(perm,ctrl)"); + strcat(buf, "(perm,ctrl,blind)"); + } else if (power >= 5) { + strcat(buf, "(ctrl,blind)"); } else if (power >= 3) { strcat(buf, "(ctrl)"); } @@ -11552,16 +11624,51 @@ int getstamcost(lifeform_t *lf, enum OBTYPE oid) { return stamcost; } -char *getvarpowerspelldesc(enum OBTYPE spellid, int power, char *buf) { +// provides a description for f_ongoing spells. +char *getspelldesc(enum OBTYPE spellid, int power, char *buf) { // default strcpy(buf, ""); switch (spellid) { + case OT_S_ALARM: + snprintf(buf, BUFLEN, "warnings about nearby enemies"); + break; + case OT_S_BARKSKIN: + snprintf(buf, BUFLEN, "%d damage reduction, vuln to fire", gethardness(MT_WOOD)); + break; + case OT_S_ENDUREELEMENTS: + snprintf(buf, BUFLEN, "resist fire, resist cold"); + break; + case OT_S_EQANDOP: + snprintf(buf, BUFLEN, "reflects missile attacks"); + break; + case OT_S_GRAVLOWER: + snprintf(buf, BUFLEN, "reduces load by %dkg", power*15); + break; + case OT_S_HOLYAURA: + snprintf(buf, BUFLEN, "weapons deal holy damage"); + break; + case OT_S_LOWERMETAB: + if (power >= 5) { + snprintf(buf, BUFLEN, "reduces hunger"); + } else { + snprintf(buf, BUFLEN, "reduces hunger and speed"); + } + break; case OT_S_PSYARMOUR: snprintf(buf, BUFLEN, "+%d Armour Rating", power*4); break; + case OT_S_SIXTHSENSE: + snprintf(buf, BUFLEN, "warnings about adjacent enemies"); + break; case OT_S_SUMMONWEAPON: snprintf(buf, BUFLEN, "Create a %d damage rating magical weapon",2+(power*2)); break; + case OT_S_TAILWIND: + snprintf(buf, BUFLEN, "Speed boost when moving fowards"); + break; + case OT_S_THORNS: + snprintf(buf, BUFLEN, "1d4 piercing damage to attackers"); + break; case OT_S_TRUESTRIKE: if (power == 1) { snprintf(buf, BUFLEN, "Next attack automatically hits"); @@ -11569,6 +11676,9 @@ char *getvarpowerspelldesc(enum OBTYPE spellid, int power, char *buf) { snprintf(buf, BUFLEN, "Next %d attacks automatically hit",power); } break; + case OT_S_WHATGOESUP: + snprintf(buf, BUFLEN, "missiles return to source"); + break; case OT_S_WINDSHIELD: snprintf(buf, BUFLEN, "Protection from missiles <= %d km/h",speedtokph(power)); break; diff --git a/spell.h b/spell.h index 968471e..a37c779 100644 --- a/spell.h +++ b/spell.h @@ -28,7 +28,7 @@ enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid); enum SKILLLEVEL getspellskill(lifeform_t *lf, enum OBTYPE spellid); int getspellrange(lifeform_t *lf, enum OBTYPE spellid, int power); int getstamcost(lifeform_t *lf, enum OBTYPE oid); -char *getvarpowerspelldesc(enum OBTYPE spellid, int power, char *buf); +char *getspelldesc(enum OBTYPE spellid, int power, char *buf); int getworkablematerials(lifeform_t *lf, enum SKILL skid , enum MATERIAL *repairablemats, int *cutoffpct, int *nmats); object_t *getworkhelpob(obpile_t *op, enum MATERIAL mat); void pullobto(object_t *o, lifeform_t *lf);