示例#1
0
        // ID is the query month and Value is the Query date
        public static bool Check(RequirementVO req)
        {
            int year  = 0;
            int month = FindMonth(req.ID);
            int day   = req.Value % 100;

            if (month == 0)
            {
                month = (int)(req.Value * .01);
                year  = (int)(month * .01);
                month = month % 100;
            }
            if (month == 0)
            {
                return(false);
            }
            if (year == 0)
            {
                year = 1789;
            }
            DateTime      date        = new DateTime(year, month, day);
            RequirementVO requirement = new RequirementVO()
            {
                Value    = date.Subtract(AmbitionApp.Calendar.StartDate).Days,
                Operator = req.Operator
            };

            return(RequirementsSvc.Check(requirement, AmbitionApp.Calendar.Day));
        }
示例#2
0
        // Utility function for checking with an operator
        public static bool Check(RequirementVO req, int query)
        {
            var result = _Check(req, query);

            Debug.LogFormat("Check: commod {0} ID {1} value {2} operator {3} target {4} result {5}", req.Type, req.ID, req.Value, req.Operator, query, result);
            return(result);
        }
示例#3
0
        public static bool Check(RequirementVO req)
        {
            CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(req.ID);
            int         check     = (character?.Acquainted ?? false) ? 1 : 0;

            return(RequirementsSvc.Check(req, check));
        }
示例#4
0
        public static bool Check(RequirementVO req)
        {
            CharacterModel model = AmbitionApp.GetModel <CharacterModel>();

            model.Characters.TryGetValue(req.ID, out CharacterVO character);
            return(character?.IsDateable ?? false);
        }
示例#5
0
        public static bool Check(RequirementVO req)
        {
            CharacterModel characters = AmbitionApp.GetModel <CharacterModel>();
            int            favor      = characters.Characters.TryGetValue(req.ID, out CharacterVO character)
                ? character.Favor : 0;

            return(RequirementsSvc.Check(req, favor));
        }
示例#6
0
 public static bool Check(RequirementVO req)
 {
     if (!AmbitionApp.Game.Misc.TryGetValue(req.ID, out int value))
     {
         value = 0;
     }
     return(RequirementsSvc.Check(req, value));
 }
示例#7
0
        public static bool Check(RequirementVO req)
        {
            int value = AmbitionApp.GetModel <GameModel>().Credibility;
            int roll  = Util.RNG.Generate(100);

            return((roll >= 95) ? true
                : (roll < 5) ? false
                : RequirementsSvc.Check(req, roll + value));
        }
示例#8
0
        public static bool Check(RequirementVO req)
        {
            int val = !string.IsNullOrEmpty(req.ID) &&
                      SteamAPI.IsSteamRunning() &&
                      Steamworks.SteamUserStats.GetAchievement(req.ID, out bool done) &&
                      done
                ? 1
                : 0;

            return(RequirementsSvc.Check(req, val));
        }
示例#9
0
        public static bool Check(RequirementVO req)
        {
            RendezVO rendez = AmbitionApp.GetEvent() as RendezVO;

            if (rendez == null)
            {
                return(false);
            }

            CharacterModel model = AmbitionApp.GetModel <CharacterModel>();
            int            score = model.GetOutfitFavor(rendez.Character, AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO);

            return(RequirementsSvc.Check(req, score));
        }
示例#10
0
        public static bool Check(RequirementVO req)
        {
            RendezVO rendez = AmbitionApp.GetEvent() as RendezVO;

            if (rendez == null)
            {
                return(false);
            }

            CharacterModel model     = AmbitionApp.GetModel <CharacterModel>();
            CharacterVO    character = model.GetCharacter(rendez.Character);

            return(RequirementsSvc.Check(req, character?.Favor ?? 0));
        }
示例#11
0
        public bool Check(RequirementVO req)
        {
#if DEBUG
            try
            {
                return(_handlers[req.Type] (req));
            }
            catch (Exception e)
            {
                throw new Exception("Requirement type \"" + req.Type.ToString() + "\" not found", e);
            }
#else
            return(_handlers.TryGetValue(req.Type, out Func <RequirementVO, bool> handler) && handler(req));
#endif
        }
示例#12
0
        public static bool _Check(RequirementVO req, int query)
        {
            switch (req.Operator)
            {
            case RequirementOperator.Less:
                return(query < req.Value);

            case RequirementOperator.LessOrEqual:
                return(query <= req.Value);

            case RequirementOperator.Greater:
                return(query > req.Value);

            case RequirementOperator.GreaterOrEqual:
                return(query >= req.Value);
            }
            return(query == req.Value);
        }
