protected override void OnPerform(Event e) { if (!mVector.CanOutbreak) { return; } Sim actor = e.Actor as Sim; if (actor == null) { return; } if (!mInstigator.Perform(e)) { return; } DiseaseVector vector = new DiseaseVector(mVector, Vector.Settings.GetNewStrain(mVector)); if (vector.Infect(actor.SimDescription, true)) { mInstigator.ShowStory(actor.SimDescription); ScoringLog.sLog.IncStat(vector.UnlocalizedName + " Success " + mInstigator.Guid); } }
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); }
protected override void OnPerform(Event e) { if (!mVector.CanOutbreak) return; Sim actor = e.Actor as Sim; if (actor == null) return; if (!mInstigator.Perform(e)) return; DiseaseVector vector = new DiseaseVector(mVector, Vector.Settings.GetNewStrain(mVector)); if (vector.Infect(actor.SimDescription, true)) { mInstigator.ShowStory(actor.SimDescription); ScoringLog.sLog.IncStat(vector.UnlocalizedName + " Success " + mInstigator.Guid); } }
public static void StartOutbreak(VectorBooter.Data vector, bool verbose) { DiseaseVector disease = new DiseaseVector(vector, Vector.Settings.GetNewStrain(vector)); ScoringLog.sLog.IncStat(disease.UnlocalizedName + " Attempt Outbreak"); List <Sim> sims = new List <Sim>(LotManager.Actors); if (sims.Count > 0) { int count = 0; while ((count < Vector.Settings.mNumPatientZero) && (sims.Count > 0)) { Sim choice = RandomUtil.GetRandomObjectFromList(sims); sims.Remove(choice); if (choice.SimDescription.ToddlerOrBelow) { continue; } if (!Vector.Settings.mOutbreakAllowActive) { if (choice.Household == Household.ActiveHousehold) { continue; } } if (disease.Infect(choice.SimDescription, true)) { count++; if (verbose) { ShowNotice(choice.SimDescription, disease, Common.kDebugging ? "Outbreak" : ""); } ScoringLog.sLog.IncStat(disease.UnlocalizedName + " Outbreak"); } } } }
public static void StartOutbreak(VectorBooter.Data vector, bool verbose) { DiseaseVector disease = new DiseaseVector(vector, Vector.Settings.GetNewStrain(vector)); ScoringLog.sLog.IncStat(disease.UnlocalizedName + " Attempt Outbreak"); List<Sim> sims = new List<Sim>(LotManager.Actors); if (sims.Count > 0) { int count = 0; while ((count < Vector.Settings.mNumPatientZero) && (sims.Count > 0)) { Sim choice = RandomUtil.GetRandomObjectFromList(sims); sims.Remove(choice); if (choice.SimDescription.ToddlerOrBelow) continue; if (!Vector.Settings.mOutbreakAllowActive) { if (choice.Household == Household.ActiveHousehold) continue; } if (disease.Infect(choice.SimDescription, true)) { count++; if (verbose) { ShowNotice(choice.SimDescription, disease, Common.kDebugging ? "Outbreak" : ""); } ScoringLog.sLog.IncStat(disease.UnlocalizedName + " Outbreak"); } } } }