diff options
Diffstat (limited to 'Thronefall_1_57/Decompile/Thronefall/MapChoice.cs')
| -rw-r--r-- | Thronefall_1_57/Decompile/Thronefall/MapChoice.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Thronefall_1_57/Decompile/Thronefall/MapChoice.cs b/Thronefall_1_57/Decompile/Thronefall/MapChoice.cs new file mode 100644 index 0000000..58ce733 --- /dev/null +++ b/Thronefall_1_57/Decompile/Thronefall/MapChoice.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; + +[Serializable] +public class MapChoice +{ + public string mapName; + + public EquippableWeapon containedWeapon; + + public List<EquippablePerk> containedPerks = new List<EquippablePerk>(); + + public List<Wave> waves = new List<Wave>(); + + public List<WaveInfo> waveInfos = new List<WaveInfo>(); + + public int goldAtStart; + + public int id; + + public static MapChoice GenerateNewMapChoice(int numberOfPerks, string mapName, Random generator, int id) + { + MapChoice mapChoice = new MapChoice(); + mapChoice.id = id; + mapChoice.mapName = mapName; + List<EquippableWeapon> list = new List<EquippableWeapon>(); + List<EquippablePerk> list2 = new List<EquippablePerk>(); + foreach (MetaLevel metaLevel in PerkManager.instance.MetaLevels) + { + if (metaLevel.reward is EquippableWeapon) + { + list.Add(metaLevel.reward as EquippableWeapon); + } + if (metaLevel.reward is EquippablePerk && !EternalTrialsRunManager.CurrentRun.acquiredPerks.Contains(metaLevel.reward as EquippablePerk)) + { + list2.Add(metaLevel.reward as EquippablePerk); + } + } + foreach (Equippable unlockedEquippable in PerkManager.instance.UnlockedEquippables) + { + if (unlockedEquippable is EquippableWeapon && !list.Contains(unlockedEquippable as EquippableWeapon)) + { + list.Add(unlockedEquippable as EquippableWeapon); + } + if (unlockedEquippable is EquippablePerk && !list2.Contains(unlockedEquippable as EquippablePerk) && !EternalTrialsRunManager.CurrentRun.acquiredPerks.Contains(unlockedEquippable as EquippablePerk)) + { + list2.Add(unlockedEquippable as EquippablePerk); + } + } + for (int i = 0; i < numberOfPerks; i++) + { + if (list2.Count < 1) + { + break; + } + int index = generator.Next(0, list2.Count); + mapChoice.containedPerks.Add(list2[index]); + list2.RemoveAt(index); + } + mapChoice.containedWeapon = list[generator.Next(0, list.Count)]; + LevelInfo levelInfoFromSceneName = LevelProgressManager.instance.GetLevelInfoFromSceneName(mapName); + mapChoice.waves = levelInfoFromSceneName.enemySpawner.waveGeneratorScript.GenerateWaves(levelInfoFromSceneName.enemySpawner.transform.GetComponentsInChildren<EnemySpawnLine>(), levelInfoFromSceneName, EternalTrialsRunManager.CurrentRun.stage, out var startingGold, EternalTrialsRunManager.CurrentRun.currentStageSeed + mapChoice.id); + int num = 1; + foreach (Wave wave in mapChoice.waves) + { + WaveInfo waveInfo = wave.GetWaveInfo(); + waveInfo.waveNumber = num; + mapChoice.waveInfos.Add(waveInfo); + num++; + } + mapChoice.goldAtStart = startingGold; + return mapChoice; + } +} |
