public void Execute(PartyVO party) { CalendarModel calendar = AmbitionApp.Calendar; if (party == null || party.Day < calendar.Day) { return; } PartyModel model = AmbitionApp.GetModel <PartyModel>(); List <PartyVO> parties = new List <PartyVO>(calendar.GetOccasions <PartyVO>(party.Day)); RendezVO[] rendezs = calendar.GetOccasions <RendezVO>(party.Day); parties.Remove(party); if (party.RSVP == RSVP.Required || (!parties.Exists(p => p.IsAttending) && !Array.Exists(rendezs, r => r.IsAttending))) { parties.ForEach(p => AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, p)); Array.ForEach(rendezs, p => AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, p)); if (party.RSVP != RSVP.Required) { party.RSVP = RSVP.Accepted; } if (party.RSVP != RSVP.Required && party.Created == calendar.Day) { CommodityVO reward = new CommodityVO(CommodityType.Credibility, model.AcceptInvitationBonus); AmbitionApp.SendMessage(reward); } AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, party); // Dispatches Broadcast() } else { AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, party); } }
public void Execute(RoomVO room) { PartyModel party = AmbitionApp.GetModel <PartyModel>(); ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO[] hand = model.Remarks; string interest; int numGuests = model.Guests.Length; int i; for (i = hand.Length - 1; i >= party.AmbushHandSize - 1; i--) { hand[i] = new RemarkVO(); } while (hand[i] == null) { interest = Util.RNG.TakeRandom(party.Interests); hand[i] = new RemarkVO(Util.RNG.Generate(1, 3), interest); i--; } model.Remarks = hand; AmbitionApp.OpenDialog <RoomVO>(DialogConsts.ROOM, room); Dictionary <string, string> subs = new Dictionary <string, string>() { { "$ROOMNAME", room.Name } }; AmbitionApp.OpenMessageDialog("ambush_dialog", subs); }
private void OnEnable() { PartyModel party = AmbitionApp.GetModel <PartyModel>(); CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); CalendarEvent cEvent = party.Party as CalendarEvent ?? characters.Rendezvous as CalendarEvent; FactionType faction = FactionType.None; LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); int exhaustion = AmbitionApp.Game.Exhaustion; int[] penalties = AmbitionApp.Game.ExhaustionPenalties; int exhaustionPenalty; LoadOutGameObject.SetActive(cEvent != null); if (cEvent is PartyVO) { string str = AmbitionApp.Localize(PartyConstants.PARTY_DESCRIPTION + cEvent.ID); PartyVO pty = (PartyVO)cEvent; CharacterVO host = characters.GetCharacter(pty.Host); NameText.text = loc.GetPartyName(pty); ButtonText.text = AmbitionApp.Localize("calendar.btn.party"); faction = (cEvent as PartyVO).Faction; DescriptionText.text = string.IsNullOrEmpty(str) ? loc.GetFormalName(host, pty.Host) + " " + loc.GetPartyInvitation(pty, host) : str; TooltipText.text = AmbitionApp.Localize("party_" + faction.ToString().ToLower() + "_likes_and_dislikes"); } else if (cEvent is RendezVO) { CharacterVO character = characters.GetCharacter(((RendezVO)cEvent).Character); faction = character?.Faction ?? FactionType.None; NameText.text = AmbitionApp.Localize(CharacterConsts.LOC_NAME + cEvent.ID); ButtonText.text = AmbitionApp.Localize("calendar.btn.rendezvous"); DescriptionText.text = AmbitionApp.Localize(ParisConsts.DESCRIPTION + (cEvent as RendezVO).Location); TooltipText.text = AmbitionApp.Localize("rendezvous_" + faction.ToString().ToLower() + "_likes_and_dislikes"); } else { TooltipText.text = null; } FactionSymbol.enabled = faction != FactionType.None; PlayerStatus.gameObject.SetActive(exhaustion != 0); ExhaustionLabel.text = AmbitionApp.Localize(exhaustion > 0 ? EXHAUSTED_LOC : WELL_RESTED_LOC); exhaustionPenalty = exhaustion < 0 ? AmbitionApp.Game.WellRestedBonus : exhaustion >= penalties.Length ? penalties[penalties.Length - 1] : penalties[exhaustion]; subs[EFFECT_TOKEN] = exhaustionPenalty > 0 ? (" + " + exhaustionPenalty) : exhaustionPenalty.ToString(); ExhaustionValue.text = AmbitionApp.Localize(STATUS_EFFECT_LOC, subs); FactionSymbol.sprite = FactionSymbols.GetSprite(faction.ToString()); ExhaustionIcon.sprite = exhaustion < 0 ? ExhaustionIcons[0] : exhaustion < ExhaustionIcons.Length ? ExhaustionIcons[exhaustion] : ExhaustionIcons[ExhaustionIcons.Length]; ExhaustionValue.color = exhaustion < 0 ? RestedBonusColor : ExhaustionPenaltyColor; }
public void Execute(RoomVO room) { // If Current Room is null, you're probably jumping into the foyer. MapModel model = AmbitionApp.GetModel <MapModel>(); PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); if (model.Room != null && !model.Room.Cleared) { int chance = model.Room.MoveThroughChance; InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); ItemVO accessory; // TODO: Implement Item states if (inventory.Equipped.TryGetValue("accessory", out accessory) && accessory.Name == "Cane") { chance = ((chance < 90) ? (chance + 10) : 100); } //TODO: MoveThrough vs Ambush // if (rnd.Next(100) < chance) } if (!room.Visited) { AmbitionApp.SendMessage(room.Actions); room.Visited = true; } model.Room = room; foreach (RoomVO rm in model.Map.Rooms) { if (!rm.Revealed && rm.IsAdjacentTo(room)) { rm.Revealed = true; AmbitionApp.SendMessage(rm); } } // Fill yer glass if (Array.IndexOf(room.Features, PartyConstants.PUNCHBOWL) >= 0) { AmbitionApp.SendMessage(PartyMessages.REFILL_DRINK); } // At a certain reputation level, the player's glass may be filled without a punchbowl else if (!room.Cleared && partyModel.Drink < partyModel.MaxDrinkAmount && AmbitionApp.GetModel <FactionModel>()[partyModel.Party.Faction].Level >= 5 && Util.RNG.Generate(0, 4) == 0) { partyModel.Drink = partyModel.MaxDrinkAmount; Dictionary <string, string> subs = new Dictionary <string, string>() { { "$HOSTNAME", partyModel.Party.Host } }; AmbitionApp.OpenMessageDialog("refill_wine_dialog", subs); } }
public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); if (model.RequiredIncident == null) { model.NextRequiredIncident(); } model.Incidents = null; }
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); }
private void OnEnable() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); TotalTurnsTxt.text = model.Turns.ToString(); TurnsTxt.text = model.TurnsLeft.ToString(); for (int i = TurnsLeft.Length - 1; i >= 0; i--) { TurnsLeft[i].sprite = model.TurnsLeft > i ? TurnImg : NoTurnImg; } }
override public void OnEnterState() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); if (model.Drink > 0) { AmbitionApp.SendMessage(PartyMessages.DRAW_REMARK); model.Drink--; model.Intoxication++; AmbitionApp.GetModel <ConversationModel>().Remark = null; } }
public void Register(Core.ModelSvc modelService) { modelService.Register <CalendarModel>(); PartyModel model = modelService.Register <PartyModel>(); model.AcceptInvitationBonus = AcceptInvitationBonus; model.IgnoreInvitationPenalty = IgnoreInvitationPenalty; model.BaseNoveltyLoss = BaseNoveltyLoss; model.CumulativeNoveltyLoss = CumulativeNoveltyLoss; model.NumTurnsByPartySize = NumTurnsByPartySize ?? new int[1] { 1 }; }
public void Execute(RoomVO room) { PartyModel model = AmbitionApp.GetModel <PartyModel>(); FactionModel fmod = AmbitionApp.GetModel <FactionModel>(); if (fmod[model.Party.Faction].Level >= 2) { AmbitionApp.SendMessage(PartyMessages.REFILL_DRINK); Dictionary <string, string> substitutions = new Dictionary <string, string>() { { "$HOSTNAME", model.Party.Host } }; AmbitionApp.OpenMessageDialog(DialogConsts.REPUTATION_WINE_DIALOG, substitutions); } }
public override void OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); IncidentConfig[] configs = Resources.LoadAll <IncidentConfig>(Filepath.INCIDENTS_PARTY_INTRO); List <IncidentVO> results = new List <IncidentVO>(); IncidentVO incident; FactionType faction = model.Party.Faction; bool foundFaction = false; bool found; foreach (IncidentConfig config in configs) { incident = config?.GetIncident(); if (incident != null) { if (!foundFaction) { if (incident.Factions == null || incident.Factions.Length == 0) { results.Add(incident); } else { found = Array.IndexOf(incident.Factions, faction) >= 0; if (found && faction == FactionType.None) { results.Add(incident); } else { foundFaction = true; results.Clear(); results.Add(incident); } } } else if (incident.Factions != null && Array.IndexOf(incident.Factions, faction) >= 0) { results.Add(incident); } } } incident = Util.RNG.TakeRandom(results); AmbitionApp.Story.Schedule(incident); }
public void Execute(CommodityVO reward) { InventoryModel imod = AmbitionApp.GetModel <InventoryModel>(); if (reward.ID != null) { imod.GossipItems.Add(new Gossip(reward.ID)); } else { PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); if (partyModel.Party != null) { imod.GossipItems.Add(new Gossip(partyModel.Party.Faction)); } } }
public override void OnEnterState() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); PartyVO party = model.Party; // Lose a turn model.Turn++; //The Player is relocated to the Entrance MapModel mmod = AmbitionApp.GetModel <MapModel>(); mmod.Room = mmod.Map.Entrance; AmbitionApp.OpenDialog("DEFEAT"); AmbitionApp.SendMessage(PartyMessages.FLEE_CONVERSATION); AmbitionApp.SendMessage(PartyMessages.SHOW_MAP); }
void Start() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); _inventory = AmbitionApp.GetModel <InventoryModel>(); List <GossipVO> gossipList = AmbitionApp.Gossip.Gossip; int gossipIndex = gossipList.Count - 1; PartyText.text = AmbitionApp.Localize(PartyConstants.PARTY_NAME + model.Party.ID); FactionIcon.sprite = FactionIconConfig.GetSprite(model.Party.Faction.ToString()); List <RewardItem> rewards = AmbitionApp.CreateRewardListItems(model.Rewards, listItem); OutfitVO outfit = _inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO; if (outfit != null) { int novelty = outfit.Novelty - model.BaseNoveltyLoss - model.CumulativeNoveltyLoss * outfit.TimesWorn; if (novelty < 0) { novelty = 0; } OutfitText.text = AmbitionApp.Localization.GetItemName(outfit); NoveltySlider.value = novelty; NoveltySliderText.text = novelty.ToString(); } string host = AmbitionApp.Localize(PartyConstants.PARTY_HOST + model.Party.Host); if (string.IsNullOrEmpty(host)) { host = model.Party.Host; } Dictionary <string, string> subs = new Dictionary <string, string>() { { HOST_TOKEN, host } }; PartyHostText.text = AmbitionApp.Localize("after_party_dialog.host", subs); for (int i = rewards.Count - 1; i >= 0; --i) { if (rewards[i].Data.Type == CommodityType.Gossip) { rewards[i].SetGossip(gossipList[gossipIndex]); --gossipIndex; } } }
public void Execute(CommodityVO[] Rewards) { if (Rewards != null) { Array.ForEach(Rewards, AmbitionApp.Reward); if (AmbitionApp.Game.Activity == ActivityType.Party) { PartyModel party = AmbitionApp.GetModel <PartyModel>(); if (party.Rewards == null) { party.Rewards = new List <CommodityVO>(Rewards); } else { party.Rewards.AddRange(Rewards); } } } }
public override void OnEnterState() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); foreach (GuestVO g in model.Guests) { if (g.State == GuestState.Bored) { g.Opinion -= partyModel.BoredomPenalty; if (g.Opinion <= 0) { g.Opinion = 0; g.State = GuestState.PutOff; } AmbitionApp.SendMessage(PartyMessages.BURN_REMARKS, 1); } AmbitionApp.SendMessage(g); } }
public void Execute(CommodityVO reward) { AmbitionApp.Reward(reward); if (AmbitionApp.Game.Activity == ActivityType.Party) { PartyModel party = AmbitionApp.GetModel <PartyModel>(); if (party.Rewards == null) { party.Rewards = new List <CommodityVO>() { reward } } ; else { party.Rewards.Add(reward); } } }
override public void OnEnterState() { MapModel map = AmbitionApp.GetModel <MapModel>(); UController controller = _machine._uflow.GetController(_machine); GuestVO guest = map.Room.Guests[controller.transform.GetSiblingIndex()]; PartyModel model = AmbitionApp.GetModel <PartyModel>(); GuestActionVO action = AmbitionApp.Create <string, GuestActionVO>("Interest"); action.Tags = new string[] { guest.Like, "" }; int index = Util.RNG.Generate(1, model.Interests.Length); if (guest.Like == model.Interests[index]) { index = 0; } guest.Like = model.Interests[index]; guest.Dislike = model.Interests[(index + 1) % model.Interests.Length]; action.Tags[1] = guest.Like; guest.Action = action; AmbitionApp.SendMessage(guest); }
public void Execute(DateTime date) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); PartyModel model = AmbitionApp.GetModel <PartyModel>(); PartyVO[] parties = calendar.GetOccasions <PartyVO>(date); RendezVO[] dates = calendar.GetOccasions <RendezVO>(date); if (parties.Length + dates.Length > 0) { PartyVO party = Array.Find(parties, p => p.IsAttending); RendezVO rendez = Array.Find(dates, p => p.IsAttending); if (party != null) { AmbitionApp.OpenDialog(DialogConsts.RSVP, new CalendarEvent[] { party }); } else if (rendez != null) { AmbitionApp.OpenDialog(DialogConsts.RSVP, new CalendarEvent[] { rendez }); } else { List <CalendarEvent> events = new List <CalendarEvent>(parties); events.AddRange(dates); AmbitionApp.OpenDialog(DialogConsts.RSVP, events.ToArray()); } } else if (date.Subtract(calendar.Today).Days >= 1 && AmbitionApp.Paris.Rendezvous.Count > 0) { CharacterModel cModel = AmbitionApp.GetModel <CharacterModel>(); foreach (CharacterVO character in cModel.Characters.Values) { if (character.IsDateable && !character.IsRendezvousScheduled) { AmbitionApp.OpenDialog(DialogConsts.CREATE_RENDEZVOUS, date); break; } } } }
override public void OnEnterState() { // Using Sibling Index is hacky as f**k, but this should work for our purposes FRN. // VERY dependent on the view. MapModel map = AmbitionApp.GetModel <MapModel>(); PartyModel model = AmbitionApp.GetModel <PartyModel>(); UController controller = _machine._uflow.GetController(_machine); int index = controller.transform.GetSiblingIndex(); if (index < map.Room.Guests.Length && map.Room.Guests[index] != null) { int[] chart = map.Room.Guests[index].State == GuestState.Charmed ? model.CharmedGuestActionChance : model.GuestActionChance; if (Util.RNG.Generate(chart[map.Room.Difficulty - 1]) > 0) { map.Room.Guests[index].Action = null; } else { GuestActionFactory factory = (GuestActionFactory)AmbitionApp.GetFactory <string, GuestActionVO>(); GuestActionVO[] actions = factory.Actions.Values.ToArray(); actions = Array.FindAll(actions, a => a.Difficulty <= map.Room.Difficulty); int choice = actions.Select(a => a.Chance).Sum(); int i = 0; for (choice = Util.RNG.Generate(choice); actions[i].Chance <= choice; i++) { choice -= actions[i].Chance; } map.Room.Guests[index].Action = actions[i]; } } else { controller.gameObject.SetActive(false); } }
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 OnEnter() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.GetModel <IncidentModel>().Schedule(model.Party?.ExitIncident); }
void Awake() { _label = GetComponent <Text>(); _model = AmbitionApp.GetModel <PartyModel>(); }
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(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); }
void OnEnable() { _model = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.Subscribe <int>(GameConsts.DRINK, HandleDrink); HandleDrink(_model.Drink); }
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 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); }
public void Initialize() { _map = AmbitionApp.GetModel <MapModel>(); _model = AmbitionApp.GetModel <PartyModel>(); _remarks = new RemarkVO[_model.HandSize]; }
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; } } }