Skip to content

Commit

Permalink
Set weather, update sight limits
Browse files Browse the repository at this point in the history
If this doesn't work, I'll try the steps in vision_test.cpp.
  • Loading branch information
actual-nh committed Mar 25, 2021
1 parent 1282f44 commit 2062bbc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/monster_attack_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
#include "calendar.h"
#include "catch/catch.hpp"
#include "character.h"
#include "game.h"
#include "map.h"
#include "map_helpers.h"
#include "monster.h"
#include "options_helpers.h"
#include "player_helpers.h"
#include "point.h"
#include "type_id.h"
#include "weather.h"
#include "weather_type.h"

static constexpr tripoint attacker_location{ 65, 65, 0 };

Expand All @@ -28,6 +31,7 @@ static void test_monster_attack( const tripoint &target_offset, bool expect_atta
Character &you = get_player_character();
clear_avatar();
you.setpos( target_location );
you.recalc_sight_limits();
monster &test_monster = spawn_test_monster( monster_type, attacker_location );
// Trigger basic attack.
CAPTURE( attacker_location );
Expand All @@ -39,6 +43,7 @@ static void test_monster_attack( const tripoint &target_offset, bool expect_atta
clear_creatures();
clear_avatar();
you.setpos( attacker_location );
you.recalc_sight_limits();
monster &target_monster = spawn_test_monster( monster_type, target_location );
CHECK( you.sees( target_monster ) == expect_vision );
CHECK( you.melee_attack( target_monster, false ) == expect_attack );
Expand Down Expand Up @@ -74,6 +79,7 @@ TEST_CASE( "monster_attack" )
clear_map();
restore_on_out_of_scope<time_point> restore_calendar_turn( calendar::turn );
calendar::turn = daylight_time( calendar::turn ) + 2_hours;
get_weather().weather_override = WEATHER_CLEAR; // Do I need to put this back?
SECTION( "attacking on open ground" ) {
// Adjacent can attack of course.
for( const tripoint &offset : eight_horizontal_neighbors ) {
Expand Down

0 comments on commit 2062bbc

Please sign in to comment.