Exemplo n.º 1
0
 private void HandleCurrentRoom(RoomVO currentRoom)
 {
     if (_room != null)
     {
         bool current  = _room == currentRoom;
         bool adjacent = _room.IsAdjacentTo(currentRoom);
         if (current || adjacent)
         {
             if (_room.Revealed) //Had to simplify this because the rooms weren't displaying a lot of their characteristics. This is because many things reveal the rooms without this void doing it
             {
                 DescriptionText.enabled = true;
                 DescriptionText.text    = _room.Name + "\n";
                 for (int i = _room.Difficulty - 1; i >= 0; i--)
                 {
                     DescriptionText.text += '\u2605';
                 }
                 Punchbowl.enabled = (Array.IndexOf(_room.Features, PartyConstants.PUNCHBOWL) >= 0);
                 Host.enabled      = (Array.IndexOf(_room.Features, PartyConstants.HOST) >= 0);
                 if (Host.enabled)
                 {
                     PartyVO party = AmbitionApp.GetModel <PartyModel>().Party;
                     Host.sprite = FactionIcons.GetSprite(party.Faction);
                 }
             }
             ColorBlock cb = _button.colors;
             cb.disabledColor = ColorConfig.GetColor(current ? "current" : "shown");
             _button.colors   = cb;
         }
         _button.interactable = adjacent;
     }
     else
     {
         _button.interactable = false;
     }
 }
Exemplo n.º 2
0
 private void HandleParty(PartyVO party)
 {
     if (party != null && party.Date >= _calendar.Today)
     {
         UpdateParties();
     }
 }
Exemplo n.º 3
0
 private void HandleParty(PartyVO party)
 {
     if (party.Day == AmbitionApp.Calendar.Day)
     {
         HandleCalendarRefresh(AmbitionApp.Calendar);
     }
 }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        // Use this for initialization
        void Awake()
        {
            PartyVO party = AmbitionApp.GetModel <PartyModel>().Party;

            PartyNameText.text        = party == null ? "" : party.Name;
            PartyDescriptionText.text = party == null ? "" : party.Description;
            StyleText.text            = AmbitionApp.GetModel <InventoryModel>().CurrentStyle;
        }
Exemplo n.º 6
0
        private void HandleParty(PartyVO party)
        {
            EventListItemView item = _pool.Find(i => i.Event == party);

            if (item != null)
            {
                item.Event = party;
            }
        }
