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

Function trapeffect_pit

src/trap.c:1824–2010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1822}
1823
1824staticfn int
1825trapeffect_pit(
1826 struct monst *mtmp,
1827 struct trap *trap,
1828 unsigned int trflags)
1829{
1830 int ttype = trap->ttyp;
1831 /* relevant_spikes is initially always true for spiked pits, but
1832 set to false if the spikes are found to not be relevant */
1833 boolean relevant_spikes = ttype == SPIKED_PIT;
1834
1835 if (mtmp == &gy.youmonst) {
1836 boolean plunged = (trflags & TOOKPLUNGE) != 0;
1837 boolean viasitting = (trflags & VIASITTING) != 0;
1838 boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
1839 boolean adj_pit = adj_nonconjoined_pit(trap);
1840 boolean already_known = trap->tseen ? TRUE : FALSE;
1841 boolean deliberate = FALSE;
1842 int steed_article = ARTICLE_THE;
1843
1844 /* suppress article in various steed messages when using its
1845 name (which won't occur when hallucinating) */
1846 if (u.usteed && has_mgivenname(u.usteed) && !Hallucination)
1847 steed_article = ARTICLE_NONE;
1848
1849 /* KMH -- You can't escape the Sokoban level traps */
1850 if (!Sokoban && (Levitation || (Flying && !plunged && !viasitting)))
1851 return Trap_Effect_Finished;
1852 feeltrap(trap);
1853 if (!Sokoban && is_clinger(gy.youmonst.data) && !plunged) {
1854 if (already_known) {
1855 You_see("%s %spit below you.", a_your[trap->madeby_u],
1856 ttype == SPIKED_PIT ? "spiked " : "");
1857 } else {
1858 pline("%s pit %sopens up under you!", A_Your[trap->madeby_u],
1859 ttype == SPIKED_PIT ? "full of spikes " : "");
1860 You("don't fall in!");
1861 }
1862 return Trap_Effect_Finished;
1863 }
1864 if (!Sokoban) {
1865 char verbbuf[BUFSZ];
1866
1867 *verbbuf = '\0';
1868 if (u.usteed) {
1869 if ((trflags & RECURSIVETRAP) != 0)
1870 Sprintf(verbbuf, "and %s fall",
1871 x_monnam(u.usteed, steed_article, (char *) 0,
1872 SUPPRESS_SADDLE, FALSE));
1873 else
1874 Sprintf(verbbuf, "lead %s",
1875 x_monnam(u.usteed, steed_article, "poor",
1876 SUPPRESS_SADDLE, FALSE));
1877 } else if (iflags.menu_requested && already_known) {
1878 You("carefully %s into the pit.",
1879 u_locomotion("lower yourself"));
1880 deliberate = TRUE;
1881 } else if (conj_pit) {

Callers 1

trapeffect_selectorFunction · 0.85

Calls 15

conjoined_pitsFunction · 0.85
t_atFunction · 0.85
adj_nonconjoined_pitFunction · 0.85
feeltrapFunction · 0.85
You_seeFunction · 0.85
YouFunction · 0.85
u_locomotionFunction · 0.85
rn2Function · 0.85
In_questFunction · 0.85
wearing_iron_shoesFunction · 0.85
Yname2Function · 0.85
upstartFunction · 0.85

Tested by

no test coverage detected