コード例 #1
0
        public GraphResult FindPath(string source, string dest, bool exhaustiveSearch = false, List <Item> startingItems = null, string requirements = null)
        {
            var reqList    = Requirement.MakeRequirementListFromString(requirements);
            var sourceNode = Nodes.Where(x => x.LogicalId == source).FirstOrDefault();
            var destNode   = Nodes.Where(x => x.LogicalId == dest).FirstOrDefault();

            return(FindPath(sourceNode, destNode, exhaustiveSearch, startingItems, reqList));
        }
コード例 #2
0
        public void UpdateDungeonBoss(Dungeon dungeon)
        {
            Node bossNode = GetBossNodeFromRoom(dungeon.BossRoomId);

            if (bossNode == null)
            {
                throw new Exception($"Graph.UpdateDungeonBoss - boss not found for room {dungeon.BossRoomId}");
            }

            Edge edge = Edges.Where(x => x.DestinationNode == bossNode).FirstOrDefault();

            string requirements;

            if (dungeon.SelectedBoss == null)
            {
                // set back to default
                requirements = "";
                switch (dungeon.BossRoomId)
                {
                case RoomIdConstants.R6_SwampPalace_Arrghus:
                    requirements = "Hookshot";
                    break;

                case RoomIdConstants.R222_IcePalace_Kholdstare:
                    requirements = "Fire Rod;Bombos,L1 Sword";
                    break;

                case RoomIdConstants.R164_TurtleRock_Trinexx:
                    requirements = "Fire Rod,Ice Rod";
                    break;
                }
            }
            else
            {
                requirements = dungeon.SelectedBoss.Requirements;
            }

            if (edge != null)
            {
                edge.Requirements = Requirement.MakeRequirementListFromString(requirements);
            }
        }
コード例 #3
0
ファイル: Edge.cs プロジェクト: tcprescott/Enimizer
 public Edge(Node sourceNode, Node destinationNode, string requirements)
     : this(sourceNode, destinationNode)
 {
     Unlocked          = false;
     this.Requirements = Requirement.MakeRequirementListFromString(requirements);
     //foreach (var r in requirements.Split(';'))
     //{
     //    if (r.Length > 0)
     //    {
     //        List<Item> items = new List<Item>();
     //        foreach (var reqItem in r.Split(','))
     //        {
     //            Item item = Data.GameItems.Items.Values.Where(x => x.LogicalId == reqItem).FirstOrDefault();
     //            if(item == null)
     //            {
     //                throw new Exception($"Edge constructor - {sourceNode.LogicalId}->{destinationNode.LogicalId} could not find item {reqItem}");
     //            }
     //            items.Add(item);
     //        }
     //        this.Requirements.Add(new Requirement(items.ToArray()));
     //    }
     //}
 }