1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-27 07:52:25 +01:00

Create function to handle ancient breaths, step 1

The diffs need this to be done in two steps due to the length of the code involved.
This commit is contained in:
ChrisANG 2021-02-13 14:51:23 -05:00
parent 485b96db0f
commit 1e84938f58
2 changed files with 9 additions and 618 deletions
include
src

View file

@ -1642,6 +1642,7 @@ E const char *FDECL(stagger, (struct monst *,const char *));
E const char *FDECL(on_fire, (struct permonst *,struct attack *));
E const struct permonst *FDECL(raceptr, (struct monst *));
E int FDECL(mstrength, (struct permonst *));
E void FDECL(do_ancient_breaths, (struct monst *));
/* ### monmove.c ### */

626
src/mon.c
View file

@ -1521,625 +1521,9 @@ mcalcdistress()
}
}
}
#define common_valid_target_inhale(tmpm) distmin(tmpm->mx,tmpm->my,mtmp->mx,mtmp->my) <= 4\
&& tmpm->mpeaceful != mtmp->mpeaceful\
&& tmpm->mtame != mtmp->mtame\
&& !is_ancient(tmpm)\
&& !DEADMONSTER(tmpm)\
&& !(tmpm->mtrapped && t_at(tmpm->mx, tmpm->my) && t_at(tmpm->mx, tmpm->my)->ttyp == VIVI_TRAP)
#define common_valid_target_exhale(tmpm) distmin(tmpm->mx,tmpm->my,mtmp->mx,mtmp->my) <= BOLT_LIM\
&& tmpm->mpeaceful != mtmp->mpeaceful\
&& tmpm->mtame != mtmp->mtame\
&& !is_ancient(tmpm)\
&& !DEADMONSTER(tmpm)\
&& !(tmpm->mtrapped && t_at(tmpm->mx, tmpm->my) && t_at(tmpm->mx, tmpm->my)->ttyp == VIVI_TRAP)
#define valid_corruption_target_inhale(tmpm) common_valid_target_inhale(tmpm)\
&& !(resists_fire(tmpm) && resists_sickness(tmpm))\
&& tmpm->mtyp != PM_GREEN_SLIME\
&& !has_template(tmpm, SLIME_REMNANT)
if(mtmp->mtyp == PM_ANCIENT_OF_CORRUPTION){
struct monst *tmpm;
int targets = 0, damage = 0;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_corruption_target_inhale(tmpm)) targets++;
}
if(distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !(Fire_resistance && Sick_resistance)
) targets++;
targets = rnd(targets);
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_corruption_target_inhale(tmpm)) targets--;
if(!targets) break;
}
if(tmpm){
if(canseemon(tmpm) && canseemon(mtmp)){
pline("Slime bubbles up from under %s %s.", s_suffix(mon_nam(tmpm)), mbodypart(tmpm, BODY_SKIN));
pline("The bursting bubbles' spray is drawn into the oral groove of %s.", mon_nam(mtmp));
} else if(canseemon(tmpm)){
pline("Slime bubbles up from under %s %s.", s_suffix(mon_nam(tmpm)), mbodypart(tmpm, BODY_SKIN));
} else if(canseemon(mtmp)){
pline("Shimmering spray is drawn into the oral groove of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 6);
if(is_wooden(tmpm->data) || (!resists_fire(tmpm) && species_resists_cold(tmpm)))
damage *= 2;
tmpm->mhp -= damage;
if(!resists_sickness(tmpm)){
tmpm->mhpmax -= damage;
tmpm->mhpmax = max(tmpm->mhpmax, tmpm->m_lev);
}
if(tmpm->mhp < 1){
if (canspotmon(tmpm))
pline("%s liquifies!", Monnam(tmpm));
set_template(tmpm, SLIME_REMNANT);
grow_up(mtmp,tmpm);
tmpm->m_lev = max(tmpm->m_lev, tmpm->data->mlevel);
tmpm->mhp = tmpm->mhpmax = tmpm->m_lev*8;
if(mtmp->mtame){
tmpm->mpeaceful = 1;
} else {
if(tmpm->mtame && !(EDOG(tmpm)->loyal)){
tmpm->mtame = 0;
tmpm->mpeaceful = 0;
set_malign(tmpm);
}
else if(!tmpm->mtame && tmpm->mpeaceful){
tmpm->mpeaceful = 0;
set_malign(tmpm);
}
}
newsym(tmpm->mx, tmpm->my);
}
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
} else if(targets > 0
&& distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !(Fire_resistance && Sick_resistance)
){
pline("Slime bubbles up from under your %s.", body_part(BODY_SKIN));
if(canseemon(mtmp)){
pline("The bursting bubbles' spray is drawn into the oral groove of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 6);
make_sick(Sick ? Sick / 2L + 1L : (long)rn1(ACURR(A_CON), 20), mtmp->data->mname, TRUE, SICK_NONVOMITABLE);
if(is_wooden(youracedata) || (Fire_resistance && species_resists_cold(&youmonst)))
damage *= 2;
int temparise = u.ugrave_arise;
u.ugrave_arise = PM_ANCIENT_OF_CORRUPTION;
losehp(damage, "corrupting slime", KILLED_BY);
u.ugrave_arise = temparise;
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
mtmp->mux = u.ux;
mtmp->muy = u.uy;
}
if(damage){
if(canseemon(mtmp))
pline("%s breathes out a spout of slime!", Monnam(mtmp));
damage = d(min(10, (mtmp->m_lev)/3), 12);
explode_yours(mtmp->mx, mtmp->my, AD_SLIM, MON_EXPLODE, damage, EXPL_NOXIOUS, 8, FALSE);
}
}
#define valid_ice_target_inhale(tmpm) common_valid_target_inhale(tmpm)\
&& !resists_fire(tmpm)
#define valid_ice_target_exhale(tmpm) common_valid_target_exhale(tmpm)\
&& !resists_cold(tmpm)\
&& m_online(mtmp, tmpm, tmpm->mx, tmpm->my, !(mtmp->mtame && !mtmp->mconf), FALSE)
if(mtmp->mtyp == PM_ANCIENT_OF_ICE){
struct monst *tmpm;
int targets = 0, damage = 0;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_ice_target_inhale(tmpm)) targets++;
}
if(distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !Fire_resistance
) targets++;
targets = rnd(targets);
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_ice_target_inhale(tmpm)) targets--;
if(!targets) break;
}
if(tmpm){
if(canseemon(tmpm) && canseemon(mtmp)){
pline("Heat shimmer dances in the air above %s.", mon_nam(tmpm));
pline("%s is covered in frost!", Monnam(tmpm));
if(resists_cold(tmpm) && has_head_mon(tmpm)) pline("%s looks very surprised!", Monnam(tmpm));
pline("The shimmers are drawn into the open mouth of %s.", mon_nam(mtmp));
} else if(canseemon(tmpm)){
pline("Heat shimmer dances in the air above %s.", mon_nam(tmpm));
pline("%s is covered in frost!", Monnam(tmpm));
if(resists_cold(tmpm) && has_head_mon(tmpm)) pline("%s looks very surprised!", Monnam(tmpm));
} else if(canseemon(mtmp)){
pline("Heat shimmers are drawn into the open mouth of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 8);
tmpm->mhp -= damage;
if(tmpm->mhp < 1){
if (canspotmon(tmpm))
pline("%s %s!", Monnam(tmpm),
nonliving(tmpm->data)
? "is destroyed" : "dies");
tmpm->mhp = 0;
grow_up(mtmp,tmpm);
mondied(tmpm);
}
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
} else if(targets > 0
&& distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !Fire_resistance
){
pline("Heat shimmer dances in the air above you.");
pline("You are covered in frost!");
if(canseemon(mtmp)){
pline("The shimmers are drawn into the open mouth of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 8);
losehp(damage, "heat drain", KILLED_BY);
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
mtmp->mux = u.ux;
mtmp->muy = u.uy;
}
if(damage){
struct attack mattk;
mattk.aatyp = AT_BREA;
mattk.adtyp = AD_COLD;
mattk.damn = 8;
mattk.damd = 8;
if(mon_can_see_you(mtmp)){
mtmp->mux = u.ux;
mtmp->muy = u.uy;
}
if (!mtmp->mtame && !mtmp->mpeaceful && m_online(mtmp, &youmonst, mtmp->mux, mtmp->muy, FALSE, FALSE)){
flags.drgn_brth = 1;
xbreathey(mtmp, &mattk, mtmp->mux, mtmp->muy);
flags.drgn_brth = 0;
} else {
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_ice_target_exhale(tmpm)){
flags.drgn_brth = 1;
xbreathey(mtmp, &mattk, tmpm->mx, tmpm->my);
flags.drgn_brth = 0;
break;
};
}
}
}
}
#define valid_death_target_inhale(tmpm) common_valid_target_inhale(tmpm)\
&& !nonliving(tmpm->data)
#define valid_death_target_exhale(tmpm) common_valid_target_exhale(tmpm)\
&& !(nonliving(tmpm->data) || is_demon(tmpm->data))\
&& !(ward_at(tmpm->mx,tmpm->my) == CIRCLE_OF_ACHERON)\
&& !(resists_death(tmpm))
if(mtmp->mtyp == PM_ANCIENT_OF_DEATH){
struct monst *tmpm;
int targets = 0, damage = 0;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_death_target_inhale(tmpm)) targets++;
}
if(distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !nonliving(youracedata)
) targets++;
targets = rnd(targets);
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_death_target_inhale(tmpm)) targets--;
if(!targets) break;
}
if(tmpm){
if(canseemon(tmpm) && canseemon(mtmp)){
pline("Motes of light dance in the air above %s.", mon_nam(tmpm));
pline("%s suddenly seems weaker!", Monnam(tmpm));
if(resists_drain(tmpm) && has_head_mon(tmpm)) pline("%s looks very surprised!", Monnam(tmpm));
pline("The motes are drawn into the %s of %s.", mtmp->mtyp == PM_BAALPHEGOR ? "open mouth" : "ghostly hood", mon_nam(mtmp));
} else if(canseemon(tmpm)){
pline("Motes of light dance in the air above %s.", mon_nam(tmpm));
pline("%s suddenly seems weaker!", Monnam(tmpm));
if(resists_drain(tmpm) && has_head_mon(tmpm)) pline("%s looks very surprised!", Monnam(tmpm));
} else if(canseemon(mtmp)){
pline("Motes of light are drawn into the %s of %s.", mtmp->mtyp == PM_BAALPHEGOR ? "open mouth" : "ghostly hood", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 4);
tmpm->mhp -= damage;
if(tmpm->mhp < 1){
if (canspotmon(tmpm))
pline("%s %s!", Monnam(tmpm),
nonliving(tmpm->data)
? "is destroyed" : "dies");
tmpm->mhp = 0;
grow_up(mtmp,tmpm);
mondied(tmpm);
}
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
} else if(targets > 0
&& distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !nonliving(youracedata)
){
pline("Motes of light dance in the air above you.");
pline("You suddenly feel weaker!");
if(canseemon(mtmp)){
pline("The motes are drawn into the %s of %s.", mtmp->mtyp == PM_BAALPHEGOR ? "open mouth" : "ghostly hood", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 4);
losehp(damage, "life-force theft", KILLED_BY);
mtmp->mhp += damage;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
mtmp->mux = u.ux;
mtmp->muy = u.uy;
}
if(damage){
if(!mtmp->mtame && !mtmp->mpeaceful && distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= BOLT_LIM
&& !(nonliving(youracedata) || is_demon(youracedata))
&& !(ward_at(u.ux,u.uy) == CIRCLE_OF_ACHERON)
&& !(u.sealsActive&SEAL_OSE || resists_death(&youmonst))
){
if(canseemon(mtmp)){
pline("%s breathes out dark vapors.", Monnam(mtmp));
}
if(Hallucination){
You("have an out of body experience.");
losehp(8, "a bad trip", KILLED_BY); //you still take damage
} else if (Antimagic){
shieldeff(u.ux, u.uy);
Your("%s flutters!", body_part(HEART));
losehp(d(4,4), "the ancient breath of death", KILLED_BY); //you still take damage
} else if(maybe_polyd((u.mh >= 100), (u.uhp >= 100))){
Your("%s stops! When it finally beats again, it is weak and thready.", body_part(HEART));
losehp(d(8,8), "the ancient breath of death", KILLED_BY); //Same as death's touch attack, sans special effects
} else {
killer_format = KILLED_BY;
killer = "the ancient breath of death";
done(DIED);
}
} else {
struct monst *targ = 0;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(valid_death_target_exhale(tmpm)){
if(!targ || (distmin(tmpm->mx, tmpm->my, mtmp->mx, mtmp->my) < distmin(targ->mx, targ->my, mtmp->mx, mtmp->my))){
targ = tmpm;
}
}
}
if(targ){
if(canseemon(mtmp)){
pline("%s breathes out dark vapors.", Monnam(mtmp));
}
if(resists_magm(targ)){
targ->mhp -= 8;
if(targ->mhp < 1){
if (canspotmon(targ))
pline("%s %s!", Monnam(targ),
nonliving(targ->data)
? "is destroyed" : "dies");
targ->mhp = 0;
grow_up(mtmp,targ);
mondied(targ);
}
} else if(targ->mhp >= 100){
targ->mhp -= d(8,8);
if(targ->mhp < 1){
if (canspotmon(targ))
pline("%s %s!", Monnam(targ),
nonliving(targ->data)
? "is destroyed" : "dies");
targ->mhp = 0;
grow_up(mtmp,targ);
mondied(targ);
}
} else {
if (canspotmon(targ))
pline("%s %s!", Monnam(targ),
nonliving(targ->data)
? "is destroyed" : "dies");
targ->mhp = 0;
grow_up(mtmp,targ);
mondied(targ);
}
}
}
}
}
if(mtmp->mtyp == PM_BAALPHEGOR && mtmp->mhp < mtmp->mhpmax/2){
struct monst *tmpm;
int targets = 0, damage = 0;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(distmin(tmpm->mx,tmpm->my,mtmp->mx,mtmp->my) <= 4
&& (tmpm->mpeaceful != mtmp->mpeaceful || mtmp->mhp < mtmp->mhpmax/4)
&& (tmpm->mtame != mtmp->mtame || mtmp->mhp < mtmp->mhpmax/4)
&& !has_template(tmpm, CRYSTALFIED)
&& !is_demon(tmpm->data)
&& !DEADMONSTER(tmpm)
&& !(tmpm->mtrapped && t_at(tmpm->mx, tmpm->my) && t_at(tmpm->mx, tmpm->my)->ttyp == VIVI_TRAP)
) targets++;
}
if(distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !is_demon(youracedata)
) targets++;
targets = rnd(targets);
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(distmin(tmpm->mx,tmpm->my,mtmp->mx,mtmp->my) <= 4
&& (tmpm->mpeaceful != mtmp->mpeaceful || mtmp->mhp < mtmp->mhpmax/4)
&& (tmpm->mtame != mtmp->mtame || mtmp->mhp < mtmp->mhpmax/4)
&& !has_template(tmpm, CRYSTALFIED)
&& !is_demon(tmpm->data)
&& !DEADMONSTER(tmpm)
&& !(tmpm->mtrapped && t_at(tmpm->mx, tmpm->my) && t_at(tmpm->mx, tmpm->my)->ttyp == VIVI_TRAP)
) targets--;
if(!targets) break;
}
if(tmpm){
if(canseemon(tmpm) && canseemon(mtmp)){
pline("Some unseen virtue is drawn from %s.", mon_nam(tmpm));
// pline("%s suddenly seems weaker!", Monnam(tmpm));
pline("The virtue is sucked into the open mouth of %s.", mon_nam(mtmp));
} else if(canseemon(tmpm)){
pline("Some unseen virtue is drawn from %s.", mon_nam(tmpm));
// pline("%s suddenly seems weaker!", Monnam(tmpm));
if(resists_drain(tmpm) && has_head_mon(tmpm)) pline("%s looks very surprised!", Monnam(tmpm));
} else if(canseemon(mtmp)){
pline("Some unseen virtue is sucked into the open mouth of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 8);
if(resists_cold(mtmp)) damage /= 2;
if(damage >= tmpm->mhp){
grow_up(mtmp,tmpm);
if (canspotmon(tmpm))
pline("%s turns to glass!", Monnam(tmpm));
tmpm->mpeaceful = mtmp->mpeaceful;
if(tmpm->mtame && tmpm->mtame != mtmp->mtame)
untame(tmpm, mtmp->mpeaceful);
set_template(tmpm, CRYSTALFIED);
newsym(tmpm->mx, tmpm->my);
mtmp->mhp += tmpm->mhp;
}
else{
tmpm->mhp -= damage;
mtmp->mhp += damage;
}
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
} else if(targets > 0
&& distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= 4
&& !mtmp->mpeaceful
&& !mtmp->mtame
&& !is_demon(youracedata)
){
pline("Some unseen virtue is drawn from you.");
u.umadness |= MAD_COLD_NIGHT;
if(canseemon(mtmp)){
pline("The virtue is sucked into the open mouth of %s.", mon_nam(mtmp));
}
damage = d(min(10, (mtmp->m_lev)/3), 8);
if(Free_action) damage /= 2;
if((HCold_resistance && ECold_resistance)
|| (NCold_resistance)
) damage /= 2;
int temparise = u.ugrave_arise;
mtmp->mhp += min(damage, maybe_polyd(u.mh, u.uhp));
u.ugrave_arise = PM_BAALPHEGOR;
mdamageu(mtmp, damage);
/*If the player surived the attack, restore the value of arise*/
u.ugrave_arise = temparise;
if(mtmp->mhp > mtmp->mhpmax){
mtmp->mhp = mtmp->mhpmax;
// grow_up(mtmp,mtmp);
}
mtmp->mspec_used = 0;
mtmp->mcan = 0;
mtmp->mux = u.ux;
mtmp->muy = u.uy;
}
if(damage){
struct obj *otmp;
for(otmp = invent; otmp; otmp=otmp->nobj)
if(otmp->oartifact == ART_HELPING_HAND)
break;
if(!mtmp->mtame && !mtmp->mpeaceful && distmin(u.ux,u.uy,mtmp->mx,mtmp->my) <= BOLT_LIM
&& !(uamul && (uamul->otyp == AMULET_VERSUS_CURSES))
&& !(uwep && (uwep->oartifact == ART_MAGICBANE) && rn2(20))
&& !(uwep && (uwep->oartifact == ART_STAFF_OF_NECROMANCY) && rn2(20))
&& !(uwep && (uwep->oartifact == ART_TENTACLE_ROD) && rn2(20))
&& !(otmp && rn2(20))
&& !(u.ukinghill && rn2(20))
){
if(canseemon(mtmp)){
pline("%s breathes out static curses.", Monnam(mtmp));
}
if(
(!Free_action || HFast) &&
(!uarmh || uarmh->cursed) &&
(!uarmc || uarmc->cursed) &&
(!uarm || uarm->cursed) &&
(!uarmu || uarmu->cursed) &&
(!uarmg || uarmg->cursed) &&
(!uarmf || uarmf->cursed)
) {
if(Free_action){
HFast = 0L;
if (!Very_fast)
You_feel("yourself slowing down%s.",
Fast ? " a bit" : "");
} else done(GLASSED);
} else {
int nobj = 0, cnt, onum;
for (otmp = invent; otmp; otmp = otmp->nobj) {
#ifdef GOLDOBJ
/* gold isn't subject to being cursed or blessed */
if (otmp->oclass == COIN_CLASS) continue;
#endif
if(!otmp->cursed) nobj++;
}
if (nobj) {
for (cnt = 8; cnt > 0; cnt--) {
onum = rnd(nobj);
for (otmp = invent; otmp; otmp = otmp->nobj) {
#ifdef GOLDOBJ
/* gold isn't subject to being cursed or blessed */
if (otmp->oclass == COIN_CLASS) continue;
#endif
if(!otmp->cursed) onum--;
if(!onum) break;
}
if (!otmp || otmp->cursed) continue; /* next target */
if(otmp->oartifact && arti_gen_prop(otmp, ARTG_MAJOR) &&
rn2(10) < 8) {
pline("%s!", Tobjnam(otmp, "resist"));
continue;
}
if(otmp->blessed)
unbless(otmp);
else
curse(otmp);
update_inventory();
}
}
}
u.umadness |= MAD_COLD_NIGHT;
} else {
struct monst *targ = 0;
struct obj *otmp;
for(tmpm = fmon; tmpm; tmpm = tmpm->nmon){
if(distmin(tmpm->mx,tmpm->my,mtmp->mx,mtmp->my) <= BOLT_LIM
&& tmpm->mpeaceful != mtmp->mpeaceful
&& tmpm->mtame != mtmp->mtame
&& !has_template(tmpm, CRYSTALFIED)
// && !(uamul && (uamul->otyp == AMULET_VERSUS_CURSES))
&& !(MON_WEP(tmpm) && (MON_WEP(tmpm)->oartifact == ART_MAGICBANE) && rn2(20))
&& !(MON_WEP(tmpm) && (MON_WEP(tmpm)->oartifact == ART_STAFF_OF_NECROMANCY) && rn2(20))
&& !(MON_WEP(tmpm) && (MON_WEP(tmpm)->oartifact == ART_TENTACLE_ROD) && rn2(20))
&& !DEADMONSTER(tmpm)
&& !(tmpm->mtrapped && t_at(tmpm->mx, tmpm->my) && t_at(tmpm->mx, tmpm->my)->ttyp == VIVI_TRAP)
){
for(otmp = tmpm->minvent; otmp; otmp=otmp->nobj)
if(otmp->oartifact == ART_TREASURY_OF_PROTEUS)
break;
if(otmp && rn2(20))
continue;
for(otmp = tmpm->minvent; otmp; otmp=otmp->nobj)
if(otmp->oartifact == ART_HELPING_HAND)
break;
if(otmp && rn2(20))
continue;
if(!targ || (distmin(tmpm->mx, tmpm->my, mtmp->mx, mtmp->my) < distmin(targ->mx, targ->my, mtmp->mx, mtmp->my))){
targ = tmpm;
}
}
}
if(targ){
if(canseemon(mtmp)){
pline("%s breathes out static curses.", Monnam(mtmp));
}
if(
!(targ->misc_worn_check & W_ARMH && (otmp = which_armor(targ, W_ARMH)) && !otmp->cursed) &&
!(targ->misc_worn_check & W_ARMC && (otmp = which_armor(targ, W_ARMC)) && !otmp->cursed) &&
!(targ->misc_worn_check & W_ARM && (otmp = which_armor(targ, W_ARM)) && !otmp->cursed) &&
!(targ->misc_worn_check & W_ARMU && (otmp = which_armor(targ, W_ARMU)) && !otmp->cursed) &&
!(targ->misc_worn_check & W_ARMG && (otmp = which_armor(targ, W_ARMG)) && !otmp->cursed) &&
!(targ->misc_worn_check & W_ARMF && (otmp = which_armor(targ, W_ARMF)) && !otmp->cursed)
) {
minstaglass(targ,FALSE);
} else {
int nobj = 0, cnt, onum;
for (otmp = targ->minvent; otmp; otmp = otmp->nobj) {
#ifdef GOLDOBJ
/* gold isn't subject to being cursed or blessed */
if (otmp->oclass == COIN_CLASS) continue;
#endif
if(!otmp->cursed) nobj++;
}
if (nobj) {
for (cnt = 8; cnt > 0; cnt--) {
onum = rnd(nobj);
for (otmp = targ->minvent; otmp; otmp = otmp->nobj) {
#ifdef GOLDOBJ
/* gold isn't subject to being cursed or blessed */
if (otmp->oclass == COIN_CLASS) continue;
#endif
if(!otmp->cursed) onum--;
if(!onum) break;
}
if (!otmp || otmp->cursed) continue; /* next target */
if (otmp->oartifact && arti_gen_prop(otmp, ARTG_MAJOR) &&
rn2(10) < 8) {
continue;
}
if(otmp->blessed)
unbless(otmp);
else
curse(otmp);
// update_inventory();
}
}
}
}
}
}
}
/* do special once-per-global turn effects */
do_ancient_breaths(mtmp);
/* regenerate hit points */
mon_regen(mtmp, FALSE);
@ -7490,6 +6874,12 @@ int flags;
}
}
void
do_ancient_breaths(mtmp)
struct monst *mtmp;
{
return;
}
#endif /* OVLB */
/*mon.c*/