public TaskPathwayPlaceKey(RandoLogic logic, LinkedNode node, int keyholeID, LinkedNode originalNode = null, bool internalOnly = false, int tries = 0) : base(logic) { // TODO: advance forward through any obligatory edges this.Node = node; this.InternalOnly = internalOnly; this.KeyholeID = keyholeID; this.OriginalNode = originalNode ?? node; this.Tries = tries; }
public TaskPathwaySatisfyRequirement(RandoLogic logic, LinkedNode node, Requirement req, FlagSet state, LinkedNode originalNode = null, bool internalOnly = false, int tries = 0) : base(logic) { this.Node = node; this.InternalOnly = internalOnly; this.Req = req; this.OriginalNode = originalNode ?? node; this.Tries = this.BaseTries = tries; this.State = state; }
public static LinkedNodeSet Closure(LinkedNode start, Capabilities capsForward, Capabilities capsReverse, bool internalOnly, int maxDistance = 9999) { var result = new LinkedNodeSet(new List <LinkedNode> { start }); result.Extend(capsForward, capsReverse, internalOnly, maxDistance); return(result); }
public static PlaceCollectableReceipt Do(LinkedNode node, StaticCollectable place, LinkedCollectable item, bool autoBubble, int keyholeID, LinkedRoom keyholeRoom) { var result = Do(node, place, item, autoBubble); keyholeRoom.UsedKeyholes.Add(keyholeID); result.KeyholeID = keyholeID; result.KeyholeRoom = keyholeRoom; return(result); }
public static PlaceCollectableReceipt Do(LinkedNode node, StaticCollectable place, LinkedCollectable item, bool autoBubble) { Logger.Log("randomizer", $"Placing collectable {item} in {node.Room.Static.Name}:{node.Static.Name}"); node.Collectables[place] = Tuple.Create(item, autoBubble); return(new PlaceCollectableReceipt { Node = node, Place = place, }); }
public static PlaceCollectableReceipt Do(LinkedNode node, StaticCollectable place, LinkedNode.LinkedCollectable item) { Logger.Log("randomizer", $"Placing collectable {item} in {node.Room.Static.Name}:{node.Static.Name}"); node.Collectables[place] = item; return(new PlaceCollectableReceipt { Node = node, Place = place }); }
public ref Requirement ExtraReqsTo(LinkedNode One) { if (One == this.NodeA) { return(ref this.ExtraReqsToA); } else if (One == this.NodeB) { return(ref this.ExtraReqsToB); } throw new Exception("Misplaced LinkedEdge call"); }
public Requirement ReqsTo(LinkedNode one) { var extra = this.ExtraReqsFrom(one); var total = new List <Requirement> { this.CorrespondingEdge(one).ReqIn, this.OtherEdge(one).ReqOut, }; if (extra != null) { total.Add(extra); } return(Requirement.And(total)); }
public LinkedRoom(StaticRoom Room, Vector2 Position) { this.Static = Room; this.Bounds = new Rectangle((int)Position.X, (int)Position.Y, Room.Level.Bounds.Width, Room.Level.Bounds.Height); this.ExtraBounds = new List <Rectangle>(); foreach (var r in Room.ExtraSpace) { this.ExtraBounds.Add(new Rectangle((int)Position.X + r.X, (int)Position.Y + r.Y, r.Width, r.Height)); } foreach (var staticnode in Room.Nodes.Values) { var node = new LinkedNode() { Static = staticnode, Room = this }; this.Nodes.Add(staticnode.Name, node); } }
public StaticEdge CorrespondingEdge(LinkedNode One) { return(One == NodeA ? StaticA : One == NodeB ? StaticB : null); }
public LinkedNode OtherNode(LinkedNode One) { return(One == NodeA ? NodeB : One == NodeB ? NodeA : null); }
public LinkedNode OtherNode(LinkedNode One) { return(One == NodeA ? NodeB : One == NodeB ? NodeA : throw new Exception("Misplaced LinkedEdge call")); }
public UnlinkedEdge(LinkedNode node, StaticEdge edge) { this.Static = edge; this.Node = node; }
public TaskPathwayBerryOffshoot(RandoLogic logic, LinkedNode node, FlagSet state) : base(logic) { this.Node = node; this.State = state; }
public StaticEdge OtherEdge(LinkedNode One) { return(One == NodeA ? StaticB : One == NodeB ? StaticA : null); }
public StaticEdge CorrespondingEdge(LinkedNode One) { return(One == NodeA ? StaticA : One == NodeB ? StaticB : throw new Exception("Misplaced LinkedEdge call")); }
public static Requirement TraversalRequires(LinkedNode start, Capabilities capsForward, bool internalOnly, LinkedNode end) { var queue = new PriorityQueue <Tuple <Requirement, LinkedNode> >(); var seen = new Dictionary <LinkedNode, List <Requirement> >(); Requirement p = new Possible(); queue.Enqueue(Tuple.Create(p, start)); seen[start] = new List <Requirement> { p }; // implementation question: should this loop break as soon as one path to end is found, or should it exhaust the queue? // for now, let's go with exhaust the queue so if there's a Possible we don't miss it while (queue.Count != 0) { var entry = queue.Dequeue(); var entryReq = entry.Item1; var entryNode = entry.Item2; foreach (var where in entryNode.SuccessorsRequires(capsForward)) { var realReq = Requirement.And(new List <Requirement> { entryReq, where.Item2 }); var nextNode = where.Item1; if (!seen.TryGetValue(nextNode, out var seenLst)) { seenLst = new List <Requirement>(); seen[nextNode] = seenLst; } // search for any requirement already seen which obsoletes this new requirement var found = false; foreach (var req in seenLst) { if (req.Equals(realReq) || req.StrictlyBetterThan(realReq)) { found = true; break; } } if (!found) { seenLst.Add(realReq); queue.Enqueue(Tuple.Create(realReq, nextNode)); } } } if (!seen.TryGetValue(end, out var disjunct)) { return(new Impossible()); } return(Requirement.Or(disjunct)); }
public StaticEdge OtherEdge(LinkedNode One) { return(One == NodeA ? StaticB : One == NodeB ? StaticA : throw new Exception("Misplaced LinkedEdge call")); }
public TaskPathwayPickEdge(RandoLogic logic, LinkedNode node) : base(logic) { // TODO: advance forward through any obligatory edges this.Node = node; }
public TaskPathwayBerryOffshoot(RandoLogic logic, LinkedNode node) : base(logic) { this.Node = node; }