| 1216 | } |
| 1217 | |
| 1218 | void bolt::do_fire() |
| 1219 | { |
| 1220 | initialise_fire(); |
| 1221 | |
| 1222 | if (range < extra_range_used && range > 0) |
| 1223 | { |
| 1224 | #ifdef DEBUG |
| 1225 | dprf(DIAG_BEAM, "fire_beam() called on already done beam " |
| 1226 | "'%s'", name.c_str()); |
| 1227 | #endif |
| 1228 | return; |
| 1229 | } |
| 1230 | |
| 1231 | apply_beam_conducts(); |
| 1232 | cursor_control coff(false); |
| 1233 | |
| 1234 | msg_generated = false; |
| 1235 | if (!aimed_at_feet) |
| 1236 | { |
| 1237 | choose_ray(); |
| 1238 | // Take *one* step, so as not to hurt the source. |
| 1239 | ray.advance(); |
| 1240 | } |
| 1241 | |
| 1242 | // Tracks if the *last* cell seen was a wall monster, therefore pretend |
| 1243 | // next cell is solid for purposes of bouncing or stopping the beam. |
| 1244 | bool wall_monster_hit = false; |
| 1245 | |
| 1246 | // Note: nothing but this loop should be changing the ray. |
| 1247 | while (map_bounds(pos())) |
| 1248 | { |
| 1249 | if (range_used() > range) |
| 1250 | { |
| 1251 | ray.regress(); |
| 1252 | extra_range_used++; |
| 1253 | ASSERT(range_used() >= range); |
| 1254 | break; |
| 1255 | } |
| 1256 | |
| 1257 | const dungeon_feature_type feat = env.grid(pos()); |
| 1258 | |
| 1259 | if (in_bounds(target) |
| 1260 | // Starburst beams are essentially untargeted; some might even hit |
| 1261 | // a victim if others have LOF blocked. |
| 1262 | && origin_spell != SPELL_STARBURST |
| 1263 | // We ran into a solid wall with a real beam... |
| 1264 | && (feat_is_solid(feat) |
| 1265 | && flavour != BEAM_DIGGING && flavour <= BEAM_LAST_REAL |
| 1266 | && !cell_is_solid(target) |
| 1267 | // Or hit a monster that'll stop our beam... |
| 1268 | || at_blocking_monster()) |
| 1269 | // and it's a player tracer that cares about blocked paths... |
| 1270 | && is_tracer() && tracer->is_collecting_warnings() && YOU_KILL(thrower) |
| 1271 | // and we're actually between you and the target... |
| 1272 | && !passed_target && pos() != target && pos() != source |
| 1273 | // ? |
| 1274 | && !tracer->has_hit_foe() && bounces == 0 && reflections == 0 |
| 1275 | // and you aren't shooting out of LOS. |
nothing calls this directly
no test coverage detected