diff --git a/TouchyTickets/Attractions/Attraction.cs b/TouchyTickets/Attractions/Attraction.cs index 6ffd768..b2a8ead 100644 --- a/TouchyTickets/Attractions/Attraction.cs +++ b/TouchyTickets/Attractions/Attraction.cs @@ -25,21 +25,12 @@ namespace TouchyTickets.Attractions { this.Type = type; } - public IEnumerable GetCoveredTiles() { - for (var x = 0; x < this.Type.Width; x++) { - for (var y = 0; y < this.Type.Height; y++) { - if (this.Type.Area[y, x]) - yield return new Point(x, y); - } - } - } - 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! + // only apply dynamic upgrades here, static ones go into the type if (Upgrade.FoodCourtModifier.IsActive() && this.GetSurrounding(map, position, AttractionType.FoodCourt).Any()) - genRate *= 3; + genRate *= 2; this.ticketPercentage += genRate * (float) passed.TotalSeconds; var amount = this.ticketPercentage.Floor(); @@ -52,7 +43,7 @@ namespace TouchyTickets.Attractions { } public IEnumerable GetSurrounding(ParkMap map, Point position, AttractionType type) { - foreach (var tile in this.GetCoveredTiles()) { + foreach (var tile in this.Type.GetCoveredTiles()) { foreach (var dir in Direction2Helper.Adjacent) { var other = map.GetAttractionAt(position + tile + dir.Offset()); if (other != null && other != this && other.Type == type) diff --git a/TouchyTickets/Attractions/AttractionType.cs b/TouchyTickets/Attractions/AttractionType.cs index f97007e..d0b1c67 100644 --- a/TouchyTickets/Attractions/AttractionType.cs +++ b/TouchyTickets/Attractions/AttractionType.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; using MLEM.Textures; using Newtonsoft.Json; @@ -8,9 +9,10 @@ namespace TouchyTickets.Attractions { public class AttractionType { public static readonly Dictionary Attractions = new Dictionary(); - public static readonly AttractionType Carousel = Register(new AttractionType("Carousel", new[,] {{true}}, Attraction.Texture[0, 0, 1, 1], 0.5F, 50)); - public static readonly AttractionType FoodCourt = Register(new AttractionType("FoodCourt", new[,] {{true, true}}, Attraction.Texture[1, 0, 2, 1], 1.1F, 300)); - public static readonly AttractionType FerrisWheel = Register(new AttractionType("FerrisWheel", new[,] {{true, true}, {true, true}}, Attraction.Texture[0, 1, 2, 2], 3.5F, 2000)); + 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 FoodCourt = Register(new AttractionType("FoodCourt", RectArea(2, 1), Attraction.Texture[1, 0, 2, 1], 1.1F, 300)); + public static readonly AttractionType FerrisWheel = Register(new AttractionType("FerrisWheel", RectArea(2, 2), Attraction.Texture[0, 1, 2, 2], 3.5F, 2000)); + public static readonly AttractionType WildMouse = Register(new AttractionType("WildMouse", RectArea(3, 2), Attraction.Texture[2, 1, 3, 2], 10, 5000)); public readonly string Name; public readonly bool[,] Area; @@ -36,18 +38,39 @@ namespace TouchyTickets.Attractions { public float GetGenerationRate() { var genRate = this.generationPerSecond; - + if (this == FerrisWheel && Upgrade.FerrisWheelModifier.IsActive()) genRate *= 4; - + // this should contain all car-based coasters + if ((this == Carousel || this == WildMouse) && Upgrade.RollerCoasterModifier.IsActive()) + genRate *= 2; + return genRate; } + public IEnumerable GetCoveredTiles() { + for (var x = 0; x < this.Width; x++) { + for (var y = 0; y < this.Height; y++) { + if (this.Area[y, x]) + yield return new Point(x, y); + } + } + } + private static AttractionType Register(AttractionType type) { Attractions.Add(type.Name, type); return type; } + private static bool[,] RectArea(int width, int height) { + var ret = new bool[height, width]; + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) + ret[y, x] = true; + } + return ret; + } + public delegate Attraction Constructor(AttractionType type); public class Converter : JsonConverter { diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index 53bf7e2..49d40c0 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -6,18 +6,21 @@ "Carousel": "Carousel", "FoodCourt": "Food Court", "FerrisWheel": "Ferris Wheel", + "WildMouse": "Wild Mouse", "MapSize1": "Big Park", - "MapSize1Description": "Increases your park's buildable area", + "MapSize1Description": "Increases your park's buildable area.", "MapSize2": "Bigger Park", - "MapSize2Description": "Increases your park's buildable area more", + "MapSize2Description": "Increases your park's buildable area more.", "MapSize3": "Biggest Park", - "MapSize3Description": "Increases your park's buildable area even more", + "MapSize3Description": "Increases your park's buildable area even more.", "MapSize4": "Biggester Park", - "MapSize4Description": "Increases your park's buildable area even more", + "MapSize4Description": "Increases your park's buildable area even more.", "MapSize5": "Biggestest Park", - "MapSize5Description": "Increases your park's buildable area to the maximum", + "MapSize5Description": "Increases your park's buildable area to the maximum.", "FoodCourtModifier": "Tasty Treats", - "FoodCourtModifierDescription": "Triples ticket sales for all attractions adjacent to food courts", + "FoodCourtModifierDescription": "Doubles ticket sales for all attractions adjacent to food courts.", "FerrisWheelModifier": "Crowded Pods", - "FerrisWheelModifierDescription": "Quadruples ticket sales for ferris wheels. Who cares about fire safety?" + "FerrisWheelModifierDescription": "Quadruples ticket sales for ferris wheels. Who cares about fire safety?", + "RollerCoasterModifier": "No Brakes", + "RollerCoasterModifierDescription": "Increases the speed of all car-based attractions, doubling their ticket sales." } \ No newline at end of file diff --git a/TouchyTickets/Content/Textures/Attractions.aseprite b/TouchyTickets/Content/Textures/Attractions.aseprite index d53c33f..442fb40 100644 Binary files a/TouchyTickets/Content/Textures/Attractions.aseprite and b/TouchyTickets/Content/Textures/Attractions.aseprite differ diff --git a/TouchyTickets/Content/Textures/Attractions.png b/TouchyTickets/Content/Textures/Attractions.png index 770750a..1453df6 100644 Binary files a/TouchyTickets/Content/Textures/Attractions.png and b/TouchyTickets/Content/Textures/Attractions.png differ diff --git a/TouchyTickets/Content/Textures/Ui.aseprite b/TouchyTickets/Content/Textures/Ui.aseprite index 8ee71c8..6d0fd80 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 77eef69..d14ab4f 100644 Binary files a/TouchyTickets/Content/Textures/Ui.png and b/TouchyTickets/Content/Textures/Ui.png differ diff --git a/TouchyTickets/GameImpl.cs b/TouchyTickets/GameImpl.cs index b702fcb..b16cc3a 100644 --- a/TouchyTickets/GameImpl.cs +++ b/TouchyTickets/GameImpl.cs @@ -78,7 +78,7 @@ namespace TouchyTickets { } public BigInteger GetStarPrice() { - return BigInteger.Pow(1000000, this.TimesRestarted / 2 + 1); + return 1000000 * BigInteger.Pow(10, this.TimesRestarted / 2); } } diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index ae574e3..9d5e58d 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -90,7 +90,9 @@ namespace TouchyTickets { if (this.draggingAttraction) { // move the current placing position var nextPos = (camera.ToWorldPos(drag.Position + drag.Delta) / Attraction.TileSize).ToPoint(); - if (this.PlacingAttraction.GetCoveredTiles().Select(p => nextPos + p).All(p => p.X >= 0 && p.Y >= 0 && p.X < this.Width && p.Y < this.Height)) + // drag the center of the attraction + nextPos -= new Point(this.PlacingAttraction.Type.Width / 2, this.PlacingAttraction.Type.Height / 2); + if (this.PlacingAttraction.Type.GetCoveredTiles().Select(p => nextPos + p).All(p => p.X >= 0 && p.Y >= 0 && p.X < this.Width && p.Y < this.Height)) this.PlacingPosition = nextPos; } else { // move the camera @@ -102,7 +104,7 @@ namespace TouchyTickets { continue; // when first pressing down, go into attraction drag mode if we're touching the place location var offset = (camera.ToWorldPos(touch.Position) / Attraction.TileSize).ToPoint(); - this.draggingAttraction = this.PlacingAttraction.GetCoveredTiles() + this.draggingAttraction = this.PlacingAttraction.Type.GetCoveredTiles() .Any(p => this.PlacingPosition + p == offset); } } @@ -137,14 +139,14 @@ namespace TouchyTickets { // placing attraction if (this.PlacingAttraction != null) { var placingPos = position + this.PlacingPosition.ToVector2() * tileSize; - foreach (var pos in this.PlacingAttraction.GetCoveredTiles()) + foreach (var pos in this.PlacingAttraction.Type.GetCoveredTiles()) batch.Draw(batch.GetBlankTexture(), new RectangleF(placingPos + pos.ToVector2() * tileSize, tileSize), Color.Black * 0.15F * alpha); batch.Draw(this.PlacingAttraction.Type.TextureRegion, placingPos, Color.White * alpha * 0.5F, 0, Vector2.Zero, scale, SpriteEffects.None, 0); } } public bool CanPlace(Point position, Attraction attraction) { - foreach (var offset in attraction.GetCoveredTiles()) { + foreach (var offset in attraction.Type.GetCoveredTiles()) { if (this.GetAttractionAt(position + offset) != null) return false; } @@ -152,7 +154,7 @@ namespace TouchyTickets { } public void Place(Point position, Attraction attraction) { - foreach (var (x, y) in attraction.GetCoveredTiles()) + foreach (var (x, y) in attraction.Type.GetCoveredTiles()) this.attractionGrid[position.X + x, position.Y + y] = attraction; this.attractions.Add((position, attraction)); } diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index a964621..c8a6651 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -46,7 +46,7 @@ namespace TouchyTickets { if (rainingTickets[i].Update()) rainingTickets.RemoveAt(i); } - while (rainingTickets.Count < Math.Min(GameImpl.Instance.Map.TicketsPerSecond / 10, 500)) + while (rainingTickets.Count < Math.Min(GameImpl.Instance.Map.TicketsPerSecond / 10, 200)) rainingTickets.Add(new RainingTicket()); }, OnDrawn = (e, time, batch, alpha) => { @@ -120,7 +120,7 @@ namespace TouchyTickets { map.PlacingAttraction = attraction.Value.Create(); // set placing position to center of camera's view var (posX, posY) = (GameImpl.Instance.Camera.LookingPosition / Attraction.TileSize).ToPoint(); - map.PlacingPosition = new Point(MathHelper.Clamp(posX, 0, map.Width), MathHelper.Clamp(posY, 0, map.Height)); + map.PlacingPosition = new Point(MathHelper.Clamp(posX, 0, map.Width - attraction.Value.Width), MathHelper.Clamp(posY, 0, map.Height - attraction.Value.Height)); var yesNoUi = new Group(Anchor.BottomLeft, new Vector2(1)); yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 40), Localization.Get("Back")) { diff --git a/TouchyTickets/Upgrade.cs b/TouchyTickets/Upgrade.cs index 879d2f0..cc69405 100644 --- a/TouchyTickets/Upgrade.cs +++ b/TouchyTickets/Upgrade.cs @@ -11,7 +11,8 @@ namespace TouchyTickets { public static readonly Upgrade[] MapSize = RegisterTiers("MapSize", 5, 1, 0.5F, Ui.Texture[0, 3]); public static readonly Upgrade FoodCourtModifier = Register(new Upgrade("FoodCourtModifier", 1, Ui.Texture[1, 3])); public static readonly Upgrade FerrisWheelModifier = Register(new Upgrade("FerrisWheelModifier", 1, Ui.Texture[2, 3])); - + public static readonly Upgrade RollerCoasterModifier = Register(new Upgrade("RollerCoasterModifier", 1, Ui.Texture[3, 3])); + public readonly string Name; public readonly int Price; public readonly TextureRegion Texture;