Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.16] Add a unit test for [move_unit]location_id with an occupied hex #6571

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions data/test/scenarios/test_move_unit_to_occupied_hex.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# wmllint: no translatables

#####
# API(s) being tested: [move_unit]to_location
##
# Actions:
# Try to move Alice to the hex that Bob already occupies.
##
# Expected end state:
# Bob has not moved and both units are still on the map.
# Alice is adjacent to Bob.
#
# The main "test_move_unit" includes a check that moving to an occupied
# location by x,y coordinates doesn't overwrite the existing unit. This
# tests the same, using a location_id.
#####
{GENERIC_UNIT_TEST "test_move_unit_to_occupied_location" (
[event]
name=start
{ASSERT (
[have_unit]
id=alice
x=7
y=3
[/have_unit]
[have_unit]
id=bob
x=13
y=3
[/have_unit]
)}

[move_unit]
id=alice
to_location=2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a location that has already been defined, I assume?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numerical location ids 1, 2, etc correspond to the starting location for that side.

[/move_unit]

# She ends up one hex north-west of Bob instead, for consistency this
# tests the exact hex instead of just checking adjacency.
{ASSERT (
[have_unit]
id=alice
x=12
y=2
[/have_unit]
[have_unit]
id=bob
x=13
y=3
[/have_unit]
)}

{SUCCEED}
[/event]
)}
1 change: 1 addition & 0 deletions wml_test_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
9 test_move_fail_6
0 test_move_unit
0 test_move_unit_in_circle
0 test_move_unit_to_occupied_location
0 sighted_on_move
0 move_skip_no_sighted_no_share_vision
0 move_skip_ally_sighted_no_share_vision
Expand Down