public void ModifyBool(TweakToApply tta) { Int32 cnt = tta.Values.Count - 1; Double a; for (int i = 0; i < tta.Values.Count; i++) { a = tta.Values[0]; tta.Values.RemoveAt(0); switch (tta.Action) { case 1: a = 1; break; case 2: a = 0; break; case 3: a = rnd.Next(0, 100) < (Int32)tta.Val1 ? 1 : 0; break; case 4: a = cnt == 0 ? 0 : (100D * i / cnt) < tta.Val1 ? 1 : 0; break; case 5: a = cnt == 0 ? 1 : (100D * i / cnt) < tta.Val1 ? 0 : 1; break; } tta.Values.Add(a); } }
public void ModifyNumber(TweakToApply tta) { Double max = Math.Max(tta.Val1, tta.Val2); Double min = Math.Min(tta.Val1, tta.Val2); Int32 cnt = tta.Values.Count - 1; Double a; for (int i = 0; i < tta.Values.Count; i++) { a = tta.Values[0]; tta.Values.RemoveAt(0); switch (tta.Action) { case 1: a += tta.Val1; break; case 2: a -= tta.Val1; break; case 3: a *= tta.Val1; break; case 4: a /= tta.Val1; break; case 5: a = tta.Val1; break; case 6: a = tta.TweakType == "Real" ? rnd.NextDouble() * (max - min) + tta.Val1 : rnd.Next((Int32)min, (Int32)max); break; case 7: a = cnt == 0 ? max : ((max - min) * i / cnt + min); break; case 8: a = cnt == 0 ? min : ((max - min) * (cnt - i) / cnt + min); break; } tta.Values.Add(a); } }