-
Notifications
You must be signed in to change notification settings - Fork 3
/
ChestFuture.cs
53 lines (48 loc) · 1.5 KB
/
ChestFuture.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FF12RNGHelperPC
{
class ChestFuture : FutureBase
{
private Chest _chest;
public Chest Chest
{
get { return _chest; }
set
{
if (_chest != value)
{
hasCachedFuture = false;
}
_chest = value;
}
}
public ChestFuture(ChestResult desiredResult, Chest chestInfo, int searchDepth)
{
DesiredResult = desiredResult;
Chest = chestInfo;
SearchDepth = searchDepth;
}
protected override bool GenerateAndCheckResult(IRNG rng, int offset = 0)
{
return this.Chest.CheckChest(rng, offset).SameOrBetter(DesiredResult);
}
public int GetSpawnFuture(IRNG rng, int offset = 0)
{
//TODO: Consider splitting ChestSpawn into its own class, and make its own future class if lack of caching turns out to be performance issue.
//No need to implement future sync either because no cached future.
//Or maybe just put a simple future calculation into the Chest Class?
for (int i = 0; i < SearchDepth; i++)
{
if (this.Chest.CheckSpawn(rng, i + offset))
{
return i;
}
}
return -1;
}
}
}