-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not assume a player has already spawned on a map when figuring out…
… spawn locations. GitOrigin-RevId: 0fcede83a96e0aca0317ba6c0afbc83fe69d0283
- Loading branch information
Showing
4 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Sniper } from '@deities/athena/info/Unit.tsx'; | ||
import withModifiers from '@deities/athena/lib/withModifiers.tsx'; | ||
import vec from '@deities/athena/map/vec.tsx'; | ||
import MapData from '@deities/athena/MapData.tsx'; | ||
import { expect, test } from 'vitest'; | ||
import estimateClosestTarget from '../estimateClosestTarget.tsx'; | ||
|
||
const map = withModifiers( | ||
MapData.createMap({ | ||
map: [ | ||
1, 1, 1, 3, 2, 1, 1, 1, 3, 1, 1, 2, 3, 1, 3, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, | ||
], | ||
size: { height: 5, width: 5 }, | ||
}), | ||
); | ||
|
||
test('estimateClosestTarget should not require a player to be present on the map', () => { | ||
const [target] = estimateClosestTarget( | ||
map, | ||
Sniper.create(3, { name: -1 }), | ||
vec(1, 1), | ||
[vec(5, 1), vec(1, 5)], | ||
true, | ||
); | ||
expect(target?.vector).toEqual(vec(1, 5)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters