- [+] lots of unneccesary redraws when using stairs

- [+] don't ever redraw during new level creation
    - [+] lots of calls to setlosdirty() - for the player, this causes
          instant screen redraw.
        - [+] remember if player is changing level. if so, setlosdirty
              won't redraw.
    - [+] fixed!
- [+] basic clothing shouldn't be able to be cursed
- [+] don't show"you have no clear line of fire to here" if all the
      things in the way are invisible!
    - [+] argument to haslof:  "knowlofonly" - already there.
    - [+] apply this to all checks where it is from someone's point of
          view only.
        - [+] (ie. aimove)
        - [+] (ie throw)
        - [+] (ie spell aiming)
This commit is contained in:
Rob Pearce 2012-06-22 02:48:39 +00:00
parent 12ca195126
commit 1de13a1904
10 changed files with 104 additions and 27 deletions

15
ai.c
View File

@ -1593,7 +1593,7 @@ int aimovetolf(lifeform_t *lf, lifeform_t *target, int wantattack) {
else spellchance = 30; else spellchance = 30;
// some attacks can always happen // some attacks can always happen
if (cancast(lf, OT_A_THRUST, NULL) && (dist == 2) && haslof(lf->cell, target->cell, LOF_NEED, NULL)) { if (cancast(lf, OT_A_THRUST, NULL) && (dist == 2) && haslofknown(lf->cell, target->cell, LOF_NEED, NULL)) {
spellchance = 100; spellchance = 100;
} }
@ -1779,7 +1779,7 @@ int aimovetolf(lifeform_t *lf, lifeform_t *target, int wantattack) {
if (attackok) { if (attackok) {
// if not adjacent, check for guns, wands, throwing // if not adjacent, check for guns, wands, throwing
if ( (rangedattack != RA_NONE) && // we have a ranged attack if ( (rangedattack != RA_NONE) && // we have a ranged attack
haslof(lf->cell, target->cell, LOF_NEED, NULL) && // and we have line of fire to them haslofknown(lf->cell, target->cell, LOF_NEED, NULL) && // and we have line of fire to them
(closethrowok || onein(2) || (getcelldist(lf->cell, target->cell) > 1) )) { // and we're not adjacent to target OR random (closethrowok || onein(2) || (getcelldist(lf->cell, target->cell) > 1) )) { // and we're not adjacent to target OR random
if (rangedattack == RA_GUN) { if (rangedattack == RA_GUN) {
setguntarget(lf, target); setguntarget(lf, target);
@ -2309,7 +2309,7 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
if (db) dblog(".oO { cant cast %s - no LOS to victim }", ot ? ot->name : "?unkownspell?"); if (db) dblog(".oO { cant cast %s - no LOS to victim }", ot ? ot->name : "?unkownspell?");
return B_FALSE; return B_FALSE;
} }
if (needlof && !haslof(lf->cell, victim->cell, needlof, NULL) ) { if (needlof && !haslofknown(lf->cell, victim->cell, needlof, NULL) ) {
if (db) dblog(".oO { cant cast %s - no LOF to victim }", ot ? ot->name : "?unkownspell?"); if (db) dblog(".oO { cant cast %s - no LOF to victim }", ot ? ot->name : "?unkownspell?");
return B_FALSE; return B_FALSE;
} }
@ -2443,7 +2443,8 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
} }
} else if (ot->id == OT_S_SUPERHEAT) { } else if (ot->id == OT_S_SUPERHEAT) {
// got a potion? // got a potion?
if (victim && hasobwithflag(lf->pack, F_DRINKABLE) && haslof(lf->cell, victim->cell, LOF_NEED, NULL)) { if (victim && hasobwithflag(lf->pack, F_DRINKABLE) &&
haslofknown(lf->cell, victim->cell, LOF_NEED, NULL)) {
ok = B_TRUE; ok = B_TRUE;
} }
} else { } else {
@ -2674,7 +2675,7 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
adjcell = get_closest_adjcell(lf->cell, victim->cell); adjcell = get_closest_adjcell(lf->cell, victim->cell);
if (!adjcell || celldangerous(lf, adjcell, B_TRUE, NULL)) { // don't charge into dangerous cells if (!adjcell || celldangerous(lf, adjcell, B_TRUE, NULL)) { // don't charge into dangerous cells
specificcheckok = B_FALSE; specificcheckok = B_FALSE;
} else if (!haslof(lf->cell, victim->cell, LOF_NEED,NULL)) { } else if (!haslofknown(lf->cell, victim->cell, LOF_NEED,NULL)) {
specificcheckok = B_FALSE; specificcheckok = B_FALSE;
} else if (isimmobile(lf)) { } else if (isimmobile(lf)) {
specificcheckok = B_FALSE; specificcheckok = B_FALSE;
@ -2974,13 +2975,13 @@ int lookforobs(lifeform_t *lf) {
if (gothere) { if (gothere) {
// cast a spell? // cast a spell?
if (cancast(lf, OT_S_CALLWIND, NULL) && haslof(lf->cell, c, LOF_NEED, NULL)) { if (cancast(lf, OT_S_CALLWIND, NULL) && haslofknown(lf->cell, c, LOF_NEED, NULL)) {
if (!castspell(lf, OT_S_CALLWIND, NULL, o, c, NULL, NULL)) { if (!castspell(lf, OT_S_CALLWIND, NULL, o, c, NULL, NULL)) {
// successful // successful
return B_TRUE; return B_TRUE;
} }
} }
if (cancast(lf, OT_A_SNATCH, NULL) && haslof(lf->cell, c, LOF_NEED, NULL)) { if (cancast(lf, OT_A_SNATCH, NULL) && haslofknown(lf->cell, c, LOF_NEED, NULL)) {
if (!useability(lf, OT_A_SNATCH, NULL, c)) { if (!useability(lf, OT_A_SNATCH, NULL, c)) {
// successful // successful
return B_TRUE; return B_TRUE;

24
data.c
View File

@ -514,6 +514,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_CANLEARN, SK_STEALTH, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_STEALTH, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SWIMMING, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_SWIMMING, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_THROWING, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_THROWING, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TECHUSAGE, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TRAPS, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_TRAPS, PR_ADEPT, NA, NULL);
// abilities // abilities
addflag(lastjob->flags, F_VEGETARIAN, B_TRUE, NA, NA, NULL); addflag(lastjob->flags, F_VEGETARIAN, B_TRUE, NA, NA, NULL);
@ -682,7 +683,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_CANLEARN, SK_STAVES, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_STAVES, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_WHIPS, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_WHIPS, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_STEALTH, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_STEALTH, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TECHUSAGE, PR_BEGINNER, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_TECHUSAGE, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TWOWEAPON, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_TWOWEAPON, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_LORE_DRAGONS, PR_SKILLED, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_LORE_DRAGONS, PR_SKILLED, NA, NULL);
// abilities // abilities
@ -809,6 +810,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_PERCEPTION, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_PERCEPTION, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SHORTBLADES, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_SHORTBLADES, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SPEECH, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_SPEECH, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_TECHUSAGE, PR_BEGINNER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_THIEVERY, PR_BEGINNER, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_THIEVERY, PR_BEGINNER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_THROWING, PR_NOVICE, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_THROWING, PR_NOVICE, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_LORE_HUMANOID, PR_BEGINNER, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_LORE_HUMANOID, PR_BEGINNER, NA, NULL);
@ -822,7 +824,6 @@ void initjobs(void) {
addflag(lastjob->flags, F_CANLEARN, SK_STAVES, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_STAVES, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_WHIPS, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_WHIPS, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SWIMMING, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_SWIMMING, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TECHUSAGE, NA, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_TWOWEAPON, PR_EXPERT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_TWOWEAPON, PR_EXPERT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_UNARMED, PR_EXPERT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_UNARMED, PR_EXPERT, NA, NULL);
addflag(lastjob->flags, F_CANLEARN, SK_SS_DIVINATION, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_CANLEARN, SK_SS_DIVINATION, PR_ADEPT, NA, NULL);
@ -6358,6 +6359,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL); addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_STR, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_STR, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 80, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 80, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
// armour - body // armour - body
addot(OT_CHEFJACKET, "set of chef whites", "A large double-breasted white jacket. Its thick cotton cloth is resistant to heat.", MT_CLOTH, 2, OC_ARMOUR, SZ_MEDIUM); addot(OT_CHEFJACKET, "set of chef whites", "A large double-breasted white jacket. Its thick cotton cloth is resistant to heat.", MT_CLOTH, 2, OC_ARMOUR, SZ_MEDIUM);
@ -6371,6 +6373,7 @@ void initobjects(void) {
addflag(lastot->flags, F_CRITPROTECTION, 33, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 33, NA, NA, NULL);
killflagsofid(lastot->flags, F_FLAMMABLE); killflagsofid(lastot->flags, F_FLAMMABLE);
killflagsofid(lastot->flags, F_DTVULN); killflagsofid(lastot->flags, F_DTVULN);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_COTTONSHIRT, "cotton shirt", "A comfortable white cotton shirt.", MT_CLOTH, 0.7, OC_ARMOUR, SZ_MEDIUM); addot(OT_COTTONSHIRT, "cotton shirt", "A comfortable white cotton shirt.", MT_CLOTH, 0.7, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
@ -6381,6 +6384,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 33, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 33, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_ARMOURDEMON, "demonskin vest", "Body armour created by flaying the flesh from a living demon, it retains its innate immunity to fire.", MT_FLESH, 7, OC_ARMOUR, SZ_MEDIUM); addot(OT_ARMOURDEMON, "demonskin vest", "Body armour created by flaying the flesh from a living demon, it retains its innate immunity to fire.", MT_FLESH, 7, OC_ARMOUR, SZ_MEDIUM);
killflagsofid(lastot->flags, F_FLAMMABLE); killflagsofid(lastot->flags, F_FLAMMABLE);
@ -6467,6 +6471,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ATTREQ, A_AGI, 35, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 35, NA, NULL);
addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 85, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 85, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_SILKSHIRT, "silk shirt", "A lightweight, comfortable white silk shirt.", MT_SILK, 0.5, OC_ARMOUR, SZ_MEDIUM); addot(OT_SILKSHIRT, "silk shirt", "A lightweight, comfortable white silk shirt.", MT_SILK, 0.5, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_UNCOMMON, NULL); addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_UNCOMMON, NULL);
@ -6476,6 +6481,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL); addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 50, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 50, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_ROBE, "robe", "A plain robe.", MT_CLOTH, 4, OC_ARMOUR, SZ_MEDIUM); addot(OT_ROBE, "robe", "A plain robe.", MT_CLOTH, 4, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_MULTISIZE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_MULTISIZE, B_TRUE, NA, NA, NULL);
@ -6519,6 +6525,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL);
addflag(lastot->flags, F_WATERPROOF, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_WATERPROOF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 80, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 80, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
// armour - waist // armour - waist
addot(OT_BELTLEATHER, "leather belt", "A plain leather belt.", MT_LEATHER, 0.2, OC_ARMOUR, SZ_SMALL); addot(OT_BELTLEATHER, "leather belt", "A plain leather belt.", MT_LEATHER, 0.2, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
@ -6535,6 +6542,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 15, 15, NA, NULL); addflag(lastot->flags, F_OBHP, 15, 15, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 60, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 60, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_RIDINGTROUSERS, "pair of riding trousers", "A tight pair of durable leather trousers.", MT_LEATHER, 2, OC_ARMOUR, SZ_MEDIUM); addot(OT_RIDINGTROUSERS, "pair of riding trousers", "A tight pair of durable leather trousers.", MT_LEATHER, 2, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_MULTISIZE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_MULTISIZE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
@ -6544,6 +6552,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL); addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 75, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 75, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_COMBATPANTS, "pair of combat pants", "An lightly-armoured pair of camoflauged trousers.", MT_CLOTH, 2, OC_ARMOUR, SZ_MEDIUM); addot(OT_COMBATPANTS, "pair of combat pants", "An lightly-armoured pair of camoflauged trousers.", MT_CLOTH, 2, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_LEGS, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_LEGS, NA, NA, NULL);
@ -6552,6 +6561,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 50, 50, NA, NULL); addflag(lastot->flags, F_OBHP, 50, 50, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 90, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 90, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_GREAVES, "set of greaves", "A set of heavy metal greaves.", MT_METAL, 4, OC_ARMOUR, SZ_MEDIUM); addot(OT_GREAVES, "set of greaves", "A set of heavy metal greaves.", MT_METAL, 4, OC_ARMOUR, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_LEGS, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_LEGS, NA, NA, NULL);
@ -6571,6 +6581,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ARMOURRATING, 0, NA, NA, NULL); addflag(lastot->flags, F_ARMOURRATING, 0, NA, NA, NULL);
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL); addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 30, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 30, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_SHOESLEATHER, "pair of leather shoes", "Cheap and rather uncomfortable leather shoes.", MT_LEATHER, 2, OC_ARMOUR, SZ_SMALL); addot(OT_SHOESLEATHER, "pair of leather shoes", "Cheap and rather uncomfortable leather shoes.", MT_LEATHER, 2, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL);
@ -6627,6 +6638,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL); addflag(lastot->flags, F_OBHP, 20, 20, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL); addflag(lastot->flags, F_ATTREQ, A_AGI, 15, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 70, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 70, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_GLOVESLEATHER, "pair of leather gloves", "A pair of coarse leather gloves.", MT_LEATHER, 0.25, OC_ARMOUR, SZ_SMALL); addot(OT_GLOVESLEATHER, "pair of leather gloves", "A pair of coarse leather gloves.", MT_LEATHER, 0.25, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_HANDS, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_HANDS, NA, NA, NULL);
@ -6652,6 +6664,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL); addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL); addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_PIRATEHAT, "tricorne", "A three cornered hat with a skull and crossbones emblem.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL); addot(OT_PIRATEHAT, "tricorne", "A three cornered hat with a skull and crossbones emblem.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
@ -6667,6 +6680,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL); addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_ANONYMOUS, NA, NA, NULL); addflag(lastot->flags, F_EQUIPCONFER, F_ANONYMOUS, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_CAP, "cap", "Close-fitting headwear with a short shade visor at the front.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL); addot(OT_CAP, "cap", "Close-fitting headwear with a short shade visor at the front.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL);
@ -6675,6 +6689,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL); addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL); addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_CHEFHAT, "toque", "A tall white hat with no brim. Commonly worn by professional cooks.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL); addot(OT_CHEFHAT, "toque", "A tall white hat with no brim. Commonly worn by professional cooks.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL);
@ -6682,6 +6697,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL); addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL); addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_GASMASK, "gas mask", "A full face mask which protects the wearer from toxic gasses.", MT_RUBBER, 3.5, OC_ARMOUR, SZ_SMALL); addot(OT_GASMASK, "gas mask", "A full face mask which protects the wearer from toxic gasses.", MT_RUBBER, 3.5, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
@ -6692,6 +6708,7 @@ void initobjects(void) {
addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -2, NA, NULL); addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -2, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 65, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 65, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_HELM, "helmet", "A plain metal helmet.", MT_METAL, 2, OC_ARMOUR, SZ_SMALL); addot(OT_HELM, "helmet", "A plain metal helmet.", MT_METAL, 2, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
@ -6707,6 +6724,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 40, 40, NA, NULL); addflag(lastot->flags, F_OBHP, 40, 40, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -1, NA, NULL); addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -1, NA, NULL);
addflag(lastot->flags, F_CRITPROTECTION, 100, NA, NA, NULL); addflag(lastot->flags, F_CRITPROTECTION, 100, NA, NA, NULL);
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
addot(OT_GOLDCROWN, "golden crown", "A heavy gold crown, encrusted with jewels.", MT_GOLD, 5, OC_ARMOUR, SZ_SMALL); addot(OT_GOLDCROWN, "golden crown", "A heavy gold crown, encrusted with jewels.", MT_GOLD, 5, OC_ARMOUR, SZ_SMALL);
addflag(lastot->flags, F_RARITY, H_ALL, 25, RR_RARE, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 25, RR_RARE, NULL);
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL); addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
@ -6739,6 +6757,8 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL); addflag(lastot->flags, F_OBHP, 5, 5, NA, NULL);
addflag(lastot->flags, F_EQUIPCONFER, F_DEAF, NA, NA, NULL); addflag(lastot->flags, F_EQUIPCONFER, F_DEAF, NA, NA, NULL);
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
killflagsofid(lastot->flags, F_ENCHANTABLE);
// armour - eyes // armour - eyes
addot(OT_SAFETYGLASSES, "pair of safety goggles", "A plastic eyemask designed for protection.", MT_PLASTIC, 0.01, OC_ARMOUR, SZ_TINY); addot(OT_SAFETYGLASSES, "pair of safety goggles", "A plastic eyemask designed for protection.", MT_PLASTIC, 0.01, OC_ARMOUR, SZ_TINY);

