From 349d9e230bdd712781f385ecd1b37e5b19dce640 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 5 Jun 2020 23:00:03 +0200 Subject: [PATCH] some rebalancing, including bigger maps --- TouchyTickets/Attractions/AttractionType.cs | 2 +- TouchyTickets/GameImpl.cs | 2 +- TouchyTickets/SaveHandler.cs | 34 +++++++++++++-------- TouchyTickets/Upgrade.cs | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/TouchyTickets/Attractions/AttractionType.cs b/TouchyTickets/Attractions/AttractionType.cs index df5dbee..6e553eb 100644 --- a/TouchyTickets/Attractions/AttractionType.cs +++ b/TouchyTickets/Attractions/AttractionType.cs @@ -19,7 +19,7 @@ namespace TouchyTickets.Attractions { public static readonly AttractionType HauntedHouse = Register(new AttractionType("HauntedHouse", RectArea(2, 2), Attraction.Texture[3, 5, 2, 2], 30, 12000)); public static readonly AttractionType WildMouse = Register(new AttractionType("WildMouse", RectArea(3, 2), Attraction.Texture[2, 1, 3, 2], 50, 24000)); public static readonly AttractionType LogFlume = Register(new AttractionType("LogFlume", new[,] {{true, true, false}, {true, true, true}}, Attraction.Texture[0, 3, 3, 2], 75, 38000)); - public static readonly AttractionType WoodCoaster = Register(new AttractionType("WoodCoaster", RectArea(3, 3), Attraction.Texture[0, 5, 3, 3], 90, 60000)); + public static readonly AttractionType WoodCoaster = Register(new AttractionType("WoodCoaster", RectArea(3, 3), Attraction.Texture[0, 5, 3, 3], 140, 60000)); public readonly string Name; public readonly bool[,] Area; diff --git a/TouchyTickets/GameImpl.cs b/TouchyTickets/GameImpl.cs index bdd5647..af06581 100644 --- a/TouchyTickets/GameImpl.cs +++ b/TouchyTickets/GameImpl.cs @@ -45,7 +45,7 @@ namespace TouchyTickets { this.Analytics.Setup(settings); if (!SaveHandler.Load(this)) - this.Map = new ParkMap(12, 12); + this.Map = new ParkMap(20, 20); this.Ui = new Ui(this.UiSystem); this.Camera = new Camera(this.GraphicsDevice) { diff --git a/TouchyTickets/SaveHandler.cs b/TouchyTickets/SaveHandler.cs index a67d809..29179c0 100644 --- a/TouchyTickets/SaveHandler.cs +++ b/TouchyTickets/SaveHandler.cs @@ -13,7 +13,7 @@ namespace TouchyTickets { TypeNameHandling = TypeNameHandling.Auto, Formatting = Formatting.Indented }); - private const int SaveVersion = 1; + private const int SaveVersion = 2; public static void Save(GameImpl game) { var file = GetSaveFile(true); @@ -36,18 +36,28 @@ namespace TouchyTickets { var file = GetSaveFile(false); if (!file.Exists) return false; - using (var stream = new JsonTextReader(file.OpenText())) { - var data = Serializer.Deserialize(stream); - game.Tickets = data.Tickets; - game.LastUpdate = data.LastUpdate; - game.Map = data.Map.Copy(); - game.Stars = data.Stars; - game.TimesRestarted = data.TimesRestarted; - game.AppliedUpgrades.Clear(); - foreach (var name in data.Upgrades) - game.AppliedUpgrades.Add(Upgrade.Upgrades[name]); - game.Tutorial.CurrentStep = data.TutorialStep; + SaveData data; + using (var stream = new JsonTextReader(file.OpenText())) + data = Serializer.Deserialize(stream); + + game.Tickets = data.Tickets; + game.LastUpdate = data.LastUpdate; + game.Map = data.Map.Copy(); + game.Stars = data.Stars; + game.TimesRestarted = data.TimesRestarted; + game.AppliedUpgrades.Clear(); + foreach (var name in data.Upgrades) + game.AppliedUpgrades.Add(Upgrade.Upgrades[name]); + game.Tutorial.CurrentStep = data.TutorialStep; + + Console.WriteLine("OLD SAVE VERSION: " + data.SaveVersion); + // version 1 had smaller maps + if (data.SaveVersion <= 1) { + game.Map = game.Map.Copy(20, 20); + foreach (var upgrade in game.AppliedUpgrades.Intersect(Upgrade.MapSize)) + upgrade.OnApplied(); } + return true; } diff --git a/TouchyTickets/Upgrade.cs b/TouchyTickets/Upgrade.cs index 337444b..15e850c 100644 --- a/TouchyTickets/Upgrade.cs +++ b/TouchyTickets/Upgrade.cs @@ -42,7 +42,7 @@ namespace TouchyTickets { // map size upgrades if (MapSize.Contains(this)) { var oldMap = GameImpl.Instance.Map; - GameImpl.Instance.Map = oldMap.Copy(oldMap.Width + 5, oldMap.Height + 5); + GameImpl.Instance.Map = oldMap.Copy(oldMap.Width + 10, oldMap.Height + 10); } }