1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-08-16 01:21:37 +01:00

Nightmare-aware sanity effects.

Nightmare reduces the effectiveness of clear thoughts from 100% to 80%

This requires modifying all the places where u.usanity was used directly to use macros.

The exact effects of sanity, walking nightmare, and clear thoughts should now be more easily adjustable.
This commit is contained in:
chris 2022-07-25 14:42:22 -04:00
parent 6904ab0c5d
commit 43c4a8bd9e
18 changed files with 286 additions and 97 deletions

View file

@ -162,7 +162,11 @@
/*** Troubles ***/
/* Pseudo-property */
#define Punished (uball)
#define Insanity (100 - u.usanity)
#define NightmareAware_Sanity ((Nightmare && ClearThoughts) ? (u.usanity + 4*Insanity/5) : u.usanity)
#define NightmareAware_Insanity ((Nightmare && ClearThoughts) ? (Insanity/5) : Insanity)
#define FacelessHelm(obj) ((obj)->otyp == PLASTEEL_HELM || (obj)->otyp == CRYSTAL_HELM || (obj)->otyp == PONTIFF_S_CROWN || (obj)->otyp == FACELESS_HELM)
#define FacelessCloak(obj) ((obj)->otyp == WHITE_FACELESS_ROBE || (obj)->otyp == BLACK_FACELESS_ROBE || (obj)->otyp == SMOKY_VIOLET_FACELESS_ROBE)
#define Faceless(obj) (FacelessHelm(obj) || FacelessCloak(obj))
@ -255,27 +259,27 @@
#define HPanicking u.uprops[PANIC].intrinsic
#define EPanicking u.uprops[PANIC].extrinsic
#define Panicking ((HPanicking || EPanicking) && !ClearThoughts)
#define Panicking ((HPanicking || EPanicking) && !BlockableClearThoughts)
#define HStumbleBlind u.uprops[STUMBLE_BLIND].intrinsic
#define EStumbleBlind u.uprops[STUMBLE_BLIND].extrinsic
#define StumbleBlind ((HStumbleBlind || EStumbleBlind) && !ClearThoughts)
#define StumbleBlind ((HStumbleBlind || EStumbleBlind) && !BlockableClearThoughts)
#define HStaggerShock u.uprops[STAGGER_SHOCK].intrinsic
#define EStaggerShock u.uprops[STAGGER_SHOCK].extrinsic
#define StaggerShock ((HStaggerShock || EStaggerShock) && !ClearThoughts)
#define StaggerShock ((HStaggerShock || EStaggerShock) && !BlockableClearThoughts)
#define HBabble u.uprops[BABBLING].intrinsic
#define EBabble u.uprops[BABBLING].extrinsic
#define Babble ((HBabble || EBabble) && !ClearThoughts)
#define Babble ((HBabble || EBabble) && !BlockableClearThoughts)
#define HScreaming u.uprops[SCREAMING].intrinsic
#define EScreaming u.uprops[SCREAMING].extrinsic
#define Screaming ((HScreaming || EScreaming) && !ClearThoughts)
#define Screaming ((HScreaming || EScreaming) && !BlockableClearThoughts)
#define HFaintingFits u.uprops[FAINTING_FIT].intrinsic
#define EFaintingFits u.uprops[FAINTING_FIT].extrinsic
#define FaintingFits ((HFaintingFits || EFaintingFits) && !ClearThoughts)
#define FaintingFits ((HFaintingFits || EFaintingFits) && !BlockableClearThoughts)
/*** Vision and senses ***/
#define HNormalvision u.uprops[NORMALVISION].intrinsic

View file