Exemplo n.º 7
0
 private void Open(PartyVO party)
 {
     if (party != null)
     {
         GameObject obj  = Instantiate(PartyInvitationPrefab, DialogParent);
         RSVPDialog dlog = obj.GetComponent <RSVPDialog>();
         dlog.Initialize(party);
     }
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 private void HandlePartyUpdated(PartyVO party)
 {
     if (party != null)
     {
         int index = (party.Date - Days[0].Date).Days;
         if (index >= 0 && index < Days.Length)
         {
             Days[index].AddParty(party);
         }
     }
 }
Exemplo n.º 10
0
        public void SetEvents(PartyVO[] parties, RendezVO[] liaisons)
        {
            RendezVO rendez = liaisons.Length == 0
                ? null
                : Array.Find(liaisons, l => l.IsAttending)
                              ?? Array.Find(liaisons, l => l.RSVP == RSVP.New)
                              ?? liaisons[0];
            PartyVO party1 = parties.Length == 0
                ? null
                : Array.Find(parties, p => p.IsAttending)
                             ?? Array.Find(parties, p => p.RSVP == RSVP.New)
                             ?? parties[0];
            PartyVO party2 = rendez != null
                ? party1
                : Array.Find(parties, p => p != party1);
            bool showRespond = !Array.Exists(parties, p => p.IsAttending) &&
                               !Array.Exists(liaisons, r => r.IsAttending) &&
                               (Array.Exists(parties, p => p.RSVP == RSVP.New) || Array.Exists(liaisons, p => p.RSVP == RSVP.New && !p.IsCaller));

            if (rendez != null)
            {
                party1 = null;
            }

            RespondIndicator.gameObject.SetActive(showRespond);

            // Party2 Icon is centered
            Party2Icon.gameObject.SetActive(party1 != null);
            if (party1 != null)
            {
                Party2Icon.sprite = CalendarSpriteConfig.GetSprite(party1.Faction.ToString());
                Party2RSVPIcon.gameObject.SetActive(party1.RSVP != RSVP.New);
                Party2RSVPIcon.sprite = CalendarSpriteConfig.GetSprite(party1.IsAttending ? ACCEPTED : DECLINED);
            }

            // Party1 Icon is in corner
            Party1Icon.gameObject.SetActive(party2 != null);
            if (party2 != null)
            {
                Party1Icon.sprite = CalendarSpriteConfig.GetSprite(party2.Faction.ToString());
                Party1RSVPIcon.gameObject.SetActive(party2.RSVP != RSVP.New);
                Party1RSVPIcon.sprite = CalendarSpriteConfig.GetSprite(party2.IsAttending ? ACCEPTED : DECLINED);
            }

            // Liaison is centered
            liaisonIcon.gameObject.SetActive(rendez != null);
            if (rendez != null)
            {
                CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(rendez.Character);
                liaisonIcon.sprite = LiaisonConfig.GetSprite(character?.Faction.ToString());
                liaisonResponse.gameObject.SetActive(rendez.RSVP != RSVP.New);
                liaisonResponse.sprite = CalendarSpriteConfig.GetSprite(rendez.IsAttending ? ACCEPTED : DECLINED);
            }
        }
Exemplo n.º 11
0
        public void Execute()
        {
            PartyVO  party  = AmbitionApp.GetModel <PartyModel>().Party;
            OutfitVO outfit = AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO;

            AmbitionApp.GetModel <FactionModel>().Factions.TryGetValue(party.Faction, out FactionVO faction);
            int         score  = 200 - Math.Abs(faction.Modesty - outfit.Modesty) - Math.Abs(faction.Luxury - outfit.Luxury);
            int         cred   = (int)(score * outfit.Novelty * .001f);
            CommodityVO reward = new CommodityVO(CommodityType.Credibility, cred);

            AmbitionApp.SendMessage(reward);
        }
Exemplo n.º 12
0
 public void Execute(CommodityVO reward)
 {
     if (!string.IsNullOrEmpty(reward.ID))
     {
         PartyVO party = new PartyVO(reward.ID);
         if (reward.Value >= 0)
         {
             party.Day = AmbitionApp.Calendar.Day + reward.Value;
         }
         AmbitionApp.SendMessage(PartyMessages.INITIALIZE_PARTY, party);
     }
 }
Exemplo n.º 13
0
        public static CalendarEvent GetEvent(int day)
        {
            PartyVO[] parties = AmbitionApp.Calendar.GetOccasions <PartyVO>(day);
            PartyVO   party   = Array.Find(parties, p => p.IsAttending);

            if (party != null)
            {
                return(party);
            }

            RendezVO[] rendezs = Calendar.GetOccasions <RendezVO>(day);
            return(Array.Find(rendezs, r => r.IsAttending));
        }
Exemplo n.º 14
0
        public override void OnEnter()
        {
            CalendarModel cal = AmbitionApp.Calendar;

            PartyVO[] parties = cal.GetOccasions <PartyVO>(cal.Day - 1);
            PartyVO   party   = Array.Find(parties, p => p.RSVP == RSVP.New);

            if (party != null)
            {
                CommodityVO penalty = new CommodityVO(CommodityType.Credibility, AmbitionApp.GetModel <PartyModel>().IgnoreInvitationPenalty);
                Dictionary <string, string> subs = new Dictionary <string, string>();
                LocalizationModel           loc  = AmbitionApp.GetModel <LocalizationModel>();
                party.RSVP           = RSVP.Declined;
                subs["$PARTYNAME"]   = loc.GetPartyName(party);
                subs["$CREDIBILITY"] = penalty.Value.ToString();
                AmbitionApp.OpenDialog(DialogConsts.MISSED_RSVP_DIALOG, subs);
                AmbitionApp.SendMessage(penalty);
            }
            else
            {
                RendezVO[] dates = cal.GetOccasions <RendezVO>(cal.Day - 1);
                RendezVO   date  = Array.Find(dates, d => d.RSVP == RSVP.New);
                if (date != null)
                {
                    CharacterModel characters  = AmbitionApp.GetModel <CharacterModel>();
                    CharacterVO    character   = characters.GetCharacter(date.Character);
                    bool           isPenalized = !date.IsCaller;
                    date.RSVP = RSVP.Declined;
                    if (character != null)
                    {
                        character.LiaisonDay = -1;
                    }
                    AmbitionApp.SendMessage(date);
                    if (isPenalized)
                    {
                        int         penalty      = characters.MissedRendezvousPenalty;
                        CommodityVO favorPenalty = new CommodityVO()
                        {
                            Type  = CommodityType.Favor,
                            ID    = date.Character,
                            Value = penalty
                        };
                        AmbitionApp.SendMessage(favorPenalty);
                        Dictionary <string, string> subs = new Dictionary <string, string>();
                        subs["$SHORTNAME"] = AmbitionApp.GetModel <LocalizationModel>().GetShortName(character, date.Character);
                        subs["$FAVOR"]     = penalty.ToString();
                        AmbitionApp.OpenDialog(DialogConsts.MISSED_RENDEZVOUS_DIALOG, subs);
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void CreateCancellationModal()
        {
            List <ICalendarEvent> events;
            CalendarModel         calendar = AmbitionApp.GetModel <CalendarModel>();

            if (calendar.Timeline.TryGetValue(calendar.Today, out events))
            {
                PartyVO party = events.Find(e => e is PartyVO && ((PartyVO)e).RSVP == RSVP.Accepted) as PartyVO;
                if (party != null)
                {
                    AmbitionApp.OpenDialog(DialogConsts.CANCEL, party);
                }
            }
        }
Exemplo n.º 16
0
 public PartyVO(PartyVO party)
 {
     ID                = party.ID;
     Faction           = party.Faction;
     RequiredIncidents = party.RequiredIncidents;
     Map               = party.Map;
     RSVP              = party.RSVP;
     Day               = party.Day;
     IntroIncident     = party.IntroIncident;
     ExitIncident      = party.ExitIncident;
     Created           = party.Created;
     Host              = party.Host;
     Requirements      = this.Requirements?.ToArray();
 }
Exemplo n.º 17
0
        public string GetPartyName(PartyVO party)
        {
            //Dictionary<string, string> subs = new Dictionary<string, string>();
            //CharacterVO character = AmbitionApp.GetModel<CharacterModel>().GetCharacter(party.Host);
            //if (party.phrases.Length > 0)
            //    subs["$REASON"] = AmbitionApp.Localize(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower() + "." + party.phrases[0]);
            //subs["$IMPORTANCE"] = AmbitionApp.Localize(PartyConstants.PARTY_IMPORTANCE + (int)party.Size);
            //subs["$HOST"] = GetFormalName(character, party.Host);
            string result = AmbitionApp.Localize(PartyConstants.PARTY_NAME + party.ID);

            return(string.IsNullOrEmpty(result)
                ? AmbitionApp.Localize(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower() + "." + party.phrases[0])
                   //? AmbitionApp.Localize(PartyConstants.PARTY_NAME_DEFAULT, subs)
                : result);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        void OnEnable()
        {
            PartyVO party = AmbitionApp.GetModel <PartyModel>().Party;

            if (party != null)
            {
                string    factionID = party == null ? null : party.Faction;
                FactionVO faction   = AmbitionApp.GetModel <FactionModel>()[factionID];
                int       stat      = (Stat.ToLower() == ItemConsts.LUXURY ? faction.Luxury : faction.Modesty);
                Minimum.enabled = (stat < 0);
                Maximum.enabled = (stat > 0);
            }
            else
            {
                Minimum.enabled = false;
                Maximum.enabled = false;
            }
        }
Exemplo n.º 20
0
        public void AddParty(PartyVO party)
        {
            if (party != null && _day == party.Date)
            {
                PartyVO accept;
                if (_parties == null)
                {
                    _parties = new List <PartyVO>();
                }
                if (!_parties.Contains(party))
                {
                    _parties.Add(party);
                }
                Party1Icon.enabled = _parties.Count > 1;   // Show for more than 1 party
                Party2Icon.enabled = true;                 // Show for at least 1 party
                accept             = _parties.Find(p => p.RSVP == RSVP.Accepted);

                // Show party 2's RSVP icon only if there's an accepted party or all declined parties
                Party2RSVPIcon.enabled = accept != null || _parties.TrueForAll(p => p.RSVP == RSVP.Declined);
                // Set the Party 2 acceptance icon
                Party2RSVPIcon.sprite = CalendarSpriteConfig.GetSprite(accept != null ? "accepted" : "declined");
                if (accept == null)
                {
                    accept = _parties.Find(p => p.RSVP == RSVP.New);
                }

                // Set Party 2's Faction icon
                if (accept != null)
                {
                    Party2Icon.sprite = CalendarSpriteConfig.GetSprite(accept.Faction);
                }

                if (Party1Icon.enabled)
                {
                    party = _parties.Find(p => p != accept && p.RSVP == RSVP.New);
                    Party1RSVPIcon.enabled = party != null;
                    if (party == null)
                    {
                        party = _parties.Find(p => p != accept);
                    }
                    Party1Icon.sprite = CalendarSpriteConfig.GetSprite(party.Faction);
                }
            }
        }
Exemplo n.º 21
0
        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);
                }
            }
        }
Exemplo n.º 22
0
        public override void OnEnterState()
        {
            CalendarModel  calendar = AmbitionApp.GetModel <CalendarModel>();
            DateTime       today    = calendar.Today;
            List <PartyVO> parties  = calendar.GetEvents <PartyVO>(today).Where(p => p.RSVP == RSVP.New).ToList();

            if (Util.RNG.Generate(0, 3) == 0)            // Chance of a random future engagement
            {
                PartyVO party = new PartyVO
                {
                    InvitationDate = today,
                    Date           = today.AddDays(Util.RNG.Generate(1, 8) + Util.RNG.Generate(1, 8)), // +2d8 days
                    RSVP           = RSVP.New
                };
                AmbitionApp.Execute <InitPartyCmd, PartyVO>(party);
                parties.Add(party);
            }
            parties.ForEach(p => AmbitionApp.OpenDialog(RSVPDialog.DIALOG_ID, p));
        }
Exemplo n.º 23
0
        public override void OnEnterState()
        {
            MapVO   map;
            RoomVO  room;
            PartyVO party = AmbitionApp.GetModel <PartyModel>().Party;

            _model = AmbitionApp.GetModel <MapModel>();

            // Determine if the party uses a preset, or build a map from scratch
            if (party.MapID == null || !_model.Maps.TryGetValue(party.MapID, out map))
            {
                map = BuildRandomMap(party);
            }

            // Fill in the blanks
            for (int i = map.Rooms.Length - 1; i > 0; i--)
            {
                room = map.Rooms[i];
                if (room != null)
                {
                    if (string.IsNullOrEmpty(room.Name))
                    {
                        room.Name = GenerateRandomName(_model.RoomAdjectives, _model.RoomNames);
                    }

                    if (room.Features == null)
                    {
                        room.Features = GetRandomFeatures();
                    }

                    if (room.Difficulty == 0 && room != map.Entrance)
                    {
                        room.Difficulty = 1 + Util.RNG.Generate(0, 5);
                    }

                    room.MoveThroughChance = GenerateMoveThroughChance(room);
                }
            }
            PopulateEnemies(map, EnemyInventory.enemyInventory.FindAll(e => e.Faction == party.Faction));
            map.Entrance.Cleared = true;
            _model.Map           = map;
            AmbitionApp.SendMessage(MapMessage.GO_TO_ROOM, map.Entrance);
        }
Exemplo n.º 24
0
        private void HandleParty(PartyVO party)
        {
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            if (party != null && party.Date == calendar.Today)
            {
                if (party.RSVP == RSVP.Accepted)
                {
                    _party = party;
                }
                else
                {
                    List <ICalendarEvent> events;
                    _party = calendar.Timeline.TryGetValue(calendar.Today, out events)
                                     ? events.OfType <PartyVO>().FirstOrDefault(p => p.RSVP == RSVP.Accepted)
                                     : null;
                }
                _text.text = _party != null ? "Go to the Party!" : "Explore Paris";
            }
        }
Exemplo n.º 25
0
        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;
                    }
                }
            }
        }
