Beispiel #1
0
        public override void OnEnterState()
        {
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            IncidentVO[] incidents = calendar.GetEvents <IncidentVO>();
            foreach (IncidentVO incident in incidents)
            {
                if (AmbitionApp.CheckRequirements(incident.Requirements))
                {
                    QueueIncident(calendar, incident);
                }
                else
                {
                    calendar.Timeline[incident.Date].Remove(incident);
                }
            }

            incidents = calendar.Unscheduled.OfType <IncidentVO>().ToArray();
            foreach (IncidentVO incident in incidents)
            {
                if (incident.Requirements.Length > 0 && AmbitionApp.CheckRequirements(incident.Requirements))
                {
                    calendar.Schedule(incident, calendar.Today);
                    QueueIncident(calendar, incident);
                }
            }
            if (calendar.Incident != null)
            {
                AmbitionApp.SendMessage(IncidentMessages.START_INCIDENT);
            }
        }
Beispiel #2
0
        // Chooses all of the new Daily locations whose requirements have been met
        // This ensures that the same locations aren't available on two consecutive days
        public void Execute(string[] pins)
        {
            ParisModel paris = AmbitionApp.Paris;

            if (paris.Daily == null &&
                AmbitionApp.GetModel <CharacterModel>().Rendezvous == null &&
                AmbitionApp.CheckRequirements(paris.ExploreParisRequirements))
            {
                GameModel     game     = AmbitionApp.Game;
                LocationVO    location = null;
                List <string> subset   = new List <string>();
                int           num      = paris.NumDailies;
                foreach (string pinID in pins)
                {
                    location = paris.GetLocation(pinID);
                    if (location != null &&
                        location.IsDiscoverable &&
                        !paris.Rendezvous.Contains(pinID) &&
                        (!location.IsOneShot || !paris.Completed.Contains(pinID)) &&
                        AmbitionApp.CheckRequirements(location.Requirements))
                    {
                        if (!string.IsNullOrWhiteSpace(location.SceneID) ||
                            AmbitionApp.CheckIncidentEligible(location.IntroIncident))
                        {
                            subset.Add(pinID);
                        }
                        else if (location.StoryIncidents != null)
                        {
                            foreach (string incidentID in location.StoryIncidents)
                            {
                                if (AmbitionApp.CheckIncidentEligible(incidentID))
                                {
                                    subset.Add(pinID);
                                    break;
                                }
                            }
                        }
                    }
                }
                if (subset.Count > num)
                {
                    pins        = Util.RNG.Shuffle(subset);
                    paris.Daily = new string[num];
                    for (int i = num - 1; i >= 0; i--)
                    {
                        paris.Daily[i] = pins[i];
                    }
                }
                else
                {
                    paris.Daily = subset.ToArray();
                }
            }
        }
Beispiel #3
0
        void HandleTransitions(TransitionVO[] transitions)
        {
            int    index = -1;
            int    max;
            string loc = null;
            bool   show;

            _transitions.Clear();
            foreach (TransitionVO trans in transitions)
            {
                if (AmbitionApp.CheckRequirements(trans.Requirements))
                {
                    if (!trans.xor)
                    {
                        _transitions.Add(trans);
                    }
                    else if (index < 0)
                    {
                        index = _transitions.Count;
                        _transitions.Add(trans);
                    }
                    else if (_transitions[index].Requirements.Length == 0)
                    {
                        _transitions[index] = trans;
                    }
                }
            }

            max = _transitions.Count;

            for (int i = _buttons.Length - 1; i >= 0; --i)
            {
                show = i < max;
                if (show)
                {
                    index = Array.IndexOf(_incident.LinkData, _transitions[i]);
                    loc   = AmbitionApp.Localize(_incident.ID + ".link." + index.ToString());
                    show  = !string.IsNullOrEmpty(loc);
                }
                _buttons[i].gameObject.SetActive(show);
                if (show)
                {
                    _buttons[i].SetTransition(_transitions[i], loc);
                }
            }

            _hitTarget.raycastTarget = _transitions.Count < 2;
            Ellipse.SetActive(_transitions.Count < 2);
            _animator.SetBool(ACTIVE, true);
        }
Beispiel #4
0
        public void Execute(CalendarModel calendar)
        {
            ChapterVO chapter = AmbitionApp.Game.GetChapter();

            if (chapter.TrivialPartyChance + chapter.DecentPartyChance + chapter.GrandPartyChance > 0 &&
                AmbitionApp.CheckRequirements(AmbitionApp.Game.StartInvitationsReqirements) &&
                RNG.Generate(0, 3) == 0)
            {
                int day = calendar.Day + RNG.Generate(1, 8) + RNG.Generate(1, 8); // +2d8 days
                if (AmbitionApp.GetEvent(day) == null)
                {
                    PartyVO party = new PartyVO()
                    {
                        Day = day
                    };
                    AmbitionApp.SendMessage(PartyMessages.INITIALIZE_PARTY, party);
                }
            }
        }
Beispiel #5
0
        void Start()
        {
            ParisModel  model = AmbitionApp.GetModel <ParisModel>();
            LocationPin pin;
            bool        active;

            foreach (Transform child in Pins)
            {
                active = model.Locations.Contains(child.name);
                child.gameObject.SetActive(active);
                if (!active && !model.Visited.Contains(child.name))
                {
                    pin = child.GetComponent <LocationPin>();
                    if (!pin.Discoverable && AmbitionApp.CheckRequirements(pin.Requirements))
                    {
                        AmbitionApp.SendMessage(ParisMessages.ADD_LOCATION, pin.name);
                    }
                }
            }
        }
Beispiel #6
0
 public static bool CheckIncidentEligible(IncidentVO incident)
 {
     if (AmbitionApp.Story.IsComplete(incident?.ID, true))
     {
         return(false);
     }
     if (!AmbitionApp.CheckRequirements(incident.Requirements))
     {
         return(false);
     }
     if (incident.Chapters?.Length == 0)
     {
         return(true);
     }
     if (Array.IndexOf(incident.Chapters, AmbitionApp.Game.Chapter) >= 0)
     {
         return(true);
     }
     return(false);
     //return !AmbitionApp.Story.IsComplete(incident?.ID, true)
     //&& AmbitionApp.CheckRequirements(incident.Requirements)
     //&& (incident.Chapters?.Length == 0 || Array.IndexOf(incident.Chapters, AmbitionApp.Game.Chapter) >= 0);
 }
Beispiel #7
0
        public override void OnEnter()
        {
            CharacterModel model = AmbitionApp.GetModel <CharacterModel>();

            foreach (IncidentVO incident in model.ExitIncidents)
            {
                if (AmbitionApp.CheckRequirements(incident.Requirements))
                {
                    AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident);
                    break;
                }
            }
            model.Characters.TryGetValue(model.Rendezvous.Character, out CharacterVO character);
            if (character != null)
            {
                character.LiaisonDay = -1;
            }
            if (!AmbitionApp.Paris.Rendezvous.Contains(model.Rendezvous.Location))
            {
                AmbitionApp.Paris.Rendezvous.Add(model.Rendezvous.Location);
            }
            AmbitionApp.Paris.Exploration.Remove(model.Rendezvous.Location);
            AmbitionApp.SendMessage(GameMessages.ADD_EXHAUSTION);
        }