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

Function dospinweb

src/polyself.c:1496–1621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496int
1497dospinweb(void)
1498{
1499 coordxy x = u.ux, y = u.uy;
1500 struct trap *ttmp = t_at(x, y);
1501 /* disallow webs on water, lava, air & cloud */
1502 boolean reject_terrain = is_pool_or_lava(x, y) || IS_AIR(levl[x][y].typ);
1503
1504 /* [at the time this was written, it was not possible to be both a
1505 webmaker and a flyer, but with the advent of amulet of flying that
1506 became a possibility; at present hero can spin a web while flying] */
1507 if (Levitation || reject_terrain) {
1508 You("must be on %s ground to spin a web.",
1509 reject_terrain ? "solid" : "the");
1510 return ECMD_OK;
1511 }
1512 if (u.uswallow) {
1513 You("release web fluid inside %s.", mon_nam(u.ustuck));
1514 if (is_animal(u.ustuck->data)) {
1515 expels(u.ustuck, u.ustuck->data, TRUE);
1516 return ECMD_OK;
1517 }
1518 if (is_whirly(u.ustuck->data)) {
1519 int i;
1520
1521 for (i = 0; i < NATTK; i++)
1522 if (u.ustuck->data->mattk[i].aatyp == AT_ENGL)
1523 break;
1524 if (i == NATTK)
1525 impossible("Swallower has no engulfing attack?");
1526 else {
1527 char sweep[30];
1528
1529 sweep[0] = '\0';
1530 switch (u.ustuck->data->mattk[i].adtyp) {
1531 case AD_FIRE:
1532 Strcpy(sweep, "ignites and ");
1533 break;
1534 case AD_ELEC:
1535 Strcpy(sweep, "fries and ");
1536 break;
1537 case AD_COLD:
1538 Strcpy(sweep, "freezes, shatters and ");
1539 break;
1540 }
1541 pline_The("web %sis swept away!", sweep);
1542 }
1543 return ECMD_OK;
1544 } /* default: a nasty jelly-like creature */
1545 pline_The("web dissolves into %s.", mon_nam(u.ustuck));
1546 return ECMD_OK;
1547 }
1548 if (u.utrap) {
1549 You("cannot spin webs while stuck in a trap.");
1550 return ECMD_OK;
1551 }
1552 exercise(A_DEX, TRUE);
1553 if (ttmp) {

Callers 1

domonabilityFunction · 0.85

Calls 15

t_atFunction · 0.85
is_pool_or_lavaFunction · 0.85
YouFunction · 0.85
mon_namFunction · 0.85
expelsFunction · 0.85
pline_TheFunction · 0.85
exerciseFunction · 0.85
deltrapFunction · 0.85
bury_objsFunction · 0.85
newsymFunction · 0.85
YourFunction · 0.85
dotrapFunction · 0.85

Tested by

no test coverage detected