MCPcopy Index your code
hub / github.com/NetHack/NetHack / trapeffect_web

Function trapeffect_web

src/trap.c:2105–2276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2103}
2104
2105staticfn int
2106trapeffect_web(
2107 struct monst *mtmp,
2108 struct trap *trap,
2109 unsigned int trflags)
2110{
2111 if (mtmp == &gy.youmonst) {
2112 boolean webmsgok = (trflags & NOWEBMSG) == 0;
2113 boolean forcetrap = ((trflags & FORCETRAP) != 0
2114 || (trflags & FAILEDUNTRAP) != 0);
2115 boolean viasitting = (trflags & VIASITTING) != 0;
2116 int steed_article = ARTICLE_THE;
2117
2118 /* suppress article in various steed messages when using its
2119 name (which won't occur when hallucinating) */
2120 if (u.usteed && has_mgivenname(u.usteed) && !Hallucination)
2121 steed_article = ARTICLE_NONE;
2122
2123 feeltrap(trap);
2124 if (mu_maybe_destroy_web(&gy.youmonst, webmsgok, trap))
2125 return Trap_Effect_Finished;
2126 if (webmaker(gy.youmonst.data)) {
2127 if (webmsgok)
2128 pline(trap->madeby_u ? "You take a walk on your web."
2129 : "There is a spider web here.");
2130 return Trap_Effect_Finished;
2131 }
2132 if (webmsgok) {
2133 char verbbuf[BUFSZ];
2134
2135 if (forcetrap || viasitting) {
2136 Strcpy(verbbuf, "are caught by");
2137 } else if (u.usteed) {
2138 Sprintf(verbbuf, "lead %s into",
2139 x_monnam(u.usteed, steed_article, "poor",
2140 SUPPRESS_SADDLE, FALSE));
2141 } else {
2142 Sprintf(verbbuf, "%s into", u_locomotion("stumble"));
2143 }
2144 You("%s %s spider web!", verbbuf, a_your[trap->madeby_u]);
2145 }
2146
2147 /* time will be adjusted below */
2148 set_utrap(1, TT_WEB);
2149
2150 /* Time stuck in the web depends on your/steed's strength. */
2151 {
2152 int tim, str = ACURR(A_STR);
2153
2154 /* If mounted, the steed gets trapped. Use mintrap
2155 * to do all the work. If mtrapped is set as a result,
2156 * unset it and set utrap instead. In the case of a
2157 * strongmonst and mintrap said it's trapped, use a
2158 * short but non-zero trap time. Otherwise, monsters
2159 * have no specific strength, so use player strength.
2160 * This gets skipped for webmsgok, which implies that
2161 * the steed isn't a factor.
2162 */

Callers 1

trapeffect_selectorFunction · 0.85

Calls 15

feeltrapFunction · 0.85
mu_maybe_destroy_webFunction · 0.85
u_locomotionFunction · 0.85
YouFunction · 0.85
set_utrapFunction · 0.85
mintrapFunction · 0.85
reset_utrapFunction · 0.85
rndFunction · 0.85
deltrapFunction · 0.85
newsymFunction · 0.85
canseemonFunction · 0.85
You_hearFunction · 0.85

Tested by

no test coverage detected