示例#1
0
        public static Event FindEvent(Pilot target, EventSpecial specialGroup)
        {
            List <Event> filteredLibrary = new List <Event>();

            foreach (Event e in library)
            {
                if (specialGroup == e.specialGroup && e.filters.IsGood(target) && !target.blockedEvents.Contains(e))
                {
                    filteredLibrary.Add(e);
                }
            }
            if (filteredLibrary.Count == 0)
            {
                return(null);
            }
            else
            {
                return(filteredLibrary[Random.Get(0, filteredLibrary.Count)]);
            }
        }
示例#2
0
        /*public static Event FindEvent(Pilot target)
         * {
         *  int eventGroups = EventGroup.None;
         *  if (target.planet == null) { eventGroups = EventGroup.Space; }
         *  else { eventGroups = target.planet.eventGroups; }
         *
         *  return FindEvent(target, eventGroups);
         * }*/
        public static Event FindEvent(Pilot target, int eventGroup)
        {
            List <Event> filteredLibrary = new List <Event>();

            foreach (Event e in library)
            {
                if ((eventGroup & e.eventGroup) > 0 && e.filters.IsGood(target) && !target.blockedEvents.Contains(e))
                {
                    for (int i = 0; i < e.chance; i++)
                    {
                        filteredLibrary.Add(e);
                    }
                }
            }
            if (filteredLibrary.Count == 0)
            {
                return(null);
            }
            else
            {
                return(filteredLibrary[Random.Get(0, filteredLibrary.Count)]);
            }
        }
示例#3
0
        public bool IsGood(Pilot target)
        {
            // Gender check
            if (!(pilotGender == GenderFilter.Any ||
                  (pilotGender == GenderFilter.MaleOnly && target.gender == Gender.Male) ||
                  (pilotGender == GenderFilter.FemaleOnly && target.gender == Gender.Female)))
            {
                return(false);
            }
            // Money check
            if (target.money < pilotMoney.min || target.money > pilotMoney.max)
            {
                return(false);
            }
            // Story check
            if (target.storyStage < storyStage.min || target.storyStage > storyStage.max)
            {
                return(false);
            }

            // All good
            return(true);
        }