MCPcopy Create free account
hub / github.com/NetHack/NetHack / mongets

Function mongets

src/makemon.c:2180–2230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2178}
2179
2180struct obj *
2181mongets(struct monst *mtmp, int otyp)
2182{
2183 struct obj *otmp;
2184
2185 if (!otyp)
2186 return (struct obj *) 0;
2187 otmp = mksobj(otyp, TRUE, FALSE);
2188 if (otmp) {
2189 if (mtmp->data->mlet == S_DEMON) {
2190 /* demons never get blessed objects */
2191 if (otmp->blessed)
2192 curse(otmp);
2193 } else if (is_lminion(mtmp)) {
2194 /* lawful minions don't get cursed, bad, or rusting objects */
2195 otmp->cursed = FALSE;
2196 if (otmp->spe < 0)
2197 otmp->spe = 0;
2198 otmp->oerodeproof = 1;
2199 otmp->oeroded = otmp->oeroded2 = 0;
2200 } else if (is_mplayer(mtmp->data) && is_sword(otmp)) {
2201 otmp->spe = (3 + rn2(4));
2202 }
2203
2204 if (otmp->otyp == CANDELABRUM_OF_INVOCATION) {
2205 otmp->spe = 0;
2206 otmp->age = 0L;
2207 otmp->lamplit = FALSE;
2208 otmp->blessed = otmp->cursed = FALSE;
2209 } else if (otmp->otyp == BELL_OF_OPENING) {
2210 otmp->blessed = otmp->cursed = FALSE;
2211 } else if (otmp->otyp == SPE_BOOK_OF_THE_DEAD) {
2212 otmp->blessed = FALSE;
2213 otmp->cursed = TRUE;
2214 }
2215
2216 /* leaders don't tolerate inferior quality battle gear */
2217 if (is_prince(mtmp->data)) {
2218 if (otmp->oclass == WEAPON_CLASS && otmp->spe < 1)
2219 otmp->spe = 1;
2220 else if (otmp->oclass == ARMOR_CLASS && otmp->spe < 0)
2221 otmp->spe = 0;
2222 }
2223
2224 if (mpickobj(mtmp, otmp)) {
2225 /* otmp was freed via merging with something else */
2226 otmp = (struct obj *) 0;
2227 }
2228 }
2229 return otmp;
2230}
2231
2232int
2233golemhp(int type)

Callers 9

mk_zoo_thronemonFunction · 0.85
savebonesFunction · 0.85
mk_mplayerFunction · 0.85
gain_guardian_angelFunction · 0.85
shkinitFunction · 0.85
m_initweapFunction · 0.85
m_initinvFunction · 0.85
makemonFunction · 0.85
priestiniFunction · 0.85

Calls 4

mksobjFunction · 0.85
curseFunction · 0.85
rn2Function · 0.85
mpickobjFunction · 0.85

Tested by

no test coverage detected