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

Method affect_player

crawl-ref/source/beam.cc:4233–4526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4231}
4232
4233void bolt::affect_player()
4234{
4235 hit_count[MID_PLAYER]++;
4236
4237 if (ignores_player() || !could_harm(agent(), &you, !is_tracer()))
4238 return;
4239
4240 // Explosions only have an effect during their explosion phase.
4241 // Special cases can be handled here.
4242 if (is_explosion && !in_explosion_phase)
4243 {
4244 // Trigger the explosion.
4245 finish_beam();
4246 return;
4247 }
4248
4249 if (is_tracer())
4250 {
4251 tracer_affect_player();
4252 return;
4253 }
4254
4255 // Trigger an interrupt, so travel will stop on misses which
4256 // generate smoke.
4257 if (!YOU_KILL(thrower))
4258 {
4259 if (agent() && agent()->is_monster())
4260 {
4261 interrupt_activity(activity_interrupt::monster_attacks,
4262 agent()->as_monster());
4263 }
4264 else
4265 interrupt_activity(activity_interrupt::monster_attacks);
4266 }
4267
4268 if (ranged_atk)
4269 {
4270 do_ranged_attack(you);
4271 return;
4272 }
4273
4274 // Visible beams reveal invisible monsters; otherwise animations confer
4275 // an information advantage for sighted players
4276 if (visible() && agent() && agent()->is_monster())
4277 {
4278 monster* mons = agent()->as_monster();
4279 mons->revealed_this_turn = true;
4280 mons->revealed_at_pos = mons->pos();
4281 }
4282
4283 if (misses_player())
4284 return;
4285
4286 if (!is_explosion && !noise_generated)
4287 {
4288 heard = noisy(loudness, pos(), source_id) || heard;
4289 noise_generated = true;
4290 }

Callers

nothing calls this directly

Calls 15

could_harmFunction · 0.85
interrupt_activityFunction · 0.85
visibleFunction · 0.85
noisyFunction · 0.85
mprfFunction · 0.85
dprfFunction · 0.85
practise_being_shotFunction · 0.85
bleed_onto_floorFunction · 0.85
check_your_resistsFunction · 0.85
make_stringfFunction · 0.85
_beam_type_nameFunction · 0.85

Tested by

no test coverage detected