Exemplo n.º 1
0
 public static LogicObjects.LogicEntry RandomizedEntry(this LogicObjects.LogicEntry entry, LogicObjects.TrackerInstance Instance, bool ReturnJunkAsItem = false)
 {
     if (ReturnJunkAsItem && entry.HasRandomItem(false) && !entry.HasRandomItem(true))
     {
         return(new LogicObjects.LogicEntry {
             ID = -1, DictionaryName = "Junk", DisplayName = "Junk", LocationName = "Junk", ItemName = "Junk"
         });
     }
     if (!entry.HasRandomItem(true) || entry.RandomizedItem >= Instance.Logic.Count)
     {
         return(null);
     }
     return(Instance.Logic[entry.RandomizedItem]);
 }
Exemplo n.º 2
0
        public static void CheckEntrancePair(LogicObjects.LogicEntry Location, LogicObjects.TrackerInstance Instance, bool Checking)
        {
            if (Location.ID < 0 || !Instance.Options.CoupleEntrances || !Location.HasRandomItem(true) || !Location.IsEntrance())
            {
                return;
            }
            var reverseLocation = Location.PairedEntry(Instance, true);
            var reverseItem     = Location.PairedEntry(Instance);

            if (reverseItem == null || reverseLocation == null)
            {
                return;
            }
            //is the reverse entrance already checked and randomized to something
            if ((reverseLocation.Checked || (reverseLocation.HasRandomItem(true) && reverseLocation.RandomizedEntry(Instance) != reverseItem) || reverseItem.Aquired) && Checking)
            {
                return;
            }
            //Does the spoiler log conflict with what the reverse check is trying to do
            if (reverseLocation.SpoilerRandom != reverseItem.ID && reverseLocation.SpoilerRandom > -1 && Checking)
            {
                return;
            }
            reverseLocation.Checked        = Checking;
            reverseLocation.RandomizedItem = (Checking) ? reverseItem.ID : -2;
            reverseItem.Aquired            = Checking;
        }