Unify finding a queen bee
This commit is contained in:
@@ -1554,6 +1554,7 @@ E boolean FDECL(monhaskey, (struct monst *, BOOLEAN_P));
|
|||||||
E void FDECL(mon_regen, (struct monst *, BOOLEAN_P));
|
E void FDECL(mon_regen, (struct monst *, BOOLEAN_P));
|
||||||
E int FDECL(dochugw, (struct monst *));
|
E int FDECL(dochugw, (struct monst *));
|
||||||
E boolean FDECL(onscary, (int, int, struct monst *));
|
E boolean FDECL(onscary, (int, int, struct monst *));
|
||||||
|
E struct monst *FDECL(find_pmmonst, (int));
|
||||||
E int FDECL(bee_eat_jelly, (struct monst *, struct obj *));
|
E int FDECL(bee_eat_jelly, (struct monst *, struct obj *));
|
||||||
E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P));
|
E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P));
|
||||||
E void FDECL(mon_yells, (struct monst *, const char *));
|
E void FDECL(mon_yells, (struct monst *, const char *));
|
||||||
|
|||||||
@@ -755,17 +755,10 @@ register struct obj *obj;
|
|||||||
return POISON;
|
return POISON;
|
||||||
if (obj->otyp == LUMP_OF_ROYAL_JELLY
|
if (obj->otyp == LUMP_OF_ROYAL_JELLY
|
||||||
&& mon->data == &mons[PM_KILLER_BEE]) {
|
&& mon->data == &mons[PM_KILLER_BEE]) {
|
||||||
struct monst *mtmp = 0;
|
struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE);
|
||||||
|
|
||||||
/* if there's a queen bee on the level, don't eat royal jelly;
|
/* if there's a queen bee on the level, don't eat royal jelly;
|
||||||
if there isn't, do eat it and grow into a queen */
|
if there isn't, do eat it and grow into a queen */
|
||||||
if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0)
|
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
|
||||||
if (DEADMONSTER(mtmp))
|
|
||||||
continue;
|
|
||||||
if (mtmp->data == &mons[PM_QUEEN_BEE])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return !mtmp ? DOGFOOD : TABU;
|
return !mtmp ? DOGFOOD : TABU;
|
||||||
}
|
}
|
||||||
if (!carni && !herbi)
|
if (!carni && !herbi)
|
||||||
|
|||||||
@@ -252,6 +252,23 @@ struct monst *mon;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct monst *
|
||||||
|
find_pmmonst(pm)
|
||||||
|
int pm;
|
||||||
|
{
|
||||||
|
struct monst *mtmp = 0;
|
||||||
|
|
||||||
|
if ((g.mvitals[pm].mvflags & G_GENOD) == 0)
|
||||||
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||||
|
if (DEADMONSTER(mtmp))
|
||||||
|
continue;
|
||||||
|
if (mtmp->data == &mons[pm])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtmp;
|
||||||
|
}
|
||||||
|
|
||||||
/* killer bee 'mon' is on a spot containing lump of royal jelly 'obj' and
|
/* killer bee 'mon' is on a spot containing lump of royal jelly 'obj' and
|
||||||
will eat it if there is no queen bee on the level; return 1: mon died,
|
will eat it if there is no queen bee on the level; return 1: mon died,
|
||||||
0: mon ate jelly and lived; -1: mon didn't eat jelly to use its move */
|
0: mon ate jelly and lived; -1: mon didn't eat jelly to use its move */
|
||||||
@@ -261,16 +278,8 @@ struct monst *mon;
|
|||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
{
|
{
|
||||||
int m_delay;
|
int m_delay;
|
||||||
struct monst *mtmp = 0;
|
struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE);
|
||||||
|
|
||||||
/* find a queen bee */
|
|
||||||
if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0)
|
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
|
||||||
if (DEADMONSTER(mtmp))
|
|
||||||
continue;
|
|
||||||
if (mtmp->data == &mons[PM_QUEEN_BEE])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* if there's no queen on the level, eat the royal jelly and become one */
|
/* if there's no queen on the level, eat the royal jelly and become one */
|
||||||
if (!mtmp) {
|
if (!mtmp) {
|
||||||
m_delay = obj->blessed ? 3 : !obj->cursed ? 5 : 7;
|
m_delay = obj->blessed ? 3 : !obj->cursed ? 5 : 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user