diff --git a/TouchyTickets/Attractions/Attraction.cs b/TouchyTickets/Attractions/Attraction.cs index 7e62e82..dd47b4b 100644 --- a/TouchyTickets/Attractions/Attraction.cs +++ b/TouchyTickets/Attractions/Attraction.cs @@ -8,6 +8,8 @@ using MLEM.Extensions; using MLEM.Misc; using MLEM.Startup; using MLEM.Textures; +using static TouchyTickets.Attractions.AttractionFlags; +using static TouchyTickets.Attractions.AttractionType; namespace TouchyTickets.Attractions { [DataContract] @@ -28,11 +30,12 @@ namespace TouchyTickets.Attractions { public float Update(GameTime time, TimeSpan passed, ParkMap map, Point position) { var genRate = this.Type.GetGenerationRate(); - // only apply dynamic upgrades here, static ones go into the type - if (Upgrade.FoodCourtModifier.IsActive() && this.GetSurrounding(map, position, AttractionType.FoodCourt).Any()) + if (Upgrade.FoodCourtModifier.IsActive() && this.GetSurrounding(map, position, FoodCourt).Any()) genRate *= 2; - if (Upgrade.SpiralSlideModifier.IsActive() && this.GetSurrounding(map, position, AttractionType.SpiralSlide).Any()) + if (Upgrade.SpiralSlideModifier.IsActive() && this.GetSurrounding(map, position, SpiralSlide).Any()) genRate *= 2; + if (Upgrade.HauntedHouseModifier.IsActive() && this.Type.Flags.HasFlag(Relaxed) && this.GetSurrounding(map, position, HauntedHouse).Any()) + genRate *= 3; this.ticketPercentage += genRate * (float) passed.TotalSeconds; var amount = this.ticketPercentage.Floor(); diff --git a/TouchyTickets/Attractions/AttractionFlags.cs b/TouchyTickets/Attractions/AttractionFlags.cs new file mode 100644 index 0000000..d786cfd --- /dev/null +++ b/TouchyTickets/Attractions/AttractionFlags.cs @@ -0,0 +1,13 @@ +using System; + +namespace TouchyTickets.Attractions { + [Flags] + public enum AttractionFlags { + + None = 0, + Relaxed = 1, + FastCars = 2, + Walking = 4 + + } +} \ No newline at end of file diff --git a/TouchyTickets/Attractions/AttractionType.cs b/TouchyTickets/Attractions/AttractionType.cs index 6e553eb..e2b908b 100644 --- a/TouchyTickets/Attractions/AttractionType.cs +++ b/TouchyTickets/Attractions/AttractionType.cs @@ -3,23 +3,24 @@ using System.Collections.Generic; using Microsoft.Xna.Framework; using MLEM.Textures; using Newtonsoft.Json; +using static TouchyTickets.Attractions.AttractionFlags; namespace TouchyTickets.Attractions { [JsonConverter(typeof(Converter))] public class AttractionType { public static readonly Dictionary Attractions = new Dictionary(); - public static readonly AttractionType Carousel = Register(new AttractionType("Carousel", RectArea(1, 1), Attraction.Texture[0, 0, 1, 1], 0.5F, 50)); - public static readonly AttractionType MirrorHouse = Register(new AttractionType("MirrorHouse", RectArea(1, 1), Attraction.Texture[3, 0, 1, 1], 1, 150)); - public static readonly AttractionType FoodCourt = Register(new AttractionType("FoodCourt", RectArea(2, 1), Attraction.Texture[1, 0, 2, 1], 2F, 300)); - public static readonly AttractionType SpiralSlide = Register(new AttractionType("SpiralSlide", RectArea(1, 2), Attraction.Texture[5, 0, 1, 2], 4, 1200)); - public static readonly AttractionType HedgeMaze = Register(new AttractionType("HedgeMaze", RectArea(2, 2), Attraction.Texture[3, 3, 2, 2], 8, 2500)); - public static readonly AttractionType FerrisWheel = Register(new AttractionType("FerrisWheel", RectArea(2, 2), Attraction.Texture[0, 1, 2, 2], 12, 4000)); - public static readonly AttractionType FreefallCoaster = Register(new AttractionType("FreefallCoaster", new[,] {{true, false, true}, {true, true, true}}, Attraction.Texture[6, 0, 3, 2], 24, 8000)); - 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], 140, 60000)); + public static readonly AttractionType Carousel = Register(new AttractionType("Carousel", RectArea(1, 1), Attraction.Texture[0, 0, 1, 1], 0.5F, 50, Relaxed)); + public static readonly AttractionType MirrorHouse = Register(new AttractionType("MirrorHouse", RectArea(1, 1), Attraction.Texture[3, 0, 1, 1], 1, 150, Relaxed | Walking)); + public static readonly AttractionType FoodCourt = Register(new AttractionType("FoodCourt", RectArea(2, 1), Attraction.Texture[1, 0, 2, 1], 2F, 300, None)); + public static readonly AttractionType SpiralSlide = Register(new AttractionType("SpiralSlide", RectArea(1, 2), Attraction.Texture[5, 0, 1, 2], 4, 1200, Relaxed | Walking)); + public static readonly AttractionType HedgeMaze = Register(new AttractionType("HedgeMaze", RectArea(2, 2), Attraction.Texture[3, 3, 2, 2], 8, 2500, Relaxed | Walking)); + public static readonly AttractionType FerrisWheel = Register(new AttractionType("FerrisWheel", RectArea(2, 2), Attraction.Texture[0, 1, 2, 2], 12, 4000, Relaxed)); + public static readonly AttractionType FreefallCoaster = Register(new AttractionType("FreefallCoaster", new[,] {{true, false, true}, {true, true, true}}, Attraction.Texture[6, 0, 3, 2], 24, 8000, FastCars)); + public static readonly AttractionType HauntedHouse = Register(new AttractionType("HauntedHouse", RectArea(2, 2), Attraction.Texture[3, 5, 2, 2], 30, 12000, FastCars)); + public static readonly AttractionType WildMouse = Register(new AttractionType("WildMouse", RectArea(3, 2), Attraction.Texture[2, 1, 3, 2], 50, 24000, FastCars)); + public static readonly AttractionType LogFlume = Register(new AttractionType("LogFlume", new[,] {{true, true, false}, {true, true, true}}, Attraction.Texture[0, 3, 3, 2], 75, 38000, FastCars)); + public static readonly AttractionType WoodCoaster = Register(new AttractionType("WoodCoaster", RectArea(3, 3), Attraction.Texture[0, 5, 3, 3], 140, 60000, FastCars)); public readonly string Name; public readonly bool[,] Area; @@ -28,19 +29,19 @@ namespace TouchyTickets.Attractions { public readonly TextureRegion TextureRegion; private readonly float generationPerSecond; public readonly long InitialPrice; - private readonly Constructor create; + public readonly AttractionFlags Flags; - public AttractionType(string name, bool[,] area, TextureRegion texture, float generationPerSecond, long initialPrice, Constructor constructor = null) { + public AttractionType(string name, bool[,] area, TextureRegion texture, float generationPerSecond, long initialPrice, AttractionFlags flags) { this.Name = name; this.Area = area; this.TextureRegion = texture; this.generationPerSecond = generationPerSecond; this.InitialPrice = initialPrice; - this.create = constructor ?? (t => new Attraction(t)); + this.Flags = flags; } public Attraction Create() { - return this.create(this); + return new Attraction(this); } public float GetGenerationRate() { @@ -48,11 +49,9 @@ namespace TouchyTickets.Attractions { if (this == FerrisWheel && Upgrade.FerrisWheelModifier.IsActive()) genRate *= 4; - // this should contain all car-based coasters that are fast - if ((this == Carousel || this == WildMouse || this == WoodCoaster || this == FreefallCoaster) && Upgrade.RollerCoasterModifier.IsActive()) + if (this.Flags.HasFlag(FastCars) && Upgrade.RollerCoasterModifier.IsActive()) genRate *= 2; - // this should contain all coasters where people just walk around on their own - if ((this == SpiralSlide || this == HedgeMaze || this == MirrorHouse) && Upgrade.ManualRideModifier.IsActive()) + if (this.Flags.HasFlag(Walking) && Upgrade.ManualRideModifier.IsActive()) genRate *= 3; return genRate; diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index f3a370b..0cabc0d 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -54,5 +54,7 @@ "ManualRideModifier": "Push and Shove", "ManualRideModifierDescription": "Increases the amount of people allowed on manual (walking-based) rides, tripling their ticket sales.", "SpiralSlideModifier": "Sightseeing", - "SpiralSlideModifierDescription": "New binoculars allow spiral slide visitors to check out adjacent rides whose ticket sales are doubled as a result." + "SpiralSlideModifierDescription": "New binoculars allow spiral slide visitors to check out adjacent rides whose ticket sales are doubled as a result.", + "HauntedHouseModifier": "Spooky, Scary", + "HauntedHouseModifierDescription": "Haunted houses become even scarier, causing riders to seek relaxation immediately. Triples ticket sales for all adjacent relaxed rides." } \ No newline at end of file diff --git a/TouchyTickets/Content/Textures/Ui.aseprite b/TouchyTickets/Content/Textures/Ui.aseprite index 3acdc6a..82c8507 100644 Binary files a/TouchyTickets/Content/Textures/Ui.aseprite and b/TouchyTickets/Content/Textures/Ui.aseprite differ diff --git a/TouchyTickets/Content/Textures/Ui.png b/TouchyTickets/Content/Textures/Ui.png index 9a7d118..f3658a5 100644 Binary files a/TouchyTickets/Content/Textures/Ui.png and b/TouchyTickets/Content/Textures/Ui.png differ diff --git a/TouchyTickets/Upgrade.cs b/TouchyTickets/Upgrade.cs index e69bee3..b89c24b 100644 --- a/TouchyTickets/Upgrade.cs +++ b/TouchyTickets/Upgrade.cs @@ -15,7 +15,8 @@ namespace TouchyTickets { public static readonly Upgrade RollerCoasterModifier = Register(new Upgrade("RollerCoasterModifier", 2, Ui.Texture[3, 3])); public static readonly Upgrade ManualRideModifier = Register(new Upgrade("ManualRideModifier", 2, Ui.Texture[4, 3])); public static readonly Upgrade SpiralSlideModifier = Register(new Upgrade("SpiralSlideModifier", 2, Ui.Texture[5, 3])); - + public static readonly Upgrade HauntedHouseModifier = Register(new Upgrade("HauntedHouseModifier", 2, Ui.Texture[7, 3])); + public readonly string Name; public readonly int Price; public readonly TextureRegion Texture;