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

Function domove_fight_ironbars

src/hack.c:1995–2017  ·  view source on GitHub ↗

force-fight iron bars with your weapon? */

Source from the content-addressed store, hash-verified

1993
1994/* force-fight iron bars with your weapon? */
1995staticfn boolean
1996domove_fight_ironbars(coordxy x, coordxy y)
1997{
1998 if (svc.context.forcefight && levl[x][y].typ == IRONBARS && uwep) {
1999 struct obj *obj = uwep;
2000 unsigned breakflags = (BRK_BY_HERO | BRK_FROM_INV | BRK_MELEE);
2001
2002 if (breaktest(obj)) {
2003 if (obj->quan > 1L)
2004 obj = splitobj(obj, 1L);
2005 else
2006 setuwep((struct obj *) 0);
2007 freeinv(obj);
2008 breakflags |= BRK_KNOWN2BREAK;
2009 } else {
2010 breakflags |= BRK_KNOWN2NOTBREAK;
2011 }
2012
2013 hit_bars(&obj, u.ux, u.uy, x, y, breakflags);
2014 return TRUE;
2015 }
2016 return FALSE;
2017}
2018
2019/* force-fight a spider web with your weapon */
2020staticfn boolean

Callers 1

domove_coreFunction · 0.85

Calls 5

breaktestFunction · 0.85
splitobjFunction · 0.85
setuwepFunction · 0.85
freeinvFunction · 0.85
hit_barsFunction · 0.85

Tested by

no test coverage detected