| 2103 | } |
| 2104 | |
| 2105 | staticfn int |
| 2106 | trapeffect_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 | */ |
no test coverage detected