Exemplo n.º 26
0
        public void SetParty(PartyVO party)
        {
            AmbitionApp.GetModel <FactionModel>().Factions.TryGetValue(party?.Faction ?? FactionType.None, out FactionVO faction);
            Substitutions[LocalizationConsts.PARTYFACTION] = AmbitionApp.Localize(faction.Type.ToString().ToLower());

            // map -100 to +100 to 0,1,2.
            int modIndex = 0;

            if (faction.Modesty < -33)
            {
                modIndex = 0;
            }
            else if (faction.Modesty < 33)
            {
                modIndex = 1;
            }
            else
            {
                modIndex = 2;
            }

            int luxIndex = 0;

            if (faction.Luxury < -33)
            {
                luxIndex = 0;
            }
            else if (faction.Luxury < 33)
            {
                luxIndex = 1;
            }
            else
            {
                luxIndex = 2;
            }
            Substitutions[LocalizationConsts.PARTYFACTIONMODESTY] = AmbitionApp.Localize(string.Format("modesty.{0}", modIndex));
            Substitutions[LocalizationConsts.PARTYFACTIONLUXURY]  = AmbitionApp.Localize(string.Format("luxury.{0}", luxIndex));
        }
Exemplo n.º 27
0
        public void Execute(CommodityVO reward)
        {
            if (reward.ID != null)
            {
                PartyConfig config = UnityEngine.Resources.Load <PartyConfig>("Parties/" + reward.ID);
                if (config != null && config.Party != null)
                {
                    CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();
                    PartyVO       party    = config.Party;
                    AmbitionApp.Execute <InitPartyCmd, PartyVO>(party);
                    party.RSVP           = (RSVP)reward.Value;
                    party.InvitationDate = calendar.Today;

                    if (default(DateTime) == party.Date)
                    {
                        party.Date = calendar.Today;
                    }

                    calendar.Schedule(party);

                    if (party.RSVP == RSVP.Accepted && party.Date == calendar.Today)
                    {
                        AmbitionApp.GetModel <PartyModel>().Party = party;
                    }
                }
                else
                {
                    UnityEngine.Debug.Log("Warning: PartyReward.cs: No party with ID \"" + reward.ID + "\" exists!");
                }
                config = null;
                UnityEngine.Resources.UnloadUnusedAssets();
            }
            else
            {
                UnityEngine.Debug.Log("Warning: PartyReward.cs: No party ID specified!");
            }
        }
