m_respond code reorg and splitting
This commit is contained in:
@@ -22,6 +22,8 @@ staticfn boolean vamprises(struct monst *);
|
|||||||
staticfn void logdeadmon(struct monst *, int);
|
staticfn void logdeadmon(struct monst *, int);
|
||||||
staticfn void anger_quest_guardians(struct monst *);
|
staticfn void anger_quest_guardians(struct monst *);
|
||||||
staticfn boolean ok_to_obliterate(struct monst *);
|
staticfn boolean ok_to_obliterate(struct monst *);
|
||||||
|
staticfn void m_respond_shrieker(struct monst *);
|
||||||
|
staticfn void m_respond_medusa(struct monst *);
|
||||||
staticfn void qst_guardians_respond(void);
|
staticfn void qst_guardians_respond(void);
|
||||||
staticfn void peacefuls_respond(struct monst *);
|
staticfn void peacefuls_respond(struct monst *);
|
||||||
staticfn void wake_nearto_core(coordxy, coordxy, int, boolean);
|
staticfn void wake_nearto_core(coordxy, coordxy, int, boolean);
|
||||||
@@ -4013,36 +4015,50 @@ mnearto(
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* monster responds to player action; not the same as a passive attack;
|
/* shrieker special action: shriek, maybe summon monster, aggravate */
|
||||||
assumes reason for response has been tested, and response _must_ be made */
|
staticfn void
|
||||||
|
m_respond_shrieker(struct monst *mtmp)
|
||||||
|
{
|
||||||
|
if (!Deaf) {
|
||||||
|
pline("%s shrieks.", Monnam(mtmp));
|
||||||
|
stop_occupation();
|
||||||
|
}
|
||||||
|
if (!rn2(10)) { /* 1/10 chance per shriek to create a monster */
|
||||||
|
/* new monster has a 1/13 chance to be a purple worm, random
|
||||||
|
otherwise; baby purple worm if adult is too difficult */
|
||||||
|
(void) makemon(rn2(13) ? (struct permonst *) 0
|
||||||
|
: &mons[montoostrong(PM_PURPLE_WORM,
|
||||||
|
monmax_difficulty_lev())
|
||||||
|
? PM_BABY_PURPLE_WORM : PM_PURPLE_WORM],
|
||||||
|
0, 0, NO_MM_FLAGS);
|
||||||
|
}
|
||||||
|
aggravate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* medusa special action: gaze at hero */
|
||||||
|
staticfn void
|
||||||
|
m_respond_medusa(struct monst *mtmp)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NATTK; i++)
|
||||||
|
if (mtmp->data->mattk[i].aatyp == AT_GAZE) {
|
||||||
|
(void) gazemu(mtmp, &mtmp->data->mattk[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* monster responds to player action; not the same as a passive attack */
|
||||||
void
|
void
|
||||||
m_respond(struct monst *mtmp)
|
m_respond(struct monst *mtmp)
|
||||||
{
|
{
|
||||||
if (mtmp->data->msound == MS_SHRIEK) {
|
if (mtmp->data->msound == MS_SHRIEK && !um_dist(mtmp->mx, mtmp->my, 1))
|
||||||
if (!Deaf) {
|
m_respond_shrieker(mtmp);
|
||||||
pline("%s shrieks.", Monnam(mtmp));
|
if (mtmp->data == &mons[PM_MEDUSA] && couldsee(mtmp->mx, mtmp->my))
|
||||||
stop_occupation();
|
m_respond_medusa(mtmp);
|
||||||
}
|
/* Erinyes will inform surrounding monsters of your crimes */
|
||||||
if (!rn2(10)) { /* 1/10 chance per shriek to create a monster */
|
if (mtmp->data == &mons[PM_ERINYS] && !mtmp->mpeaceful && m_canseeu(mtmp))
|
||||||
/* new monster has a 1/13 chance to be a purple worm, random
|
|
||||||
otherwise; baby purple worm if adult is too difficult */
|
|
||||||
(void) makemon(rn2(13) ? (struct permonst *) 0
|
|
||||||
: &mons[montoostrong(PM_PURPLE_WORM,
|
|
||||||
monmax_difficulty_lev())
|
|
||||||
? PM_BABY_PURPLE_WORM : PM_PURPLE_WORM],
|
|
||||||
0, 0, NO_MM_FLAGS);
|
|
||||||
}
|
|
||||||
aggravate();
|
aggravate();
|
||||||
}
|
|
||||||
if (mtmp->data == &mons[PM_MEDUSA]) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < NATTK; i++)
|
|
||||||
if (mtmp->data->mattk[i].aatyp == AT_GAZE) {
|
|
||||||
(void) gazemu(mtmp, &mtmp->data->mattk[i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* how quest guardians respond when you attack the quest leader */
|
/* how quest guardians respond when you attack the quest leader */
|
||||||
|
|||||||
+2
-11
@@ -738,17 +738,8 @@ dochug(struct monst *mtmp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Erinyes will inform surrounding monsters of your crimes */
|
/* some monsters have special abilities */
|
||||||
if (mdat == &mons[PM_ERINYS] && !mtmp->mpeaceful && m_canseeu(mtmp))
|
m_respond(mtmp);
|
||||||
aggravate();
|
|
||||||
|
|
||||||
/* Shriekers and Medusa have irregular abilities which must be
|
|
||||||
checked every turn. These abilities do not cost a turn when
|
|
||||||
used. */
|
|
||||||
if (mdat->msound == MS_SHRIEK && !um_dist(mtmp->mx, mtmp->my, 1))
|
|
||||||
m_respond(mtmp);
|
|
||||||
if (mdat == &mons[PM_MEDUSA] && couldsee(mtmp->mx, mtmp->my))
|
|
||||||
m_respond(mtmp);
|
|
||||||
if (DEADMONSTER(mtmp))
|
if (DEADMONSTER(mtmp))
|
||||||
return 1; /* m_respond gaze can kill medusa */
|
return 1; /* m_respond gaze can kill medusa */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user