diff --git a/FormMain.cs b/FormMain.cs index c8dae03..ed5dfa8 100644 --- a/FormMain.cs +++ b/FormMain.cs @@ -18,7 +18,7 @@ namespace FF13Randomizer { public partial class FormMain : Form { - public static string Version { get; set; } = "1.8.2"; + public static string Version { get; set; } = "1.8.3"; public static bool PlandoModified { get; set; } = false; diff --git a/Randomizers/RandoCrystarium.cs b/Randomizers/RandoCrystarium.cs index 6f5b4e2..0cbc31f 100644 --- a/Randomizers/RandoCrystarium.cs +++ b/Randomizers/RandoCrystarium.cs @@ -278,12 +278,20 @@ public void SetRemaining(List list) List others; do { - others = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }.SelectMany(t => crystarium.DataList.Where(o => o.Role == c.Role && o.Stage == c.Stage && o.Type == t)).ToList(); + others = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }.SelectMany(t => crystarium.DataList.Where(o => o.Role == c.Role && o.Stage == stage && o.Type == t)).ToList(); stage--; - } while (others.Count == 0); - DataStoreCrystarium other = others[RandomNum.RandInt(0, others.Count - 1)]; - c.Type = other.Type; - c.Value = other.Value; + } while (others.Count == 0 && stage > 0); + if (others.Count > 0) + { + DataStoreCrystarium other = others[RandomNum.RandInt(0, others.Count - 1)]; + c.Type = other.Type; + c.Value = other.Value; + } + else + { + c.Type = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }[RandomNum.RandInt(0, 2)]; + c.Value = 1; + } } } } diff --git a/Randomizers/RandoEnemies.cs b/Randomizers/RandoEnemies.cs index 72db0a0..a282b29 100644 --- a/Randomizers/RandoEnemies.cs +++ b/Randomizers/RandoEnemies.cs @@ -388,7 +388,7 @@ private void RandomizeDebuffs(DataStoreEnemy enemy, Enemy enemyID, int modifier, plandoDebuffResists[enemyID].ForEach(pair => { bounds[pair.Key] = new int[] { pair.Value, pair.Value }; if (pair.Value == 100) immunities--; }); } - immunities = Math.Max(0, Math.Min(11, immunities)); + immunities = Math.Max(0, Math.Min(11 - bounds.Values.Where(a => a[0] == 100 && a[1] == 100).Count(), immunities)); for (int i = 0; i < immunities; i++) { diff --git a/StatValues.cs b/StatValues.cs index d3a2724..41d8a88 100644 --- a/StatValues.cs +++ b/StatValues.cs @@ -23,7 +23,7 @@ public void Randomize(int variance) public void Randomize(Tuple[] bounds, long amount) { - int randTotal = (int)Math.Min(Math.Min(amount, bounds.Select(t => (long)t.Item2).Sum()), Int32.MaxValue); + int randTotal = (int)Math.Min(Math.Min(amount, bounds.Select(t => (long)t.Item2 - (long)t.Item1).Sum()), Int32.MaxValue); while (Vals.Sum() < randTotal) { int select = SelectNext(); diff --git a/VersionOrder.cs b/VersionOrder.cs index 8234685..8fc9b0b 100644 --- a/VersionOrder.cs +++ b/VersionOrder.cs @@ -14,6 +14,7 @@ public class VersionOrder "1.8.0.Pre-3", "1.8.0", "1.8.1", + "1.8.2", FormMain.Version };