diff --git a/attack.c b/attack.c index 307d66a..a7cc28d 100644 --- a/attack.c +++ b/attack.c @@ -2395,16 +2395,17 @@ void criticalhit(lifeform_t *lf, lifeform_t *victim, enum BODYPART hitpos, objec if (cansee(player, lf) || cansee(player, victim)) { getlfname(lf, lfname); getlfname(victim, victimname); - setfacing(victim, getrandomdirexcept(DT_COMPASS, victim->facing)); msg("%s%s blow spins %s around!", lfname, getpossessive(lfname),victimname); } } else { if (isplayer(victim) || cansee(player, victim)) { getlfname(victim, victimname); - setfacing(victim, getrandomdirexcept(DT_COMPASS, victim->facing)); msg("%s is spun around!", victimname); } } + // actually spin them + setfacing(victim, getrandomdirexcept(DT_COMPASS, victim->facing)); + breakgrabs(victim, B_TRUE, B_TRUE, B_TRUE); break; } } diff --git a/data.c b/data.c index 18ca54b..842592c 100644 --- a/data.c +++ b/data.c @@ -5272,7 +5272,7 @@ void initobjects(void) { addflag(lastot->flags, F_MAXPOWER, 3, NA, NA, NULL); addflag(lastot->flags, F_TARGETTEDSPELL, TT_NONE, NA, NA, NULL); addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL); - addot(OT_S_LETHARGY, "lethargy", "Reduces the target's stamina by ^bpower^n*2.", MT_NOTHING, 0, OC_SPELL, SZ_TINY); + addot(OT_S_LETHARGY, "lethargy", "Reduces the target's stamina by ^bpower^n.", MT_NOTHING, 0, OC_SPELL, SZ_TINY); addflag(lastot->flags, F_SPELLSCHOOL, SS_MENTAL, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_DEATH, NA, NA, NULL); addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL); diff --git a/spell.c b/spell.c index e76b070..b576cdc 100644 --- a/spell.c +++ b/spell.c @@ -136,7 +136,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } slev = getskill(user, SK_ENGINEERING); - dir = askdir("Build something in which direction (. for self, - to cancel)", B_TRUE, B_TRUE); + dir = askdir("Build something in which direction (. for self, - to cancel)", B_TRUE, B_TRUE); if (dir == D_MYSELF) { c = NULL; initprompt(&prompt, "What will you build?"); @@ -153,7 +153,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (c->lf || c->type->solid) { msg("There is no space to build anything there!"); return B_TRUE; - } + } // what can we build? initprompt(&prompt, "What will you build?"); if (hasdoor(c)) { @@ -184,7 +184,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef addbuildchoice(&prompt, user, OT_TRAPROCK, &ch); } } - } + } if (prompt.nchoices <= 0) { if (c) { @@ -254,7 +254,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef sprintf(buf, "%d original %s", numtobuild, tempot->name); o = addob(user->pack, buf); } - + taketime(user, getactspeed(user)*2); if (c) { setlosdirty(user); @@ -333,12 +333,12 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef msg("There is no space nearby for you to attack!"); } return B_TRUE; - } + } if (adjcell->lf) { if (isplayer(user)) msg("Your path there is blocked!"); return TRUE; } - + // take some time taketime(user, getactspeed(user)); @@ -371,7 +371,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef needredraw = B_TRUE; drawlevelfor(player); redraw(); - + //if (!isplayer(user)) { more(); //} @@ -427,7 +427,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (lfhasflag(user, F_DETECTLIFE)) { addchoice(&prompt, 'd', "Detect lifeforms", NULL, NULL, NULL); } - if ( ((getskill(user, SK_LISTEN) >= PR_ADEPT) && !isdeaf(user)) || + if ( ((getskill(user, SK_LISTEN) >= PR_ADEPT) && !isdeaf(user)) || hasequippedobid(user->pack, OT_AMU_THIEF)) { addchoice(&prompt, 'l', "Listen for sounds", NULL, NULL, NULL); } @@ -483,7 +483,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } else if (ch == 'f') { // footprints msg("You inspect %s...",obname); } else if (ch == 'p') { // peek - msg("You peek %s the stairs...", getdirname(stairdir)); + msg("You peek %s the stairs...", getdirname(stairdir)); } // find out where the other end goes... @@ -502,7 +502,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef redrawpause(); - // move any lfs at the other end out of the way. + // move any lfs at the other end out of the way. if (c->lf) { if (movelfsoutofway(c)) { // can't move them? ie. no adj cells. @@ -521,7 +521,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef user->cell = c; c->lf = user; } - + // now actually do the check if (ch == 'd') { lifeform_t *lf; @@ -577,7 +577,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef strcpy(amttext, "several "); } else { // 4+ strcpy(amttext, "lots of "); - } + } msg("You detect %s%s.", amttext, dname[n]); } } else { @@ -645,7 +645,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef strcpy(amttext, "some "); } else { strcpy(amttext, "lots of "); - } + } } else { // we're hearing monster sounds strcpy(amttext, ""); } @@ -678,7 +678,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef f = lfhasflag(user, F_ENHANCESMELL); if (f) { range = f->val[0]; - } + } if (range) { // list everyone you can smell. @@ -714,7 +714,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } } } - } + } // announce if (nposs) { for (n = 0; n < nposs; n++) { @@ -726,7 +726,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef strcpy(amttext, "some "); } else { strcpy(amttext, "lots of "); - } + } if (smellcount[n] > 1) { newtext = strdup(smellrace[n]->name); @@ -783,7 +783,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef fpcount[nposs] = 1; nposs++; } - } + } killob(trailob); } } @@ -800,7 +800,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef strcpy(amttext, "several "); } else { // 4+ strcpy(amttext, "lots of "); - } + } msg("You find %s%s.", amttext, fpname[n]); } } else { @@ -869,17 +869,17 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int dir; dir = askdir("Climb in which direction (orthogonal only, - to cancel)", B_TRUE, B_FALSE); if ((dir == D_NONE) || (dir == D_MYSELF) || !isorthogonal(dir)) { - msg("You can only climb in orthogonal directions."); + msg("You can only climb in orthogonal directions."); return B_TRUE; } else { origdir = user->facing; setfacing(user, dir); targcell = getcellindir(user->cell, user->facing); } - } - + } + if (!canclimb(user, &why)) { - if (isplayer(user)){ + if (isplayer(user)){ switch (why) { case E_CLIMBING: msg("You are already climbing!"); break; case E_CANTMOVE: msg("You can't move!"); break; @@ -896,7 +896,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef setfacing(user, origdir); } return B_TRUE; - } + } startclimbing(user); } else if (abilid == OT_A_COOK) { @@ -910,7 +910,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int donesomething = B_TRUE; int ncooked = 0; int cooktime = 0; - + if (!isplayer(user)) return B_TRUE; if (isswimming(user) && !lfhasflag(user, F_AQUATIC)) { @@ -976,7 +976,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef longdesc = malloc(HUGEBUFLEN * sizeof(char)); initprompt(&prompt, "What will you cook (ESC to cancel)?"); for (rec = firstrecipe ; rec ; rec = rec->next ) { - if (cancook(user, rec, NULL)) { + if (cancook(user, rec, NULL)) { object_t *o; o = addobfast(fakecell.obpile, rec->result); makedesc_ob(o, longdesc); @@ -1103,7 +1103,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } if (targcell->lf) { - if (isplayer(user)) { + if (isplayer(user)) { char inwayname[BUFLEN]; getlfname(targcell->lf, inwayname); msg("%s is in your way!",inwayname); @@ -1196,12 +1196,12 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } if (trapflag->id == F_TRAP) { // an actual trap - trapeffects(trapob, trapob->type->id, user->cell, + trapeffects(trapob, trapob->type->id, user->cell, (trapflag->id == F_TRAPPED) ? trapob : NULL); } else { // a trap on an object triggerattachedtraps(trapob, user, B_NOANNOUNCE); - //trapeffects(NULL, trapflag->val[0], user->cell, + //trapeffects(NULL, trapflag->val[0], user->cell, //(trapflag->id == F_TRAPPED) ? trapob : NULL); } } else { @@ -1265,7 +1265,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef targetskillmod = getweaponskill(target, targetwep) * 10; if (isplayer(target) && (targetskillmod == 0)) targetskillmod = -25; - + if (skillcheckvs(user, SC_DEX, skillmod, target, SC_DEX, targetskillmod)) { if (cansee(player, user)) { msg("^w%s disarm%s %s!",username, isplayer(user) ? "" : "s", targetname); @@ -1338,7 +1338,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // ie trying to dismantle a wall return digcell(user, c, NULL, B_TRUE); } - + // figrue out what to replace it with switch (o->material->id) { case MT_STONE: newot = findot(OT_STONE); break; @@ -1346,7 +1346,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef case MT_WOOD: newot = findot(OT_WOODPLANK); break; default: break; } - + if (newot) { int origsize,junksize; // figure out how many @@ -1478,13 +1478,13 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef username, targetname, getpossessive(targetname)); } return B_FALSE; - } + } // if not already held, victim gets a skillcheck to avoid being grabbed - hard. - if (!lfhasflagval(user, F_GRABBING, target->id, NA, NA, NULL) && + if (!lfhasflagval(user, F_GRABBING, target->id, NA, NA, NULL) && skillcheck(target, SC_DODGE, getattr(user, A_AGI)+50, 0)) { if (cansee(player, user)) { - msg("%s evade%s %s%s grasp.", targetname, isplayer(target) ? "" : "s", + msg("%s evade%s %s%s grasp.", targetname, isplayer(target) ? "" : "s", username, getpossessive(username)); } } else { @@ -1493,13 +1493,13 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // free space behind the flipper? dir = diropposite(user->facing); c = getcellindir(user->cell, dir); - + if (c && cellwalkable(target, c, NULL)) { int dist; // break grabs, but don't annouce "you break free" breakgrabs(target, B_TRUE, B_TRUE, B_FALSE); - - // throw! + + // throw! // - announce BEFORE moving the target. if (isplayer(user)) { msg("^%cYou flip %s over your head!", getlfcol(target, CC_BAD), targetname); @@ -1517,9 +1517,9 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef movelf(target, c, B_FALSE); // move target behind player dist = 2 + (getskill(user, SK_ATHLETICS)/3); setfacing(target, getrandomdir(DT_COMPASS)); - knockback(target, dir, dist, user, 125, B_NOANNOUNCE, B_DODAM); + knockback(target, dir, dist, user, 125, B_NOANNOUNCE, B_DODAM); } else { - if (isplayer(user)) { + if (isplayer(user)) { msg("There is no room to flip %s!", targetname); } else if (cansee(player, user)) { msg("%s tries to flip %s but fails.", username, targetname); @@ -1542,13 +1542,13 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } else if (!isdualweilding(user)) { if (isplayer(user)) msg("You need to be dual-weilding to perform an attack flurry!"); return B_TRUE; - } + } // ask for direction if (targcell) { dir = getdirtowards(user->cell, targcell, NULL, B_FALSE, DT_ORTH); } else { - dir = askdir("Flurry in which direction (- to cancel)", B_TRUE, B_TRUE); + dir = askdir("Flurry in which direction (- to cancel)", B_TRUE, B_TRUE); if ((dir == D_NONE) || (dir == D_MYSELF)) { if (isplayer(user)) msg("Cancelled."); return B_TRUE; @@ -1570,7 +1570,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } // push them back - knockback(target, dir, 1, user, 25, B_DOANNOUNCE, B_NODAM); + knockback(target, dir, 1, user, 25, B_DOANNOUNCE, B_NODAM); // if we succeeded in pushing them... if (target->cell != targcell) { @@ -1620,7 +1620,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef taketime(user, getactspeed(user)); } else if (abilid == OT_A_GRAB) { flag_t *f; - + f = lfhasflag(user, F_GRABBING); if (f) { if (isplayer(user)) msg("You are already holding someone!"); @@ -1665,12 +1665,12 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef username, targetname, getpossessive(targetname)); } return B_FALSE; - } + } // victim gets a skilcheck to avoid being grabbed if (skillcheck(target, SC_DODGE, (getattr(user, A_AGI))+50, 0)) { if (cansee(player, user)) { - msg("%s evade%s %s%s grasp.", targetname, isplayer(target) ? "" : "s", + msg("%s evade%s %s%s grasp.", targetname, isplayer(target) ? "" : "s", username, getpossessive(username)); } } else { @@ -1688,7 +1688,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You cannot move!"); return B_TRUE; } - + // announce if (cansee(player, target)) { msg("%s squeeze%s %s tightly!", username, isplayer(user) ? "" : "s", targetname); @@ -1807,7 +1807,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // we now have a cell - go there! taketime(user, getactspeed(user)); - + if (!targcell || (targcell == user->cell)) { if (isplayer(user)) { msg("You jump on the spot."); @@ -1870,7 +1870,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } else { swapplaces(victim, user, B_CHANGEDIR, B_CHANGEDIR, B_NOTONPURPOSE); swapped = B_TRUE; - } + } } if (!swapped) { @@ -1973,7 +1973,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int n; for (n = 0 ; n < prompt.nchoices; n++) { o = (object_t *)prompt.choice[n].data; - if (o) { + if (o) { char buf[BUFLEN]; sprintf(buf, "%ld", o->id); addflag(user->flags, F_REPAIRING, NA, NA, NA, buf); @@ -1992,7 +1992,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef o = (object_t *) prompt.choice[rnd(2,prompt.nchoices-1)].data; if (!o) return B_TRUE; } - + if (o) { char buf[BUFLEN]; sprintf(buf, "%ld", o->id); @@ -2168,7 +2168,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the stability for a shield bash while swimming."); return B_TRUE; } - + getallshields(user, DT_ALL, shieldlist, NULL, &nshields); for (i = 0; i < nshields; i++) { if (isshield(shieldlist[i])) { @@ -2178,7 +2178,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } if (!shield) { badshield = B_TRUE; - } + } if (badshield) { if (isplayer(user)) msg("You need a shield equipped to perform a shield bash!"); @@ -2186,7 +2186,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } getobname(shield, shname, 1); - + f = hasflagval(shield->flags, F_EQUIPCONFER, F_SHIELDPENALTY, NA, NA, NULL); if (f) { shpenalty = adjustshieldpenalty(user, f->val[1]); @@ -2197,7 +2197,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("Your %s is too cumbersome to bash with.",shname); return B_TRUE; } - + // ask for direction if (!targcell) { @@ -2227,7 +2227,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef msg("%s bashes %s with %s!",username, tname, shname); } - + // only works if shield is hard if (gethardness(shield->material->id)) { int damamt; @@ -2304,7 +2304,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // setting v0 to spellid just in case pickup() changes flags addflag(user->flags, F_NOTIME, OT_A_SNATCH, NA, NA, NULL); } - + if (!pickup(user, o, 1, B_TRUE, B_FALSE)) { if (isplayer(user)) { msg("You snatch %s from the ground!",obname); @@ -2326,7 +2326,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef makenoise(user, N_SONICBOLT); // if target can hear, they take damage - f = hasflagval(user->flags, F_NOISETEXT, N_SONICBOLT, NA, NA, NULL); + f = hasflagval(user->flags, F_NOISETEXT, N_SONICBOLT, NA, NA, NULL); if (f) { volume = f->val[1]; } else { @@ -2394,7 +2394,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef getlfname(target, targetname); if (cansee(player, target)) { - msg("%s inject%s acid into %s!", username, + msg("%s inject%s acid into %s!", username, isplayer(user) ? "" : "s", targetname); } @@ -2412,7 +2412,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef object_t *o; int difficulty, mod; flag_t *f; - + // only players can do this if (!isplayer(user)) { return B_TRUE; @@ -2491,13 +2491,13 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // note: takes no time. } else if (abilid == OT_A_SUCKBLOOD) { int dam = 0; - + f = lfhasflag(user, F_ATTACHEDTO); if (!f) { if (isplayer(user)) msg("You need to attach to someone before using this ability."); return B_TRUE; } - + // announce if (cansee(player, target)) { msg("^%c%s suck%s blood from %s!", getlfcol(target, CC_BAD), username, isplayer(user) ? "" : "s", targetname); @@ -2529,7 +2529,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef satedat = 8; break; } - + if (num >= satedat) { // sated. killflagsofid(user->flags, F_ATTACHEDTO); @@ -2560,7 +2560,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // take some time taketime(user, getactspeed(user)); - + for (o = targcell->obpile->first ; o ; o = nexto) { nexto = o->next; if (!hasflag(o->flags, F_NOPICKUP)) { @@ -2569,7 +2569,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef nswallowed++; } } - + target = targcell->lf; if (target) { @@ -2615,7 +2615,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int x,y; condset_t cs; - + lflinkflag = hasflag(user->flags, F_MAPLINK); if (lflinkflag) { newmap = findmap(lflinkflag->val[0]); @@ -2638,7 +2638,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef initcondv(&cs, CC_ISROOM, B_TRUE, NA, CC_WALKABLEFOR, B_TRUE, target->id, CC_NONE); entry = getcell_cond(newmap, &cs); - + /* while (!cellwalkable(target, entry, NULL)) { //entry = getrandomroomcell(newmap, ANYROOM, WE_WALKABLE); @@ -2751,7 +2751,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } return B_TRUE; } - + // take some time taketime(user, getactspeed(user)); @@ -2765,7 +2765,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef needredraw = B_TRUE; drawlevelfor(player); redraw(); - + //if (!isplayer(user)) { more(); //} @@ -2801,7 +2801,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the stability for a thrust while swimming."); return B_TRUE; } - + wep = getweapon(user); if (!wep) { object_t *weplist[MAXPILEOBS]; @@ -2813,11 +2813,11 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } else { badweapon = B_TRUE; } - } + } if (wep) { if (getdamtype(wep) != DT_PIERCE) { badweapon = B_TRUE; - } + } damflag = hasflag(wep->flags, F_DAM); } if (!damflag) { @@ -2852,7 +2852,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef f = addflag(user->flags, F_ACCURACYMOD, -10, NA, NA, NULL); attacklf(user, target, wep, damflag); killflag(f); - taketime(user, getattackspeed(user)); + taketime(user, getattackspeed(user)); if (op) killobpile(op); } else if (abilid == OT_A_TRAIN) { // can we train? @@ -3004,7 +3004,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef return B_TRUE; } else { cell_t *cell1 = NULL,*cell2 = NULL; - + cell1 = getcellindir(user->cell, dir); if (cell1) { cell2 = getcellindir(cell1, dir); @@ -3012,7 +3012,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("There is no room to tumble that way!"); return B_TRUE; } - + if (cell2) targcell = cell2; else targcell = cell1; @@ -3071,7 +3071,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef strcpy(stopverb, "fall"); getobname(stopob, stopthing, stopob->amt); break; - } + } // run into a person, wall or impassable object? if (i >= 1) { @@ -3102,7 +3102,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef default: strcpy(stopthing, "something"); break; - } + } } else { strcpy(stopthing, "something"); } @@ -3165,14 +3165,14 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (!f) { if (isplayer(user)) nothinghappens(); return B_TRUE; - } + } // this call will also remove this ability... setrace(user, f->val[0], B_TRUE); } else if (abilid == OT_A_PRAY) { lifeform_t *god; if (!isplayer(user)) return B_FALSE; - + if (lfhasflag(player, F_NOPRAY)) { if (isplayer(user)) { msg("Your pride prevents you from worshipping another being."); @@ -3180,7 +3180,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef return B_TRUE; } - // ask for which god + // ask for which god god = askgod("To whom will you pray?", B_FALSE, B_TRUE); if (!god) { msg("Cancelled."); @@ -3222,7 +3222,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } ch = getchoice(&prompt); wantlev = firstlev + (ch - 'a'); - + //while (strcmp(getskilllevelname(getskill(user, sk->id)), prompt.choice[prompt.selection].text)) { giveskilllev(user, sk->id, wantlev); //} @@ -3261,7 +3261,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the control for an aimed strike while swimming."); return B_TRUE; } - + wep = getweapon(user); // ask for direction @@ -3304,7 +3304,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } else { msg("You need to weild a weapon first!"); return B_TRUE; - } + } if (slev < PR_ADEPT) { msg("You are not skilled enough with your weapon to do this!"); return B_TRUE; @@ -3356,7 +3356,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You cannot perform a combination attack while swimming."); return B_TRUE; } - + wep = getweapon(user); if (wep) { wepsk = getobskill(wep->flags); @@ -3407,7 +3407,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // if the lf there died, keep going. if (!c->lf || isdead(c->lf)) { keepgoing = B_TRUE; - } + } // other reasons to stop the combo now? if (keepgoing) { @@ -3490,7 +3490,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (where && where->lf) { char ch; enum ATTRIB att; - ch = askchar("Enhance which stat (n for none)?", "sacin",NULL, B_TRUE, B_FALSE); + ch = askchar("Enhance which stat (n for none)?", "sacin",NULL, B_TRUE, B_FALSE); switch (ch) { case 's': att = A_STR; break; case 'a': att = A_AGI; break; @@ -3510,7 +3510,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef getlfname(where->lf, buf); msg("%s%s %s set to %d.", buf, getpossessive(buf), getattrname(att), val); } - // + // } } @@ -3545,7 +3545,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int gotdupe = B_FALSE; // do we have another? for (o2 = user->pack->first ; o2 ; o2 = o2->next) { - if ((o2 != o) && (o2->type->id == o->type->id)) { + if ((o2 != o) && (o2->type->id == o->type->id)) { gotdupe = B_TRUE; break; } @@ -3572,7 +3572,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef sprintf(buf, "Destroy which object to enahnce %s?", obname); initprompt(&prompt, buf); for (o2 = user->pack->first ; o2 ; o2 = o2->next) { - if ((o2 != o) && (o2->type->id == o->type->id)) { + if ((o2 != o) && (o2->type->id == o->type->id)) { getobname(o2, obname, o2->amt); addchoice(&prompt, o2->letter, obname, NULL, o2, NULL); } @@ -3587,7 +3587,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef } o2 = (object_t *)prompt.result; - + // in case it's on fire, etc if (touch(user, o)) { taketime(user, getactspeed(user)); @@ -3598,7 +3598,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef return B_FALSE; } - // destroy second ob + // destroy second ob removeob(o2, ALL); // fully repair first ob f = hasflag(o->flags, F_OBHP); @@ -3641,7 +3641,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef f = addflag(user->flags, F_ACCURACYMOD, 200, NA, NA, NULL); attackcell(user, targcell, B_FALSE); - taketime(user, getattackspeed(user)*2); + taketime(user, getattackspeed(user)*2); killflag(f); } else if (abilid == OT_A_HEAVYBLOW) { object_t *wep; @@ -3653,15 +3653,15 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the stability for a heavy blow while swimming."); return B_TRUE; } - + wep = getweapon(user); if (!wep) { if (!hasjob(user, J_MONK)) { badweapon = B_TRUE; } - } else if (!ismeleeweapon(wep) || !isheavyweapon(wep)) { + } else if (!ismeleeweapon(wep) || !isheavyweapon(wep)) { badweapon = B_TRUE; - } + } damflag = hasflag(wep->flags, F_DAM); if (!damflag) { badweapon = B_TRUE; @@ -3693,7 +3693,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef f = addflag(user->flags, F_HEAVYBLOW, B_TRUE, NA, NA, NULL); attacklf(user, target, wep, damflag); - taketime(user, getattackspeed(user)); + taketime(user, getattackspeed(user)); killflag(f); } else if (abilid == OT_A_QUIVERINGPALM) { object_t *wep; @@ -3704,7 +3704,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the stability to use this ability while swimming."); return B_TRUE; } - + wep = getweapon(user); if (wep) { if (isplayer(user)) msg("You must be unarmed to make a quivering palm strike."); @@ -3814,7 +3814,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // announce if (isplayer(user)) { msg("You shout a blood-curdling war cry!"); - } + } makenoise(user, N_WARCRY); // take a lot of time, so that there is a danger in just @@ -3849,7 +3849,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef return B_TRUE; } - // take time + // take time // - NOTE: purposely using action speed, not weapon speed. taketime(user, getactspeed(user)); @@ -3929,10 +3929,10 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef stopsprinting(user); // start hiding addflag(user->flags, F_HIDING, 0, NA, NA, NULL); - + // even though it's untrainable - this will // still mark it as used. - practice(user, SK_STEALTH, 1); + practice(user, SK_STEALTH, 1); taketime(user, getactspeed(user)); } else if (abilid == OT_A_INSPECT) { @@ -3942,7 +3942,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef int mod; enum SKILLLEVEL slev; flag_t *f; - + // only players can do this if (!isplayer(user)) { return B_FALSE; @@ -4045,7 +4045,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef if (isplayer(user)) msg("You lack the stability to invoke the iron fist manouver while swimming."); return B_TRUE; } - + if (getweapon(user)) { if (isplayer(user)) msg("You must be unarmed to invoke the iron fist."); return B_TRUE; @@ -4077,7 +4077,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef // convert all remaining stamina into damage. dam = getstamina(user); - + setstamina(user, 0); sprintf(damstr, "%s%s invocation of the iron fist",username,getpossessive(username)); losehp(target, dam, DT_DIRECT, user, damstr); @@ -4136,7 +4136,7 @@ int checkcharm(lifeform_t *caster, lifeform_t *target) { } return B_TRUE; } - } + } if (!ischarmable(target)) { if (isplayer(caster)) { @@ -4191,7 +4191,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ maxr = nretcells-1; } targcell = retcell[maxr]; - } + } // adjust for LOF - we already validated this during castspell()'s call to validatespellcell(), // but check again in case, for example, there was an invisible lf in the way which we couldn't @@ -4216,7 +4216,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int cost; cost = getmpcost(caster, spellid); sp = findot(spellid); - + if (sp && hasflag(sp->flags, F_VARPOWER)) { cost *= power; } @@ -4234,15 +4234,15 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (d = DC_N; d <= DC_NW; d++) { c = getcellindir(caster->cell, d); if (c) { - for (o = c->obpile->first ; o ; o = o->next){ + for (o = c->obpile->first ; o ; o = o->next){ if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o); } } } - for (o = caster->cell->obpile->first ; o ; o = o->next){ + for (o = caster->cell->obpile->first ; o ; o = o->next){ if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o); } - for (o = caster->pack->first ; o ; o = o->next){ + for (o = caster->pack->first ; o ; o = o->next){ if (o->type->obclass->id == OC_FLORA) totweight += getobmass(o); } powerinc = totweight / 50; @@ -4252,7 +4252,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // worshipers of ekrub gain power from piety - if (isplayer(caster) && godprayedto(R_GODNATURE) && + 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); @@ -4317,7 +4317,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ o = addobfast(retcell[i]->obpile, OT_ICESHEET); if (o) killflagsofid(o->flags, F_OBHPDRAIN); } - + } else if (spellid == OT_S_ABSORBMETAL) { int i; float totalmass = 0; @@ -4383,7 +4383,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // maximum based on power max = 40 + (power*10); - + if (howmuch > max) howmuch = max; mptoheal = getmaxmp(caster) - caster->mp; @@ -4395,7 +4395,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ howmuch /= 2; if (howmuch > 0) { gainhp(caster, howmuch); - } + } } else { fizzle(caster); return B_TRUE; @@ -4431,7 +4431,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // carried wood? - if (targcell->lf && (targcell->lf != caster) && + if (targcell->lf && (targcell->lf != caster) && !spellresisted(targcell->lf, caster, spellid, power, seenbyplayer, B_TRUE)) { // destroy only WORN wood objects, not CARRIED ones for (o = targcell->lf->pack->first ; o ; o = o->next) { @@ -4455,7 +4455,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // maximum based on power max = 40 + (power*10); - + if (howmuch > max) howmuch = max; mptoheal = getmaxmp(caster) - caster->mp; @@ -4467,7 +4467,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ howmuch /= 2; if (howmuch > 0) { gainhp(caster, howmuch); - } + } } else { fizzle(caster); return B_TRUE; @@ -4540,10 +4540,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ float convrate, powerpct; float obvalue; // needs: - // object = which object to convert + // object = which object to convert if (!targob && isplayer(caster)) { condset_t cs; - initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_STONE, + initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_STONE, CC_NONE); targob = doaskobject(caster->pack, "Convert which object to gold", NULL, NULL, B_FALSE, B_FALSE, B_FALSE, '\0', NULL, SA_NONE, &cs, B_FALSE); @@ -4589,7 +4589,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (newob->pile->owner && isplayer(newob->pile->owner)) { getobname(newob, newobname, newob->amt); msgnocap("%c - %s", newob->letter, newobname); - } + } } else { msg("%s vanishes!", obname); if (isplayer(caster)) angergodmaybe(R_GODNATURE, 10, GA_ATTACKOBJECT); @@ -4725,7 +4725,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("%s comes to life!",obname); if (seenbyplayer) *seenbyplayer = B_TRUE; } - addflag(lf->flags, F_XPVAL, 0, NA, NA, NULL); + addflag(lf->flags, F_XPVAL, 0, NA, NA, NULL); if (caster) { petify(lf, caster); addflag(lf->flags, F_SUMMONEDBY, caster->id, rnd(50,100), NA, NULL); @@ -4734,7 +4734,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addflag(lf->flags, F_NOCORPSE, NA, NA, NA, NULL); if (isplayer(caster)) { angergodmaybe(R_GODFIRE, 50, GA_HERESY); - + } } else { fizzle(caster); @@ -4770,7 +4770,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("%s comes to life!",obname); if (seenbyplayer) *seenbyplayer = B_TRUE; } - addflag(lf->flags, F_XPVAL, 0, NA, NA, NULL); + addflag(lf->flags, F_XPVAL, 0, NA, NA, NULL); if (caster) { petify(lf, caster); addflag(lf->flags, F_SUMMONEDBY, caster->id, rnd(50,100), NA, NULL); @@ -4928,7 +4928,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (target && cansee(player, target)) { char lfname[BUFLEN]; getlfname(target, lfname); - msg("^%cA green miasma surrounds %s%s %s.", getlfcol(target, CC_BAD), lfname, + msg("^%cA green miasma surrounds %s%s %s.", getlfcol(target, CC_BAD), lfname, getpossessive(lfname), obname); if (seenbyplayer) *seenbyplayer = B_TRUE; } else if (targcell && haslos(player, targcell)) { @@ -5057,7 +5057,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ cell_t *c; c = getcellat(caster->cell->map, x, y); if (c && haslof(caster->cell, c, LOF_WALLSTOP, NULL)) { - if (cellwalkable(caster, c, NULL) && + if (cellwalkable(caster, c, NULL) && !celldangerous(caster, c, B_FALSE, NULL)) { poss[nposs++] = c; } @@ -5122,8 +5122,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - - if (isplayer(target)){ + + if (isplayer(target)){ msg("You suddenly feel supremely confident!"); } else if (cansee(player, target)) { char targname[BUFLEN]; @@ -5176,7 +5176,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // set on fire o = addob(c->obpile, "medium fire"); - + if (o) { setobcreatedby(o, caster); } @@ -5315,14 +5315,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ char targname[BUFLEN]; getlfname(target, targname); getobname(targob, obname, targob->amt); - msg("%s%s %s appear%s in your pack!", targname, getpossessive(targname), + msg("%s%s %s appear%s in your pack!", targname, getpossessive(targname), noprefix(obname), OB1(targob,"es","")); if (seenbyplayer) *seenbyplayer = B_TRUE; } else if (cansee(player, target)) { char targname[BUFLEN]; getlfname(target, targname); getobname(targob, obname, targob->amt); - msg("^%c%s%s %s vanish%s!", getlfcol(target, CC_VBAD), targname, getpossessive(targname), noprefix(obname), + msg("^%c%s%s %s vanish%s!", getlfcol(target, CC_VBAD), targname, getpossessive(targname), noprefix(obname), OB1(targob,"es","")); if (seenbyplayer) *seenbyplayer = B_TRUE; } @@ -5395,7 +5395,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // too heavy? max weight is now based on our race's weight and intelligence - maxweight = getlfweight(caster, B_NOOBS) + + maxweight = getlfweight(caster, B_NOOBS) + (getlfweight(caster, B_NOOBS) * (getstatmod(caster, A_IQ) / 100)); // modify by power @@ -5445,7 +5445,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ awardxpfor(c->lf, 25); } // prevent attacking it and getting xp again. - addflag(c->lf->flags, F_XPVAL, 0, NA, NA, NULL); + addflag(c->lf->flags, F_XPVAL, 0, NA, NA, NULL); } if (cansee(player, c->lf)) { @@ -5519,7 +5519,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ losehp(arccell[i]->lf, rolldie(3,nsides), DT_ELECTRIC, caster, "an electricity bolt"); hitcell[nhitcells++] = arccell[i]; assert(nhitcells < MAXRETCELLS*2); - + if (haslos(player, arccell[i])) { stillseen = B_TRUE; needredraw = B_TRUE; @@ -5531,7 +5531,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ range /= 2; if (range <= 0) break; if (--nsides <= 0) break; // ie. max of 5 arcs - + // now arc to other cells with lfs still within range narccells2 = 0; for (i = 0; i < narccells; i++) { @@ -5540,7 +5540,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (y = arccell[i]->y - range ; y <= arccell[i]->y + range; y++) { for (x = arccell[i]->x - range ; x <= arccell[i]->x + range; x++) { c = getcellat(targcell->map, x, y); - if (c && c->lf && (c->lf != caster) + if (c && c->lf && (c->lf != caster) && haslof(arccell[i], c, LOF_NEED, NULL)) { int n,found = B_FALSE; // if this cell hasn't been hit... @@ -5557,7 +5557,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ assert(narccells2 < MAXRETCELLS); animline(arccell[i], c, B_FALSE, '/', '\\', C_WHITE); } - } + } } } } @@ -5632,7 +5632,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ clonelf(caster, targcell); } else if (spellid == OT_S_CLOUDKILL) { int radius; - + if (targcell->type->solid) { fizzle(caster); return B_TRUE; @@ -5640,7 +5640,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ radius = (power/3); addobburst(targcell, radius, DT_COMPASS, "puff of poison gas", caster, LOF_WALLSTOP); - + if (haslos(player, targcell)) { msg("A cloud of poison gas appears!"); if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -5649,7 +5649,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ char targetname[BUFLEN]; target = targcell->lf; - + if (!target) { fizzle(caster); return B_TRUE; @@ -5694,7 +5694,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ char targetname[BUFLEN]; target = targcell->lf; - + if (!target) { fizzle(caster); return B_TRUE; @@ -5705,7 +5705,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (getraceclass(target) != RC_ANIMAL) { fizzle(caster); return B_TRUE; - } + } if (checkcharm(caster, target)) return B_FALSE; @@ -5825,7 +5825,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // partially avoidable if (check_for_block(caster, target, dam, DT_COLD, 999, "the icy air", B_RANGED)) { dam /= 2; - } + } losehp(target, dam, DT_COLD, caster, "a chill spell"); } } else if (spellid == OT_S_COLDBURST) { @@ -5842,7 +5842,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster) || cansee(player, caster)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - + for (y = caster->cell->y - range ; y <= caster->cell->y + range; y++) { for (x = caster->cell->x - range ; x <= caster->cell->x + range; x++) { targcell = getcellat(caster->cell->map, x,y); @@ -5858,9 +5858,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // partially avoidable if (check_for_block(caster, target, dam, DT_COLD, 999, "a burst of coldness", B_RANGED)) { dam /= 2; - } else { + } else { if (haslos(player, targcell)) { - msg("^%c%s %s chilled!",getlfcol(targcell->lf, CC_BAD), + msg("^%c%s %s chilled!",getlfcol(targcell->lf, CC_BAD), lfname,is(targcell->lf)); } } @@ -5884,7 +5884,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } - calcbresnham(caster->cell->map, caster->cell->x, caster->cell->y, + calcbresnham(caster->cell->map, caster->cell->x, caster->cell->y, targcell->x, targcell->y, retcell, &nretcell); for (i = 1; i < nretcell; i++) { @@ -5906,7 +5906,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (check_for_block(caster, target, dam, DT_COLD, 999, "a blast of icy air", B_RANGED)) { dam /= 2; - } else { + } else { if (cansee(player, target)) { msg("^%cA blast of icy air assails %s.",getlfcol(target, CC_BAD), lfname); } @@ -5942,12 +5942,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster) || cansee(player, target)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - // it worked. temporarily make them a pet so that you + // it worked. temporarily make them a pet so that you // can command them. f = addflag(target->flags, F_PETOF, caster->id, NA, NA, NULL); docomms(target); killflag(f); - + } } else if (spellid == OT_S_CREATEFOOD) { objecttype_t *ot; @@ -5968,7 +5968,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (hasflag(ot->flags, F_VENOMSAC)) { pickagain = B_TRUE; continue; - } + } f = hasflag(ot->flags, F_EDIBLE); if (!f || (f->val[1] <= 5)) { pickagain = B_TRUE; @@ -5976,7 +5976,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - + o = addobfast(targcell->obpile, ot->id); if (i == 0) { getobname(o, obname, o->amt); @@ -5993,7 +5993,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { // ie. power == 1 msg("%s appear%s!", obname, (amt == 1) ? "s" : ""); } - + if (seenbyplayer) *seenbyplayer = B_TRUE; } if (isplayer(caster)) { @@ -6020,7 +6020,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targcell) { fizzle(caster); return B_TRUE; - } + } // determine type of mosnter if (getforcedspellrace(caster, spellid, buf, NULL)) { @@ -6087,8 +6087,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ ch = askchar("Teleport to the new vault", "yn","y", B_TRUE, B_FALSE); if (ch == 'y') { condset_t cs; - initcondv(&cs, CC_WALKABLEFOR, B_TRUE, caster->id, - CC_HASROOMID, B_TRUE, caster->cell->map->nrooms-1, + initcondv(&cs, CC_WALKABLEFOR, B_TRUE, caster->id, + CC_HASROOMID, B_TRUE, caster->cell->map->nrooms-1, CC_NONE); //c = getrandomroomcell(caster->cell->map, caster->cell->map->nrooms-1, WE_WALKABLE); c = getcell_cond(caster->cell->map, &cs); @@ -6117,11 +6117,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ switch (bp[i]) { case BP_BODY: default: o = addob(target->pack, "ice crystal armour"); break; - case BP_HEAD: + case BP_HEAD: o = addob(target->pack, "ice crystal helmet"); break; - case BP_HANDS: + case BP_HANDS: o = addob(target->pack, "ice crystal gauntlets"); break; - case BP_FEET: + case BP_FEET: o = addob(target->pack, "ice crystal boots"); break; } if (o) { @@ -6133,7 +6133,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(target)) { msg("^%c%s forms %s your %s!", getlfcol(target, CC_VGOOD), obname, getbodypartequipname(bp[i]), getbodypartname(target, bp[i])); } else if (cansee(player, target)) { - msg("^%c%s forms %s %s%s %s!", getlfcol(target, CC_VGOOD),obname, getbodypartequipname(bp[i]), + msg("^%c%s forms %s %s%s %s!", getlfcol(target, CC_VGOOD),obname, getbodypartequipname(bp[i]), castername, getpossessive(castername), getbodypartname(target, bp[i])); } // don't use "wear" because we don't want it being announced. @@ -6149,7 +6149,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { killob(o); } - } + } } } @@ -6158,7 +6158,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ stopspell(caster, spellid); return B_TRUE; } - + } else if (spellid == OT_S_CRYSTALSHIELD) { object_t *o; targcell = caster->cell; @@ -6270,7 +6270,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // remove this from the list for (n = i; n < nposs-1; n++) { poss[n] = poss[n+1]; - } + } nposs--; ndone++; } @@ -6336,7 +6336,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (blessed || (power >= 5)) { modillumination(targcell->map, D_DARKER); - } + } if (haslos(player, targcell)) { msg("A cloud of darkness descends nearby!"); @@ -6350,7 +6350,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ object_t *o,*nexto; int range = 0, ncells,i,lfdam,obdam,walldam; cell_t *cell[MAXCANDIDATES]; - + // default to radiating out from the caster's cell if (!targcell) { if (caster) { @@ -6472,7 +6472,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ somethinghappened = B_TRUE; } } - + // now check objects on the ground... for (o = caster->cell->obpile->first ; o ; o = o->next) { if (o->blessed == B_BLESSED) { @@ -6516,7 +6516,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { // don't need line of fire OR sight! //if (!validatespellcell(caster, &targcell, TT_NONE, spellid, power, frompot)) return B_TRUE; - ch = askchar("Dig in which direction (- to cancel)", "yuhjklbn.-<>","-", B_FALSE, B_TRUE); + ch = askchar("Dig in which direction (- to cancel)", "yuhjklbn.-<>","-", B_FALSE, B_TRUE); if ((ch == '.') || (ch == '-') || !ch) { fizzle(caster); return B_TRUE; @@ -6572,7 +6572,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int dam; dam = roll("2d6"); if (check_for_block(caster, c2->lf, dam, DT_PROJECTILE, 999, "flying debris", B_RANGED)) { - } else { + } else { if (cansee(player, c2->lf)) { char lfname[BUFLEN]; getlfname(c2->lf, lfname); @@ -6591,7 +6591,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addobsinradius(c, 1, DT_COMPASS, "pool of blood", B_TRUE, B_NOCENTRE, NULL, NULL, NULL, NULL); addob(c->obpile, "pool of blood"); } - + } else { // stop. break; @@ -6619,7 +6619,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ c = getcellindir(c, dir); } - + // announce destruction of any walls seen /* if (numseen) { @@ -6641,10 +6641,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - if (isplayer(target)) { + if (isplayer(target)) { msg("^%cYou feel your body's essence unraveling!", getlfcol(target, CC_BAD)); } else if (cansee(player, target)) { - char lfname[BUFLEN]; + char lfname[BUFLEN]; getlfname(target, lfname); msg("%s convulses.", lfname); } @@ -6677,7 +6677,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("%s spins around to face %s!", tname, getdirname(target->facing)); if (seenbyplayer) *seenbyplayer = B_TRUE; } - + setfacing(target, newdir); // ai loses target info loseaitargets(target); @@ -6778,7 +6778,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } f = hasflag(o->flags, F_TRAPPED); if (f) { - if ((f->val[0] == OT_TRAPARROWP) || + if ((f->val[0] == OT_TRAPARROWP) || (f->val[0] == OT_TRAPNEEDLEP) || (f->val[0] == OT_TRAPGAS)) { char obname[BUFLEN]; @@ -6794,7 +6794,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (ispoisoned || isdecayed) { char obname[BUFLEN]; getobname(o, obname, o->amt); - msg("%s %s %s!", obname, OB1(o,"is","are"), + msg("%s %s %s!", obname, OB1(o,"is","are"), ispoisoned ? "poisoned" : "rotted"); npoisoned++; } @@ -6803,7 +6803,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ makeknown(o->type->id); } } - } + } if (!npoisoned) { msg("You can't detect any %spoison nearby.", selfpoisoned ? "other " : ""); } @@ -6839,7 +6839,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } addtempflag(caster->flags, F_LEVITATING, B_TRUE, NA, NA, NULL, howlong); addtempflag(caster->flags, F_DTIMMUNE, DT_PROJECTILE, NA, NA, NULL, howlong); - + } else if (spellid == OT_S_EVAPORATE) { cell_t *cell[MAXCANDIDATES]; int i,ncells; @@ -6873,7 +6873,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("%s boil%s and explode%s!", obname, OBS1(o), OBS1(o)); removeob(o, ALL); } - + if (dosteam) { addob(cell[i]->obpile, "cloud of steam"); } @@ -6890,7 +6890,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ removeob(o, ALL); addob(cell[i]->obpile, "cloud of steam"); } - + } } } @@ -6942,7 +6942,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (i = 1; i < caster->nlos; i++) { cell_t *c; c = caster->los[i]; - if (c->lf && + if (c->lf && (lfhasflag(c->lf, F_SUMMONEDBY) || (getraceclass(c->lf) == RC_DEMON)) ) { if (canexorcise(caster, c->lf, power)) { unsummon(c->lf, B_TRUE); @@ -7077,10 +7077,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ return B_TRUE; } - if (isplayer(target)) { + if (isplayer(target)) { msg("^%cYour brain cells are blasted!",getlfcol(target, CC_VBAD)); } else if (isplayer(caster)) { - char lfname[BUFLEN]; + char lfname[BUFLEN]; getlfname(target, lfname); msg("^%cYou blast %s%s brain cells!", getlfcol(target, CC_VBAD), lfname, getpossessive(lfname)); @@ -7110,10 +7110,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (isplayer(caster) || cansee(player, caster)) { if (isimmuneto(target->flags, DT_NECROTIC, B_FALSE)) { - msg("^%c%s suck%s death from %s!",getlfcol(target, CC_BAD), + msg("^%c%s suck%s death from %s!",getlfcol(target, CC_BAD), castername,isplayer(caster) ? "" : "s", lfname); } else { - msg("^%c%s suck%s life from %s!",getlfcol(target, CC_BAD), + msg("^%c%s suck%s life from %s!",getlfcol(target, CC_BAD), castername,isplayer(caster) ? "" : "s", lfname); } if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -7150,7 +7150,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster) || haslos(player, targcell)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - + for (y = targcell->y - range ; y <= targcell->y + range; y++) { for (x = targcell->x - range ; x <= targcell->x + range; x++) { cell_t *c; @@ -7237,7 +7237,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // always set to 3 (ie. animal) f = addtempflag(target->flags, F_ATTRSET, A_IQ, 15, NA, NULL, howlong); f->obfrom = OT_S_FEEBLEMIND; - + if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); @@ -7309,7 +7309,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targcell) { fizzle(caster); return B_TRUE; - } + } // add it newlf = summonmonster(caster, targcell, R_FLOATINGDISC, NULL, PERMENANT, B_TRUE); if (newlf) { @@ -7344,7 +7344,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (i = 0; i < amt; i++) { cell_t *c; - initcondv(&cs, CC_SOLID, B_FALSE, NA, + initcondv(&cs, CC_SOLID, B_FALSE, NA, CC_HASOBTYPE, B_FALSE, badoid, CC_NONE); @@ -7404,8 +7404,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ getradiuscells(targcell, n, DT_COMPASS, B_TRUE, LOF_WALLSTOP, B_FALSE, retcell, &nretcells, 0); for (i = 0; i < nretcells; i++) { if (retcell[i]->lf) { - knockback(retcell[i]->lf, - getdiraway(retcell[i], targcell, NULL, B_FALSE, DT_COMPASS, B_FALSE), + knockback(retcell[i]->lf, + getdiraway(retcell[i], targcell, NULL, B_FALSE, DT_COMPASS, B_FALSE), 2, target, 100+(power*10), B_DOANNOUNCE, B_DODAM); } } @@ -7536,7 +7536,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - if ((spellid = OT_S_METEOR) || (power > 5)) { + if ((spellid = OT_S_METEOR) || (power > 5)) { for (dir = D_N; dir <= D_W; dir++) { cell_t *c; c = getcellindir(targcell, dir); @@ -7563,7 +7563,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } redrawresume(); - + } else { failed = B_TRUE; } @@ -7620,16 +7620,16 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ range = 1 + (power / 5); // announce - sprintf(buf, "%s emit%s a %sblast of fire!",castername,isplayer(caster) ? "" : "s", + sprintf(buf, "%s emit%s a %sblast of fire!",castername,isplayer(caster) ? "" : "s", (power >= 5) ? "huge " : ""); - sprintf(buf2, "Something emit%s a %sblast of fire!",isplayer(caster) ? "" : "s", + sprintf(buf2, "Something emit%s a %sblast of fire!",isplayer(caster) ? "" : "s", (power >= 5) ? "huge " : ""); animradial(caster->cell, range, '}', C_RED, DT_ORTH, buf, buf2); if (isplayer(caster) || cansee(player, caster)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - + for (y = caster->cell->y - range ; y <= caster->cell->y + range; y++) { for (x = caster->cell->x - range ; x <= caster->cell->x + range; x++) { targcell = getcellat(caster->cell->map, x,y); @@ -7715,7 +7715,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (seenpits || seenwalls || cansee(player, caster)) { msg("The earth below you shudders and shakes violently!"); - setlosdirty(player); + setlosdirty(player); } if (seenpits) { if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -7741,7 +7741,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { // ask for an object condset_t cs; - initcondv(&cs, CC_HASFLAG, B_TRUE, F_ENCHANTABLE, + initcondv(&cs, CC_HASFLAG, B_TRUE, F_ENCHANTABLE, CC_NONE); o = askobject(caster->pack, "Enchant which object", NULL, NULL, '\0', &cs, B_FALSE); } @@ -7758,7 +7758,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int amt; char obname[BUFLEN]; getobname(o, obname, o->amt); - msg("Your %s glow%s %s for a moment.", noprefix(obname), (o->amt == 1) ? "s" : "", + msg("Your %s glow%s %s for a moment.", noprefix(obname), (o->amt == 1) ? "s" : "", (blessed == B_CURSED) ? "black" : "green"); if (seenbyplayer) *seenbyplayer = B_TRUE; if (blessed == B_CURSED) { @@ -7822,7 +7822,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } - // create vine + // create vine o = addobfast(targcell->obpile, OT_VINE); // set power @@ -7872,7 +7872,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (seenobs || seenwalls || cansee(player, caster)) { msg("A shockwave of destructive force rips through the air!"); - setlosdirty(player); + setlosdirty(player); } if (isplayer(caster) && killedobs) { angergodmaybe(R_GODNATURE, 10*killedobs, GA_ATTACKOBJECT); @@ -7987,7 +7987,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // now gather flame from cells in los for (i = 0; (i < target->nlos) && (amt < power); i++) { object_t *o, *nexto; - for (o = target->los[i]->obpile->first ; o ; o = nexto) { + for (o = target->los[i]->obpile->first ; o ; o = nexto) { nexto = o->next; if (o->material->id == MT_FIRE) { removeob(o, ALL); @@ -8054,7 +8054,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } addobburst(targcell, radius, DT_ORTH, createname, caster, LOF_WALLSTOP); - + if (haslos(player, targcell)) { char underbuf[BUFLEN]; if (targcell->lf && cansee(player, targcell->lf)) { @@ -8088,7 +8088,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ radius = power / 2; if (radius < 1) radius = 1; - addobsinradius(targcell, radius, DT_ORTH, "hail storm", B_FALSE, B_INCLUDECENTRE, + addobsinradius(targcell, radius, DT_ORTH, "hail storm", B_FALSE, B_INCLUDECENTRE, caster, NULL, NULL, NULL); // replace damage per sec with power d4 @@ -8110,7 +8110,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } // end forx } // end fory - + free(dambuf); } else { // end if targcell not solid failed = B_TRUE; @@ -8274,7 +8274,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } donesomething = B_TRUE; } - } + } } if (isplayer(target)) { @@ -8285,7 +8285,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (donesomething && isplayer(caster)) { // god of death REALLY doesn't like healing. angergodmaybe(R_GODDEATH, 40, GA_HERESY); - } + } // hostile monsters might calm down if (!undead && !frompot && donesomething && isplayer(caster) && !isplayer(target) && (getallegiance(target) == AL_HOSTILE)) { enum ATTRBRACKET iqb; @@ -8316,12 +8316,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { int nburn = 0,ndropobs = 0; object_t *dropob[MAXPILEOBS]; - // affect equipped objects + // affect equipped objects for (o = target->pack->first ; o ; o = nexto) { int amt; nexto = o->next; amt = isheatable(o); - + if (ismetal(o->material->id) && amt) { int dodam = B_FALSE; if (isequippedon(o, BP_WEAPON) || isequippedon(o, BP_SECWEAPON)) { @@ -8351,7 +8351,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(target)) { char obname[BUFLEN]; getobname(dropob[i], obname, dropob[i]->amt); - msg("^BYour %s %s too hot to hold!", obname, + msg("^BYour %s %s too hot to hold!", obname, (dropob[i]->amt == 1) ? "is" : "are"); } drop(dropob[i], dropob[i]->amt); @@ -8410,7 +8410,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // move any objects which are in the way (but not lfs) - initcondv(&cs, CC_SOLID, B_FALSE, NA, + initcondv(&cs, CC_SOLID, B_FALSE, NA, CC_NONE); for (oo = targcell->obpile->first ; oo ; oo = oo->next) { if ((oo != o) && (getmaterialstate(oo->material->id) == MS_SOLID)) { @@ -8441,8 +8441,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ o = targob; } else { condset_t cs; - initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, - CC_HASFLAG, B_TRUE, F_DAM, + initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, + CC_HASFLAG, B_TRUE, F_DAM, CC_NONE); // ask for an object o = doaskobject(caster->pack, "Hone which metal weapon", NULL, NULL, B_FALSE, B_FALSE, B_FALSE, '\0', NULL, SA_NONE, &cs, B_FALSE); @@ -8515,7 +8515,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - + if (isplayer(target)) { msg("^%cA sudden hunger comes over you!", getlfcol(target, CC_BAD)); if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -8524,7 +8524,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ getlfname(target, lfname); msg("^%c%s looks ravenous!", getlfcol(target, CC_BAD), lfname); if (seenbyplayer) *seenbyplayer = B_TRUE; - } + } if (lfhasflag(target, F_HUNGER)) { modhunger(target, HUNGERCONST); // make more hungry @@ -8569,7 +8569,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } addtempflag(wep->flags, F_FROZEN, B_TRUE, NA, NA, NULL, 10 + power*3); - + } else if (spellid == OT_S_ICICLE) { object_t *o; int donesomething = B_FALSE; @@ -8585,9 +8585,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // knock lfs away if (targcell->lf) { cell_t *c; - c = getrandomadjcell(targcell, &ccwalkable, B_NOEXPAND); + c = getrandomadjcell(targcell, &ccwalkable, B_NOEXPAND); if (c) { - knockback(targcell->lf, getdirtowards(targcell, c, NULL, B_FALSE, DT_COMPASS), 1, NULL, + knockback(targcell->lf, getdirtowards(targcell, c, NULL, B_FALSE, DT_COMPASS), 1, NULL, 100+(power*10), B_DOANNOUNCE, B_DODAM); } else { if (isplayer(targcell->lf)) { @@ -8602,7 +8602,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ donesomething = B_TRUE; } - // NOW create the icicle + // NOW create the icicle o = addob(targcell->obpile, "huge icicle"); if (o) { flag_t *f; @@ -8612,7 +8612,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ f->val[1] = 3+power; } addflag(o->flags, F_OBHPDRAIN, 1, DT_MELT, NA, NULL); - + donesomething = B_TRUE; } else { if (haslos(player, targcell)) { @@ -8634,7 +8634,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { // ask for an object condset_t cs; - initcondv(&cs, CC_IDENTIFIED, B_FALSE, NA, + initcondv(&cs, CC_IDENTIFIED, B_FALSE, NA, CC_NONE); o = askobject(target->pack, "Identify which object", "You have nothing which needs identifying.", NULL, '\0', &cs, B_FALSE); } @@ -8664,10 +8664,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else if (spellid == OT_S_IMMOLATE) { char targname[BUFLEN],buf[BUFLEN]; - if (!target) { + if (!target) { target = targcell->lf; } - if (!target) { + if (!target) { fizzle(caster); return B_TRUE; } @@ -8679,7 +8679,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ getlfname(target, targname); if (rolltohit(caster, target, NULL, NULL, NULL, NULL)) { if (isplayer(caster) || cansee(player, caster)) { - construct_hit_string(caster, target, castername, targname, targname, NULL, DT_TOUCH, 0, target->maxhp, + construct_hit_string(caster, target, castername, targname, targname, NULL, DT_TOUCH, 0, target->maxhp, 0, B_FALSE, B_FALSE, B_FALSE, B_TRUE, buf); msg("%s", buf); if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -8708,7 +8708,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (l = caster->cell->map->lf ; l ; l = l->next) { if (l != caster) { /* - if (isimmuneto(l->flags, DT_NECROTIC, B_FALSE) || + if (isimmuneto(l->flags, DT_NECROTIC, B_FALSE) || spellresisted(l, caster, spellid, power, seenbyplayer, B_FALSE)) { */ if (spellresisted(l, caster, spellid, power, seenbyplayer, B_FALSE)) { @@ -8795,7 +8795,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("Your %s slides off your %s!", buf, getbodypartname(caster, f->val[0])); } else if (cansee(player, caster)) { getobname(o, buf, 1); - msg("%s%s %s slides off its %s!", castername, + msg("%s%s %s slides off its %s!", castername, getpossessive(castername), buf, getbodypartname(caster, f->val[0])); } moveob(o, caster->cell->obpile, o->amt); @@ -8847,7 +8847,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ setcellknown(c, MAXOF(PR_ADEPT, getskill(target, SK_CARTOGRAPHY))); } } - } + } } } @@ -8929,7 +8929,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ lifeform_t *oldplayer; // calc view - setlosdirty(targcell->lf); + setlosdirty(targcell->lf); //precalclos(targcell->lf); // temporarily change player pointer... @@ -8968,10 +8968,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - if (isplayer(target)) { + if (isplayer(target)) { msg("^%cA lash of psychic power assaults your mind!",getlfcol(target, CC_BAD)); } else if (isplayer(caster)) { - char lfname[BUFLEN]; + char lfname[BUFLEN]; getlfname(target, lfname); msg("^%cYou psycically lash %s%s mind!", getlfcol(target, CC_BAD), lfname, getpossessive(lfname)); @@ -9168,9 +9168,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // now remove the ability to cast them! while (ndone < power) { - // for player: - // remove memorised spells - // for monsters: + // for player: + // remove memorised spells + // for monsters: // remove racial spells AND abilities // // abilities/spells conferred by objects are not affected. @@ -9183,7 +9183,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ ok = B_FALSE; } else if (retflag[i]->lifetime != PERMENANT) { ok = B_FALSE; - } + } } else { if ((retflag[i]->lifetime != FROMRACE) && (retflag[i]->lifetime != PERMENANT)) { ok = B_FALSE; @@ -9212,7 +9212,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ sid = f->val[0]; ot = findot(sid); if (seen && !isplayer(target)) { - msg("^%c%s can no longer %s '%s'!", getlfcol(target, CC_BAD), lfname, + msg("^%c%s can no longer %s '%s'!", getlfcol(target, CC_BAD), lfname, (f->id == F_CANCAST) ? "cast" : "use the ability", ot->name); } killflag(f); @@ -9265,8 +9265,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ newoid = OT_GREATAXE; } else if (targob->type->obclass->id == OC_ROCK) { newoid = OT_BOULDER; - } else if ((targob->type->obclass->id == OC_ARMOUR) && - hasflag(targob->flags, F_MULTISIZE) && + } else if ((targob->type->obclass->id == OC_ARMOUR) && + hasflag(targob->flags, F_MULTISIZE) && (getarmoursize(targob) < SZ_LARGE)) { newsize = getarmoursize(targob) + 1; } else if (targob->type->obclass->id == OC_POTION) { @@ -9353,8 +9353,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ newoid = OT_STICK; } else if (isweapon(targob) && (obsk->id == SK_AXES)) { newoid = OT_KNIFE; - } else if ((targob->type->obclass->id == OC_ARMOUR) && - hasflag(targob->flags, F_MULTISIZE) && + } else if ((targob->type->obclass->id == OC_ARMOUR) && + hasflag(targob->flags, F_MULTISIZE) && (getarmoursize(targob) > SZ_TINY)) { newsize = getarmoursize(targob) - 1; } else if (targob->type->obclass->id == OC_POTION) { @@ -9423,7 +9423,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // ask for an object if (spellid == OT_S_ACCELMETAL) { condset_t cs; - initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, + initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, CC_NONE); // TODO: handle ai casting targob = askobject(caster->pack, "Accelerate which metal object", NULL, NULL, 't', &cs, B_FALSE); @@ -9442,7 +9442,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - + if (!targob || ((spellid == OT_S_ACCELMETAL) && !ismetal(targob->material->id)) ) { fizzle(caster); return B_TRUE; @@ -9452,10 +9452,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if ((spellid == OT_S_PROPELMISSILE) && (getmaxthrowrange(caster, targob) <= 0)) { if (isplayer(caster)) { msg("%s is too heavy for you to throw!"); - } + } return B_FALSE; // don't cost mana } - + if (isequipped(targob) && iscursed(targob)) { msg("Your %s appears to be stuck to you!", noprefix(obname)); @@ -9530,7 +9530,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!srcmap) { // we'll need to create the map. srcmap = addmap(); - createmap(srcmap, depth, srcregion, NULL, D_NONE, NULL); + createmap(srcmap, depth, srcregion, NULL, D_NONE, NULL); } if (rt->whatkind == RT_BRANCHLINK) { @@ -9552,7 +9552,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { msg("srcregion doesnt exist!"); } - + if (dstcell && !cellwalkable(caster, dstcell, NULL)) { dstcell = real_getrandomadjcell(dstcell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED, NULL, NULL); } @@ -9571,10 +9571,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ region_t *r; char ch = 'a'; if (seenbyplayer) *seenbyplayer = B_TRUE; - // ask for region + // ask for region initprompt(&prompt, "Where do you wish to travel?"); prompt.maycancel = B_TRUE; - + for (r = firstregion ; r ; r = r->next) { branch_t *rt; rt = r->rtype; @@ -9597,9 +9597,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // find random free cell in map //targcell = getrandomcell(m); //targcell = getrandomroomcell(m, ANYROOM, WE_WALKABLE); - initcondv(&cs, CC_ISROOM, B_TRUE, NA, + initcondv(&cs, CC_ISROOM, B_TRUE, NA, CC_WALKABLEFOR, B_TRUE, target->id, - CC_DANGEROUSFOR, B_FALSE, target->id, + CC_DANGEROUSFOR, B_FALSE, target->id, CC_NONE); targcell = getcell_cond(m, &ccwalkableroom); if (!targcell) { @@ -9673,7 +9673,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targcell) { fizzle(caster); - // purposely returning false here, since we've already revealed + // purposely returning false here, since we've already revealed // some information to the caster. return B_FALSE; } @@ -9705,7 +9705,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else if (skillcheck(target, SC_STR, 100 + (power*5), 0)) { saved = B_TRUE; } - + if (saved) { if (isplayer(target)) { msg("You stiffen momentarily."); @@ -9810,7 +9810,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("^%cA glob of venom hits %s.",getlfcol(target, CC_BAD), lfname); } if (!isimmuneto(target->flags, DT_POISON, B_FALSE)) { - poison(target, power*3, P_VENOM, (power/4)+1, "a glob of venom", + poison(target, power*3, P_VENOM, (power/4)+1, "a glob of venom", caster ? caster->race->id : R_NONE, B_TRUE); } } @@ -9832,7 +9832,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster)) { char buf[BUFLEN]; char ch; - snprintf(buf, BUFLEN, "You may be stuck in %s%s body - proceed?", targname, + snprintf(buf, BUFLEN, "You may be stuck in %s%s body - proceed?", targname, getpossessive(targname)); ch = askchar(buf, "yn", "n", B_TRUE, B_FALSE); if (ch != 'y') { @@ -9889,7 +9889,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } - + // remove 'become a ghost' flag fro mcaster killflagsofid(caster->flags, F_RISEASGHOST); @@ -9924,7 +9924,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ case AL_FRIENDLY: makefriendly(target, PERMENANT); break; - } + } // now kill the caster! die(caster); } @@ -9986,7 +9986,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster) || haslos(player, targcell)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - + for (y = targcell->y - range ; y <= targcell->y + range; y++) { for (x = targcell->x - range ; x <= targcell->x + range; x++) { cell_t *c; @@ -10015,7 +10015,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ cell_t *cellaway; target = targcell->lf; - + pushpower = power+1; getlfname(target, tname); @@ -10042,7 +10042,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (pushcaster) { // push caster back - msg("%s %s backwards through the air!", castername, + msg("%s %s backwards through the air!", castername, isplayer(caster) ? "sail" : "sails"); knockback(caster, diraway, pushpower, caster, NA, B_NOANNOUNCE, B_NODAM); // never fall } else { @@ -10065,7 +10065,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int gotmetal = B_FALSE; float metalweight = 0; object_t *wep; - + donesomething = B_FALSE; // if they are weilding a metal weapon... @@ -10074,7 +10074,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // pull their weapon from them pullobto(wep, caster); donesomething = B_TRUE; - } + } // if they're wearing metal... @@ -10114,7 +10114,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } return B_FALSE; } - } + } if (!donesomething) { fizzle(caster); @@ -10131,7 +10131,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } else if (cansee(player, caster)) { if (seenbyplayer) *seenbyplayer = B_TRUE; - } + } if (getobpileweight(caster->pack) + getobmass(targob) <= getmaxcarryweight(caster)) { // move it to the player pullobto(targob, caster); @@ -10194,7 +10194,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ dstportal = linkportaltodepth(srcportal, newdepth); setobcreatedby(dstportal, caster); - + //newmap = findmapofdepth(newdepth); // make both gates temporary maketemporary(srcportal, 6, "vanishes"); @@ -10256,7 +10256,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ msg("^%cYour %s suddenly appears next to you!", getlfcol(target, CC_BAD), noprefix(obname)); } else { msg("^%cYour %s suddenly vanishes!", getlfcol(target, CC_BAD), noprefix(obname)); - + announcethump = B_TRUE; } } else if (cansee(player, target)) { @@ -10287,7 +10287,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int howlong = 30; int willannounce = B_FALSE; char targname[BUFLEN]; - + // special case for ghosts... if (caster->race->id == R_GHOST) { targcell = caster->cell; @@ -10338,7 +10338,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else if (spellid == OT_S_KNOCK) { object_t *o; target = targcell->lf; - + // high powered knock can knock back monsters if (target && (power >= 7)) { int dir; @@ -10370,7 +10370,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addflag(o->flags, F_DEAD, B_TRUE, NA, NA, NULL); donesomething = B_TRUE; } - } else { + } else { flag_t *f; f = hasflag(o->flags, F_LOCKED); if (f) { @@ -10436,7 +10436,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (blessed || (power >= 5)) { // permenant light modillumination(targcell->map, D_LIGHTER); - } + } if (haslos(player, targcell)) { if (power < 5) { @@ -10472,7 +10472,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ animcells(caster->cell, &retcell[1], nretcells-1, B_FALSE, '/', '\\', C_WHITE); if (cansee(player, caster)) { // if fromob is set, this was from a lightning javelin. instead of announcing - // the bolt firing, announce it hitting people (since we've already said + // the bolt firing, announce it hitting people (since we've already said // "the javelin turns into lightning"). if (!fromob) { msg("%s shoot%s a bolt of lightning!",castername, isplayer(caster) ? "" : "s"); @@ -10553,7 +10553,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ int dam; if (cansee(player, targ[i])) { getlfname(targ[i],targname); - msg("^%c%s %s struck by a bolt of lightning!",getlfcol(targ[i], CC_BAD), + msg("^%c%s %s struck by a bolt of lightning!",getlfcol(targ[i], CC_BAD), targname, is(targ[i])); } if (caster && (targ[i]->cell->map->habitat->id == H_FOREST)) { @@ -10610,7 +10610,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (o = c->obpile->first ; o ; o = o->next) { char obname[BUFLEN]; - real_getobname(o, obname, o->amt, B_PREMODS, B_CONDITION, B_NOBLINDADJUST, + real_getobname(o, obname, o->amt, B_PREMODS, B_CONDITION, B_NOBLINDADJUST, B_NOBLESSINGS, B_USED, B_NOSHOWALL); if (!hasflag(o->flags, F_TRAIL) && strcasestr(obname, wantname)) { char ptext[BUFLEN]; @@ -10625,7 +10625,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (c->lf) { for (o = c->lf->pack->first ; o ; o = o->next) { char obname[BUFLEN]; - real_getobname(o, obname, o->amt, B_PREMODS, B_CONDITION, + real_getobname(o, obname, o->amt, B_PREMODS, B_CONDITION, B_NOBLINDADJUST, B_NOBLESSINGS, B_USED, B_NOSHOWALL); if (strcasestr(obname, wantname)) { char ptext[BUFLEN]; @@ -10634,7 +10634,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ real_getlfnamea(c->lf, lfname, NULL, B_SHOWALL, B_REALRACE); getdisttext(caster->cell, c, distbuf, NULL, dirbuf); - sprintf(ptext, "%s: %s (%s to the %s, held by %s)", + sprintf(ptext, "%s: %s (%s to the %s, held by %s)", mapname, obname, distbuf, dirbuf, lfname); addchoice(&prompt, ch++, ptext, NULL, o, NULL); @@ -10794,7 +10794,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (o = op->first ; o ; o = nexto) { nexto = o->next; if (!hasflag(o->flags, F_NOSTEAL) && !hasflag(o->flags, F_NOPICKUP) && !hasflag(o->flags, F_COSMETIC)) { - if ((getobweight(o) <= 5) || + if ((getobweight(o) <= 5) || ((isweapon(o)) && (isequipped(o))) ) { poss[nposs++] = o; } @@ -10829,7 +10829,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ c = getrandomadjcell(targcell, &cs, B_ALLOWEXPAND); if (c && ((rnd(1,100)-power) <= 33)) { // move it - fireat(NULL, blowob[i], 1, c, 4, NULL); + fireat(NULL, blowob[i], 1, c, 4, NULL); } } @@ -10896,7 +10896,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ o = targob; } else { condset_t cs; - initcondv(&cs, CC_DAMAGED, B_TRUE, NA, + initcondv(&cs, CC_DAMAGED, B_TRUE, NA, CC_NONE); // ask for an object o = askobject(caster->pack, "Mend which object", NULL, NULL, '\0', &cs, B_FALSE); @@ -10975,7 +10975,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else if (spellid == OT_S_PACIFY) { char targetname[BUFLEN]; target = targcell->lf; - + if (!target) { fizzle(caster); return B_TRUE; @@ -11040,7 +11040,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ breakgrabs(target, B_TRUE, B_TRUE, B_TRUE); - + } else if ((spellid == OT_S_POLYMORPH) || (spellid == OT_S_SHAPESHIFT)) { race_t *r = NULL; @@ -11121,7 +11121,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // make sure race is valid: if (r && !canpolymorphto(r->id)) r = NULL; - } else { + } else { dorandom = B_TRUE; } } @@ -11186,9 +11186,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // make sure race is valid: - // - can't turn into monsters which aren't randomly generated. - // - can't turn into unique monsters - // - can't turn into undead monsters + // - can't turn into monsters which aren't randomly generated. + // - can't turn into unique monsters + // - can't turn into undead monsters if (r && !canpolymorphto(r->id) && !hasjob(caster, J_GOD)) { if (isplayer(caster)) msg("As you think of a %s, magic energy dampens around you.", r->name); r = NULL; @@ -11282,7 +11282,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // you now know what water is. // you DONT know what the original type was, since it could have been a number // of different things. - makeknown(o->type->id); + makeknown(o->type->id); } donesomething = B_TRUE; ndone++; @@ -11291,7 +11291,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (f) { f->val[0] = f->val[1]; f = hasflag(o->flags, F_DECAY); - if (f) { + if (f) { f->val[2] = 0; killflag(f); donesomething = B_TRUE; @@ -11343,7 +11343,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (retob[n]->material->id == MT_FIRE) { // large fires get surrounded with small ones f = hasflag(retob[n]->flags, F_DIECONVERT); - if (f) { + if (f) { cell_t *retcell[MAXCANDIDATES]; int nretcells,nn; getradiuscells(targcell, 1, DT_COMPASS, B_FALSE, LOF_WALLSTOP, B_FALSE, retcell, &nretcells, 90); @@ -11401,7 +11401,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (haslos(player, targcell)) { if (seenbyplayer) *seenbyplayer = B_TRUE; } - + killflagsofid(o->flags, F_ONFIRE); ndone++; } @@ -11559,7 +11559,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (!ndone) { return B_TRUE; - } + } } else if (spellid == OT_S_LETHARGY) { int amttolose; target = targcell->lf; @@ -11567,7 +11567,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - amttolose = roll("1d6") + power; + //amttolose = roll("1d6") + power; + amttolose = power; if (isplayer(target)) { msg("^%cYou suddenly feel very lethargic!", getlfcol(target, CC_BAD)); } else if (cansee(player, target)) { @@ -11586,14 +11587,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (isplayer(caster)) { msg("^%cYour body seems to shimmer and bend!", getlfcol(caster, CC_GOOD)); } else if (cansee(player, caster)) { - msg("^%c%s%s body seems to shimmer and bend!", getlfcol(caster, CC_GOOD), + msg("^%c%s%s body seems to shimmer and bend!", getlfcol(caster, CC_GOOD), castername, getpossessive(castername)); } } else if (spellid == OT_S_REMOTEKO) { char targetname[BUFLEN]; target = targcell->lf; - + if (!target) { fizzle(caster); return B_TRUE; @@ -11624,11 +11625,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targob) { if (isplayer(caster)) { condset_t cs; - initcondv(&cs, CC_HASFLAG, B_TRUE, F_REPLENISHABLE, + initcondv(&cs, CC_HASFLAG, B_TRUE, F_REPLENISHABLE, CC_NONE); // ask for an object targob = askobject(caster->pack, "Replenish which object", NULL, NULL, '\0', &cs, B_FALSE); - } + } } if (!targob) { fizzle(caster); @@ -11639,7 +11640,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!f) { if (isplayer(caster)) nothinghappens(); return B_TRUE; - } + } // restores power% of maximum incamt = pctof(power*10, f->val[1]); @@ -11651,11 +11652,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (f->val[0] == newamt) { // already maxed maxed = B_TRUE; - } + } f->val[0] = newamt; targcell = getoblocation(targob); - + if (maxed) { if (haslos(player, targcell)) { nothinghappens(); @@ -11663,7 +11664,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ return B_TRUE; } getobname(targob, obname, targob->amt); - + if (targob->pile->owner) { if (isplayer(targob->pile->owner)) { msg("Your %s %s %s.", noprefix(obname), (targob->amt == 1) ? "pulses" : "pulse", (power < 5) ? "briefly" : "for a while"); @@ -11685,7 +11686,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ lifeform_t *newlf; if (!targob) { condset_t cs; - initcondv(&cs, CC_HASFLAG, B_TRUE, F_CORPSEOF, + initcondv(&cs, CC_HASFLAG, B_TRUE, F_CORPSEOF, CC_NONE); // select object from cell... targob = askobject(targcell->obpile, "Revive which corpse", NULL, NULL, '\0', &cs, B_FALSE); @@ -11695,7 +11696,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } newlf = ressurect(targob); - + if (newlf) { if (haslos(player, targcell)) { if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -11720,7 +11721,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ power = 1; } else { power = 2; - } + } } if (!isplayer(target) && cansee(player, target)) { @@ -11907,7 +11908,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ o = targob; } else { condset_t cs; - initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, + initcondv(&cs, CC_HASMATERIAL, B_TRUE, MT_METAL, CC_NONE); // ask for an object o = doaskobject(caster->pack, "Repair which metal object", NULL, NULL, B_FALSE, B_FALSE, B_FALSE, '\0', NULL, SA_NONE, &cs, B_FALSE); @@ -12042,7 +12043,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } howlong = rnd(20,30) + power*2; - + addtempflag(target->flags, F_SILENCED, NA, NA, NA, NULL, howlong); if (isplayer(target) || haslos(player, target->cell)) { if (seenbyplayer) *seenbyplayer = B_TRUE; @@ -12076,13 +12077,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (origsize >= SZ_ENORMOUS) { fizzle(caster); return B_TRUE; - } + } newsize = origsize + 1; } else { // ie. sizedown if (origsize <= SZ_MINI) { fizzle(caster); return B_TRUE; - } + } newsize = origsize - 1; } @@ -12238,11 +12239,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - if (isplayer(target)) { - msg("^%cThe power of %s smites you!",getlfcol(target, CC_BAD), + if (isplayer(target)) { + msg("^%cThe power of %s smites you!",getlfcol(target, CC_BAD), (spellid == OT_S_SMITEEVIL) ? "good" : "evil"); } else if (cansee(player, target)) { - char lfname[BUFLEN]; + char lfname[BUFLEN]; getlfname(target, lfname); msg("^%cThe power of %s smites %s!", getlfcol(target, CC_BAD), (spellid == OT_S_SMITEEVIL) ? "good" : "evil", lfname); @@ -12315,7 +12316,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } redrawresume(); - + } else { failed = B_TRUE; } @@ -12340,7 +12341,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (targcell) { object_t *o,*oo; int i; - + oo = hasob(targcell->obpile, OT_BOULDER); while (oo && powerleft) { removeob(oo, 1); @@ -12371,9 +12372,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ o = addob(targcell->obpile, "pool of mud"); if (o) { condset_t cs; - initcondv(&cs, CC_SOLID, B_FALSE, NA, - CC_HASOBTYPE, B_FALSE, OT_MUDPOOL, - CC_HASMATERIAL, B_TRUE, MT_STONE, + initcondv(&cs, CC_SOLID, B_FALSE, NA, + CC_HASOBTYPE, B_FALSE, OT_MUDPOOL, + CC_HASMATERIAL, B_TRUE, MT_STONE, CC_NONE); ndone++; powerleft--; @@ -12437,7 +12438,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ cell_t *where; char smallprompt[BUFLEN]; // link target to target2 - // ask for a target cell + // ask for a target cell snprintf(buf, BUFLEN, "Who will you soul-link %s to?", tname); snprintf(smallprompt, BUFLEN, "soul link:%s->", tname); where = askcoords(buf, smallprompt, TT_MONSTER, caster, UNLIMITED, LOF_DONTNEED, B_FALSE); @@ -12489,7 +12490,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (targcell->lf) { losehp(targcell->lf, roll("2d3"), DT_FIRE, caster, "a burst of flame"); - } + } for (o = targcell->obpile->first ; o ; o = nexto) { nexto = o->next; // special cases @@ -12532,7 +12533,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addchoice(&prompt, '-', "(nothing)", NULL, NULL, NULL); prompt.maycancel = B_TRUE; - + ch = getchoice(&prompt); if ((ch != '\0') && (ch != '-')) { snprintf(buf, BUFLEN, "%s whispers:", corpsename); @@ -12541,7 +12542,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (ch == 'a') { flag_t *f; char *p; - + f = hasflag(corpse->flags, F_CORPSEOF); if (f && strlen(f->text)) { char killer[BUFLEN]; @@ -12552,7 +12553,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { strcpy(weapon, ""); } - + snprintf(buf, BUFLEN, "\"I was killed by %s", killer); if (strlen(weapon)) { strcat(buf, ", "); @@ -12692,8 +12693,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (c->lf && cansee(caster, c->lf) && (c->lf != caster)) { for (o = c->lf->pack->first ; o ; o = nexto) { nexto = o->next; - if ( hasflag(o->flags, F_RODSHAPED) && - isequipped(o) && + if ( hasflag(o->flags, F_RODSHAPED) && + isequipped(o) && (o->blessed == B_UNCURSED) && !hasflag(o->flags, F_HASBRAND)) { char obname[BUFLEN]; @@ -12706,7 +12707,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // add a snake there. snake = addlf(newcell, raceposs[rnd(0,nraceposs-1)]->id, 1); if (snake) { - msg("%s%s %s transforms into a snake!",lfname, + msg("%s%s %s transforms into a snake!",lfname, getpossessive(lfname), noprefix(obname)); killflagsofid(snake->flags, F_XPVAL); @@ -12735,7 +12736,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ for (o = c->obpile->first ; o ; o = nexto) { lifeform_t *snake = NULL; nexto = o->next; - if ( hasflag(o->flags, F_RODSHAPED) && + if ( hasflag(o->flags, F_RODSHAPED) && (o->blessed == B_UNCURSED) && !hasflag(o->flags, F_HASBRAND)) { cell_t *newcell = NULL; @@ -12801,14 +12802,14 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // sleep everyone within los of caster for (i = 0; i < target->nlos; i++) { lifeform_t *thistarg; - + targcell = target->los[i]; thistarg = targcell->lf; if (thistarg && (thistarg != caster)) { if (lfhasflag(thistarg, F_ASLEEP) || !ischarmable(thistarg)) { continue; } - // we set frompot to B_TRUE to avoid 'fizzled' messages if there is someone + // we set frompot to B_TRUE to avoid 'fizzled' messages if there is someone // unaffected in range. dospelleffects(caster, OT_S_SLEEP, power+1, thistarg,NULL,NULL,blessed, seenbyplayer, B_TRUE, NULL); @@ -12884,7 +12885,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // cell = where to throw the potion if (!targob && isplayer(caster)) { condset_t cs; - initcondv(&cs, CC_DRINKABLE, B_TRUE, NA, + initcondv(&cs, CC_DRINKABLE, B_TRUE, NA, CC_NONE); targob = askobject(caster->pack, "Superheat which potion", NULL, NULL, 'q', &cs, B_FALSE); } @@ -12897,7 +12898,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!targob) { if (isplayer(caster)) { msg("Your pack is too full for this spell to work!"); - } + } fizzle(caster); return B_TRUE; } @@ -12912,7 +12913,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // potion will explode next turn if you don't throw it. addflag(targob->flags, F_EXPLODEONDEATH, NA, 1, NA, "6d2"); //ie . 6-12 damage addflag(targob->flags, F_EXPLODEONDAM, NA, 1, NA, "6d2"); //ie . 6-12 damage - addflag(targob->flags, F_OBHPDRAIN, 1, NA, NA, NULL); + addflag(targob->flags, F_OBHPDRAIN, 1, NA, NA, NULL); if (isplayer(caster) && !targcell) { char buf[BUFLEN],buf2[BUFLEN]; @@ -12941,7 +12942,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ // target is always the caster if (!target) target = caster; - + if (spellresisted(target, caster, spellid, power, seenbyplayer, B_FALSE)) { if (isplayer(target)) { msg("You flicker."); @@ -12979,7 +12980,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (c) break; } } - } + } if (!c) { // random @@ -12988,7 +12989,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } else if (power >= 8) { - // controlled + // controlled snprintf(buf, BUFLEN, "Where will you teleport to?"); while (!c) { int ch; @@ -13006,7 +13007,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (ch != 'y') c = NULL; } } - } else { // ie. if (power >= 5) + } else { // ie. if (power >= 5) int dir; cell_t *poss[MAX_MAPW * MAX_MAPH]; int nposs; @@ -13020,7 +13021,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - + // make a list of all valid cells in that dir nposs = 0; switch (dir) { @@ -13029,7 +13030,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ ymin = 0; ymax = target->cell->y - 1; - xmin = target->cell->x - 5; + xmin = target->cell->x - 5; xmax = target->cell->x + 5; break; case DC_NE: @@ -13146,7 +13147,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - + rv = B_FALSE; } else if (spellid == OT_S_TELEKINESIS) { cell_t *where = NULL; @@ -13210,7 +13211,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // too heavy? max weight is now based on our race's weight and intelligence - maxweight = getlfweight(caster, B_NOOBS) + + maxweight = getlfweight(caster, B_NOOBS) + (getlfweight(caster, B_NOOBS) * (getstatmod(caster, A_IQ) / 100)); // modify by power @@ -13234,12 +13235,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (targcell == caster->cell) { pullobto(targob, caster); } else { - // otherwise throw it there - but speed is based on + // otherwise throw it there - but speed is based on // caster's INTELLIGENCE, not strength like normal. addflag(caster->flags, F_TKTHROW, A_IQ, SK_SS_MENTAL, NA, NULL); real_fireat(caster, targob, targob->amt, targcell, power, NULL, B_TRUE, spellid, NULL); killflagsofid(caster->flags, F_TKTHROW); - // note that we use fireat() rather than throwat() to avoid + // note that we use fireat() rather than throwat() to avoid // calling taketime() twice. } } else { @@ -13320,7 +13321,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } else if (spellid == OT_S_TWIDDLE) { target = targcell->lf; - + if (!target || (target == caster)) { fizzle(caster); return B_TRUE; @@ -13342,7 +13343,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { noise(targcell, NULL, NC_OTHER, SV_TALK+power, "shouting", "You hear shouting."); } - } else if ((spellid == OT_S_SUMMONANIMALSSM) || + } else if ((spellid == OT_S_SUMMONANIMALSSM) || (spellid == OT_S_SUMMONANIMALSMD) || (spellid == OT_S_SUMMONANIMALSLG) || (spellid == OT_S_SUMMONSWARM) || @@ -13449,7 +13450,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // override count if (tempcount > 0) { - nwant = tempcount; + nwant = tempcount; } if (!pctchance(successrate)) { @@ -13472,7 +13473,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } else { - if (haslos(player, caster->cell)) { // intentionally not using cansee + if (haslos(player, caster->cell)) { // intentionally not using cansee if (seenbyplayer) *seenbyplayer = B_TRUE; if (wantrace) { race_t *r; @@ -13516,7 +13517,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ flag_t *f; object_t *oldwep; // unweild current weapon - + oldwep = getweapon(target); if (oldwep) { if (iscursed(oldwep)) setblessed(oldwep, B_UNCURSED); @@ -13550,7 +13551,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else if (spellid == OT_S_WALLOFFIRE) { object_t *o; cell_t *c; - int vdist = 0,hdist = 0; + int vdist = 0,hdist = 0; int vbad = B_FALSE, hbad = B_FALSE; int walldir; int seen = B_FALSE; @@ -13618,8 +13619,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, firename); } - for (c = getcellindir(targcell, D_S) ; - (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); + for (c = getcellindir(targcell, D_S) ; + (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); c = getcellindir(c, D_S)) { if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, firename); @@ -13630,8 +13631,8 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, firename); } - for (c = getcellindir(targcell, D_W) ; - (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); + for (c = getcellindir(targcell, D_W) ; + (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); c = getcellindir(c, D_W)) { if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, firename); @@ -13650,7 +13651,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ object_t *o; int donesomething = B_FALSE; cell_t *c; - int vdist = 0,hdist = 0; + int vdist = 0,hdist = 0; int vbad = B_FALSE, hbad = B_FALSE; int walldir; int seen = B_FALSE; @@ -13715,13 +13716,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // knock lfs away if (c->lf) { - knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, + knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, 100+(power*10), B_DOANNOUNCE, B_DODAM); donesomething = B_TRUE; } } - for (c = getcellindir(targcell, D_S) ; - (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); + for (c = getcellindir(targcell, D_S) ; + (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); c = getcellindir(c, D_S)) { if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, "wall of ice"); @@ -13732,7 +13733,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // knock lfs away if (c->lf) { - knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, + knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, 100+(power*10), B_DOANNOUNCE, B_DODAM); donesomething = B_TRUE; } @@ -13749,13 +13750,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // knock lfs away if (c->lf) { - knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, + knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, 100+(power*10), B_DOANNOUNCE, B_DODAM); donesomething = B_TRUE; } } - for (c = getcellindir(targcell, D_W) ; - (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); + for (c = getcellindir(targcell, D_W) ; + (c == targcell) || c->lf || cellwalkable(NULL, c, NULL); c = getcellindir(c, D_W)) { if (!seen && haslos(player, c)) seen = B_TRUE; o = addob(c->obpile, "wall of ice"); @@ -13766,7 +13767,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } // knock lfs away if (c->lf) { - knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, + knockback(c->lf, getdiraway(c, c, NULL, B_FALSE, DT_COMPASS, B_FALSE), 1, NULL, 100+(power*10), B_DOANNOUNCE, B_DODAM); donesomething = B_TRUE; } @@ -13866,7 +13867,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - + } for (o = targcell->obpile->first ; o ; o = nexto) { @@ -13948,7 +13949,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ f->obfrom = OT_S_WEAKEN; f = addtempflag(target->flags, F_MELEEDAMPCT, 50, NA, NA, NULL, howlong); f->obfrom = OT_S_WEAKEN; - + if (seenbyplayer) *seenbyplayer = B_TRUE; } else { fizzle(caster); @@ -13970,7 +13971,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (seenbyplayer) *seenbyplayer = B_TRUE; } - // create webs + // create webs for (i = 0; i < power; i++) { cell_t *c; if (i == 0) { @@ -14002,7 +14003,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } } - + } } else if (spellid == OT_S_WHATGOESUP) { if (isplayer(caster)) { @@ -14053,7 +14054,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } else { ok = B_FALSE; } - } + } if (ok) { flag_t *f; object_t *o; @@ -14107,7 +14108,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ f = addtempflag(caster->flags, F_WINDSHIELD, power, NA, NA, NULL, FROMSPELL); f->obfrom = spellid; - + sprintf(retaltext, "1d%d^whirling debris", power); f = addtempflag(target->flags, F_RETALIATE, DT_BASH, NA, NA, retaltext, FROMSPELL); f->obfrom = spellid; @@ -14213,20 +14214,20 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ bp = poss[rnd(0,nposs-1)]; // find all associated armour for (ot = objecttype ; ot ; ot = ot->next) { - if ((ot->obclass->id == OC_ARMOUR) && + if ((ot->obclass->id == OC_ARMOUR) && hasflagval(ot->flags, F_GOESON, bp, NA, NA, NULL)) { // make sure this armour won't give us a penalty if (!wouldgivepenalty(target, ot->flags)) { narms++; } - + } } if (narms) { int sel,n = 0; sel = rnd(0,narms-1); for (ot = objecttype ; ot ; ot = ot->next) { - if ((ot->obclass->id == OC_ARMOUR) && + if ((ot->obclass->id == OC_ARMOUR) && hasflagval(ot->flags, F_GOESON, bp, NA, NA, NULL)) { if (!wouldgivepenalty(target, ot->flags)) { if (n == sel) break; @@ -14289,7 +14290,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } } // now identify everything that you have tried, - // and 10% chance of identifying others + // and 10% chance of identifying others for (k = knowledge; k ; k = k->next) { if ((k->known == B_TRIED) || pctchance(10)) { makeknown(k->id); @@ -14361,7 +14362,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ where = real_getrandomadjcell(target->cell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED, NULL, target); if (!where) { where = target->cell; - } + } o = addob(where->obpile, buf); if (o) { noise(caster->cell, NULL, NC_OTHER, SV_WHISPER, "something hitting the ground.", NULL); @@ -14444,7 +14445,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } nretobs -= nbad; - + //addob(target->cell->obpile, buf); if (nretobs > 0) { int ncreated = 0; @@ -14457,7 +14458,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ } if (!hasflag(o->flags, F_IMPASSABLE) && canpickup(target, o, ALL)) { // you gain it. - relinkob(o, target->pack); // move to pack + relinkob(o, target->pack); // move to pack getobname(o, obname, o->amt); if (isplayer(target)) { @@ -14473,12 +14474,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ if (hasflag(o->flags, F_IMPASSABLE)) { cell_t *newloc; // if so, don't put it where the player is! - newloc = real_getrandomadjcell(target->cell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED, + newloc = real_getrandomadjcell(target->cell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED, NULL, target); o = relinkob(o, newloc->obpile); } else { // move to target cell under the lf - o = relinkob(o, target->cell->obpile); + o = relinkob(o, target->cell->obpile); } if (o) { getobname(o, obname, o->amt); @@ -14566,7 +14567,7 @@ enum OBTYPE getfirstwizspell(enum SPELLSCHOOL school) { case SS_TRANSLOCATION: firstspell = OT_S_APPORTATION; break; case SS_SUMMONING: firstspell = OT_S_GLYPHWARDING; break; case SS_LIFE: firstspell = OT_S_HEALINGMIN; break; - default: + default: case SS_WILD: firstspell = OT_S_MANASPIKE; break; } return firstspell; @@ -14590,7 +14591,7 @@ char *getforcedspellrace(lifeform_t *lf, enum OBTYPE spellid, char *racestr, int int getmpcost(lifeform_t *lf, enum OBTYPE oid) { flag_t *f; - objecttype_t *ot; + objecttype_t *ot; int cost = 0; ot = findot(oid); if (!ot) { @@ -14648,17 +14649,17 @@ enum OBTYPE getrandomspell(int maxlev) { wantlev++; } limit(&wantlev, 1, maxlev); - + // get list of all spells of this level for (ot = objecttype ; ot ; ot = ot->next) { if ((ot->obclass->id == OC_SPELL) && (getspelllevel(ot->id) == wantlev) ) { poss[nposs++] = ot; } - } + } if (nposs <= 0) { return OT_NONE; - } + } ot = poss[rnd(0,nposs-1)]; return ot->id; } @@ -14677,11 +14678,11 @@ enum OBTYPE getrandomspellfromschool(enum SPELLSCHOOL school, int wantlev) { } } } - } + } if (nposs <= 0) { return OT_NONE; - } + } ot = poss[rnd(0,nposs-1)]; return ot->id; } @@ -14719,11 +14720,11 @@ enum SKILL getschoolskill(enum SPELLSCHOOL ss) { switch (ss) { case SS_ALLOMANCY: return SK_SS_ALLOMANCY; - case SS_AIR: + case SS_AIR: return SK_SS_AIR; case SS_DEATH: return SK_SS_DEATH; - case SS_DIVINATION: + case SS_DIVINATION: return SK_SS_DIVINATION; case SS_NATURE: return SK_SS_NATURE; @@ -14752,11 +14753,11 @@ enum SPELLSCHOOL getskillschool(enum SKILL skid) { switch (skid) { case SK_SS_ALLOMANCY: return SS_ALLOMANCY; - case SK_SS_AIR: + case SK_SS_AIR: return SS_AIR; case SK_SS_DEATH: return SS_DEATH; - case SK_SS_DIVINATION: + case SK_SS_DIVINATION: return SS_DIVINATION; case SK_SS_NATURE: return SS_NATURE; @@ -14826,7 +14827,7 @@ int getspellduration(int min,int max,int blessed) { // abilities count as level 0 int getspelllevel(enum OBTYPE spellid) { flag_t *f; - objecttype_t *ot; + objecttype_t *ot; int level = 0; ot = findot(spellid); if (!ot) { @@ -14840,7 +14841,7 @@ int getspelllevel(enum OBTYPE spellid) { } enum LOFTYPE getspellloftype(enum OBTYPE spellid) { - objecttype_t *ot; + objecttype_t *ot; flag_t *f; ot = findot(spellid); if (!ot) { @@ -14855,7 +14856,7 @@ enum LOFTYPE getspellloftype(enum OBTYPE spellid) { int getspellmaxpower(enum OBTYPE spellid) { flag_t *f; - objecttype_t *ot; + objecttype_t *ot; int max = 10; ot = findot(spellid); if (!ot) { @@ -14960,7 +14961,7 @@ int getspellpower(lifeform_t *lf, enum OBTYPE spellid) { willflag = lfhasflagval(lf, F_CANWILL, spellid, NA, NA, NULL); if (willflag && strlen(willflag->text)) { texttospellopts(willflag->text, "pw:", &willpower, NULL ); - } + } castflag = lfhasflagval(lf, F_CANCAST, spellid, NA, NA, NULL); if (castflag && strlen(castflag->text)) { texttospellopts(castflag->text, "pw:", &castpower, NULL ); @@ -14980,7 +14981,7 @@ int getspellpower(lifeform_t *lf, enum OBTYPE spellid) { power = castpower; strcpy(whatfrom, "cancast"); } - + if (strlen(whatfrom)) { if (db) { dblog("-->power = %d (from %s)", power, whatfrom); @@ -14994,8 +14995,8 @@ int getspellpower(lifeform_t *lf, enum OBTYPE spellid) { school = getspellschoolknown(lf, spellid); schoolskill = getskill(lf, getschoolskill(school)); spelllev = getspelllevel(spellid); - - // for most spell schools, your skill in the school determines which + + // for most spell schools, your skill in the school determines which // spells you can cast. // // this check doesn't apply for monsters. @@ -15028,8 +15029,8 @@ int getspellpower(lifeform_t *lf, enum OBTYPE spellid) { // HOW POWERFUL IS THIS SPELL? //////////////////////////////////// if (isplayer(lf)) { - power = 1; - // plus your hitdice/3 + power = 1; + // plus your hitdice/3 power += (gettr(lf)/3); // plus stat modifier @@ -15047,7 +15048,7 @@ int getspellpower(lifeform_t *lf, enum OBTYPE spellid) { power = gettr(lf)/2; limit(&power, 1, NA); } - + power += boost; limit(&power, 0, getspellmaxpower(spellid)); return power; @@ -15093,7 +15094,7 @@ int getspellpowerstatmod(lifeform_t *lf, enum SPELLSCHOOL school, enum ATTRIB *a // +/- 1 for strength mod += (getstatmod(lf, A_STR) / 50); } else if (school == SS_LIFE) { - // ie. clerical. + // ie. clerical. // +/- 2 for wisdom if (att) *att = A_WIS; mod += (getstatmod(lf, A_WIS) / 25); @@ -15108,7 +15109,7 @@ int getspellpowerstatmod(lifeform_t *lf, enum SPELLSCHOOL school, enum ATTRIB *a enum SPELLSCHOOL getspellschool(enum OBTYPE spellid) { flag_t *f; - objecttype_t *ot; + objecttype_t *ot; ot = findot(spellid); if (!ot) { return SS_NONE; @@ -15129,7 +15130,7 @@ enum SPELLSCHOOL getspellschool(enum OBTYPE spellid) { enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid) { flag_t *f; enum SPELLSCHOOL thisschool; - objecttype_t *ot; + objecttype_t *ot; enum SPELLSCHOOL poss[MAXCANDIDATES]; int nposs = 0; @@ -15141,8 +15142,8 @@ enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid) { if (ot->obclass->id == OC_ABILITY) { return SS_ABILITY; } - - // make a list of all schools which this spell belongs to, and which we know. + + // make a list of all schools which this spell belongs to, and which we know. thisschool = SS_NONE; for (f = ot->flags->first ; f ; f = f->next) { if ((f->id == F_SPELLSCHOOL) && getskill(lf, getschoolskill(f->val[0]))) { @@ -15328,7 +15329,7 @@ char *getspelldesc(enum OBTYPE spellid, int power, char *buf) { snprintf(buf, BUFLEN, "Summon a rat swarm."); break; case 2: snprintf(buf, BUFLEN, "Summon a spider swarm."); break; - default: + default: case 3: snprintf(buf, BUFLEN, "Summon a locust swarm."); break; } @@ -15447,7 +15448,7 @@ void pullobto(object_t *o, lifeform_t *lf) { getlfname(lf, lfname); if (isplayer(lf) || haslos(player, lf->cell)) { msg("%s %s towards %s!", obname, OB1(o,"flies","fly"), lfname); - } + } // can we pick up the object? if (hasflag(o->flags, F_NOPICKUP) || isimpassableob(o, lf, getlfsize(lf)) || !canpickup(lf, o, ALL)) { @@ -15598,7 +15599,7 @@ void spellcloud(cell_t *srcloc, int radius, int dirtype, int ch, enum COLOUR col for (x = srcloc->x - radius ; x <= srcloc->x + radius; x++) { cell_t *c; c = getcellat(srcloc->map, x, y); - if (c && c->lf && !c->type->solid && + if (c && c->lf && !c->type->solid && haslof(srcloc, c, LOF_WALLSTOP, NULL)) { int safe = B_FALSE; if (!includecentre && (c == srcloc)) { @@ -15684,7 +15685,7 @@ int spellresisted(lifeform_t *target, lifeform_t *caster, int spellid, int power return B_FALSE; } } - + if (announce) { getlfname(target, buf); if (spellisfromschool(spellid, SS_MENTAL)) { @@ -15854,7 +15855,7 @@ int summonlfs(lifeform_t *caster, cell_t *where, enum RACE wantrace, enum RACECL c = real_getrandomadjcell(where, &ccwalkable, B_ALLOWEXPAND, LOF_NEED, NULL, caster); if (!c) { return ncreated; - } + } // determine exact type of monster r = findrace(poss[rnd(0,nposs-1)]); if (r) { @@ -15869,7 +15870,7 @@ int summonlfs(lifeform_t *caster, cell_t *where, enum RACE wantrace, enum RACECL addflag(newlf->flags, F_PETOF, caster->id, NA, NA, NULL); if (areallies(player, caster)) { makefriendly(newlf, PERMENANT); - } + } } else if (friendly == B_FALSE) { if (!lfhasflag(newlf, F_HOSTILE)) { addflag(newlf->flags, F_HOSTILE, B_TRUE, NA, NA, NULL); @@ -15941,7 +15942,7 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e } else if ((caster->race->raceclass->id == RC_GOD) && targcell) { return *targcell; } - + sp = findot(spellid); if (sp) { flag_t *f; @@ -15996,14 +15997,14 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e msg("Too far away - max range is %d.",maxrange); more(); } where = NULL; - } + } if (where && (getcelldist(caster->cell, where) < minrange)) { // out of range if (isplayer(caster) && !frompot) { msg("Too close - min range is %d.",minrange); more(); } where = NULL; - } + } if (!frompot && where && where->lf && haslos(caster, where) && isplayer(caster) && areallies(caster, where->lf)) { // warn before targetting yourself! @@ -16088,7 +16089,7 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e // ie. spelllev7 needs 16+ intelligence int getiqreq(enum OBTYPE oid) { flag_t *f; - objecttype_t *ot; + objecttype_t *ot; int iqreq = 0; ot = findot(oid); if (!ot) {