public void Execute() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); int count = Array.FindAll(model.Remarks, r => r == null).Length; AmbitionApp.SendMessage(PartyMessages.DRAW_REMARKS, count); }
public void Execute(GuestVO guest) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); if (model.Remark == null || guest == null) // The argument guest is the one being explicitly targeted { AmbitionApp.SendMessage <GuestVO>(PartyMessages.GUEST_TARGETED, null); } else { GuestVO[] guests = model.Guests; int index = Array.IndexOf(guests, guest); if (index >= 0) { int len = guests.Length; for (int i = 0; i < model.Remark.NumTargets; i++) { for (guest = guests[(i + index) % len]; guest.State == GuestState.Offended; guest = guests[(i + index) % len]) { index++; } AmbitionApp.SendMessage(PartyMessages.GUEST_TARGETED, guest); } } else { AmbitionApp.SendMessage <GuestVO>(PartyMessages.GUEST_TARGETED, null); } } }
override public void OnEnterState() { base.OnEnterState(); ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); GameObject canvas = Array.Find(SceneManager.GetActiveScene().GetRootGameObjects(), o => o.GetComponent <Canvas>() != null); if (canvas != null) { TurnTimerView[] timerViews = canvas.GetComponentsInChildren <TurnTimerView>(); foreach (TurnTimerView timer in timerViews) { timer.enabled = false; } RemarkView[] remarks = canvas.GetComponentsInChildren <RemarkView>(false); int index = Array.FindIndex(model.Remarks, r => Array.Exists(model.Guests, g => g.Like == r.Interest)); if (index < 0) { Array.FindIndex(model.Remarks, r => Array.Exists(model.Guests, g => g.Dislike != r.Interest)); } if (index < 0) { index = 0; } GameObject obj = Array.Find(remarks, r => r.transform.GetSiblingIndex() == index).gameObject; _bounz = obj.AddComponent <TutorialBounce>(); } }
// Use this for initialization void Start() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); HandleDeck(model.Deck.Count); RemarksMaxDeckSizeTf.text = (model.Deck.Count + model.Discard.Count + Array.FindAll(model.Remarks, r => r != null).Length).ToString(); }
public void Execute(int numcards) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO[] hand = model.Remarks; int num = Array.FindAll(hand, r => r == null).Length; if (num < numcards) { numcards = num; } if (model.Deck.Count < numcards) { numcards = model.Deck.Count; } for (int i = 0; i < numcards; i++) { num = Array.IndexOf(hand, null); hand[num] = model.Deck.Dequeue(); AmbitionApp.SendMessage(PartyMessages.DRAW_REMARK, hand[num]); } AmbitionApp.SendMessage(PartyMessages.DECK_SIZE, model.Deck.Count); model.Remarks = hand; model.Remark = null; }
public void Execute() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO[] hand = model.Remarks; int index = Array.FindIndex(hand, r => r == null); if (index >= 0) { string[] interests = AmbitionApp.GetModel <PartyModel>().Interests; string interest; // Create a topic that is exclusive of the previous topic used. if (model.Remark != null) { interest = Util.RNG.TakeRandomExcept(interests, model.Remark.Interest); } else { interest = Util.RNG.TakeRandom(interests); } hand[index] = new RemarkVO() { NumTargets = Util.RNG.Generate(1, 3), Interest = interest, Free = true }; // Assuming 1:2 odds of one target vs two model.Remarks = hand; } }
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); }
override public void OnEnterState() { base.OnEnterState(); Dispose(); GameObject canvas = Array.Find(SceneManager.GetActiveScene().GetRootGameObjects(), o => o.GetComponent <Canvas>() != null); if (canvas != null) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO rem = model.Remark; if (rem != null) { GuestVO[] guests = model.Guests; SpotlightView[] spotlights = canvas.GetComponentsInChildren <SpotlightView>(true); int index = Array.FindIndex(guests, g => g.Like == rem.Interest); if (index < 0) { index = Array.FindIndex(guests, g => g.Dislike != rem.Interest); } if (index < 0) { index = 0; } _flash = spotlights[index].gameObject.AddComponent <TutorialFlashSpot>(); } } }
IEnumerator Timer(float time) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); for (float t = time; t >= 0; t -= Time.deltaTime) { model.Repartee = (t * 2 >= time); yield return(null); } }
public void Execute(int numCards) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); for (int i = numCards > model.Deck.Count ? model.Deck.Count : numCards; i > 0; i--) { model.Discard.Add(model.Deck.Dequeue()); } AmbitionApp.SendMessage(PartyMessages.DECK_SIZE, model.Deck.Count); }
public override void OnEnterState() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); if (model.Round % model.FreeRemarkCounter == 0) { App.Service <MessageSvc>().Send(PartyMessages.FREE_REMARK); } model.Round++; AmbitionApp.SendMessage(model.Guests); AmbitionApp.SendMessage(PartyMessages.START_ROUND); }
public override void OnEnterState() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); GuestVO[] guests = Array.FindAll(model.Guests, g => !g.IsLockedIn && g.State != GuestState.Bored); if (guests.Length > 0) { GuestVO g = Util.RNG.TakeRandom(guests); g.State = GuestState.Bored; AmbitionApp.SendMessage(PartyMessages.GUEST_REACTION_BORED, g); } }
public void Execute(int numCards) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); int index; for (int i = (model.Discard.Count < numCards) ? model.Discard.Count : numCards; i > 0; i--) { index = RNG.Generate(model.Discard.Count); model.Deck.Enqueue(model.Discard[index]); model.Discard.RemoveAt(index); } }
protected void InitGuest() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); _index = transform.GetSiblingIndex(); AmbitionApp.Subscribe <GuestVO[]>(HandleGuests); AmbitionApp.Subscribe <GuestVO>(HandleGuest); if (model.Guests != null) { HandleGuests(model.Guests); } else { this.gameObject.SetActive(false); } }
private void HandleGuest(GuestVO guest) { UController controller = _machine._uflow.GetController(_machine); if (guest != null && controller != null) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); int index = controller.transform.GetSiblingIndex(); if (model.Remark != null && model.Remark.Interest != guest.Dislike && guest == model.Guests[index]) { Activate(); } } }
public void Execute(RemarkVO remark) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); if (model.Remarks != null && remark != null) { int index = Array.IndexOf(model.Remarks, remark); if (index >= 0) { model.Remarks[index] = null; if (!remark.Free) { model.Discard.Add(remark); } } } AmbitionApp.SendMessage(PartyMessages.DECK_SIZE, model.Deck.Count); }
override public void OnEnterState() { UController controller = _machine._uflow.GetController(_machine); if (controller != null) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); GuestVO guest = model.Guests[controller.transform.GetSiblingIndex()]; if (guest.Action != null && guest.Action.Values != null) { int reward; int others; guest.Action.Values.TryGetValue("guest", out reward); guest.Action.Values.TryGetValue("others", out others); guest.Opinion += reward - others; Array.ForEach(model.Guests, g => g.Opinion += others); } } }
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(GuestVO guest) { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); RemarkVO remark = model.Remark; if (remark != null) { GuestVO[] guests = model.Guests; int index = Array.IndexOf(guests, guest); if (index >= 0) { int num = model.Remarks.Length - 1; RemarkVO[] hand = model.Remarks; for (int i = Array.IndexOf(model.Remarks, remark); i < num; i++) { hand[i] = hand[i + 1]; } hand[num] = null; model.Remarks = hand; num = guests.Length; for (int i = remark.NumTargets - 1; i >= 0; i--) { guest = guests[(i + index) % num]; // Broadcast change to guest AmbitionApp.SendMessage(PartyMessages.GUEST_SELECTED, guest); } // Erode the interest of guests not iteracted with for (int i = num - model.Remark.NumTargets; i > 0; i--) { guest = guests[(index - i + num) % num]; AmbitionApp.SendMessage(PartyMessages.GUEST_IGNORED, guest); } model.Remark = null; } } }
public void Execute(GuestVO guest) { guest.Opinion = 0; if (guest.State != GuestState.PutOff) { guest.State = GuestState.PutOff; } else { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); int burn = model.Deck.Count < 5 ? model.Deck.Count : 5; RemarkVO remark; RemarkVO[] remarks; guest.State = GuestState.Offended; AmbitionApp.SendMessage(PartyMessages.BURN_REMARKS, burn); for (burn = 5 - burn; burn > 0; burn--) { remarks = Array.FindAll(model.Remarks, r => r != null); remark = Util.RNG.TakeRandom(remarks); AmbitionApp.SendMessage(PartyMessages.DISCARD, remark); } } }
public override void OnEnterState() { ConversationModel model = _models.GetModel <ConversationModel>(); int numCharmed = Array.FindAll(model.Guests, g => g.State == GuestState.Charmed).Length; model.Remark = null; model.Room.Cleared = true; if (model.Room.Rewards != null && model.Room.Rewards.Length > 0) { model.Party.Rewards.AddRange(model.Room.Rewards); AmbitionApp.SendMessage(model.Room.Rewards); } else { model.Party.Rewards.Add(GenerateRandomReward(numCharmed, model.Party.Faction)); } int numRemarks = (int)(model.MaxDeckSize * .1f); AmbitionApp.SendMessage(PartyMessages.RESHUFFLE_REMARKS, numRemarks); //AmbitionApp.OpenDialog("END_CONVERSATION", model.Room.Rewards); AmbitionApp.SendMessage(PartyMessages.END_CONVERSATION); }
public override bool Validate() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); return(model.Guests.Count(g => g.IsLockedIn) == model.Guests.Length); }
public override bool Validate() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); return(model.Room != null && !model.Room.Cleared); }
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); }
//This is not being handled via an Initialize function because this dialog needs to be brought up via the state machine, and there's currently no way to use 'Open Dialog' and set an array of commodities at the same time //While I could have made the state machine able to accept both a string and CommodityVO[] in the same state, I didn't feel comfortable making changes to something as critical as the state machine public void Awake() { ConversationModel conversationModel = _models.GetModel <ConversationModel>(); Commodities.SetCommodities(conversationModel.Room.Rewards); }
public override bool Validate() { ConversationModel model = AmbitionApp.GetModel <ConversationModel>(); return(model.Deck.Count == 0 && (model.Remarks == null || Array.TrueForAll(model.Remarks, r => r == null))); }
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; }