protected DiseaseVector.Variant GetNewStrain(VectorBooter.Data vector, DiseaseVector.Variant strain, bool force) { DiseaseVector.Variant newStrain = new DiseaseVector.Variant(vector, strain); if ((force) || (strain.Mutated)) { // Doing this stops the previous strain from reentering this process strain.Mutated = false; long id = 1; DiseaseVector.Variant oldStrain; if (mVariants.TryGetValue(vector.Guid, out oldStrain)) { if (oldStrain.Strain < strain.Strain) { oldStrain.Strain = strain.Strain; } id = oldStrain.Strain; } else { oldStrain = null; } if ((oldStrain == null) || (oldStrain.Variation(vector) < newStrain.Variation(vector))) { newStrain.Strain++; oldStrain = new DiseaseVector.Variant(newStrain, id + 1); mVariants.Remove(vector.Guid); mVariants.Add(vector.Guid, oldStrain); if (Common.kDebugging) { Common.DebugNotify("BETTER " + vector.Guid + " Strain:" + Common.NewLine + oldStrain); } } else if (RandomUtil.RandomChance01(vector.StrainMutationRate * (force ? 2 : 1))) { newStrain.Strain = id + 1; if (force) { oldStrain.Strain = newStrain.Strain; if (Common.kDebugging) { Common.DebugNotify("OUTBREAK " + vector.Guid + " Strain:" + Common.NewLine + newStrain); } } else { if (Common.kDebugging) { Common.DebugNotify("RANDOM " + vector.Guid + " Strain:" + Common.NewLine + newStrain); } } } } return(newStrain); }
public DiseaseVector.Variant GetNewStrain(VectorBooter.Data vector, DiseaseVector.Variant strain) { return(GetNewStrain(vector, strain, false)); }