private void Start() { CalendarModel calendar = AmbitionApp.Calendar; GameModel model = AmbitionApp.GetModel <GameModel>(); AmbitionApp.SendMessage(GameMessages.HIDE_HEADER); AmbitionApp.SendMessage(AudioMessages.STOP_AMBIENT); AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC); ChapterVO chapter = Array.Find(model.Chapters, d => d.Date == calendar.Today); if (chapter.Splash != null) { Splash.sprite = chapter.Splash; } Title.text = AmbitionApp.Localize(chapter.ID); Date.text = AmbitionApp.GetModel <LocalizationModel>().Date; if (!string.IsNullOrWhiteSpace(chapter.Sting.Name)) { AmbitionApp.SendMessage(AudioMessages.PLAY, chapter.Sting); } else if (!string.IsNullOrWhiteSpace(AudioSting.Name)) { AmbitionApp.SendMessage(AudioMessages.PLAY, AudioSting); } }
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); } } }
public void Execute(PartyVO party) { CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); GameModel game = AmbitionApp.Game; CalendarModel calendar = AmbitionApp.Calendar; IncidentModel story = AmbitionApp.Story; PartyModel model = AmbitionApp.GetModel <PartyModel>(); if (string.IsNullOrEmpty(party.ID) || !model.LoadParty(party.ID, out party)) { party.ID = null; if (party.Faction == FactionType.None) { List <FactionType> factions = new List <FactionType>(AmbitionApp.Politics.Factions.Keys); factions.Remove(FactionType.None); party.Faction = RNG.TakeRandom(factions); } } if (string.IsNullOrEmpty(party.Host)) { string gender = RNG.Generate(2) < 1 ? "male" : "female"; string[] host = new string[3]; IEnumerable <string> locs = AmbitionApp.GetPhrases(gender + "_title").Values; host[0] = RNG.TakeRandom(locs); locs = AmbitionApp.GetPhrases(gender + "_name").Values; host[1] = RNG.TakeRandom(locs); locs = AmbitionApp.GetPhrases("last_name").Values; host[2] = RNG.TakeRandom(locs); party.Host = string.Join(" ", host); } if (party.Size == PartySize.None) { ChapterVO chapter = AmbitionApp.Game.GetChapter(); int chance = RNG.Generate(chapter.TrivialPartyChance + chapter.DecentPartyChance + chapter.GrandPartyChance); if (chance < chapter.GrandPartyChance) { party.Size = PartySize.Grand; } else if (chance < chapter.DecentPartyChance + chapter.GrandPartyChance) { party.Size = PartySize.Decent; } else { party.Size = PartySize.Trivial; } } if (party.phrases?.Length != 4) { party.phrases = new int[4]; party.phrases[0] = GetRandomPhrase(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower()); party.phrases[1] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_INTRO); party.phrases[2] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_ADJECTIVE); party.phrases[3] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_NOUN); } switch (party.RSVP) { case RSVP.Accepted: case RSVP.Required: AmbitionApp.SendMessage(PartyMessages.ACCEPT_INVITATION, party); break; case RSVP.Declined: AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, party); break; default: if (party.Day >= 0) { AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, party); } break; } }
public void Execute(CalendarModel calendar) { RendezVO[] rendezs = calendar.GetOccasions <RendezVO>(calendar.Day - 1); CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); CharacterVO notable; ChapterVO chapter = AmbitionApp.Game.GetChapter(); // Let down notables who haven't responded to your invitations rendezs = Array.FindAll(rendezs, r => r.RSVP == RSVP.New && r.IsCaller); foreach (RendezVO rendez in rendezs) { notable = characters.GetCharacter(rendez.Character); if (notable != null) { notable.LiaisonDay = -1; } rendez.RSVP = RSVP.Declined; // The Command penalizes the player; we're avoiding that here AmbitionApp.SendMessage(rendez); } if ((chapter.TrivialPartyChance + chapter.DecentPartyChance + chapter.GrandPartyChance > 0) && (int)(calendar.Today.DayOfWeek) % 7 == 6) // For whatever reason, DateTime weeks start on Monday { List <string> locations; CalendarEvent[] events; bool doSchedule; foreach (CharacterVO character in characters.Characters.Values) { if (character.IsDateable && character.LiaisonDay < 0 && RNG.Generate(100) < characters.LiaisonChance) { int day = calendar.Day + RNG.Generate(2, 6); events = AmbitionApp.GetEvents(day); doSchedule = (!Array.Exists(events, e => e is RendezVO) && !Array.Exists(events, e => e.IsAttending)); if (!doSchedule) { events = AmbitionApp.GetEvents(++day); doSchedule = (!Array.Exists(events, e => e is RendezVO) && !Array.Exists(events, e => e.IsAttending)); } if (doSchedule) { locations = new List <string>(character.FavoredLocations); if (locations.Count == 0) { locations = new List <string>(AmbitionApp.Paris.Rendezvous); locations.RemoveAll(l => Array.IndexOf(character.OpposedLocations, l) >= 0); } if (locations.Count > 0) // If there's no viable locations, skip it { RendezVO liaison = new RendezVO() { Created = -1, ID = character.ID, Day = day, Location = RNG.TakeRandom(locations), RSVP = RSVP.New, IsCaller = false }; character.LiaisonDay = day; AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, liaison); } } } } } }