Esempio n. 1
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(parameters.mTarget.SimDescription);

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

            string vectors = null;

            foreach (VectorBooter.Item item in items)
            {
                VectorControl.Inoculate(parameters.mTarget.SimDescription, item.Value, true, false);

                vectors += Common.NewLine + " " + item.Value.GetLocalizedName(parameters.mTarget.IsFemale);
            }

            if (!string.IsNullOrEmpty(vectors))
            {
                Common.Notify(parameters.mTarget, Common.Localize("Inoculate:Success", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }) + vectors);
            }

            return(OptionResult.SuccessClose);
        }
Esempio n. 2
0
        public static bool Perform(SimDescription sim, bool promptStrength, bool random)
        {
            List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(sim);

            int maxSelection = 0;

            if (!promptStrength)
            {
                maxSelection = 1;
            }

            List <VectorBooter.Item> selection = new List <VectorBooter.Item>();

            if (random)
            {
                if (choices.Count == 0)
                {
                    return(false);
                }

                selection.Add(RandomUtil.GetRandomObjectFromList(choices));
            }
            else
            {
                CommonSelection <VectorBooter.Item> .Results items = new CommonSelection <VectorBooter.Item>(Common.Localize("Infect:MenuName"), choices).SelectMultiple(maxSelection);
                if ((items == null) || (items.Count == 0))
                {
                    return(false);
                }

                selection.AddRange(items);
            }

            foreach (VectorBooter.Item item in selection)
            {
                DiseaseVector.Variant strain = Vector.Settings.GetCurrentStrain(item.Value);

                int strength = strain.Strength;

                if (promptStrength)
                {
                    string text = StringInputDialog.Show(Common.Localize("Infect:MenuName"), Common.Localize("Infect:Prompt", false, new object[] { item.Value.GetLocalizedName(false) }), strain.Strength.ToString());

                    if (!int.TryParse(text, out strength))
                    {
                        Common.Notify(Common.Localize("Numeric:Error"));
                    }
                }

                strain.Strength = strength;

                DiseaseVector disease = new DiseaseVector(item.Value, strain);

                disease.Infect(sim, true);
            }

            return(true);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public override bool Run()
        {
            try
            {
                StandardEntry();

                try
                {
                    if (!Target.StartComputing(this, SurfaceHeight.Table, true))
                    {
                        return(false);
                    }

                    AnimateSim("GenericTyping");

                    List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(null);

                    VectorBooter.Item item = new CommonSelection <VectorBooter.Item>(GetInteractionName(), choices, new StrainColumn()).SelectSingle();
                    if (item == null)
                    {
                        return(false);
                    }

                    Common.Notify(item.Value.GetResearch(Actor.IsFemale));

                    Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                    return(true);
                }
                finally
                {
                    StandardExit();
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }