private void StealAndKeepGoing(SpatialValuable valuable, Path path)
 {
     Steal(valuable);
     ItemsRemaining--;
     CurrentLocation = path.Last();
     Go();
 }
 private void Steal(SpatialValuable valuable)
 {
     if (IsFacilityValuable(valuable))
     {
         _thiefBody.StealAt(valuable);
     }
     _map.Remove(valuable.Obj);
     StolenItems.Add(valuable.Obj);
 }
        private IEnumerable <Orientation> GetDirectionsValuableCanBeStolenFrom(SpatialValuable valuable)
        {
            var space = _map[valuable.Location];

            if (IsFacilityValuable(valuable))
            {
                return(space.Contains("Wall") ? Lists.Of(valuable.Orientation) : Orientation.AllOrientations);
            }
            var container = space.FacilityContainers.First(x => x.Valuables.Any(y => y.Equals(valuable.Obj)));

            return(space.Contains("Wall") ? container.AccessibleFrom.Where(x => x.Equals(container.Orientation)) : container.AccessibleFrom);
        }
        private Path GetStealPath(SpatialValuable valuable)
        {
            var destinations = GetStealLocations(valuable).Shuffle();

            foreach (var destination in destinations)
            {
                if (_pathFinder.PathExists(CurrentLocation, destination))
                {
                    return(GetTrimmedPath(CurrentLocation, destination));
                }
            }
            return(new Path());
        }
 private bool IsFacilityValuable(SpatialValuable valuable)
 {
     return(_map[valuable.Location].Contains(valuable.Obj.Type));
 }
 private IEnumerable <XYZ> GetStealLocations(SpatialValuable valuable)
 {
     return(GetDirectionsValuableCanBeStolenFrom(valuable)
            .Select(x => (XYZ) new XYZAdjacent(valuable.Location, x))
            .Where(x => _map.IsOpenSpace(x)));
 }
 public void StealAt(SpatialValuable valuable)
 {
     _stolenLocations.Add(valuable);
 }
Example #8
0
 public void StealAt(SpatialValuable valuable)
 {
 }