| 4231 | } |
| 4232 | |
| 4233 | void 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 | } |
nothing calls this directly
no test coverage detected