@ -818,8 +818,8 @@ you_calc_movement()
default: break;
}
if(u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
int delta = Insanity;
if(u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int delta = NightmareAware_Insanity;
int discomfort = u_clothing_discomfort();
discomfort = (discomfort * delta)/100;
if (moveamt - discomfort < NORMAL_SPEED/2) {
@ -1039,9 +1039,9 @@ you_regen_hp()
}
}
if(FaintingFits && rn2(100) >= u.usanity && multi >= 0){
if(FaintingFits && rn2(100) >= NightmareAware_Sanity && multi >= 0){
You("suddenly faint!");
fall_asleep((u.usanity - 100)/10 - 1, FALSE);
fall_asleep((NightmareAware_Sanity - 100)/10 - 1, FALSE);
}
//Worn Vilya bonus ranges from -4 (penalty) to +7 HP per 10 turns
@ -1459,7 +1459,7 @@ moveloop()
for (mtmp = fmon; mtmp; mtmp = nxtmon){
nxtmon = mtmp->nmon;
if(mtmp->m_insight_level > u.uinsight
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && ClearThoughts)
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && BlockableClearThoughts)
){
insight_vanish(mtmp);
continue;
@ -1541,7 +1541,7 @@ moveloop()
}
}
if(mtmp->m_insight_level > u.uinsight
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && ClearThoughts)
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && BlockableClearThoughts)
){
insight_vanish(mtmp);
continue;
@ -1999,7 +1999,7 @@ karemade:
if(DEADMONSTER(mtmp) || MIGRATINGMONSTER(mtmp))
continue;
if(mtmp->mtyp == PM_WALKING_DELIRIUM && !mtmp->mtame && !ClearThoughts) {
if(mtmp->mtyp == PM_WALKING_DELIRIUM && !mtmp->mtame && !BlockableClearThoughts) {
static long lastusedmove = 0;
if (lastusedmove != moves) {
if (!mtmp->mappearance || (canseemon(mtmp) && distmin(mtmp->mx, mtmp->my, u.ux, u.uy) <= 1 && rn2(3))) {
@ -2015,7 +2015,7 @@ karemade:
}
}
if(has_template(mtmp, MAD_TEMPLATE) && !ClearThoughts && canseemon(mtmp) && dimness(mtmp->mx, mtmp->my) <= 0 && distmin(mtmp->mx, mtmp->my, u.ux, u.uy) <= 1){
if(has_template(mtmp, MAD_TEMPLATE) && !BlockableClearThoughts && canseemon(mtmp) && dimness(mtmp->mx, mtmp->my) <= 0 && distmin(mtmp->mx, mtmp->my, u.ux, u.uy) <= 1){
static long lastusedmove = 0;
static int lastcost = 0;
int sancost = u_sanity_loss_minor(mtmp);
@ -2295,7 +2295,10 @@ karemade:
You("feel it %s inside your body!", hoststrings[rn2(SIZE(hoststrings))]);
make_vomiting(Vomiting+49+d(4,11), TRUE);
}
if(Nightmare)
dohost_mon(&youmonst);
}
if(roll_madness(MAD_ROTTING)){
if(roll_madness(MAD_ROTTING))
create_gas_cloud(u.ux+rn2(3)-1, u.uy+rn2(3)-1, 1, rnd(6), FALSE); //Longer-lived smoke
@ -2540,7 +2543,7 @@ karemade:
if (flags.bypasses) clear_bypasses();
if(Glib) glibr();
// if(StumbleBlind && rn2(100) >= u.usanity) bumbler();
// if(StumbleBlind && rn2(100) >= NightmareAware_Sanity) bumbler();
nh_timeout();
run_regions();
run_maintained_spells();
@ -2864,7 +2867,7 @@ karemade:
}
}
if(mtmp->m_insight_level > u.uinsight
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && ClearThoughts)
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && BlockableClearThoughts)
){
insight_vanish(mtmp);
continue;
@ -2916,11 +2919,11 @@ karemade:
see_objects();
see_traps();
if (u.uswallow) swallowed(0);
} else if (Unblind_telepat || goodsmeller(youracedata) || Warning || Warn_of_mon || u.usanity < 100 || oldsanity < 100) {
} else if (Unblind_telepat || goodsmeller(youracedata) || Warning || Warn_of_mon || NightmareAware_Sanity < 100 || oldsanity < 100) {
see_monsters();
}
oldsanity = u.usanity;
oldsanity = NightmareAware_Sanity;
switch (((u_healing_penalty() - healing_penalty) > 0) - ((u_healing_penalty() - healing_penalty) < 0))
{
@ -2964,11 +2967,11 @@ karemade:
see_objects();
see_traps();
if (u.uswallow) swallowed(0);
} else if (Unblind_telepat || goodsmeller(youracedata) || Warning || Warn_of_mon || u.usanity < 100 || oldsanity < 100) {
} else if (Unblind_telepat || goodsmeller(youracedata) || Warning || Warn_of_mon || NightmareAware_Sanity < 100 || oldsanity < 100) {
see_monsters();
}
oldsanity = u.usanity;
oldsanity = NightmareAware_Sanity;
if (!oldLightBlind ^ !LightBlind) { /* one or the other but not both */
see_monsters();
@ -5181,6 +5184,150 @@ struct monst *magr;
}
}
void
dohost_mon(magr)
struct monst *magr;
{
struct monst *mdef;
int count_close = 0;
int count_far = 0;
int dist;
boolean peace = 0;
boolean youagr = &youmonst == magr;
struct attack symbiote = { 0, 0, 6, 6 };
// if(&youmonst == magr || magr->mpeaceful)
if(youagr)
peace = 1;
for(mdef = fmon; mdef; mdef = mdef->nmon){
if(mdef->mpeaceful == peace)
continue;
dist = distmin(x(magr), y(magr), x(mdef), y(mdef));
if(dist > BOLT_LIM)
continue;
if(!couldsee(x(mdef), y(mdef)))
continue;
if(dist > 1)
count_far++;
if((touch_petrifies(mdef->data)
|| mdef->mtyp == PM_MEDUSA)
&& ((!youagr && !resists_ston(magr)) || (youagr && !Stone_resistance))
) continue;
if(mdef->mtyp == PM_PALE_NIGHT)
continue;
if(dist <= 2)
count_close++;
}
if(!peace){
mdef = &youmonst;
}
switch(rn2(6)){
//Acid blast
case 0:
// pline("acid blast");
if(!count_far)
return;
count_far = rn2(count_far);
for(mdef = fmon; mdef; mdef = mdef->nmon){
if(mdef->mpeaceful == peace)
continue;
dist = distmin(x(magr), y(magr), x(mdef), y(mdef));
if(dist > BOLT_LIM)
continue;
if(!couldsee(x(mdef), y(mdef)))
continue;
if(dist > 1){
if(count_far-- > 0)
continue;
explode(x(mdef), y(mdef), AD_ACID, 0, d(6,6), EXPL_NOXIOUS, 1);
return;
}
}
break;
//Sickness
case 1:
// pline("sickness");
if(!count_far && !count_close)
return;
count_far = rn2(count_far+count_close);
symbiote.aatyp = AT_MAGC;
symbiote.adtyp = AD_CLRC;
for(mdef = fmon; mdef; mdef = mdef->nmon){
if(mdef->mpeaceful == peace)
continue;
dist = distmin(x(magr), y(magr), x(mdef), y(mdef));
if(dist > BOLT_LIM)
continue;
if(!couldsee(mdef->mx, mdef->my))
continue;
if(count_far-- > 0)
continue;
cast_spell(magr, mdef, &symbiote, PLAGUE, x(mdef), y(mdef));
return;
}
break;
//Flesh hook
case 2:
// pline("flesh hook");
if(!count_close)
return;
count_close = rn2(count_close);
symbiote.aatyp = AT_LRCH;
symbiote.adtyp = AD_HOOK;
break;
//Vampiric
case 3:
// pline("vampire");
if(!count_close)
return;
count_close = rn2(count_close);
symbiote.aatyp = AT_BITE;
symbiote.adtyp = AD_VAMP;
break;
//Brain
case 4:
// pline("brain");
if(!count_close)
return;
count_close = rn2(count_close);
symbiote.aatyp = AT_TENT;
symbiote.adtyp = AD_DRIN;
break;
//Acid slash
case 5:
// pline("acid slash");
if(!count_close)
return;
count_close = rn2(count_close);
symbiote.aatyp = AT_SRPR;
symbiote.adtyp = AD_EACD;
break;
}
for(mdef = fmon; mdef; mdef = mdef->nmon){
if(mdef->mpeaceful == peace)
continue;
dist = distmin(x(magr), y(magr), x(mdef), y(mdef));
if(dist > BOLT_LIM)
continue;
if(!couldsee(mdef->mx, mdef->my))
continue;
if((touch_petrifies(mdef->data)
|| mdef->mtyp == PM_MEDUSA)
&& ((!youagr && !resists_ston(magr)) || (youagr && !Stone_resistance))
) continue;
if(mdef->mtyp == PM_PALE_NIGHT)
continue;
if(dist <= 2){
if(count_close-- > 0)
continue;
xmeleehity(magr, mdef, &symbiote, (struct obj **)0, -1, 0, FALSE);
return;
}
}
}
void
donachash(magr)
struct monst *magr;

