예제 #1
0
        public void AddVector(SimDescription sim, DiseaseVector vector)
        {
            PrivateGetVectors(sim).Add(vector);

            if (!vector.IsInoculated)
            {
                if (Common.kDebugging)
                {
                    OutbreakControl.ShowNotice(sim, vector, "Infected: ");
                }
            }
        }
예제 #2
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(null);

            CommonSelection <VectorBooter.Item> .Results items = new CommonSelection <VectorBooter.Item>(Name, choices).SelectMultiple();
            if ((items == null) || (items.Count == 0))
            {
                return(OptionResult.Failure);
            }

            foreach (VectorBooter.Item item in items)
            {
                OutbreakControl.StartOutbreak(item.Value, true);
            }

            return(OptionResult.SuccessRetain);
        }
예제 #3
0
        public bool Process(SimDescription sim)
        {
            if (!mNonPersistableData.IsEnabled)
            {
                return(false);
            }

            if (mProtected > 0)
            {
                mProtected--;
            }
            else if (mProtected <= 0)
            {
                mVirulence = 1f;
            }

            if ((RawStrength <= 0) || (SimTypes.IsDead(sim)))
            {
                mStageType = VectorControl.StageType.Resisted;
                return(false);
            }

            if ((IsInoculated) || (IsResisted))
            {
                return(false);
            }

            bool noticeShown = false;

            if (mNextCheck > 0)
            {
                mNextCheck--;
            }
            else
            {
                if (InRemission)
                {
                    mResistance = 0;
                    mNotices   &= ~Notices.FirstSign;
                }

                mStageType = mNonPersistableData.AdjustStage(this, sim, out mStage, out mNextCheck);

                mNextCheck = (int)(mNextCheck * (Vector.Settings.mStageRatio / 100f));

                string key = mNonPersistableData.GetStory(mStage, IsIdentified);

                if (!string.IsNullOrEmpty(key))
                {
                    if ((SimTypes.IsSelectable(sim)) || (!IsIgnored))
                    {
                        Common.Notify(sim.CreatedSim, Common.Localize("Story:" + key, sim.IsFemale, new object[] { sim, GetLocalizedName(sim.IsFemale) }));
                        noticeShown = true;
                    }
                }
                else if ((!ShowingSigns) && (HadFirstSign))
                {
                    if (SimTypes.IsSelectable(sim))
                    {
                        if (IsIdentified)
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:Better", sim.IsFemale, new object[] { sim, GetLocalizedName(sim.IsFemale) }));
                        }
                        else
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:BetterUnknown", sim.IsFemale, new object[] { sim }));
                        }
                    }

                    mNotices &= ~Notices.FirstSign;
                }

                if (IsResisted)
                {
                    return(false);
                }
            }

            if (ShowingSigns)
            {
                if (!HadFirstSign)
                {
                    mNotices |= Notices.FirstSign;

                    if (!noticeShown)
                    {
                        if (SimTypes.IsSelectable(sim))
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("Vector:FirstSign", sim.IsFemale, new object[] { sim }));
                        }
                        else if (!IsIgnored)
                        {
                            OutbreakControl.ShowNotice(sim, this, Common.kDebugging ? "Showing: " : "");
                        }
                    }
                }

                if (sim.CreatedSim != null)
                {
                    BuffGermy.BuffInstanceGermy germy = sim.CreatedSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy;
                    if (germy == null)
                    {
                        OccultTypes currentOccultTypes = sim.OccultManager.mCurrentOccultTypes;

                        try
                        {
                            sim.OccultManager.mCurrentOccultTypes = OccultTypes.None;

                            if (sim.CreatedSim.BuffManager.AddElement(BuffNames.Germy, sFromInfectionOrigin))
                            {
                                germy = sim.CreatedSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy;
                            }
                        }
                        finally
                        {
                            sim.OccultManager.mCurrentOccultTypes = currentOccultTypes;
                        }
                    }

                    if (germy != null)
                    {
                        if (germy.GermyContagionBroadcaster != null)
                        {
                            germy.GermyContagionBroadcaster.Dispose();
                            germy.GermyContagionBroadcaster = null;
                        }

                        germy.mCurrentTotalDurationIncrease = 0;
                        germy.ModifyDuration(30);
                    }
                }

                mNonPersistableData.Symptomize(sim.CreatedSim, this);
            }

            if (IsMutating)
            {
                Mutate();
            }

            PurchaseControl.AddCheck(sim.Household);

            return(true);
        }