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

Function zap_over_floor

src/zap.c:5140–5497  ·  view source on GitHub ↗

Burn floor scrolls, evaporate pools, etc... in a single square. * Used both for normal bolts of fire, cold, etc... and for fireballs. * Sets shopdamage to TRUE if a shop door is destroyed, and returns the * amount by which range is reduced (value is negative and will be added * to remaining range by caller; ignored by fireballs and poison gas). */

Source from the content-addressed store, hash-verified

5138 * to remaining range by caller; ignored by fireballs and poison gas).
5139 */
5140int
5141zap_over_floor(
5142 coordxy x, coordxy y, /* location */
5143 int type, /* damage type plus {wand|spell|breath} info */
5144 boolean *shopdamage, /* extra output if shop door is destroyed */
5145 boolean ignoremon, /* ignore any monster here */
5146 short exploding_wand_typ) /* supplied when breaking a wand; or POT_OIL
5147 * when a lit potion of oil explodes */
5148{
5149 const char *zapverb;
5150 struct monst *mon;
5151 struct trap *t;
5152 struct rm *lev = &levl[x][y];
5153 boolean see_it = cansee(x, y), yourzap;
5154 int rangemod = 0, damgtype = zaptype(type) % 10;
5155 boolean lavawall = (lev->typ == LAVAWALL);
5156
5157 if (type == PHYS_EXPL_TYPE) {
5158 /* this won't have any effect on the floor */
5159 return -1000; /* not a zap anyway, shouldn't matter */
5160 }
5161
5162 switch (damgtype) {
5163 case ZT_FIRE:
5164 t = t_at(x, y);
5165 if (t && t->ttyp == WEB) {
5166 /* a burning web is too flimsy to notice if you can't see it */
5167 if (see_it)
5168 Norep("A web bursts into flames!");
5169 (void) delfloortrap(t), t = (struct trap *) 0;
5170 if (see_it)
5171 newsym(x, y);
5172 }
5173 if (is_ice(x, y)) {
5174 melt_ice(x, y, (char *) 0);
5175 } else if (is_pool(x, y)) {
5176 boolean on_water_level = Is_waterlevel(&u.uz), msggiven = FALSE;
5177 const char *msgtxt = (!Deaf)
5178 ? "You hear hissing gas." /* Deaf-aware */
5179 : (type >= 0)
5180 ? "That seemed remarkably uneventful."
5181 : (char *) 0;
5182
5183 /* don't create steam clouds on Plane of Water; air bubble
5184 movement and gas regions don't understand each other */
5185 if (!on_water_level) {
5186 create_gas_cloud(x, y, rnd(5), 0); /* 1..5, no damg */
5187 if (iflags.last_msg == PLNMSG_ENVELOPED_IN_GAS)
5188 msggiven = TRUE;
5189 }
5190
5191 if (lev->typ != POOL) { /* MOAT or DRAWBRIDGE_UP or WATER */
5192 t = (struct trap *) 0;
5193 if (on_water_level)
5194 msgtxt = (see_it || !Deaf) ? "Some water boils." : 0;
5195 else if (see_it)
5196 msgtxt = "Some water evaporates.";
5197 } else {

Callers 3

dobuzzFunction · 0.85
mon_spell_hits_spotFunction · 0.85
explodeFunction · 0.85

Calls 15

zaptypeFunction · 0.85
t_atFunction · 0.85
NorepFunction · 0.85
delfloortrapFunction · 0.85
newsymFunction · 0.85
is_iceFunction · 0.85
melt_iceFunction · 0.85
is_poolFunction · 0.85
create_gas_cloudFunction · 0.85
rndFunction · 0.85
maketrapFunction · 0.85
dotrapFunction · 0.85

Tested by

no test coverage detected