View file

@ -2869,6 +2869,7 @@ get_premium_heart_multiplier()
if (!Upolyd && u.uhp<u.uhpmax / 16) multiplier++;
if (Insanity > 50 && !ClearThoughts) multiplier++;
if (Insanity > 75 && !ClearThoughts) multiplier++;
if (NightmareAware_Insanity >= 90 && ClearThoughts && Nightmare) multiplier++;
if (Blind) multiplier++;
if (Stunned) multiplier++;
if (Confusion) multiplier++;

View file

@ -1298,8 +1298,8 @@ int x;
tmp += u.ulevel/3;
}
} else if (x == A_CHA) {
if(u.umadness&MAD_ROTTING && !ClearThoughts){
tmp -= (Insanity)/5;
if(u.umadness&MAD_ROTTING && !BlockableClearThoughts){
tmp -= (NightmareAware_Insanity)/5;
}
} else if (x == A_INT || x == A_WIS) {
/* yes, this may raise int/wis if player is sufficiently
@ -1321,8 +1321,9 @@ change_usanity(delta, check)
int delta;
boolean check;
{
int nightmare_starting_sanity = NightmareAware_Sanity;
int starting_sanity = u.usanity;
int starting_insanity = Insanity;
int starting_insanity = NightmareAware_Insanity;
if(discover || wizard)
pline("Sanity change: %d + %d", u.usanity, delta);
u.usanity += delta;
@ -1345,40 +1346,40 @@ boolean check;
}
}
if(check && delta < 0 && ((-delta > rn2(ACURR(A_WIS))) || -delta >= starting_sanity/10) && rn2(100) >= starting_sanity
if(check && delta < 0 && ((-delta > rn2(ACURR(A_WIS))) || -delta >= starting_sanity/10) && rn2(100) >= nightmare_starting_sanity
&& !Panicking && !StumbleBlind && !StaggerShock && !Babble && !Screaming && !FaintingFits
){
switch(rn2(5)){
case 0:
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little panicky.");
else
You("panic in your insanity!");
HPanicking = 1+rnd((starting_insanity)/10+1)+rnd((starting_insanity)/10+1);
break;
case 1:
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little off balance.");
else
You("stumble blindly in your insanity!");
HStumbleBlind = 1+rnd((starting_insanity)/10+1)+rnd((starting_insanity)/10+1);
break;
case 2:
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little shocked.");
else
You("stagger in shock!");
HStaggerShock = 1+rnd((starting_insanity)/10+1)+rnd((starting_insanity)/10+1);
break;
case 3:
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little incoherent.");
else
You("begin babbling incoherently!");
HBabble = 1+rnd((starting_insanity)/10+1)+rnd((starting_insanity)/10+1);
break;
case 4:
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little frightened.");
else
You("begin screaming in terror and madness!");
@ -1386,7 +1387,7 @@ boolean check;
break;
/*Dummied out for being unusually nasty and non-interactive*/
// case 5:
// if(ClearThoughts)
// if(BlockableClearThoughts)
// You_feel("a little faint.");
// else
// You(Hallucination ? "have a case of the vapors!" : "feel faint!");
@ -1438,12 +1439,17 @@ roll_generic_madness(clearable)
boolean clearable;
{
int sanlevel;
if(clearable && ClearThoughts)
int usan = u.usanity;
if((clearable && BlockableClearThoughts) || TimeStop)
return 0;
sanlevel = (int)(((float)rand()/(float)(RAND_MAX)) * ((float)rand()/(float)(RAND_MAX)) * 100);
if(u.usanity < sanlevel)
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(clearable)
usan = NightmareAware_Sanity;
if(usan < sanlevel)
return 1;
return 0;
}
@ -1453,10 +1459,15 @@ roll_generic_flat_madness(clearable)
int clearable;
{
int sanlevel;
if(clearable && ClearThoughts)
int usan = u.usanity;
if((clearable && BlockableClearThoughts) || TimeStop)
return 0;
if(u.usanity < rnd(100))
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(clearable)
usan = NightmareAware_Sanity;
if(usan < rnd(100))
return 1;
return 0;
}
@ -1466,7 +1477,8 @@ roll_madness(madness)
long int madness;
{
int sanlevel;
if(ClearThoughts && madness != MAD_GOAT_RIDDEN)
int usan = u.usanity;
if((BlockableClearThoughts && madness != MAD_GOAT_RIDDEN) || TimeStop)
return 0;
if(madness == MAD_NON_EUCLID && DimensionalLock)
return 0;
@ -1476,7 +1488,11 @@ long int madness;
sanlevel = (int)(((float)rand()/(float)(RAND_MAX)) * ((float)rand()/(float)(RAND_MAX)) * 100);
if(u.usanity < sanlevel)
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(madness != MAD_GOAT_RIDDEN)
usan = NightmareAware_Sanity;
if(usan < sanlevel)
return 1;
return 0;
}
@ -1486,8 +1502,9 @@ mad_turn(madness)
long int madness;
{
int sanlevel;
int usan = u.usanity;
unsigned long hashed = hash((unsigned long) (moves + nonce + hash((unsigned long)madness))); //Offset the different madnesses before hashing
if(ClearThoughts || TimeStop)
if((BlockableClearThoughts && madness != MAD_GOAT_RIDDEN) || TimeStop)
return 0;
if(madness == MAD_NON_EUCLID && DimensionalLock)
return 0;
@ -1497,7 +1514,11 @@ long int madness;
sanlevel = max_ints(1,(int)(((float)hashed/ULONG_MAX) * ((float)hash(hashed)/ULONG_MAX) * 100));
if(u.usanity < sanlevel)
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(madness != MAD_GOAT_RIDDEN)
usan = NightmareAware_Sanity;
if(usan < sanlevel)
return 1;
return 0;
}
@ -1507,8 +1528,9 @@ flat_mad_turn(madness)
long int madness;
{
int sanlevel;
int usan = u.usanity;
unsigned long hashed = hash((unsigned long) (moves + nonce + hash((unsigned long)madness))); //Offset the different madnesses before hashing
if(ClearThoughts || TimeStop)
if((BlockableClearThoughts && madness != MAD_GOAT_RIDDEN) || TimeStop)
return 0;
if(madness == MAD_NON_EUCLID && DimensionalLock)
return 0;
@ -1516,7 +1538,11 @@ long int madness;
if(!(u.umadness&madness))
return 0;
if(u.usanity <= hashed%100)
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(madness != MAD_GOAT_RIDDEN)
usan = NightmareAware_Sanity;
if(usan < hashed%100)
return 1;
return 0;
}
@ -1527,8 +1553,9 @@ struct monst *mon;
long int madness;
{
int sanlevel;
int usan = u.usanity;
unsigned long hashed = hash((unsigned long) (moves + nonce + hash((unsigned long)madness + mon->m_id))); //Offset the different madnesses before hashing
if(ClearThoughts || TimeStop)
if((BlockableClearThoughts && madness != MAD_GOAT_RIDDEN) || TimeStop)
return 0;
if(madness == MAD_NON_EUCLID && DimensionalLock)
return 0;
@ -1538,7 +1565,11 @@ long int madness;
sanlevel = max_ints(1,(int)(((float)hashed/ULONG_MAX) * ((float)hash(hashed)/ULONG_MAX) * 100));
if(u.usanity < sanlevel)
//Note: Clear Thoughts plus Walking Nightmare yields partial resistance rather than complete.
if(madness != MAD_GOAT_RIDDEN)
usan = NightmareAware_Sanity;
if(usan < sanlevel)
return 1;
return 0;
}

View file

@ -2432,11 +2432,11 @@ base_uac()
dexbonus = -5;
} else {
dexbonus += (int)( (ACURR(A_DEX)-11)/2 ); /*ranges from -5 to +7 (1 to 25) */
if(u.umadness&MAD_RAGE && !ClearThoughts){
dexbonus -= (Insanity)/10;
if(u.umadness&MAD_RAGE && !BlockableClearThoughts){
dexbonus -= (NightmareAware_Insanity)/10;
}
if(u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
int delta = Insanity;
if(u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int delta = NightmareAware_Insanity;
int discomfort = u_clothing_discomfort();
if (discomfort) {
dexbonus -= (discomfort * delta)/20;
@ -2601,8 +2601,8 @@ int base_udr()
if (HProtection & INTRINSIC) udr += (u.ublessed)/2;
if(u.edenshield > moves) udr += 7;
if(u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
int delta = Insanity;
if(u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int delta = NightmareAware_Insanity;
int discomfort = u_clothing_discomfort();
if (discomfort) {
udr -= (discomfort * delta)/100;

View file

@ -336,7 +336,7 @@ losedogs()
mtmp2 = mtmp->nmon;
if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel
&& mtmp->m_insight_level <= u.uinsight
&& !(mtmp->mtyp == PM_WALKING_DELIRIUM && ClearThoughts)
&& !(mtmp->mtyp == PM_WALKING_DELIRIUM && BlockableClearThoughts)
) {
mon_extract_from_list(mtmp, &migrating_mons);
mon_arrive(mtmp, FALSE);

View file

@ -40,7 +40,10 @@ register boolean clumsy;
int result;
if(mon->m_ap_type) {
if(mon->m_ap_type == M_AP_MONSTER) seemimic_ambush(mon); else seemimic(mon);
// if((M_AP_TYPEMASK&(mon->m_ap_type)) == M_AP_MONSTER)
if(mon->m_ap_type == M_AP_MONSTER)
seemimic_ambush(mon);
else seemimic(mon);
}
check_caitiff(mon);

View file

@ -3823,11 +3823,11 @@ gethungry() /* as time goes by - called by moveloop() and domove() */
if ((!inediate(youracedata) || Race_if(PM_INCANTIFIER))
&& !uclockwork
&& u.usanity < 100
&& !ClearThoughts
&& NightmareAware_Sanity < 100
&& !BlockableClearThoughts
&& u.umadness&MAD_GLUTTONY
){
int delta = Insanity;
int delta = NightmareAware_Insanity;
if(Race_if(PM_INCANTIFIER)) losepw(delta/25);
else u.uhunger -= delta/25;
//remainder

View file

@ -610,7 +610,7 @@ boolean dumping;
if(Doubt)
enl_msg("You ", "can't", "couldn't", " pray or use clerical magic");
/*** Madnesses ***/
if(u.usanity < 100 && !ClearThoughts){
if(NightmareAware_Sanity < 100 && !BlockableClearThoughts){
if (u.umadness&MAD_DELUSIONS){
you_have("a tendency to hallucinate, obscuring some monsters' true forms");
}
@ -1215,7 +1215,7 @@ resistances_enlightenment()
if(Doubt)
putstr(en_win, 0, "You are having a crisis of faith.");
/*** Madnesses ***/
if(u.usanity < 100 && !ClearThoughts){
if(NightmareAware_Sanity < 100 && !BlockableClearThoughts){
char messaged = 0;
if (u.umadness&MAD_DELUSIONS){
putstr(en_win, 0, "You have a tendency to hallucinate.");

View file

@ -5544,8 +5544,8 @@ u_healing_penalty()
penalty += plat_penalty/2;
}
if(u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
int delta = Insanity;
if(u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int delta = NightmareAware_Insanity;
penalty += (u_clothing_discomfort() * delta)/10;
}
return penalty;

View file

@ -12124,7 +12124,7 @@ int faction;
}
mtmp->invis_blkd = TRUE;
}
if(mndx == PM_WALKING_DELIRIUM && !ClearThoughts){
if(mndx == PM_WALKING_DELIRIUM && !BlockableClearThoughts){
mtmp->mappearance = select_newcham_form(mtmp);
mtmp->m_ap_type = M_AP_MONSTER;
}

View file

@ -1798,7 +1798,7 @@ movemon()
if(u.specialSealsActive&SEAL_LIVING_CRYSTAL)
average_dogs();
if(mtmp->m_insight_level > u.uinsight
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && ClearThoughts)
|| (mtmp->mtyp == PM_WALKING_DELIRIUM && BlockableClearThoughts)
){
insight_vanish(mtmp);
continue;
@ -7866,7 +7866,7 @@ int damage;
You("hear a terrible scream!");
dmg = d(damage,7);
losehp(dmg, "the scream of an old one", KILLED_BY);
if(rn2(100) >= u.usanity){
if(rn2(100) >= NightmareAware_Sanity){
if(!Panicking)
You("panic!");
HPanicking += damage*2;
@ -8394,7 +8394,7 @@ struct monst *mtmp;
done(DIED);
}
//Roll vs. sanity
if(rn2(100) >= u.usanity){
if(rn2(100) >= NightmareAware_Sanity){
if(!Panicking)
You("panic!");
HPanicking = max(damage*5, HPanicking);

View file

@ -1831,19 +1831,19 @@ register struct monst *mtmp;
}
if(power >= 4 && !Babble && !Screaming){
if(rn2(3)){
if(!ClearThoughts)
if(!BlockableClearThoughts)
You("scream in pain!");
HScreaming = 2;
}
else if(rn2(2)){
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little frightened.");
else
You("begin screaming in terror and madness!");
HScreaming = 1+rnd((dmg)/5+1)+rnd((dmg)/5+1);
}
else {
if(ClearThoughts)
if(BlockableClearThoughts)
You_feel("a little incoherent.");
else
You("begin babbling incoherently!");

View file

@ -5722,8 +5722,10 @@ boolean inc_penalties;
maxskill = min(P_EXPERT, P_SKILL(weapon_type(uswapwep)));
}
if(inc_penalties && u.umadness&MAD_FORMICATION && !ClearThoughts && maxskill > P_UNSKILLED){
if(inc_penalties && u.umadness&MAD_FORMICATION && !BlockableClearThoughts && maxskill > P_UNSKILLED){
int delta = (Insanity)/20;
if(Nightmare && ClearThoughts && delta)
delta = 1; /* Want Should have SOME effect */
maxskill = max(maxskill - delta, P_UNSKILLED);
}
@ -5788,8 +5790,10 @@ boolean inc_penalties;
curskill = P_BASIC;
}
if(inc_penalties && u.umadness&MAD_FORMICATION && !ClearThoughts && curskill > P_UNSKILLED){
if(inc_penalties && u.umadness&MAD_FORMICATION && !BlockableClearThoughts && curskill > P_UNSKILLED){
int delta = (Insanity)/20;
if(Nightmare && ClearThoughts && delta)
delta = 1; /* Want Should have SOME effect */
curskill = max(curskill - delta, P_UNSKILLED);
}

View file

@ -1048,7 +1048,7 @@ age_spells()
* does not alter the loss of memory.
*/
if(roll_madness(MAD_FORGETFUL))
timeout += (Insanity);
timeout += (NightmareAware_Insanity);
for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++)
if (spellknow(i)){
@ -6082,23 +6082,24 @@ int spell;
//Many madnesses affect spell casting chances
if(u.umadness){
int delta = Insanity;
if(u.umadness&MAD_RAGE && !ClearThoughts){
int delta = NightmareAware_Insanity;
if(u.umadness&MAD_RAGE && !BlockableClearThoughts){
chance -= delta;
}
if(u.umadness&MAD_FORMICATION && !ClearThoughts){
if(u.umadness&MAD_FORMICATION && !BlockableClearThoughts){
chance -= delta/2;
}
if(u.umadness&MAD_SCIAPHILIA && !ClearThoughts && ((dimness(u.ux, u.uy) != 3 && dimness(u.ux, u.uy) > 0) || (!levl[u.ux][u.uy].lit && dimness(u.ux, u.uy) == 0))){
chance -= delta;
}
if(u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
if(u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int discomfort = u_clothing_discomfort();
if (discomfort) {
chance -= (discomfort * delta)/10;
} else {
if (!uwep && !uarms) {
chance += delta/10;
//Not reduced by ClearThoughts+Nightmare combo
chance += Insanity/10;
}
}
}

View file

@ -2644,7 +2644,7 @@ struct obj *otmp;
else if (str < STR19(25)) bonus = 7;
else /* str ==25*/bonus = 8;
if(u.umadness&MAD_RAGE && !ClearThoughts){
if(u.umadness&MAD_RAGE && !BlockableClearThoughts){
bonus += (Insanity)/10;
}
if(otmp){

View file

@ -3601,8 +3601,8 @@ int *shield_margin;
/* Some madnesses give accuracy bonus/penalty (player-only) (melee) */
if(youagr && melee && u.umadness){
/* nudist accuracy bonus/penalty */
if (u.umadness&MAD_NUDIST && !ClearThoughts && u.usanity < 100){
int delta = Insanity;
if (u.umadness&MAD_NUDIST && !BlockableClearThoughts && NightmareAware_Sanity < 100){
int delta = NightmareAware_Insanity;
int discomfort = u_clothing_discomfort();
static boolean clothmessage = TRUE;
if (discomfort) {
@ -3618,8 +3618,8 @@ int *shield_margin;
}
}
/* Sciaphilia accuracy bonus/penalty */
if (u.umadness&MAD_SCIAPHILIA && !ClearThoughts && u.usanity < 96){
int delta = Insanity;
if (u.umadness&MAD_SCIAPHILIA && !BlockableClearThoughts && NightmareAware_Sanity < 96){
int delta = NightmareAware_Insanity;
boolean discomfort = (dimness(u.ux, u.uy) != 3 && dimness(u.ux, u.uy) > 0) || (!levl[u.ux][u.uy].lit && dimness(u.ux, u.uy) == 0);
static boolean shadowmessage = TRUE;
if (discomfort) {
@ -4063,8 +4063,8 @@ boolean ranged;
}
/* madness can make the player take more damage */
if (youdef) {
if (u.umadness&MAD_SUICIDAL && !ClearThoughts){
dmg += ((Insanity)*u.ulevel) / 200;
if (u.umadness&MAD_SUICIDAL && !BlockableClearThoughts){
dmg += ((NightmareAware_Insanity)*u.ulevel) / 200;
}
if ((pa->mlet == S_SNAKE
@ -4082,26 +4082,26 @@ boolean ranged;
|| pa->mtyp == PM_SALAMANDER
|| pa->mtyp == PM_KARY__THE_FIEND_OF_FIRE
|| pa->mtyp == PM_CATHEZAR
) && u.umadness&MAD_OPHIDIOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
) && u.umadness&MAD_OPHIDIOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if ((pa->mlet == S_WORM
|| mon_attacktype(magr, AT_TENT)
) && u.umadness&MAD_HELMINTHOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
) && u.umadness&MAD_HELMINTHOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if (!magr->female && humanoid_upperbody(pa) && u.umadness&MAD_ARGENT_SHEEN && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
if (!magr->female && humanoid_upperbody(pa) && u.umadness&MAD_ARGENT_SHEEN && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if ((is_insectoid(pa) || is_arachnid(pa)) && u.umadness&MAD_ENTOMOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
if ((is_insectoid(pa) || is_arachnid(pa)) && u.umadness&MAD_ENTOMOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if (is_aquatic(pa) && u.umadness&MAD_THALASSOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
if (is_aquatic(pa) && u.umadness&MAD_THALASSOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if ((is_spider(pa)
@ -4109,12 +4109,12 @@ boolean ranged;
|| pa->mtyp == PM_DRIDER
|| pa->mtyp == PM_PRIESTESS_OF_GHAUNADAUR
|| pa->mtyp == PM_AVATAR_OF_LOLTH
) && u.umadness&MAD_ARACHNOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
) && u.umadness&MAD_ARACHNOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
if (magr->female && humanoid_upperbody(pa) && u.umadness&MAD_ARACHNOPHOBIA && !ClearThoughts && u.usanity < 100){
dmg += (Insanity) / 5;
if (magr->female && humanoid_upperbody(pa) && u.umadness&MAD_ARACHNOPHOBIA && !BlockableClearThoughts && NightmareAware_Sanity < 100){
dmg += (NightmareAware_Insanity) / 5;
}
}

View file

@ -340,14 +340,12 @@ struct monst * mon;
return TRUE;
}
if (u.umadness&MAD_PARANOIA && !ClearThoughts && u.usanity < rnd(100)){
if (u.umadness&MAD_PARANOIA && !BlockableClearThoughts && NightmareAware_Sanity < rnd(100)){
You("attack %s's hallucinatory twin!", mon_nam(mon));
return TRUE;
}
if ((mon->data->mlet == S_WORM
|| mon_attacktype(mon, AT_TENT)
) && roll_madness(MAD_HELMINTHOPHOBIA)){
if (triggers_helminthophobia(mon) && roll_madness(MAD_HELMINTHOPHOBIA)){
pline("You're afraid to go near that wormy thing!");
return TRUE;
}