MCPcopy Create free account
hub / github.com/crawl/crawl / zapping

Function zapping

crawl-ref/source/beam.cc:212–243  ·  view source on GitHub ↗

If needs_tracer is true, we need to check the beam path for friendly monsters.

Source from the content-addressed store, hash-verified

210// If needs_tracer is true, we need to check the beam path for friendly
211// monsters.
212spret zapping(zap_type ztype, int power, bolt &pbolt,
213 bool needs_tracer, const char* msg, bool fail)
214{
215 dprf(DIAG_BEAM, "zapping: power=%d", power);
216
217 pbolt.thrower = KILL_YOU_MISSILE;
218
219 // Check whether tracer goes through friendlies.
220 // NOTE: Whenever zapping() is called with a randomised value for power
221 // (or effect), player_tracer should be called directly with the highest
222 // power possible respecting current skill, experience level, etc.
223 if (needs_tracer && !player_tracer(ztype, power, pbolt))
224 return spret::abort;
225
226 fail_check();
227 // Fill in the bolt structure.
228 zappy(ztype, power, false, pbolt);
229
230 if (msg)
231 mpr(msg);
232
233 if (ztype == ZAP_DIG)
234 pbolt.aimed_at_spot = false;
235 // XXX: Not an explosion internally, which would do this automatically,
236 // but is aimed like one and should behavior like one UI-wise.
237 else if (ztype == ZAP_RUST_BREATH)
238 pbolt.aimed_at_spot = true;
239
240 pbolt.fire();
241
242 return spret::success;
243}
244
245void fire_partial_player_tracer(zap_type ztype, int power,
246 player_beam_tracer& tracer,

Callers 6

_damaging_cardFunction · 0.85
_do_castFunction · 0.85
cast_inner_flameFunction · 0.85
cast_vile_clutchFunction · 0.85
cast_teleport_otherFunction · 0.85
_do_abilityFunction · 0.85

Calls 5

dprfFunction · 0.85
player_tracerFunction · 0.85
zappyFunction · 0.85
mprFunction · 0.85
fireMethod · 0.45

Tested by

no test coverage detected