| 601 | } |
| 602 | |
| 603 | void bolt::initialise_fire() |
| 604 | { |
| 605 | // Fix some things which the tracer might have set. |
| 606 | extra_range_used = 0; |
| 607 | in_explosion_phase = false; |
| 608 | use_target_as_pos = false; |
| 609 | enchant_chaining_done = false; |
| 610 | hit_count.clear(); |
| 611 | |
| 612 | if (special_explosion != nullptr) |
| 613 | { |
| 614 | ASSERT(!is_explosion); |
| 615 | ASSERT(special_explosion->is_explosion); |
| 616 | ASSERT(special_explosion->special_explosion == nullptr); |
| 617 | special_explosion->in_explosion_phase = false; |
| 618 | special_explosion->use_target_as_pos = false; |
| 619 | } |
| 620 | |
| 621 | if (chose_ray) |
| 622 | { |
| 623 | ASSERT_IN_BOUNDS(ray.pos()); |
| 624 | |
| 625 | if (source == coord_def()) |
| 626 | source = ray.pos(); |
| 627 | } |
| 628 | |
| 629 | if (target == source) |
| 630 | { |
| 631 | range = 0; |
| 632 | aimed_at_feet = true; |
| 633 | aimed_at_spot = true; |
| 634 | use_target_as_pos = true; |
| 635 | } |
| 636 | |
| 637 | if (flavour == BEAM_VISUAL) |
| 638 | affects_nothing = true; |
| 639 | |
| 640 | ASSERT_IN_BOUNDS(source); |
| 641 | ASSERT_RANGE(flavour, BEAM_NONE + 1, BEAM_FIRST_PSEUDO); |
| 642 | ASSERT(!drop_item || ranged_atk); |
| 643 | ASSERTM(range >= 0, "beam '%s', source '%s', has range -1", |
| 644 | name.c_str(), |
| 645 | (source_id == MID_PLAYER ? "player" : |
| 646 | monster_by_mid(source_id) ? |
| 647 | monster_by_mid(source_id)->name(DESC_PLAIN, true) : |
| 648 | "unknown").c_str()); |
| 649 | ASSERT(!aimed_at_feet || source == target); |
| 650 | |
| 651 | real_flavour = flavour; |
| 652 | |
| 653 | message_cache.clear(); |
| 654 | |
| 655 | // seen might be set by caller to suppress this. |
| 656 | if (!seen && you.see_cell(source) && range > 0 && visible()) |
| 657 | { |
| 658 | seen = true; |
| 659 | const monster* mon = monster_at(source); |
| 660 |
nothing calls this directly
no test coverage detected