public override void OnOpen(LocationConfig config) { bool rendezvousMode = AmbitionApp.GetModel <CharacterModel>().CreateRendezvousMode; ParisModel paris = AmbitionApp.Paris; IncidentModel story = AmbitionApp.Story; LocationVO location = paris.SaveLocation(config); _incident = story.GetIncident(config.IntroIncidentConfig?.name); _location = config.name; LocationNameText.text = AmbitionApp.Localize(ParisConsts.LABEL + _location); LocationDescriptionText.text = AmbitionApp.Localize(ParisConsts.DESCRIPTION + _location); LocationImage.sprite = config.LocationModalSprite; GoButtonText.text = AmbitionApp.Localize(rendezvousMode ? ParisConsts.PICK_LOC_BTN_LABEL : ParisConsts.GO_LOC_BTN_LABEL); if (!AmbitionApp.CheckIncidentEligible(_incident) && config.StoryIncidentConfigs != null) { foreach (IncidentConfig icon in config.StoryIncidentConfigs) { if (AmbitionApp.CheckIncidentEligible(icon?.name)) { _incident = story.GetIncident(icon.name); } } } List.SetIncident(_incident); }
public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentModel story = AmbitionApp.Story; PartyVO party = AmbitionApp.GetModel <PartyModel>().Party; IncidentVO incident = story.GetIncident(party?.IntroIncident); LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); AmbitionApp.Game.Activity = ActivityType.Party; model.Turn = -1; model.Incidents = null; if (party == null) { model.Turns = 0; } else { string[] names = Enum.GetNames(typeof(PartySize)); int index = Array.IndexOf(names, party.Size.ToString()); if (index < 0) { index = 0; } if (index < model.NumTurnsByPartySize.Length) { model.Turns = model.NumTurnsByPartySize[index]; } else { model.Turns = model.NumTurnsByPartySize[model.NumTurnsByPartySize.Length - 1]; } if (party.RequiredIncidents?.Length > model.Turns) { model.Turns = party.RequiredIncidents.Length; } } if (incident == null) { IncidentVO[] incidents = AmbitionApp.Story.GetIncidents(IncidentType.PartyIntro); IncidentVO[] candidates = Array.FindAll(incidents, i => Array.IndexOf(i.Factions, party.Faction) >= 0); if (candidates.Length == 0) { candidates = Array.FindAll(incidents, i => ((i.Factions?.Length ?? 0) == 0 || (i.Factions.Length == 1 && i.Factions[0] == FactionType.None))); } incident = Util.RNG.TakeRandom(candidates); } loc.SetPartyOutfit(AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO); loc.SetParty(party); AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident); }
public void Execute(CalendarModel calendar) { IncidentModel story = AmbitionApp.Story; IncidentVO incident = story.Incident; if (incident == null && Util.RNG.Generate(100) < AmbitionApp.Game.PoliticalChance) { string[] incidentIDs = story.Types[IncidentType.Political]; List <IncidentVO> incidents = new List <IncidentVO>(); foreach (string incidentID in incidentIDs) { incident = story.GetIncident(incidentID); if (AmbitionApp.CheckIncidentEligible(incident) && !incident.IsScheduled) { incidents.Add(incident); } } if (incidents.Count > 0) { incident = Util.RNG.TakeRandom(incidents); AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident); } } }
public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); IncidentVO[] incidents = new IncidentVO[model.NumRooms]; IncidentModel story = AmbitionApp.Story; if (model.Incidents != null) { incidents = new IncidentVO[model.NumRooms]; for (int i = model.NumRooms - 1; i >= 0; --i) { incidents[i] = story.GetIncident(model.Incidents[i]); } } else { HashSet <string> characters = new HashSet <string>(); if (model.RequiredIncident != null) { int index = RNG.Generate(model.NumRooms); incidents[index] = story.GetIncident(model.RequiredIncident); } else { List <IncidentVO> result = new List <IncidentVO>(); IncidentVO incident; if (model.Party.SupplementalIncidents != null) { string[] shuffle = RNG.Shuffle(model.Party.SupplementalIncidents); foreach (string incidentID in shuffle) { incident = story.GetIncident(incidentID); if (result.Count < model.NumRooms) { if (FindCharacters(incident, characters)) { result.Add(incident); } } } } if (result.Count < model.NumRooms) { incidents = story.GetIncidents(IncidentType.Party); incidents = RNG.Shuffle(incidents); foreach (IncidentVO rand in incidents) { if (AmbitionApp.CheckIncidentEligible(rand) && (rand.Factions?.Length == 0 || Array.IndexOf(rand.Factions, model.Party.Faction) >= 0) && FindCharacters(rand, characters)) { result.Add(rand); } if (result.Count >= model.NumRooms) { break; } } } while (result.Count < model.NumRooms) { result.Add(null); } incidents = RNG.Shuffle(result); } model.Incidents = new string[model.NumRooms]; for (int i = model.NumRooms - 1; i >= 0; --i) { model.Incidents[i] = incidents[i]?.ID; } } AmbitionApp.SendMessage(PartyMessages.SELECT_INCIDENTS, incidents); string title = AmbitionApp.Localize(PartyConstants.PARTY_NAME + model.Party.ID); if (string.IsNullOrEmpty(title)) { title = PartyConstants.PARTY_REASON + model.Party.Faction.ToString().ToLower() + "." + model.Party.phrases[0]; } AmbitionApp.SendMessage(GameMessages.SHOW_HEADER, title); }