Exemplo n.º 28
0
        public string GetPartyInvitation(PartyVO party, CharacterVO host)
        {
            Dictionary <string, string> subs = new Dictionary <string, string>();
            string result;

            subs["$HOST"] = GetFormalName(host, party.Host);
            if (party.phrases?.Length > 1)
            {
                subs["$INTRO"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_INTRO + party.phrases[0]);
            }
            if (party.phrases?.Length > 2)
            {
                subs["$ADJECTIVE"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_ADJECTIVE + party.phrases[1]);
            }
            if (party.phrases?.Length > 3)
            {
                subs["$NOUN"] = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF_NOUN + party.phrases[2]);
            }
            result = AmbitionApp.Localize(PartyConstants.PARTY_FLUFF, subs);
            subs.Clear();
            subs["$FLUFF"]   = result;
            subs["$PLAYER"]  = AmbitionApp.Game.PlayerName;
            subs["$PRONOUN"] = host == null || host.Gender == Gender.NonBinary || host.Gender == Gender.Unknown
                ? AmbitionApp.Localize("their")
                : host.Gender == Gender.Male
                ? AmbitionApp.Localize("his")
                : AmbitionApp.Localize("her");
            subs["$DATE"]  = Localize(AmbitionApp.Calendar.StartDate.AddDays(party.Day));
            subs["$SIZE"]  = AmbitionApp.Localize(PartyConstants.PARTY_SIZE + (int)party.Size);
            subs["$PARTY"] = GetPartyName(party);

            result = AmbitionApp.Localize(PartyConstants.PARTY_INVITATION + party.ID, subs);
            return(string.IsNullOrEmpty(result)
                ? AmbitionApp.Localize(PartyConstants.PARTY_INVITATION_LOC, subs)
                : result);
        }
Exemplo n.º 29
0
 private Image BuildRandomMap(PartyVO party)
 {
     // TODO
     return(null);
 }
Exemplo n.º 30
0
        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);
        }