public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.GetModel <IncidentModel>().Schedule(model.Party?.ExitIncident); }
public void Execute(EnemyVO guest) { if (guest.IsLockedIn) { return; // Don't bother if the guest is already locked in } PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO remark = model.Remark; float levelBonus = (AmbitionApp.GetModel <GameModel>().Level >= 4) ? 1.25f : 1.0f; float ReparteBonus = 1.0f + (model.Repartee ? AmbitionApp.GetModel <PartyModel>().ReparteeBonus : 0f); // Determine reaction to remark string key = remark.Interest == guest.Like ? PartyConstants.LIKE : remark.Interest == guest.Dislike ? PartyConstants.DISLIKE : PartyConstants.NEUTRAL; if (key == PartyConstants.DISLIKE && model.ItemEffect) { model.ItemEffect = false; return; } // Adjust guest according to configued reaction RemarkResult result = partyModel.RemarkResults[key]; guest.Opinion += (int)(((float)RNG.Generate(result.OpinionMin, result.OpinionMax)) * ReparteBonus * levelBonus); if (guest.Opinion >= 100) { guest.Opinion = 100; guest.State = GuestState.Charmed; AmbitionApp.SendMessage(PartyMessages.FREE_REMARK); AmbitionApp.SendMessage(PartyMessages.FREE_REMARK); AmbitionApp.SendMessage(PartyMessages.GUEST_CHARMED, guest); } else if (guest.Opinion <= 0) { guest.Opinion = 0; guest.State = GuestState.PutOff; AmbitionApp.SendMessage(PartyMessages.GUEST_OFFENDED, guest); } else { switch (key) { case PartyConstants.LIKE: AmbitionApp.SendMessage(PartyMessages.GUEST_REACTION_POSITIVE, guest); break; case PartyConstants.DISLIKE: AmbitionApp.SendMessage(PartyMessages.GUEST_REACTION_NEGATIVE, guest); AmbitionApp.SendMessage(PartyMessages.FREE_REMARK); break; default: AmbitionApp.SendMessage(PartyMessages.GUEST_REACTION_NEUTRAL, guest); break; } } // So, there's a potential that the clock won't reset? Deal with that when it's a thing }
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; } }
void Awake() { _text = GetComponent <Text>(); HandleDate(AmbitionApp.GetModel <CalendarModel>().Today); }
public void Execute(ServantVO servant) { ServantModel model = AmbitionApp.GetModel <ServantModel>(); model.Introduce(servant); }
//This is how the localized text is put into all of the text boxes in the dialog public void SetPhrase() { Core.LocalizationModel localizationModel = AmbitionApp.GetModel <Core.LocalizationModel>(); string phrase = "peddle_influence_dialog"; //Setting up the dictionary for the necessary substitutions Dictionary <string, string> dialogSubstitutions = new Dictionary <string, string>(); dialogSubstitutions.Add("$GOSSIPNAME", _gossip.Name()); dialogSubstitutions.Add("$FACTION", _gossip.Faction); dialogSubstitutions.Add("$SHIFTAMOUNT", _gossip.PoliticalEffectValue().ToString()); dialogSubstitutions.Add("$CAUGHTODDS", localizationModel.GetString("gossip_caught_odds." + (int)(Mathf.Clamp(_inventoryModel.GossipSoldOrPeddled, 0, 9)))); //Performing the substitutions themselves BodyText.text = localizationModel.GetString(phrase + DialogConsts.BODY, dialogSubstitutions); TitleText.text = localizationModel.GetString(phrase + DialogConsts.TITLE, dialogSubstitutions); string str; if (DismissText != null) { str = localizationModel.GetString(phrase + DialogConsts.CANCEL, dialogSubstitutions); if (str != null && DismissText != null) { DismissText.text = str; } else { DismissText.text = localizationModel.GetString(DialogConsts.DEFAULT_CANCEL); } } if (IncreaseStatText != null) { if (_gossip.PowerShiftEffect())//If it's a power shift { str = localizationModel.GetString(phrase + ".increase_power", dialogSubstitutions); if (str != null && IncreaseStatText != null) { IncreaseStatText.text = str; } else { IncreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM); } } else //If it's an allegiance shift { str = localizationModel.GetString(phrase + ".increase_allegiance", dialogSubstitutions); if (str != null && IncreaseStatText != null) { IncreaseStatText.text = str; } else { IncreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM); } } } if (DecreaseStatText != null) { if (_gossip.PowerShiftEffect())//If it's a power shift { str = localizationModel.GetString(phrase + ".decrease_power", dialogSubstitutions); if (str != null && DecreaseStatText != null) { DecreaseStatText.text = str; } else { DecreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM); } } else //If it's an allegiance shift { str = localizationModel.GetString(phrase + ".decrease_allegiance", dialogSubstitutions); if (str != null && DecreaseStatText != null) { DecreaseStatText.text = str; } else { DecreaseStatText.text = localizationModel.GetString(DialogConsts.DEFAULT_CONFIRM); } } } }
public override bool Validate() { return(AmbitionApp.GetModel <CalendarModel>().Incident != null); }
public void Execute(string savedGameData) { GameModel game = AmbitionApp.Game; if (!game.Initialized) { AmbitionApp.Execute <InitGameCmd>(); } UFlowSvc uflow = AmbitionApp.GetService <UFlowSvc>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentModel story = AmbitionApp.Story; ParisModel paris = AmbitionApp.Paris; PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.GetService <ModelSvc>().Restore(savedGameData); PlayerConfig config = Resources.Load <PlayerConfig>(Filepath.PLAYERS + game.playerID); AmbitionApp.Execute <RestorePlayerCmd, PlayerConfig>(config); LocationVO location = paris.GetLocation(paris.Location); AmbitionApp.CloseAllDialogs(); AmbitionApp.SendMessage(AudioMessages.STOP_AMBIENT); AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC); uflow.Reset(); story.RestoreIncident(); foreach (string tutorialID in game.Tutorials) { AmbitionApp.Execute <TutorialReward, CommodityVO>(new CommodityVO() { Type = CommodityType.Tutorial, ID = tutorialID }); } UMachine flow = calendar.Day == 0 ? uflow.Instantiate(FlowConsts.GAME_CONTROLLER) : uflow.Instantiate(FlowConsts.DAY_FLOW_CONTROLLER); string sceneID = null; switch (game.Activity) { case ActivityType.Estate: if (story.Moment == null) { flow = RestoreEstate(flow, out sceneID); } else { flow = Restore(flow, MORNING_INCIDENT); } break; case ActivityType.Party: flow = Restore(flow, PARTY_STATE); if (story.Moment == null) { if (partyModel.TurnsLeft > 0) { Restore(flow, PARTY_MAP); sceneID = SceneConsts.MAP_SCENE; } else { Restore(flow, AFTER_PARTY); sceneID = SceneConsts.AFTER_PARTY_SCENE; } } else if (partyModel.Turn < 0) { flow = Restore(flow, PARTY_INTRO); } else if (partyModel.TurnsLeft > 0) { flow = Restore(flow, PARTY_ROOM); } else { flow = Restore(flow, PARTY_OUTTRO); } break; case ActivityType.Evening: flow = Restore(flow, EVENING_STATE); break; case ActivityType.Paris: flow = Restore(flow, PARIS_STATE); if (story.Moment != null) { flow = Restore(flow, PARIS_INCIDENT); } else { sceneID = location?.SceneID ?? SceneConsts.PARIS_SCENE; Restore(flow, sceneID == SceneConsts.PARIS_SCENE ? PARIS_STATE : PARIS_SCENE); } break; case ActivityType.Rendezvous: flow = Restore(flow, RENDEZVOUS_STATE); flow = Restore(flow, RENDEZVOUS_INCIDENT); break; } if (story.Moment != null) { Restore(flow, MOMENT); sceneID = SceneConsts.INCIDENT_SCENE; } if (!string.IsNullOrEmpty(sceneID)) { AmbitionApp.SendMessage(GameMessages.LOAD_SCENE, sceneID); } uflow.Execute(); AmbitionApp.SendMessage(GameMessages.GAME_LOADED); }
// TODO: Store them in order private string GetPowerString(int power) { return(AmbitionApp.GetModel <LocalizationModel>().GetString("power." + power.ToString())); }
public override void OnEnterState() { ParisModel paris = AmbitionApp.GetModel <ParisModel>(); AmbitionApp.SendMessage(GameMessages.LOAD_SCENE, paris.Location.Scene); }
public void Execute(string location) { AmbitionApp.GetModel <ParisModel>().Locations.Remove(location); }
public bool CheckRequirements(CommodityVO[] requirments) { GameModel model = AmbitionApp.GetModel <GameModel>(); foreach (CommodityVO req in requirments) { switch (req.Type) { case CommodityType.Item: InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); ItemVO item = inventory.Inventory.Find(i => i.Name == req.ID); if (item == null || item.Quantity < req.Value) { return(false); } break; case CommodityType.Livre: if (model.Livre < req.Value) { return(false); } break; case CommodityType.Location: ParisModel paris = AmbitionApp.GetModel <ParisModel>(); if (!paris.Locations.Contains(req.ID)) { return(false); } break; case CommodityType.Reputation: FactionModel factions = AmbitionApp.GetModel <FactionModel>(); return((req.ID != null && factions.Factions.ContainsKey(req.ID)) ? factions[req.ID].Reputation >= req.Value : model.Reputation >= req.Value); case CommodityType.Servant: ServantModel servants = AmbitionApp.GetModel <ServantModel>(); if (!servants.Servants.ContainsKey(req.ID)) { return(false); } break; case CommodityType.Date: CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); if (calendar.Today.Ticks < req.Value) { return(false); } break; case CommodityType.Mark: MapModel map = AmbitionApp.GetModel <MapModel>(); return(Array.Exists(map.Map.Rooms, r => r.HostHere && r.Cleared)); } } return(true); }
public void Submit() { AmbitionApp.GetModel <CharacterModel>().CreateRendezvous = _rendez; AmbitionApp.SendMessage(RendezvousMessages.CHOOSE_RENDEZVOUS); Close(); }
private void OnEnable() { HandleRoom(AmbitionApp.GetModel <MapModel>().Room); }
public void Execute(int intoxication) { PartyModel model = AmbitionApp.GetModel <PartyModel>(); PartyVO party = model.Party; if (intoxication >= party.MaxIntoxication) { InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); ItemVO item; //Determine Random Effect switch (Util.RNG.Generate(0, 10)) { case 0: model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, -Util.RNG.Generate(20, 51))); break; case 1: model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, party.Faction, -Util.RNG.Generate(20, 51))); break; // Outfit penalized case 2: item = inventory.GetEquipped(ItemConsts.OUTFIT); if (item is OutfitVO) { ((OutfitVO)item).Novelty -= Util.RNG.Generate(20, 51); } break; // Outfit Ruined case 3: item = inventory.GetEquipped(ItemConsts.OUTFIT); if (item is OutfitVO) { model.Party.Rewards.Add(new CommodityVO(CommodityType.Item, item.Name, -1)); } break; // Accessory Lost case 4: item = inventory.GetEquipped(ItemConsts.ACCESSORY); if (item != null) { model.Party.Rewards.Add(new CommodityVO(CommodityType.Item, item.Name, -1)); } else { model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, -Util.RNG.Generate(30, 61))); } break; // Livre Lost case 5: model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, -Util.RNG.Generate(30, 61))); break; // Enemy made case 6: model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, party.Faction)); break; // Forgot gossip case 7: model.Party.Rewards.RemoveAll(r => r.Type == CommodityType.Gossip); { model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, party.Faction)); } break; case 8: switch (Util.RNG.Generate(0, 6)) { case 1: model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, Util.RNG.Generate(20, 51))); break; case 2: model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, party.Faction, Util.RNG.Generate(20, 51))); break; case 3: model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, Util.RNG.Generate(30, 61))); break; case 4: model.Party.Rewards.Add(new CommodityVO(CommodityType.Gossip, party.Faction, 1)); break; default: EnemyVO enemy = Util.RNG.TakeRandom(party.Enemies); if (enemy != null) { model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, enemy.Name, -1)); } else { model.Party.Rewards.Add(new CommodityVO(CommodityType.Gossip, party.Faction, 1)); } break; } break; } } }
void UpdateInfo() { FactionModel model = AmbitionApp.GetModel <FactionModel>(); //---- Crown Info ---- if (model["Crown"].Level >= 8) { crownInfo.text = "- The Royalty and members of high ranking nobility alligned with them" + "\n- Like Expensive but Modest Clothes" + "\n- Power: " + GetPowerString(model["Crown"].Power) + " (Faction Benefit)"; } else if (model["Crown"].Level >= 6) { crownInfo.text = "- The Royalty and members of high ranking nobility alligned with them" + "\n- Like Expensive but Modest Clothes" + "\n- Power: " + GetPowerString(model["Crown"].Power) + " (Faction Benefit)"; } else { crownInfo.text = "- The Royalty and members of high ranking nobility alligned with them" + "\n- Like Expensive but Modest Clothes" + "\n- Power: " + model["Crown"].knownPower + " " + ConvertKnowledgeTimer(_powerTimers["Crown"]); } //---- Church Info ---- if (model["Church"].Level >= 8) { churchInfo.text = "- The Clergy and those alligned with them" + "\n- Like Vintage and Modest Clothes" + "\n- Allegiance: " + GetAllegianceString(model["Church"].Allegiance) + " (Faction Benefit)" + "\n- Power: " + GetPowerString(model["Church"].Power) + " (Faction Benefit)"; } else if (model["Church"].Level >= 6) { churchInfo.text = "- The Clergy and those alligned with them" + "\n- Like Vintage and Modest Clothes" + "\n- Allegiance: " + model["Church"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Church"]) + "\n- Power: " + GetPowerString(model["Church"].Power) + " (Faction Benefit)"; } else { churchInfo.text = "- The Clergy and those alligned with them" + "\n- Like Vintage and Modest Clothes" + "\n- Allegiance: " + model["Church"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Church"]) + "\n- Power: " + model["Church"].knownPower + " " + ConvertKnowledgeTimer(_powerTimers["Church"]); } //---- Military Info ---- if (model["Military"].Level >= 8) { militaryInfo.text = "- The Generals and Troops of the armed forces and those alligned with them" + "\n- Couldn't care less about your clothes" + "\n- Allegiance: " + GetAllegianceString(model["Military"].Allegiance) + " (Faction Benefit)" + "\n- Power: " + GetPowerString(model["Military"].Power) + " (Faction Benefit)"; } else if (model["Military"].Level >= 6) { militaryInfo.text = "- The Generals and Troops of the armed forces and those alligned with them" + "\n- Couldn't care less about your clothes" + "\n- Allegiance: " + model["Military"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Military"]) + "\n- Power: " + GetPowerString(model["Military"].Power) + " (Faction Benefit)"; } else { militaryInfo.text = "- The Generals and Troops of the armed forces and those alligned with them" + "\n- Couldn't care less about your clothes" + "\n- Allegiance: " + model["Military"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Military"]) + "\n- Power: " + model["Military"].knownPower + " " + ConvertKnowledgeTimer(_powerTimers["Military"]); } //---- Bourgeoisie Info ---- if (model["Bourgeoisie"].Level >= 8) { bourgeoisieInfo.text = "- The newly wealthy Mercantile class" + "\n- Like clothes that are Luxurious and Racy" + "\n- Allegiance: " + GetAllegianceString(model["Bourgeoisie"].Allegiance) + " (Faction Benefit)" + "\n- Power: " + GetPowerString(model["Bourgeoisie"].Power) + " (Faction Benefit)"; } else if (model["Bourgeoisie"].Level >= 6) { bourgeoisieInfo.text = "- The newly wealthy Mercantile class" + "\n- Like clothes that are Luxurious and Racy" + "\n- Allegiance: " + model["Bourgeoisie"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Bourgeoisie"]) + "\n- Power: " + GetPowerString(model["Bourgeoisie"].Power) + " (Faction Benefit)"; } else { bourgeoisieInfo.text = "- The newly wealthy Mercantile class" + "\n- Like clothes that are Luxurious and Racy" + "\n- Allegiance: " + model["Bourgeoisie"].knownAllegiance + " " + ConvertKnowledgeTimer(_allegianceTimers["Bourgeoisie"]) + "\n- Power: " + model["Bourgeoisie"].knownPower + " " + ConvertKnowledgeTimer(_powerTimers["Bourgeoisie"]); } //---- Third Estate Info ---- if (model["Third Estate"].Level >= 8) { revolutionInfo.text = "- The unhappy Common Man along with the Academics and Artists alligned with them" + "\n - Like clothes that are Vintage and Racy" + "\n- Power: " + GetPowerString(model["Third Estate"].Power) + " (Faction Benefit)"; } else if (model["Third Estate"].Level >= 6) { revolutionInfo.text = "- The unhappy Common Man along with the Academics and Artists alligned with them" + "\n - Like clothes that are Vintage and Racy" + "\n- Power: " + GetPowerString(model["Third Estate"].Power) + " (Faction Benefit)"; } else { revolutionInfo.text = "- The unhappy Common Man along with the Academics and Artists alligned with them" + "\n - Like clothes that are Vintage and Racy" + "\n- Power: " + model["Third Estate"].knownPower + " " + ConvertKnowledgeTimer(_powerTimers["Third Estate"]); } }
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); } } } } } }
void OnEnable() { _model = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.Subscribe <int>(GameConsts.DRINK, HandleDrink); HandleDrink(_model.Drink); }
public void Execute(DateTime day) { FactionModel fmod = AmbitionApp.GetModel <FactionModel>(); string victoriousPower; //Establish each Faction's final Power float crownFinalPower = fmod["Crown"].Power * 100; float revolutionFinalPower = fmod["Third Estate"].Power * 100; if (fmod["Church"].Allegiance > 0) { crownFinalPower += (Math.Abs((float)(fmod["Church"].Allegiance / 2)) * fmod["Church"].Power); } else if (fmod["Church"].Allegiance < 0) { revolutionFinalPower += (Math.Abs((float)(fmod["Church"].Allegiance / 2)) * fmod["Church"].Power); } if (fmod["Military"].Allegiance > 0) { crownFinalPower += (Math.Abs((float)(fmod["Military"].Allegiance / 2)) * fmod["Military"].Power); } else if (fmod["Military"].Allegiance < 0) { revolutionFinalPower += (Math.Abs((float)(fmod["Military"].Allegiance / 2)) * fmod["Military"].Power); } if (fmod["Bourgeoisie"].Allegiance > 0) { crownFinalPower += (Math.Abs((float)(fmod["Bourgeoisie"].Allegiance / 2)) * fmod["Bourgeoisie"].Power); } else if (fmod["Bourgeoisie"].Allegiance < 0) { revolutionFinalPower += (Math.Abs((float)(fmod["Bourgeoisie"].Allegiance / 2)) * fmod["Bourgeoisie"].Power); } //Compare Final Powers (who won and by what degree?) victoriousPower = crownFinalPower >= revolutionFinalPower ? "Crown" : "Third Estate"; // isDecisive = Math.Abs(crownFinalPower - revolutionFinalPower) > 50; //Calculate Player Allegiance if (fmod["Crown"].Reputation > fmod["Third Estate"].Reputation) { GameData.Allegiance = "Crown"; } else if (fmod["Third Estate"].Reputation > fmod["Crown"].Reputation) { GameData.Allegiance = "Third Estate"; } else // If it's equal then you get shuffled onto the losing team of History { GameData.Allegiance = "Unknown"; } //Go to the End Screen if (GameData.Allegiance == victoriousPower) { GameData.playerVictoryStatus = "Political Victory"; } else { GameData.playerVictoryStatus = "Political Loss"; } AmbitionApp.SendMessage <string>(GameMessages.LOAD_SCENE, "Game_EndScreen"); }
public override void OnEnterState() { PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RoomVO room = model.Room; GuestVO guest; GuestVO[] guests = model.Guests; _phrases = AmbitionApp.GetModel <LocalizationModel>(); // This ensures that previous guest formations stay consistent if (guests == null || guests.Length == 0) { // TODO: Determine how to vary this number guests = new GuestVO[4]; } for (int i = guests.Length - 1; i >= 0; i--) { if (guests[i] == null) { guest = new GuestVO(); if (RNG.Generate(2) == 0) { guest.Gender = Gender.Female; guest.Title = GetRandomDescriptor("female_title"); guest.FirstName = GetRandomDescriptor("female_name"); } else { guest.Gender = Gender.Male; guest.Title = GetRandomDescriptor("male_title"); guest.FirstName = GetRandomDescriptor("male_name"); } guest.LastName = GetRandomDescriptor("last_name"); guest.LastName = "aeiouAEIOU".Contains(guest.LastName.Substring(0, 1)) ? (" d'" + guest.LastName) : (" de " + guest.LastName); guests[i] = guest; } } if (!room.Cleared) { int likeIndex; GuestDifficultyVO stats = partyModel.GuestDifficultyStats[room.Difficulty - 1]; string[] interests = partyModel.Interests; if (room.Actions != null) { AmbitionApp.SendMessage(room.Actions); } foreach (GuestVO g in guests) { g.Opinion = RNG.Generate(stats.Opinion[0], stats.Opinion[1]); likeIndex = RNG.Generate(interests.Length); g.Like = interests[likeIndex]; g.Dislike = interests[(likeIndex + 1) % interests.Length]; } // All Variety of Likes final check if (Array.TrueForAll(guests, g => g.Like == guests[0].Like)) { guest = RNG.TakeRandom(guests); likeIndex = RNG.Generate(interests.Length); guest.Like = interests[likeIndex]; guest.Dislike = interests[(likeIndex + 1) % interests.Length]; } } model.Guests = guests; model.Round = 0; model.Remark = null; model.FreeRemarkCounter = partyModel.FreeRemarkCounter; model.Repartee = false; model.RemarksBought = 0; }
public override void Initialize() { _inventory = AmbitionApp.GetModel <InventoryModel>(); AmbitionApp.Subscribe(PartyMessages.START_PARTY, HandleCheckOutfit); }
void Start() { PartyVO party = AmbitionApp.GetModel <PartyModel>().Party; PartyText.text = party.Name; if (party.Host != null) { PartyText.text += (" - " + party.Host); } PartyImportanceValueText.text = party.Importance.ToString(); NoveltyLossValueText.text = "-" + inventory.NoveltyDamage.ToString(); FactionIcon.sprite = FactionIconConfig.GetSprite(party.Faction); //Setting all these values to blank to zero in order to override the placeholder stuff int livre = 0; int rep = 0; RewardText.text = ""; GossipText.text = ""; foreach (CommodityVO reward in party.Rewards) { switch (reward.Type) { case CommodityType.Gossip: GossipText.text += "- " + localizationModel.GetString("commodity." + reward.Type.ToString().ToLower() + ".name") + "\n"; print("Gossip Item Added!"); break; case CommodityType.Livre: livre += reward.Value; break; case CommodityType.Reputation: rep += reward.Value; break; case CommodityType.Item: RewardText.text += "- " + localizationModel.GetString("commodity." + reward.ID.ToLower() + ".name") + "\n"; break; } } if (GossipText.text == "") { GossipText.text = localizationModel.GetString("commodity.none.name"); } if (RewardText.text == "") { RewardText.text = localizationModel.GetString("commodity.none.name"); } RepGainIcon.enabled = rep >= 0; RepLossIcon.enabled = rep < 0; if (rep >= 0) { ReputationText.text = "+"; } else { ReputationText.text = ""; } ReputationText.text += rep.ToString(); LivreText.text = "+ £" + livre.ToString(); }
private void HandleDate(DateTime t) { _text.text = AmbitionApp.GetModel <LocalizationModel>().GetList("month")[t.Month - 1]; }
public void Done() { AmbitionApp.SendMessage(PartyMessages.END_PARTY); AmbitionApp.GetModel <PartyModel>().Party = null; }
public override void OnEnterState() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); PartyVO party = model.Party; InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); FactionVO faction = AmbitionApp.GetModel <FactionModel>()[party.Faction]; OutfitVO outfit = inventory.Equipped[ItemConsts.OUTFIT] as OutfitVO; // TODO: Passive buff system //Is the Player using the Fascinator Accessory? If so then allow them to ignore the first negative comment! ItemVO item; if (inventory.Equipped.TryGetValue(ItemConsts.ACCESSORY, out item) && item != null) { switch (item.Name) { case "Garter Flask": //model.AddBuff(GameConsts.DRINK, ItemConsts.ACCESSORY, 1.0f, 1.0f); break; case "Fascinator": AmbitionApp.GetModel <ConversationModel>().ItemEffect = true; break; case "Snuff Box": model.Party.MaxIntoxication += 5; break; } } //Is the Player decent friends with the Military? If so, make them more alcohol tolerant! // TODO: why? if (AmbitionApp.GetModel <FactionModel>()[FactionConsts.MILITARY].Level >= 3) { model.Party.MaxIntoxication += 3; } model.Drink = 0; model.Intoxication = 0; float outfitScore = 400 - Math.Abs(faction.Modesty - outfit.Modesty) - Math.Abs(faction.Luxury - outfit.Luxury); ConversationModel conversation = AmbitionApp.GetModel <ConversationModel>(); int num = model.DeckSize + (int)(outfitScore * (float)(outfit.Novelty) * 0.001f) + faction.DeckBonus + AmbitionApp.GetModel <GameModel>().DeckBonus; int[] remarkids = Enumerable.Range(0, num).ToArray(); int index; int tmp; string interest; int numTargets; int targetIndex = (int)(num * .5f); // Fifty-fifty one or two targets conversation.Deck = new Queue <RemarkVO>(); conversation.Discard = new List <RemarkVO>(); for (int i = num - 1; i >= 0; i--) { index = Util.RNG.Generate(i); tmp = remarkids[i]; remarkids[i] = remarkids[index]; remarkids[index] = tmp; interest = model.Interests[remarkids[i] % model.Interests.Length]; numTargets = remarkids[i] > targetIndex ? 2 : 1; conversation.Deck.Enqueue(new RemarkVO(numTargets, interest)); } // TODO: Commandify and insert after entering map for first time //Damage the Outfit's Novelty, now that the Confidence has already been Tallied AmbitionApp.SendMessage(InventoryMessages.DEGRADE_OUTFIT, outfit); // string introText = AmbitionApp.GetString("party.intro." + party.ID + ".body"); // if (introText != null) AmbitionApp.OpenMessageDialog("party.intro." + party.ID); }
override protected string GetValue() { string scene = AmbitionApp.GetModel <GameModel>().Scene; return(scene != null ? scene : Value); }
void OnEnable() { _btn = GetComponent <Button>(); AmbitionApp.Subscribe <int>(GameConsts.DRINK, HandleDrink); HandleDrink(AmbitionApp.GetModel <PartyModel>().Drink); }
public void Initialize() { _map = AmbitionApp.GetModel <MapModel>(); _model = AmbitionApp.GetModel <PartyModel>(); _remarks = new RemarkVO[_model.HandSize]; }
void Awake() { _label = GetComponent <Text>(); _model = AmbitionApp.GetModel <PartyModel>(); }
// Use this for initialization void Start() { _model = AmbitionApp.GetModel <InventoryModel>(); myText = GetComponent <Text>(); }