Пример #1
0
        protected static bool BumpDown(SimDescription a, SimDescription b, bool prompt)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(false);
            }

            string currentState = relation.LTR.CurrentLTR;

            string nextState = ChangeRelationship.NextNegativeRomanceState(currentState);

            if (nextState == null)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "There is no way to go lower than these sims already are.");
                }
                return(false);
            }

            if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "A relationship of " + nextState + " is unavailable to the selected sims.");
                }
                return(false);
            }

            if (a.Partner == b)
            {
                a.Partner = null;
                b.Partner = null;
            }

            relation.LTR.ForceChangeState(nextState);
            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Show(new StyledNotification.Format("Relationship between " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " changed to " + nextState, StyledNotification.NotificationStyle.kAlert));
            return(true);
        }
Пример #2
0
        public bool BumpToLowerState(Common.IStatGenerator stats, SimDescription a, SimDescription b, bool story)
        {
            if (a.Partner == b)
            {
                if ((!AllowBreakup(this, a, Managers.Manager.AllowCheck.None)) || (!AllowBreakup(this, b, Managers.Manager.AllowCheck.None)))
                {
                    IncStat("BumpDown: Breakup: User Denied");
                    stats.IncStat("BumpDown: Breakup: User Denied");
                    return(false);
                }

                SetElapsedTime <DayOfLastPartnerOption>(a);
                SetElapsedTime <DayOfLastPartnerOption>(b);

                try
                {
                    a.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(a, e);
                }

                try
                {
                    b.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(b, e);
                }

                if ((a.CreatedSim != null) && (a.CreatedSim.BuffManager != null))
                {
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if ((b.CreatedSim != null) && (b.CreatedSim.BuffManager != null))
                {
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if (story)
                {
                    Stories.PrintStory(this, "Breakup", new object[] { a, b }, null);
                }
            }

            Relationship relation = ManagerSim.GetRelationship(a, b);

            if (relation != null)
            {
                LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR;

                LongTermRelationshipTypes nextState = ChangeRelationship.NextNegativeRomanceState(currentState, relation.IsPetToPetRelationship);
                if (nextState != LongTermRelationshipTypes.Undefined)
                {
                    float liking = relation.LTR.Liking;

                    AddStat("BumpDown: Pre", liking);
                    stats.AddStat("BumpDown: Pre", liking);

                    ForceChangeState(relation, nextState);

                    int score = AddScoring("BumpDown: Hate Loss", ScoringLookup.GetScore("HateRomanceLoss", b));
                    if ((SimTypes.IsSelectable(a)) || (SimTypes.IsSelectable(b)) || (stats.AddScoring("BumpDown: Hate Loss", score) <= 0))
                    {
                        if (liking > relation.LTR.Liking)
                        {
                            try
                            {
                                relation.LTR.SetLiking(liking);
                            }
                            catch (Exception e)
                            {
                                Common.DebugException(a, b, e);

                                IncStat("BumpDown: Reset Liking Fail");
                                stats.IncStat("BumpDown: Reset Liking Fail");
                            }
                        }
                    }

                    AddStat("BumpDown: Post", relation.LTR.Liking);
                    stats.AddStat("BumpDown: Post", relation.LTR.Liking);

                    IncStat("BumpDown " + relation.LTR.CurrentLTR);
                    stats.IncStat("BumpDown " + relation.LTR.CurrentLTR);
                }
            }
            return(true);
        }
Пример #3
0
            protected override bool Run(SimDescription a, SimDescription b)
            {
                Relationship relation = Relationship.Get(a, b, true);

                if (relation == null)
                {
                    return(false);
                }

                string currentState = relation.LTR.CurrentLTR;

                List <NewLevel> allOptions = new List <NewLevel>();

                string newState = ChangeRelationship.NextNegativeRomanceState(currentState);

                while (newState != null)
                {
                    if (!relation.LTR.RelationshipIsInappropriate(LTRData.Get(newState)))
                    {
                        allOptions.Insert(0, new NewLevel(newState, false));
                    }

                    newState = ChangeRelationship.NextNegativeRomanceState(newState);
                }

                allOptions.Add(new NewLevel(currentState, true));

                if (currentState == "Stranger")
                {
                    newState = "Acquaintance";
                    allOptions.Add(new NewLevel(newState, true));
                }
                else
                {
                    newState = currentState;
                }

                newState = ChangeRelationship.NextPositiveRomanceState(newState);
                while (newState != null)
                {
                    if (!relation.LTR.RelationshipIsInappropriate(LTRData.Get(newState)))
                    {
                        allOptions.Add(new NewLevel(newState, true));
                    }

                    newState = ChangeRelationship.NextPositiveRomanceState(newState);
                }

                List <ObjectPicker.HeaderInfo> headers = new List <ObjectPicker.HeaderInfo>();

                headers.Add(new ObjectPicker.HeaderInfo("Level", "Relationship Level", 230));

                int count = 0;

                List <ObjectPicker.RowInfo> rowInfo = new List <ObjectPicker.RowInfo>();

                foreach (NewLevel level in allOptions)
                {
                    ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(level, new List <ObjectPicker.ColumnInfo>());

                    count++;

                    item.ColumnInfo.Add(new ObjectPicker.TextColumn(count.ToString() + ". " + level.mState));

                    rowInfo.Add(item);
                }

                List <ObjectPicker.TabInfo> tabInfo = new List <ObjectPicker.TabInfo>();

                tabInfo.Add(new ObjectPicker.TabInfo("shop_all_r2", Localization.LocalizeString("Ui/Caption/ObjectPicker:All", new object[0]), rowInfo));

                string buttonTrue  = "Ok";
                string buttonFalse = Localization.LocalizeString("Ui/Caption/ObjectPicker:Cancel", new object[0]);

                List <ObjectPicker.RowInfo> list = ObjectPickerDialog.Show(true, ModalDialog.PauseMode.PauseSimulator, "Relationship", buttonTrue, buttonFalse, tabInfo, headers, 1, new Vector2(-1f, -1f), true);

                List <string> selection = new List <string>();

                if ((list == null) || (list.Count == 0))
                {
                    return(false);
                }

                NewLevel choice = list[0].Item as NewLevel;

                if (choice == null)
                {
                    return(false);
                }

                if (choice.mState == currentState)
                {
                    return(false);
                }

                bool bFirst = true;

                if (choice.mUp)
                {
                    while (BumpUp(a, b, bFirst))
                    {
                        if (choice.mState == relation.LTR.CurrentLTR)
                        {
                            return(true);
                        }

                        if (currentState == relation.LTR.CurrentLTR)
                        {
                            return(false);
                        }
                        currentState = relation.LTR.CurrentLTR;

                        bFirst = false;
                    }
                }
                else
                {
                    while (BumpDown(a, b, bFirst))
                    {
                        if (choice.mState == relation.LTR.CurrentLTR)
                        {
                            return(true);
                        }

                        if (currentState == relation.LTR.CurrentLTR)
                        {
                            return(false);
                        }
                        currentState = relation.LTR.CurrentLTR;

                        bFirst = false;
                    }
                }

                return(true);
            }