Update makemon.c

szy_
pmje2o5iu 1 year ago
parent 2fdb95299c
commit 3c57139871

@ -30,18 +30,19 @@ static boolean makemon_rnd_goodpos(struct monst *, mmflags_nht, coord *);
boolean
is_home_elemental(struct permonst *ptr)
{
if (ptr->mlet == S_ELEMENTAL)
switch (monsndx(ptr)) {
if (ptr->mlet == S_ELEMENTAL)// Check if the monster is an elemental creature
switch (monsndx(ptr)) {// Determine the specific type of the elemental creature
case PM_AIR_ELEMENTAL:
case PM_AIR_ELEMENTAL:
return Is_airlevel(&u.uz);
return Is_airlevel(&u.uz);// Check if the player is on an air elemental level
case PM_FIRE_ELEMENTAL:
return Is_firelevel(&u.uz);
return Is_firelevel(&u.uz);// Check if the player is on a fire elemental level
case PM_EARTH_ELEMENTAL:
return Is_earthlevel(&u.uz);
return Is_earthlevel(&u.uz);// Check if the player is on an earth elemental level
case PM_WATER_ELEMENTAL:
return Is_waterlevel(&u.uz);
return Is_waterlevel(&u.uz);// Check if the player is on a water elemental level
}
return FALSE;
return FALSE;// The monster is not an elemental or the player is not on a matching elemental level
}
/*
@ -50,23 +51,24 @@ is_home_elemental(struct permonst *ptr)
static boolean
wrong_elem_type(struct permonst *ptr)
{
if (ptr->mlet == S_ELEMENTAL) {
return (boolean) !is_home_elemental(ptr);
if (ptr->mlet == S_ELEMENTAL) { // Check if the monster is an elemental creature
return (boolean) !is_home_elemental(ptr);// Return the opposite of is_home_elemental
} else if (Is_earthlevel(&u.uz)) {
/* no restrictions? */
} else if (Is_waterlevel(&u.uz)) {
/* just monsters that can swim */
if (!is_swimmer(ptr))
return TRUE;
return TRUE; // Return true if the monster cannot swim
} else if (Is_firelevel(&u.uz)) {
if (!pm_resistance(ptr, MR_FIRE))
return TRUE;
return TRUE; // Return true if the monster is not resistant to fire
} else if (Is_airlevel(&u.uz)) {
if (!(is_flyer(ptr) && ptr->mlet != S_TRAPPER) && !is_floater(ptr)
&& !amorphous(ptr) && !noncorporeal(ptr) && !is_whirly(ptr))
return TRUE;
return TRUE; // Return true if the monster is not suited for an air level
}
return FALSE;
return FALSE; // The monster is suitable for the current level or is not an elemental
}
/* make a group just like mtmp */
@ -142,12 +144,12 @@ m_initthrow(struct monst *mtmp, int otyp, int oquan)
{
register struct obj *otmp;
otmp = mksobj(otyp, TRUE, FALSE);
otmp->quan = (long) rn1(oquan, 3);
otmp->owt = weight(otmp);
otmp = mksobj(otyp, TRUE, FALSE); // Create a new object of the given type
otmp->quan = (long) rn1(oquan, 3); // Set the quantity of the object
otmp->owt = weight(otmp); // Set the weight of the object
if (otyp == ORCISH_ARROW)
otmp->opoisoned = TRUE;
(void) mpickobj(mtmp, otmp);
otmp->opoisoned = TRUE;// Set the poisoned flag if the object type is ORCISH_ARROW
(void) mpickobj(mtmp, otmp);// Add the object to the monster's inventory
}
static void

Loading…
Cancel
Save