forked from Jarno458/TsRandomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemLocationMapFixture.cs
61 lines (51 loc) · 2.41 KB
/
ItemLocationMapFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using TsRandomizer.IntermediateObjects;
using TsRandomizer.Randomisation;
namespace TsRandomizer.Tests
{
[TestFixture]
class ItemLocationMapFixture
{
[Test]
public void With_no_items_only_6_item_locatios_should_be_accessable()
{
var unlockingMap = new ItemUnlockingMap(Seed.Zero);
var itemLocations = new ItemLocationMap(new ItemInfoProvider(SeedOptions.None, unlockingMap), unlockingMap, SeedOptions.None);
var accessableLocations = itemLocations.GetReachableLocations(Requirement.None).ToArray();
Assert.That(Contains(accessableLocations, ItemKey.TutorialMeleeOrb));
Assert.That(Contains(accessableLocations, ItemKey.TutorialSpellOrb));
Assert.That(Contains(accessableLocations, new ItemKey(1, 1, 1528, 144)));
Assert.That(Contains(accessableLocations, new ItemKey(1, 15, 264, 144)));
Assert.That(Contains(accessableLocations, new ItemKey(1, 25, 296, 176)));
Assert.That(Contains(accessableLocations, new ItemKey(1, 9, 600, 192)));
}
[Test]
public void With_doubejump_timestop_spindle_and_cardD_should_get_access_to_past()
{
var unlockingMap = new ItemUnlockingMap(Seed.Zero);
var itemLocations = new ItemLocationMap(new ItemInfoProvider(SeedOptions.None, unlockingMap), unlockingMap, SeedOptions.None);
var accessableLocations = itemLocations.GetReachableLocations(
Requirement.DoubleJump | Requirement.GateAccessToPast | Requirement.Swimming)
.ToArray();
Assert.That(Contains(accessableLocations, new ItemKey(3, 3, 648, 272)));
}
[Test]
public void With_given_requirements_shoud_mark_captians_chests_as_available()
{
var unlockingMap = new ItemUnlockingMap(Seed.Zero);
var itemLocations = new ItemLocationMap(new ItemInfoProvider(SeedOptions.None, unlockingMap), unlockingMap, SeedOptions.None);
var accessableLocations = itemLocations.GetReachableLocations(
Requirement.GassMask | Requirement.AntiWeed | Requirement.Swimming | Requirement.GateLakeSereneRight | Requirement.DoubleJump)
.ToArray();
Assert.That(Contains(accessableLocations, new ItemKey(1, 18, 1320, 189)));
Assert.That(Contains(accessableLocations, new ItemKey(1, 18, 1272, 192)));
Assert.That(Contains(accessableLocations, new ItemKey(1, 18, 1368, 192)));
}
static bool Contains(IEnumerable<ItemLocation> itemLocations, ItemKey itemKey)
{
return itemLocations.Any(loc => loc.Key == itemKey);
}
}
}