From d39e7ea7c174a71f441537eae5dfac35717c16fd Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sun, 25 Nov 2012 19:57:49 +0000 Subject: [PATCH] - [+] gunpoweder should be unstable - explode on ANY dam. - [+] mosnter facing being set to -. debug with forced break. fixed. - [+] fix territorial monster crash. - [+] CRASH in celldangerous when undead avoiding holy circles. - [+] alternate text for 'ineffectually' - [+] need an announce for bjorn's ecstatic ability (ehavy blow) - [+] whenever you gain a new godbonus, give you a grace period - [+] change selectweapon so i can specify valid choices - [+] have multiple F_SELECTWEAPON flags, v0 = object. (or text?) - [+] getflags() then pick from these. - [+] hwen gunpowder inside a barrel explodes: - [+] say "the barrel explodes", since that's what you can see - [+] explosion should actually work!!! - [+] lethargy should drain lots more stamina now that exhaustion doesn't prevent attacks - [+] thrown knifes not doing enough damage. - [+] fireat(): dam = throwdam(2) + speed(2) dealing 3 damage - [+] maybe increase throwdam to 4. - [+] check otehr throwmissiles too --- ai.c | 2 +- attack.c | 54 +++++++++++++++++++++++++++-------------------- data.c | 39 +++++++++++++++++++--------------- data/hiscores.db | Bin 17408 -> 17408 bytes defs.h | 7 ++++++ god.c | 35 ++++++++++++++++++++++++++++++ io.c | 4 ++++ lf.c | 43 ++++++++++++++++++++++++++++--------- move.c | 6 ++++-- objects.c | 33 +++++++++++++++++++---------- spell.c | 5 +++-- text.c | 12 +++++++++-- 12 files changed, 172 insertions(+), 68 deletions(-) diff --git a/ai.c b/ai.c index 4a7eed7..e50d261 100644 --- a/ai.c +++ b/ai.c @@ -2347,7 +2347,7 @@ int aimovetotargetcell(lifeform_t *lf, flag_t *f) { } killflag(f); } else { - if (!turned) { + if (!turned && (c != lf->cell)) { turntoface(lf, c); } } diff --git a/attack.c b/attack.c index b564cdb..6f9a7f1 100644 --- a/attack.c +++ b/attack.c @@ -670,6 +670,10 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) { attacksdone = maxattacks; break; } + // no longer adjacent? + if (!isadjacent(lf->cell, victim->cell) || isdead(victim)) { + break; + } // vicitm started to flee? if (isplayer(lf)) { if (!fleeflag && isfleeingfrom(victim, lf)) { @@ -2047,6 +2051,11 @@ int attackob(lifeform_t *lf, object_t *o, object_t *wep, flag_t *damflag) { } // damstring should never be used... shatter(oo, B_FALSE, "shattering damage", lf); + } else { + int obdam; + obdam = dam[0] / 2; + limit(&obdam, 1, NA); + takedamage(oo, obdam, DT_BASH, NULL); } } } @@ -3015,6 +3024,7 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical, int db = B_FALSE; char lfname[BUFLEN]; char vicname[BUFLEN]; + int critpossible = B_TRUE; if (lfhasflag(lf, F_DEBUG)) db = B_TRUE; real_getlfname(lf, lfname, NULL, B_SHOWALL, B_CURRACE); @@ -3027,6 +3037,12 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical, if (fumble) *fumble = B_FALSE; if (missby) *missby = 0; + if (lf && lfhasflag(lf, F_NOGIVECRITS)) { + critpossible = B_FALSE; + } else if (victim && lfhasflag(victim, F_NOTAKECRITS)) { + critpossible = B_FALSE; + } + // anticipate action spell? if (lfhasflagval(victim, F_ANTICIPATE, lf->id, NA, NA, NULL)) { if (db) dblog("%s: victim has anticipate action - MISS.", lfname); @@ -3045,7 +3061,7 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical, } gothit = B_TRUE; if (db) dblog("%s: we have truestrike - HIT.", lfname); - } else if (critical && *critical) { + } else if (critical && *critical && critpossible) { // critical already set = forced critical gothit = B_TRUE; if (db) dblog("%s: pre-determined critical - HIT.", lfname); @@ -3169,30 +3185,22 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical, } // critical chance - if (critical && gothit) { - int critpossible = B_TRUE; - if (lf && lfhasflag(lf, F_NOGIVECRITS)) { - critpossible = B_FALSE; - } else if (victim && lfhasflag(victim, F_NOTAKECRITS)) { - critpossible = B_FALSE; - } - if (critpossible) { - if (lfhasflag(lf, F_AIMEDSTRIKE)) { - *critical = 1; - } else { - int critroll; - critroll = rnd(1,100); + if (critical && gothit && critpossible) { + if (lfhasflag(lf, F_AIMEDSTRIKE)) { + *critical = 1; + } else { + int critroll; + critroll = rnd(1,100); - // modify for lore level > pr_novice - if (lorelev > PR_NOVICE) { - int lorebonus; - lorebonus = ((lorelev-1)*5); // ie. up to 25% bonus - critroll -= lorebonus; - } - limit(&critroll, 1, 100); - - if (critroll <= getcritchance(lf, wep,victim)) *critical = 1; + // modify for lore level > pr_novice + if (lorelev > PR_NOVICE) { + int lorebonus; + lorebonus = ((lorelev-1)*5); // ie. up to 25% bonus + critroll -= lorebonus; } + limit(&critroll, 1, 100); + + if (critroll <= getcritchance(lf, wep,victim)) *critical = 1; } } diff --git a/data.c b/data.c index 08bca76..6cb147d 100644 --- a/data.c +++ b/data.c @@ -1011,7 +1011,10 @@ void initjobs(void) { // abilities addflag(lastjob->flags, F_MPDICE, 1, -1, NA, NULL); addflag(lastjob->flags, F_MAXHPMOD, 120, NA, NA, NULL); - addflag(lastjob->flags, F_SELECTWEAPON, B_TRUE, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_LONGSWORD, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_SHORTSWORD, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_SPEAR, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_MACE, NA, NA, NULL); addflag(lastjob->flags, F_LEVABIL, 3, OT_A_HEAVYBLOW, NA, NULL); addflag(lastjob->flags, F_LEVABIL, 4, OT_A_WARCRY, NA, NULL); addflag(lastjob->flags, F_LEVABIL, 5, OT_A_CHARGE, NA, NULL); @@ -1123,7 +1126,8 @@ void initjobs(void) { addflag(lastjob->flags, F_CANLEARN, SK_SS_WILD, PR_ADEPT, NA, NULL); // abilities addflag(lastjob->flags, F_MPDICE, 1, 0, NA, NULL); - addflag(lastjob->flags, F_SELECTWEAPON, B_TRUE, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_LONGSWORD, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_SHORTSWORD, NA, NA, NULL); addflag(lastjob->flags, F_HIRABLE, B_TRUE, NA, NA, NULL); addjob(J_PALADIN, "Paladin", "Paladins are holy warriors dedicated to the Goddess of Life. They gain powerful abilities and have access to healing magics, but these powers are dependant upon their goddess' approval. Paladins must take holy vows to only ever use battle equipiment which has first been blessed.", JC_FIGHTERMAGE); @@ -1183,7 +1187,8 @@ void initjobs(void) { // abilities addflag(lastjob->flags, F_MPDICE, 1, -1, NA, NULL); addflag(lastjob->flags, F_MAXHPMOD, 120, NA, NA, NULL); - addflag(lastjob->flags, F_SELECTWEAPON, B_TRUE, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_LONGSWORD, NA, NA, NULL); + addflag(lastjob->flags, F_SELECTWEAPON, OT_FLAIL, NA, NA, NULL); addflag(lastjob->flags, F_HIRABLE, B_TRUE, NA, NA, NULL); // can permenantly turn undead for 0 power. addflag(lastjob->flags, F_CANWILL, OT_S_TURNUNDEAD, NA, NA, NULL); @@ -2974,7 +2979,7 @@ void initobjects(void) { addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "1"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "2"); addot(OT_BRICK, "brick", "A heavy brick.", MT_STONE, 3, OC_ROCK, SZ_TINY); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_RARITY, H_DUNGEON, NA, RR_RARE, ""); @@ -2984,7 +2989,7 @@ void initobjects(void) { addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "3"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "4"); // gems addot(OT_AQUAMARINE, "aquamarine stone", "An aqua-coloured gemstone.", MT_STONE, 0.2, OC_ROCK, SZ_TINY); @@ -5997,14 +6002,14 @@ void initobjects(void) { addflag(lastot->flags, F_STARTOBCLASS, 50, OC_FOOD, NA, NULL); addflag(lastot->flags, F_STARTOBCLASS, 50, OC_FOOD, NA, NULL); - addot(OT_GUNPOWDER, "pile of gunpowder", "A black metallic powder.", MT_METAL, 0.5, OC_TOOLS, SZ_TINY); + addot(OT_GUNPOWDER, "pile of gunpowder", "A black metallic powder. Said to be highly unstable.", MT_METAL, 0.5, OC_TOOLS, SZ_TINY); addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, "pile of black powder"); addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 65, NA, NULL); addflag(lastot->flags, F_VALUE, 25, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_EXPLODEONDAM, DT_FIRE, NA, NA, "8d2"); + addflag(lastot->flags, F_EXPLODEONDAM, NA, NA, NA, "8d2"); addflag(lastot->flags, F_DTVULN, DT_FIRE, NA, NA, "2d6"); addflag(lastot->flags, F_FLAMMABLE, 3, NA, NA, NULL); addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL); @@ -8635,7 +8640,7 @@ void initobjects(void) { addot(OT_DART, "dart", "A small, sharp projectile weapon.", MT_WOOD, 0.5, OC_MISSILE, SZ_SMALL); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "1"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "2"); addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 100, NA, ""); addflag(lastot->flags, F_NUMAPPEAR, 1, 3, NA, ""); @@ -8646,7 +8651,7 @@ void initobjects(void) { addot(OT_KNIFETHROWING, "throwing knife", "A weighted knife, designed to be thrown.", MT_METAL, 1.5, OC_MISSILE, SZ_SMALL); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "2"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "5"); addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 100, NA, ""); addflag(lastot->flags, F_NUMAPPEAR, 1, 3, NA, ""); @@ -8655,7 +8660,7 @@ void initobjects(void) { addot(OT_DARTNANO, "nanodart", "A metal dart with a nanofibre point. Capable of piercing most armour.", MT_METAL, 0.5, OC_MISSILE, SZ_TINY); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "2"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "5"); addflag(lastot->flags, F_ARMOURPIERCE, 10, NA, NA, ""); addflag(lastot->flags, F_RARITY, H_DUNGEON, 67, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 67, NA, ""); @@ -8712,7 +8717,7 @@ void initobjects(void) { addot(OT_JAVELIN, "javelin", "A long, sharp missile weapon.", MT_METAL, 4, OC_MISSILE, SZ_MEDIUM); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "3"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "6"); addflag(lastot->flags, F_RARITY, H_DUNGEON, 90, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 90, NA, ""); addflag(lastot->flags, F_NUMAPPEAR, 1, 2, NA, ""); @@ -8721,7 +8726,7 @@ void initobjects(void) { addot(OT_JAVELINLT, "lightning javelin", "A long, sharp missile weapon which transforms into a bolt of lightning when thrown.", MT_METAL, 4, OC_MISSILE, SZ_MEDIUM); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "3"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "6"); addflag(lastot->flags, F_RARITY, H_ALL, NA, RR_RARE, NULL); addflag(lastot->flags, F_NUMAPPEAR, 1, 2, NA, NULL); addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL); @@ -8735,7 +8740,7 @@ void initobjects(void) { addflag(lastot->flags, F_RARITY, H_CAVE, 85, NA, ""); addflag(lastot->flags, F_NUMAPPEAR, 1, 10, NA, ""); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "3"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "4"); addflag(lastot->flags, F_OBHP, 2, 2, NA, NULL); addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CANHAVEOBMOD, OM_POISONED, 17, NA, NULL); @@ -8746,7 +8751,7 @@ void initobjects(void) { addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_RARITY, H_DUNGEON, 80, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 80, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "4"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "6"); addflag(lastot->flags, F_NUMAPPEAR, 1, 10, NA, ""); addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CANHAVEOBMOD, OM_POISONED, 17, NA, NULL); @@ -8761,7 +8766,7 @@ void initobjects(void) { addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_MISSILEALWAYSDIES, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_OBHP, 1, 1, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "4"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "6"); addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_CANBEDIFFMAT, MT_SILVER, 10, NA, NULL); @@ -8780,7 +8785,7 @@ void initobjects(void) { addot(OT_SHURIKEN, "shuriken", "A sharpened star-shaped piece of metal, made for throwing.", MT_METAL, 1, OC_MISSILE, SZ_SMALL); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, ""); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "4"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "6"); addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, NA, ""); addflag(lastot->flags, F_RARITY, H_CAVE, 100, NA, ""); addflag(lastot->flags, F_NUMAPPEAR, 1, 3, NA, ""); @@ -8833,7 +8838,7 @@ void initobjects(void) { addflag(lastot->flags, F_ARMOURPIERCE, 4, NA, NA, ""); addflag(lastot->flags, F_DAM, DT_CHOP, 7, NA, NULL); addflag(lastot->flags, F_ACCURACY, 70, NA, NA, NULL); - addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "5"); + addflag(lastot->flags, F_MISSILEDAM, NA, NA, NA, "7"); addflag(lastot->flags, F_THROWMISSILE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_USESSKILL, SK_AXES, NA, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_STR, 35, 55, "5"); diff --git a/data/hiscores.db b/data/hiscores.db index a0794f05bcdd69393ec7d1e396bf1cb661e14317..2d6a5432b2d7797b493dc946a6629366586d9e94 100644 GIT binary patch delta 241 zcmZqZU~K4MoFL68zftA|JF_;k=45sbe-35~W@BbOX3foU9H*H?SeO|YwLydyh|mNP z8k=pokL!qVFt#x;Z)VP9=3&~+l+UEfc%89rV__bnnZGt01Cy|RF=Iwiev(g_se(so zZepH7cw$jeW`0p{PGV-BLQtext @@ -4923,6 +4927,9 @@ typedef struct lifeform_s { // set to TRUE after lf has being created int born; + // not saved - don't ever recalc this lf's los + int loslock; + // debugging int redraws; // # actual screen redraws during this lf's turn. diff --git a/god.c b/god.c index ea929c3..d706f99 100644 --- a/god.c +++ b/god.c @@ -946,6 +946,7 @@ void givegodbonus(enum RACE rid, flag_t *bf) { // increment piety so that it doesn't keep bouncing around the border. modpiety(rid, PIETYPRAYLOSS); + addtempflag(player->flags, F_NOPIETYLOSS, rid, NA, NA, NULL,rnd(50,100)); // parse regular rags parsegodbonusargs(bf, &bonuslev, &bonusid, &arg, targ); @@ -976,6 +977,8 @@ void givegodbonus(enum RACE rid, flag_t *bf) { case SC_SEARCH: godsay(rid, B_FALSE, "That which is hidden shall be revealed!"); break; default: break; } + } else if (arg == F_HEAVYBLOW) { + godsay(rid, B_FALSE, "Foes shall be driven away by your blows!"); break; } } break; @@ -2032,6 +2035,7 @@ int prayto(lifeform_t *lf, lifeform_t *god) { char assisttext[BUFLEN]; enum PIETYLEV plev; int newgod; + enum ALIGNMENT changealign = AL_NONE; taketime(lf, getactspeed(lf)); @@ -2069,6 +2073,30 @@ int prayto(lifeform_t *lf, lifeform_t *god) { // you get some help... plev = getpietylev(god->race->id, NULL, NULL); + if ((god->race->id == R_GODDEATH) && (getalignment(player) == AL_GOOD)) { + char yn; + godsay(god->race->id, B_TRUE, "You really wish to walk the path of evil, fleshling?"); + yn = askchar("Change alignment to Evil?", "yn?", "n", B_TRUE, B_FALSE); + if (yn == 'y') { + godsay(god->race->id, B_FALSE, "So be it, foolish mortal."); + changealign = AL_EVIL; + } else { + godsay(god->race->id, B_FALSE, "Coward!"); + return B_FALSE; + } + } else if ((god->race->id == R_GODLIFE) && (getalignment(player) == AL_EVIL)) { + char yn; + godsay(god->race->id, B_TRUE, "Are you sure you wish to forsake your evil ways?"); + yn = askchar("Change alignment to Good?", "yn?", "n", B_TRUE, B_FALSE); + if (yn == 'y') { + godsay(god->race->id, B_FALSE, "Be welcome, then!"); + changealign = AL_GOOD; + } else { + godsay(god->race->id, B_FALSE, "If you reconsider, pray to me."); + return B_FALSE; + } + } + if (!prayedtoany()) { // special msg for first time. switch (god->race->id) { @@ -2141,6 +2169,13 @@ int prayto(lifeform_t *lf, lifeform_t *god) { } godsay(god->race->id, B_TRUE, assisttext); + if (changealign != AL_NONE) { + setalignment(player, changealign); + msg("^gYour alignment has changed to %s!", getalignmentname(changealign)); + more(); + } + + // at this point, remember that we have now prayed to // this god. ie. player is expected to follow the god's rules. diff --git a/io.c b/io.c index 244ae07..6106c64 100644 --- a/io.c +++ b/io.c @@ -13371,6 +13371,10 @@ void showlfstats(lifeform_t *lf, int showall) { mvwprintw(mainwin, y, 0, "%s %s %s resistant to magic.", you(lf), is(lf), adjective); y++; } + f = hasflag_real(lf->flags, F_FEARLESS, B_TRUE, NULL, FROMRACE); + if (f) { + wrapprint(mainwin, &y, &x, 0, "%s %s immune to the effects of fear.", you(lf), is(lf)); + } f = hasflag_real(lf->flags, F_FASTMETAB, B_TRUE, NULL, FROMRACE); if (f) { diff --git a/lf.c b/lf.c index b540737..2c8de19 100644 --- a/lf.c +++ b/lf.c @@ -325,8 +325,10 @@ long calcscore(lifeform_t *lf) { // the game. if (winner) { points += getobpoints(o); - } else { + } else if (isknown(o)) { points += (getobpoints(o)/4); + } else { + points += (getobpoints(o)/6); } } // donated items etc @@ -12156,12 +12158,21 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) { // handle autoweapon if (lf && hasflag(fp, F_SELECTWEAPON)) { - skill_t *sk; + //skill_t *sk; flag_t *f2; objecttype_t *poss[MAXSKILLS]; int nposs = 0, i; + flag_t *retflag[MAXCANDIDATES]; + int nretflags; + + getflags(fp, retflag, &nretflags, F_SELECTWEAPON, F_NONE); + for (i = 0; i < nretflags; i++) { + poss[nposs++] = findot(retflag[i]->val[0]); + } + // find all the weapon skills this lf can learn // and get basic objects of this type + /* for (sk = firstskill ; sk ; sk = sk->next) { if (isweaponskill(sk->id)) { if (canlearn(lf, sk->id) || getskill(lf, sk->id)) { @@ -12173,6 +12184,7 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) { } } } + */ if (nposs) { objecttype_t *ot = NULL; char ch = 'a'; @@ -14708,6 +14720,7 @@ lifeform_t *real_addlf(cell_t *cell, enum RACE rid, int level, int controller) { a->los = NULL; // will be alloced in precalclos //a->losdark = NULL; // will be alloced in precalclos a->nlos = 0; + a->loslock = B_FALSE; //a->nlosdark = 0; //a->eyeadjustment = 0; @@ -18528,6 +18541,8 @@ void precalclos(lifeform_t *lf) { if (gamemode == GM_CLEANUP) return; + if (lf->loslock) return; + if (lf->cell->type->id == CT_FAKE) return; if (lf->los) { @@ -20040,11 +20055,7 @@ int scare(lifeform_t *lf, lifeform_t *scarer, int howlong, int scarerbonus) { void setalignment(lifeform_t *lf, enum ALIGNMENT al) { flag_t *f; - if (isplayer(lf)) { - dblog("warning - changing player alignment"); - msg("warning - changing player alignment"); - more(); - } + f = lfhasflag(lf, F_ALIGNMENT); if (f) { f->val[0] = al; @@ -20157,6 +20168,9 @@ void setbodytype(race_t *r, enum BODYTYPE bt) { } int setfacing(lifeform_t *lf, int dir) { + if (dir < 0) { + raise(SIGINT); + } if (isclimbing(lf)) { // can't change dir while climbing return B_TRUE; } @@ -21986,9 +22000,14 @@ void startlfturn(lifeform_t *lf) { chance = piety; limit(&chance, 10, 100); } else { - dir = -1; - chance = 100 - (piety-200); // ie. 100 max - limit(&chance, 1, 50); + if (lfhasflagval(player, F_NOPIETYLOSS, godlf[i]->race->id, NA, NA, NULL)) { + dir = 0; + chance = 0; + } else { + dir = -1; + chance = 100 - (piety-200); // ie. 100 max + limit(&chance, 1, 50); + } } // the further away from neutral you are, the less chance // piety/anger has of 'expiring' @@ -22222,6 +22241,8 @@ void startlfturn(lifeform_t *lf) { if (f && !lfhasflag(lf, F_HOSTILE) && !isinbattle(lf, B_INCLUDEDISTANT, B_FALSE) && !isfleeing(lf) && !isplayer(lf)) { + + lf->loslock = B_TRUE; for (i = 1 ; i < lf->nlos; i++) { lifeform_t *otherlf; otherlf = lf->los[i]->lf; @@ -22242,6 +22263,7 @@ void startlfturn(lifeform_t *lf) { } } } + lf->loslock = B_FALSE; } f = lfhasflag(lf, F_AUTOROTATE); @@ -24221,6 +24243,7 @@ int real_touch(lifeform_t *lf, object_t *o, int onpurpose) { void turntoface(lifeform_t *lf, cell_t *dstcell) { if (isdead(lf)) return; if (lfhasflag(lf, F_AUTOROTATE)) return; + if (dstcell == lf->cell) return; // not providing srclf, since this will make getdirtowards() not include // directions in which the next cell is unwalkable. in this case we're // not actually walking there, so we don't care. diff --git a/move.c b/move.c index cb47a19..847de43 100644 --- a/move.c +++ b/move.c @@ -220,8 +220,10 @@ int celldangerous(lifeform_t *lf, cell_t *cell, int onlyifknown, enum ERROR *err } } else if (o->type->id == OT_HOLYCIRCLE) { if (isundead(lf) || lfhasflag(lf, F_LYCANTHROPE)) { - *error = E_AVOIDOB; - rdata = o; + if (error) { + *error = E_AVOIDOB; + rdata = o; + } return B_TRUE; } } diff --git a/objects.c b/objects.c index d888c2c..8f6b7df 100644 --- a/objects.c +++ b/objects.c @@ -3639,8 +3639,7 @@ void explodeob(object_t *o, flag_t *f, int bigness, lifeform_t *causedby) { cell_t *c; int dam; char obname[BUFLEN]; - - c = getoblocation(o); + object_t *outerob; // override causedby if (!causedby) { @@ -3652,24 +3651,36 @@ void explodeob(object_t *o, flag_t *f, int bigness, lifeform_t *causedby) { } dam = roll(f->text); - getobname(o, obname, o->amt); + + // inside a container? if so, it's the container + // which you will see exploding. + if (o->pile->parentob) { + outerob = o->pile->parentob; + } else { + outerob = o; + } + c = getoblocation(outerob); + + getobname(outerob, obname, outerob->amt); // announce - if (o->pile->owner) { - if (isplayer(o->pile->owner)) { - msg("^BYour %s explode%s!^n", noprefix(obname),OBS1(o)); - } else if (cansee(player, o->pile->owner)) { + if (outerob->pile->owner) { + if (isplayer(outerob->pile->owner)) { + msg("^BYour %s explode%s!^n", noprefix(obname),OBS1(outerob)); + } else if (cansee(player, outerob->pile->owner)) { char lfname[BUFLEN]; - getlfname(o->pile->owner, lfname); - msg("^B%s%s %s explode%s!^n", lfname, getpossessive(lfname), noprefix(obname),OBS1(o)); + getlfname(outerob->pile->owner, lfname); + msg("^B%s%s %s explode%s!^n", lfname, getpossessive(lfname), noprefix(obname),OBS1(outerob)); } } else if (haslos(player, c)) { - msg("^B%s explode%s!^n", obname,OBS1(o)); + msg("^B%s explode%s!^n", obname,OBS1(outerob)); } explodecells(c, dam * o->amt, bigness ? B_TRUE : B_FALSE, o, bigness , DT_ORTH, B_FALSE, causedby); // object dies. - removeob(o, o->amt); + //removeob(o, o->amt); + // explode the container + removeob(outerob, outerob->amt); } void extinguish(object_t *o) { diff --git a/spell.c b/spell.c index afb9cde..d5bfb1b 100644 --- a/spell.c +++ b/spell.c @@ -7924,7 +7924,8 @@ 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, (o->amt == 1) ? "is" : "are"); + msg("^BYour %s %s too hot to hold!", obname, + (dropob[i]->amt == 1) ? "is" : "are"); } drop(dropob[i], dropob[i]->amt); } @@ -11069,7 +11070,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ fizzle(caster); return B_TRUE; } - amttolose = power*2; + amttolose = roll("1d6") + power; if (isplayer(target)) { msg("^%cYou suddenly feel very lethargic!", getlfcol(target, CC_BAD)); } else if (cansee(player, target)) { diff --git a/text.c b/text.c index f56148f..da7c6ff 100644 --- a/text.c +++ b/text.c @@ -246,7 +246,11 @@ char *construct_hit_string(lifeform_t *lf, lifeform_t *victim, char *attackernam if (!victim || getlorelevel(lf, victim->race->raceclass->id)) { if (!lfhasflag(lf, F_PHANTASM)) { //strcpy(extradambuf, " but do no damage"); - strcpy(extradambuf, " ineffectually"); + if (onein(2)) { + strcpy(extradambuf, " ineffectually"); + } else { + strcpy(extradambuf, ", but do no damage."); + } knownnodam = B_TRUE; } } @@ -335,7 +339,11 @@ char *construct_hit_string(lifeform_t *lf, lifeform_t *victim, char *attackernam strcpy(nodamstr, ""); if ((dam == 0) && (damtype != DT_TOUCH) && !lfhasflag(lf, F_PHANTASM)) { nodam = B_TRUE; - strcpy(nodamstr, " ineffectually"); + if (onein(2)) { + strcpy(nodamstr, " ineffectually"); + } else { + strcpy(nodamstr, ", but does no damage"); + } } if (backstab && (idx == 0)) {