8
defs.h
View File

@ -2803,6 +2803,8 @@ enum FLAG {
F_MAGICBOOST, // boost power of all spells by v0 F_MAGICBOOST, // boost power of all spells by v0
F_TEMPMAGICBOOST, // boost power of next spell cast (only) by v0 F_TEMPMAGICBOOST, // boost power of next spell cast (only) by v0
F_WHIP, // this weapon is a whip - use different damtext. F_WHIP, // this weapon is a whip - use different damtext.
F_STARTSPLAIN, // this object is never randomly generated with
// a bless/curse or with a +xxx bonus.
F_CANHAVEOBMOD, // weapon can have obmod om_v0 applied F_CANHAVEOBMOD, // weapon can have obmod om_v0 applied
// optional: v1 is chance of randomly having it // optional: v1 is chance of randomly having it
F_ATTREQ, // requires attrib v0 to be at least v1 F_ATTREQ, // requires attrib v0 to be at least v1
@ -4453,9 +4455,15 @@ typedef struct lifeform_s {
// the first rotation in a turn is free, others cost time. // the first rotation in a turn is free, others cost time.
int rotated; int rotated;
// is the player in the process of changing levels
int changinglev;
// set to TRUE after lf has being created // set to TRUE after lf has being created
int born; int born;
// debugging
int redraws; // # actual screen redraws during this lf's turn.
// for ai movement and pushers. DO save these. // for ai movement and pushers. DO save these.
struct cell_s *prevcell[2]; struct cell_s *prevcell[2];

8
io.c
View File

@ -1033,7 +1033,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
cell_t *newcell; cell_t *newcell;
int bad = B_FALSE; int bad = B_FALSE;
if (srclf) { if (srclf) {
if (!haslof_real(srclf->cell, c, loftype, &newcell, srclf, B_TRUE)) { if (!haslofknown(srclf->cell, c, loftype, &newcell)) {
bad = B_TRUE; bad = B_TRUE;
} }
} else { } else {
@ -8554,7 +8554,7 @@ void donextguntarget(void) {
cell_t *c; cell_t *c;
c = player->los[i]; c = player->los[i];
if (c->lf && (c->lf != player) && (c->lf != targ)) { if (c->lf && (c->lf != player) && (c->lf != targ)) {
if (haslof(player->cell, c, LOF_NEED, NULL) && isingunrange(player, c)) { if (haslofknown(player->cell, c, LOF_NEED, NULL) && isingunrange(player, c)) {
// found one! // found one!
setguntarget(player, c->lf); setguntarget(player, c->lf);
done = B_TRUE; done = B_TRUE;
@ -8759,7 +8759,7 @@ int dothrow(obpile_t *op, object_t *o) {
if (where) { if (where) {
cell_t *newwhere = NULL; cell_t *newwhere = NULL;
if (!haslof(player->cell, where, LOF_WALLSTOP, &newwhere)) { if (!haslofknown(player->cell, where, LOF_WALLSTOP, &newwhere)) {
if (newwhere && (newwhere != player->cell)) { if (newwhere && (newwhere != player->cell)) {
char ch; char ch;
ch = askchar("Your line of fire is blocked - really throw here", "yn", "y", B_TRUE, B_FALSE); ch = askchar("Your line of fire is blocked - really throw here", "yn", "y", B_TRUE, B_FALSE);
@ -8986,6 +8986,8 @@ void drawlevelfor(lifeform_t *lf) {
precalclos(player); precalclos(player);
} }
lf->redraws++;
//dbtimestart("drawscreen"); //dbtimestart("drawscreen");
map = lf->cell->map; map = lf->cell->map;

28
lf.c
View File

@ -3761,7 +3761,13 @@ void dumplf(void) {
startmap = firstmap; startmap = firstmap;
} }
for (lf = startmap->lf ; lf ; lf = lf->next) { for (lf = startmap->lf ; lf ; lf = lf->next) {
dblog(" timespent=%3d id %d race %s",lf->timespent, lf->id, lf->race->name); char buf[BUFLEN];
sprintf(buf," timespent=%3d id %d race %s, redraws last turn=%d",lf->timespent, lf->id, lf->race->name,
lf->redraws);
if (cansee(player, lf)) {
strcat(buf, "(seen by player)");
}
dblog("%s", buf);
count++; count++;
} }
dblog("END LIFEFORM DUMP (%d found)",count); dblog("END LIFEFORM DUMP (%d found)",count);
@ -12642,6 +12648,9 @@ int haslof(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest) {
return haslof_real(src, dest, loftype, newdest, NULL, B_TRUE); return haslof_real(src, dest, loftype, newdest, NULL, B_TRUE);
} }
int haslofknown(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest) {
return haslof_real(src, dest, loftype, newdest, src->lf, B_TRUE);
}
// got line of fire to dest? if lof is blocked, return last cell in 'newdest' // got line of fire to dest? if lof is blocked, return last cell in 'newdest'
// if 'srclf' is set, we are checking whether 'srclf' THINKS they have line of fire. ie invisible/unseed // if 'srclf' is set, we are checking whether 'srclf' THINKS they have line of fire. ie invisible/unseed
// lifeforms don't block lof. // lifeforms don't block lof.
@ -13760,6 +13769,11 @@ lifeform_t *real_addlf(cell_t *cell, enum RACE rid, int level, int controller) {
a->eyeadjustment = 0; a->eyeadjustment = 0;
a->changinglev = B_FALSE;
// debug
a->redraws = 0;
// for ai // for ai
// avoid messages when equipping initial obs // avoid messages when equipping initial obs
@ -18983,8 +18997,10 @@ void setlosdirty(lifeform_t *lf) {
lf->losdirty = B_TRUE; lf->losdirty = B_TRUE;
if (lf->losdirty && isplayer(lf)) { if (lf->losdirty && isplayer(lf)) {
needredraw = B_TRUE; if (!lf->changinglev) {
drawscreen(); needredraw = B_TRUE;
drawscreen();
}
} }
} }
@ -19560,6 +19576,9 @@ void startlfturn(lifeform_t *lf) {
if (db) dblog("startlfturn for lf id %d %s", lf->id, lf->race->name); if (db) dblog("startlfturn for lf id %d %s", lf->id, lf->race->name);
// debugging
lf->redraws = 0;
// MOVE OUT OF STOMACHS WHICH DONT EXIST ANYMORE // MOVE OUT OF STOMACHS WHICH DONT EXIST ANYMORE
sf = hasflag(map->flags, F_STOMACHOF); sf = hasflag(map->flags, F_STOMACHOF);
if (sf) { if (sf) {
@ -21108,8 +21127,6 @@ int stone(lifeform_t *lf) {
getlfname(lf, lfname); getlfname(lf, lfname);
// kill lifeform // kill lifeform
addflag(lf->flags, F_NODEATHANNOUNCE, B_TRUE, NA, NA, NULL); addflag(lf->flags, F_NODEATHANNOUNCE, B_TRUE, NA, NA, NULL);
snprintf(statname, BUFLEN, "statue of a %s", lf->race->name); snprintf(statname, BUFLEN, "statue of a %s", lf->race->name);
@ -22290,6 +22307,7 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) {
} }
} }
// do stairs go somewhere? generate new maps if required. // do stairs go somewhere? generate new maps if required.
newcell = getstairdestination(o, &madenewmap); newcell = getstairdestination(o, &madenewmap);
if (newcell) { if (newcell) {

1
lf.h
View File

@ -312,6 +312,7 @@ void loseobflags(lifeform_t *lf, object_t *o, int kind);
int hasbp(lifeform_t *lf, enum BODYPART bp); int hasbp(lifeform_t *lf, enum BODYPART bp);
flag_t *hasactivespell(lifeform_t *lf, enum OBTYPE sid); flag_t *hasactivespell(lifeform_t *lf, enum OBTYPE sid);
int haslof(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest); int haslof(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest);
int haslofknown(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest);
int haslof_real(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest, lifeform_t *srclf, int walllfsok); int haslof_real(cell_t *src, cell_t *dest, enum LOFTYPE loftype, cell_t **newdest, lifeform_t *srclf, int walllfsok);
int haslos(lifeform_t *viewer, cell_t *dest); int haslos(lifeform_t *viewer, cell_t *dest);
int haslosdark(lifeform_t *viewer, cell_t *dest); int haslosdark(lifeform_t *viewer, cell_t *dest);

5
map.c
View File

@ -3812,6 +3812,9 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
int nprevaults = 0; int nprevaults = 0;
int db = B_TRUE; int db = B_TRUE;
// don't redraw screen during level change calculations
noredraw = B_TRUE;
//if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging //if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging
// determine habitat based on region // determine habitat based on region
@ -4432,6 +4435,8 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
} }
//if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging //if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging
noredraw = B_FALSE;
map->beingcreated = B_FALSE; map->beingcreated = B_FALSE;
if (db) dblog(" Map creation finished."); if (db) dblog(" Map creation finished.");
} }

11
move.c
View File

@ -27,6 +27,8 @@ extern enum GAMEMODE gamemode;
extern enum ERROR reason; extern enum ERROR reason;
extern void *rdata; extern void *rdata;
extern int noredraw;
extern long curtime; extern long curtime;
extern WINDOW *gamewin, *msgwin; extern WINDOW *gamewin, *msgwin;
@ -1180,8 +1182,13 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
needredraw = B_TRUE; needredraw = B_TRUE;
} }
if (newcell->map != lf->cell->map) { if (newcell->map != lf->cell->map) {
changedlev = B_TRUE; changedlev = B_TRUE;
lf->changinglev = B_TRUE;
setlosdirty(lf); setlosdirty(lf);
if (isplayer(lf)) { if (isplayer(lf)) {
// remember the time which we exitted this map. // remember the time which we exitted this map.
@ -1211,6 +1218,8 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
// now remove the barrier // now remove the barrier
o = hasobid(newcell->obpile, barrierid); o = hasobid(newcell->obpile, barrierid);
if (o) killob(o); if (o) killob(o);
if (isplayer(lf)) noredraw = B_FALSE;
} }
// remember current cell + room id // remember current cell + room id
@ -1621,6 +1630,8 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
} }
} // end if gamestarted } // end if gamestarted
lf->changinglev = B_FALSE;
return didmsg; return didmsg;
} }

View File

@ -6407,7 +6407,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
// chance to be blessed or cursed? 15% chance each way // chance to be blessed or cursed? 15% chance each way
strcpy(cursestr, ""); strcpy(cursestr, "");
if (!hasflag(ot->flags, F_NOBLESS)) { if (!hasflag(ot->flags, F_NOBLESS) && !hasflag(ot->flags, F_STARTSPLAIN)) {
int num; int num;
num = rnd(1,100); num = rnd(1,100);
if (num <= 15) { if (num <= 15) {
@ -6418,7 +6418,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
} }
if (hasflag(ot->flags, F_ENCHANTABLE)) { if (hasflag(ot->flags, F_ENCHANTABLE) && !hasflag(ot->flags, F_STARTSPLAIN)) {
char buf2[BUFLENSMALL]; char buf2[BUFLENSMALL];
int bonus = 0; int bonus = 0;
int dir,chance; int dir,chance;
@ -6431,7 +6431,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
chance = 30; chance = 30;
dir = 1; dir = 1;
} else { } else {
chance = 25; chance = 10;
dir = 1; dir = 1;
} }
while (rnd(1,100) <= chance) { while (rnd(1,100) <= chance) {

25
spell.c
View File

@ -157,7 +157,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
if (!target) { if (!target) {
if (isplayer(user)) msg("There is nobody there!"); if (isplayer(user)) msg("There is nobody there!");
return TRUE; return TRUE;
} else if (!haslof(user->cell, targcell, LOF_NEED, NULL)) { } else if (!haslof_real(user->cell, targcell, LOF_NEED, NULL, user, B_FALSE)) {
if (isplayer(user)) msg("Your path there is blocked!"); if (isplayer(user)) msg("Your path there is blocked!");
return TRUE; return TRUE;
} }
@ -3526,7 +3526,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
targcell = retcell[maxr]; targcell = retcell[maxr];
} }
// adjust for LOF // 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
// see.
loft = getspellloftype(spellid); loft = getspellloftype(spellid);
if (loft != LOF_DONTNEED) { if (loft != LOF_DONTNEED) {
cell_t *newtarg; cell_t *newtarg;
@ -12450,6 +12452,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
ch = rnd('a', 'f'); ch = rnd('a', 'f');
} }
} }
// warn if this was bad...
if (isplayer(target) && (blessed == B_CURSED)) {
msg("^%cUh oh, you have a bad feeling about this...", getlfcol(target, CC_VBAD)); more();
}
if (ch == 'a') { // wealth (gold, bad: goldtouch) if (ch == 'a') { // wealth (gold, bad: goldtouch)
snprintf(buf, BUFLEN, "1000-2000 gold coins"); snprintf(buf, BUFLEN, "1000-2000 gold coins");
} else if (ch == 'b') { // power (weapons, bad: battery) } else if (ch == 'b') { // power (weapons, bad: battery)
@ -12527,9 +12535,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
snprintf(buf, BUFLEN, "sun hat"); snprintf(buf, BUFLEN, "sun hat");
} }
} else { } else {
snprintf(buf, BUFLEN, "sun hat"); stone(caster);
} }
} else if (ch == 'd') { // fame (allies bad: useless allies) } else if (ch == 'd') { // fame (allies bad: useless allies or monsters)
lifeform_t *lf; lifeform_t *lf;
cell_t *c; cell_t *c;
job_t *j; job_t *j;
@ -12543,7 +12551,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (cansee(player, lf)) { if (cansee(player, lf)) {
msg("%s appears!", lfname); msg("%s appears!", lfname);
} }
petify(lf, target); if (blessed == B_CURSED) {
aiattack(lf, target, aigetchasetime(lf));
} else {
petify(lf, target);
}
if (isplayer(target)) { if (isplayer(target)) {
p = assignnpcname(lf->flags); p = assignnpcname(lf->flags);
@ -14056,7 +14068,6 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e
enum LOFTYPE needlof = LOF_NEED; enum LOFTYPE needlof = LOF_NEED;
int minrange = 0; int minrange = 0;
if (!caster) { if (!caster) {
return *targcell; return *targcell;
} else if ((caster->race->raceclass->id == RC_GOD) && targcell) { } else if ((caster->race->raceclass->id == RC_GOD) && targcell) {
@ -14093,7 +14104,7 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e
} }
// line of fire interrupted? // line of fire interrupted?
if (where && needlof && !haslof(caster->cell, where, needlof, &newwhere)) { if (where && needlof && !haslofknown(caster->cell, where, needlof, &newwhere)) {
if (newwhere) { if (newwhere) {
if (isplayer(caster) && !frompot) { if (isplayer(caster) && !frompot) {
// warn! // warn!