示例#13
0
        public static bool Check(RequirementVO req)
        {
            //Debug.LogFormat("FactionAllegianceReq check");
            FactionModel factions   = AmbitionApp.GetModel <FactionModel>();
            int          allegiance = 0;

            if (Enum.TryParse(req.ID, ignoreCase: true, out FactionType factionID))
            {
                allegiance = factions.Factions.TryGetValue(factionID, out FactionVO faction)
                    ? faction.Allegiance : 0;

                //Debug.LogFormat("Faction {0} allegiance is {1}, checking {2} {3}",req.ID, allegiance, req.Operator, req.Value);
            }
            else
            {
                Debug.LogErrorFormat("Bad faction ID {0} in FactionAllegianceReq", req.ID);
            }

            return(RequirementsSvc.Check(req, allegiance));
        }
示例#14
0
        // If currently on a rendezvous, checks the requirement ID against both the current character and location
        // If not on a rendezvous, checks whether the requirement ID is either a viable rendezvous destination or a dateable character
        // A value of 1 or greater verifies a match;
        // A value of 0 or less verifies that neither match
        public static bool Check(RequirementVO requirement)
        {
            CharacterModel model = AmbitionApp.GetModel <CharacterModel>();

            if (AmbitionApp.GetModel <GameModel>().Activity == ActivityType.Rendezvous && model.Rendezvous != null)
            {
                return((model.Rendezvous.Character == requirement.ID || model.Rendezvous.Location == requirement.ID) == (requirement.Value > 0));
            }
            if (AmbitionApp.Paris.Completed.Contains(requirement.ID))
            {
                return(false);
            }
            if (AmbitionApp.Paris.Rendezvous.Contains(requirement.ID))
            {
                return(true);
            }
            if (!model.Characters.TryGetValue(requirement.ID, out CharacterVO character))
            {
                return(false);
            }
            return(character?.IsDateable ?? false);
        }
示例#15
0
        public static bool Check(RequirementVO req)
        {
            var party = AmbitionApp.GetModel <PartyModel>().Party;

            // outfit reaction credibility shift
            ItemVO        outfit = AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit);
            CalendarEvent e      = AmbitionApp.GetEvent();
            FactionType   faction;

            if (e is PartyVO)
            {
                faction = ((PartyVO)e).Faction;
            }
            else
            {
                CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(((RendezVO)e).Character);
                faction = character?.Faction ?? FactionType.Military;
            }
            int value = AmbitionApp.Inventory.GetFactionBonus(outfit, faction);

            return(RequirementsSvc.Check(req, value));
        }
示例#16
0
        public static bool Check(RequirementVO req)
        {
            FactionModel model = AmbitionApp.GetModel <FactionModel>();

            char[]           sep      = new char[] { ',', ' ' };
            string[]         tokens   = req.ID.Split(sep);
            List <FactionVO> factions = new List <FactionVO>();
            FactionType      faction;

            foreach (string token in tokens)
            {
                if (Enum.TryParse(token, true, out faction))
                {
                    factions.Add(model.Factions[faction]);
                }
            }
            if (factions.Count > 1)
            {
                req.Value = factions[1].Power;
            }
            return(RequirementsSvc.Check(req, factions[0].Power));
        }
示例#17
0
 public static bool Check(RequirementVO req) => RequirementsSvc.Check(req, AmbitionApp.Gossip.Quests.Count);
示例#18
0
 public static bool CheckRequirement(RequirementVO req) => App.Service <RequirementsSvc>().Check(req);
示例#19
0
        public static bool Check(RequirementVO req)
        {
            int isComplete = AmbitionApp.Story.IsComplete(req.ID, false) ? 1 : 0;

            return(RequirementsSvc.Check(req, isComplete));
        }
示例#20
0
 public static bool Check(RequirementVO req) => RequirementsSvc.Check(req, Util.RNG.Generate(100));
示例#21
0
 // Checks the Paris model for known locations or currently available explorable locations
 public static bool Check(RequirementVO req)
 {
     return(RequirementsSvc.Check(req, AmbitionApp.Game.Exhaustion));
 }
示例#22
0
 // Returns whether the Mark's room has been cleared
 public static bool Check(RequirementVO req)
 {
     return(true); //Array.Exists(map.Map.Rooms, r => r.HostHere && r.Cleared);
 }
示例#23
0
        public static bool Check(RequirementVO req)
        {
            int value = AmbitionApp.GetModel <GameModel>().Livre;

            return(RequirementsSvc.Check(req, value));
        }