public override void Generate(AsteroidsDungeon location, ref Vector2 warpFromPrev, ref Vector2 warpFromNext) { Map place = Mod.instance.Helper.Content.Load <Map>("assets/maps/MoonBossIsland.tmx"); int offsetX = (location.Map.Layers[0].LayerWidth - place.Layers[0].LayerWidth) / 2; int offsetY = (location.Map.Layers[0].LayerHeight - place.Layers[0].LayerHeight) / 2; location.ApplyMapOverride(place, "island_boss", new Rectangle(0, 0, place.Layers[0].LayerWidth, place.Layers[0].LayerHeight), new Rectangle(offsetX, offsetY, place.Layers[0].LayerWidth, place.Layers[0].LayerHeight)); warpFromPrev = warpFromNext = new Vector2(24 + offsetX, 43 + offsetY); PlaceNextWarp(location, offsetX + 23, offsetY + 17); { Vector2 position = new Vector2(offsetX + 24, offsetY + 24); Chest chest = new Chest(playerChest: false, position); chest.dropContents.Value = true; chest.synchronized.Value = true; chest.type.Value = "interactive"; chest.SetBigCraftableSpriteIndex(227); chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.SoulSapphire) as ObjectPackData)); chest.addItem(new Necklace(Necklace.Type.Lunar)); if (location.netObjects.ContainsKey(position)) { location.netObjects.Remove(position); } location.netObjects.Add(position, chest); } location.PlaceSpaceTiles(); }
protected void PlaceTeleporter(AsteroidsDungeon location, Random rand, int num, bool active, int centerX, int groundY, int targetX, int targetY) { int offset = num * 27; int ts = location.Map.TileSheets.IndexOf(location.Map.GetTileSheet("z_moon-teleporters")); int ts2 = location.Map.TileSheets.IndexOf(location.Map.GetTileSheet("P")); Log.Debug("Placing teleporter " + location.teleports.Count + " @ " + centerX + ", " + groundY + " to " + targetX + " " + targetY); if (!active) { location.setMapTile(centerX, groundY - 2, offset + 0 + 8, "Front", null, ts); location.setMapTile(centerX, groundY - 1, offset + 9 + 8, "Front", null, ts); location.setMapTile(centerX, groundY - 0, offset + 18 + 8, "Buildings", "LunarTeleporterOffline " + location.teleports.Count, ts); } else { int[] a = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; int[] b = new int[] { 9, 10, 11, 12, 13, 14, 15, 16 }; int[] c = new int[] { 18, 19, 20, 21, 22, 23, 24, 25 }; a = a.Select(x => x + offset).ToArray(); b = b.Select(x => x + offset).ToArray(); c = c.Select(x => x + offset).ToArray(); location.setMapTile(centerX, groundY - 2, 8, "Paths", null, ts2); location.setAnimatedMapTile(centerX, groundY - 2, a, 300, "Front", null, ts); location.setAnimatedMapTile(centerX, groundY - 1, b, 300, "Front", null, ts); location.setAnimatedMapTile(centerX, groundY - 0, c, 300, "Buildings", "LunarTeleporter " + location.teleports.Count, ts); } location.teleports.Add(new Vector2(targetX * Game1.tileSize, targetY * Game1.tileSize)); }
public override void Generate(AsteroidsDungeon location, ref Vector2 warpFromPrev, ref Vector2 warpFromNext) { Random rand = new Random(location.genSeed.Value); location.isIndoorLevel = true; var caveMap = Game1.game1.xTileContent.Load <Map>(Mod.instance.Helper.Content.GetActualAssetKey("assets/maps/MoonDungeonRoom.tmx")); int x = (location.Map.Layers[0].LayerWidth - caveMap.Layers[0].LayerWidth) / 2; int y = (location.Map.Layers[0].LayerHeight - caveMap.Layers[0].LayerHeight) / 2; location.ApplyMapOverride(caveMap, "actual_map", null, new Rectangle(x, y, caveMap.Layers[0].LayerWidth, caveMap.Layers[0].LayerHeight)); for (int ix = x + 4; ix <= x + 14; ++ix) { for (int iy = y + 4; iy <= y + 8; ++iy) { if (rand.NextDouble() < 0.175) { PlaceBreakableAt(location, rand, ix, iy); } } } PlaceChestAt(location, rand, x + caveMap.Layers[0].LayerWidth / 2 - 1, y + caveMap.Layers[0].LayerHeight / 2, rand.Next(3) == 0); warpFromPrev = new Vector2(x + 9, y + 10); location.warps.Add(new Warp(x + 9, y + 11, "Custom_MM_MoonAsteroidsDungeon" + location.level.Value / 100, 1, location.level.Value % 100, false)); }
protected string GetPreviousLocationName(AsteroidsDungeon location) { if (location.level.Value == 1) { return("Custom_MM_MoonAsteroidsEntrance"); } return(AsteroidsDungeon.BaseLocationName + (location.level.Value - 1)); }
public override void Generate(AsteroidsDungeon location, ref Vector2 warpFromPrev, ref Vector2 warpFromNext) { // spooky, no tiles to stand on warpFromPrev = new Vector2(5, 5); warpFromNext = new Vector2(5, 5); PlacePreviousWarp(location, 5, 4); PlaceNextWarp(location, 5, 6); }
public static bool Prefix(string name, bool isStructure, ref GameLocation __result) { if (name.StartsWith(AsteroidsDungeon.BaseLocationName)) { __result = AsteroidsDungeon.GetLevelInstance(name); return(false); } return(true); }
protected void PlaceMinableAt(AsteroidsDungeon location, Random rand, int sx, int sy) { double r = rand.NextDouble(); if (r < 0.65) { location.netObjects.Add(new Vector2(sx, sy), new StardewValley.Object(new Vector2(sx, sy), rand.NextDouble() < 0.5 ? 846 : 847, 1) { Name = "Stone", MinutesUntilReady = 12 }); } else if (r < 0.85) { int[] ores = new int[] { 95, 95, 849, 850, 764, 765, int.MaxValue, int.MaxValue, int.MaxValue }; int[] breaks = new int[] { 15, 15, 6, 8, 10, 12 }; int ore_ = rand.Next(ores.Length); int ore = ores[ore_]; if (ore == int.MaxValue) { var obj = new DynamicGameAssets.Game.CustomObject((DynamicGameAssets.PackData.ObjectPackData)DynamicGameAssets.Mod.Find(ItemIds.MythiciteOreMinable)); obj.Name = "Stone"; obj.MinutesUntilReady = 24; location.netObjects.Add(new Vector2(sx, sy), obj); } else { location.netObjects.Add(new Vector2(sx, sy), new StardewValley.Object(new Vector2(sx, sy), ore, 1) { Name = "Stone", MinutesUntilReady = breaks[ore_] }); } } else if (r < 0.95) { int[] gems = new int[] { 2, 4, 6, 8, 10, 12, 14, 44, 44, 44, 46, 46 }; int gem_ = rand.Next(gems.Length); int gem = gems[gem_]; location.netObjects.Add(new Vector2(sx, sy), new StardewValley.Object(new Vector2(sx, sy), gem, 1) { Name = "Stone", MinutesUntilReady = 10 }); } else { location.netObjects.Add(new Vector2(sx, sy), new StardewValley.Object(new Vector2(sx, sy), 819, 1) { Name = "Stone", MinutesUntilReady = 10 }); } }
public static void Postfix(GameTime time) { if (Game1.menuUp && !Game1.IsMultiplayer) { return; } if (Game1.IsClient) { return; } AsteroidsDungeon.UpdateLevels(time); }
protected void PlaceRandomTeleporterPair(AsteroidsDungeon location, Random rand, int centerX1, int groundY1, int centerX2, int groundY2, bool canInactive = true) { int num = rand.Next(3); bool active = true; if (canInactive && rand.NextDouble() < 0.5) { active = false; } PlaceTeleporter(location, rand, num, active, centerX1, groundY1, centerX2, groundY2 + 1); PlaceTeleporter(location, rand, num, true, centerX2, groundY2, centerX1, groundY1 + 1); }
protected void PlaceMonsterAt(AsteroidsDungeon location, Random rand, int tx, int ty) { switch (rand.Next(3)) { case 0: location.characters.Add(new BoomEye(new Vector2(tx * Game1.tileSize, ty * Game1.tileSize))); break; case 1: case 2: location.characters.Add(new LunarSlime(new Vector2(tx * Game1.tileSize, ty * Game1.tileSize))); break; } }
protected void PlaceBreakableAt(AsteroidsDungeon location, Random rand, int tx, int ty) { Vector2 position = new Vector2(tx, ty); if (location.netObjects.ContainsKey(position)) { return; } BreakableContainer bcontainer = new BreakableContainer(position, true); bcontainer.setHealth(6); location.netObjects.Add(position, bcontainer); }
protected void PlacePreviousWarp(AsteroidsDungeon location, int centerX, int groundY) { int ts = location.Map.TileSheets.IndexOf(location.Map.GetTileSheet("tf_darkdimension_sheet")); Log.Debug("Placing previous warp @ " + centerX + ", " + groundY); location.setMapTile(centerX + -1, groundY - 2, 503, "Front", null, ts); location.setMapTile(centerX + 0, groundY - 2, 504, "Front", null, ts); location.setMapTile(centerX + 1, groundY - 2, 505, "Front", null, ts); location.setMapTile(centerX + -1, groundY - 1, 532, "Front", null, ts); location.setMapTile(centerX + 0, groundY - 1, 533, "Front", null, ts); location.setMapTile(centerX + 1, groundY - 1, 534, "Front", null, ts); location.setMapTile(centerX + -1, groundY - 0, 561, "Buildings", "AsteroidsWarpPrevious", ts); location.setMapTile(centerX + 0, groundY - 0, 562, "Buildings", "AsteroidsWarpPrevious", ts); location.setMapTile(centerX + 1, groundY - 0, 563, "Buildings", "AsteroidsWarpPrevious", ts); }
protected void PlaceNextWarp(AsteroidsDungeon location, int centerX, int groundY) { int ts = location.Map.TileSheets.IndexOf(location.Map.GetTileSheet("tf_darkdimension_sheet")); Log.Debug("Placing next warp @ " + centerX + ", " + groundY); location.setMapTile(centerX + -1, groundY - 2, 503 + 9, "Front", null, ts); location.setMapTile(centerX + 0, groundY - 2, 504 + 9, "Front", null, ts); location.setMapTile(centerX + 1, groundY - 2, 505 + 9, "Front", null, ts); location.setMapTile(centerX + -1, groundY - 1, 532 + 9, "Front", null, ts); location.setMapTile(centerX + 0, groundY - 1, 533 + 9, "Front", null, ts); location.setMapTile(centerX + 1, groundY - 1, 534 + 9, "Front", null, ts); location.setMapTile(centerX + -1, groundY - 0, 561 + 9, "Buildings", "AsteroidsWarpNext", ts); location.setMapTile(centerX + 0, groundY - 0, 562 + 9, "Buildings", "AsteroidsWarpNext", ts); location.setMapTile(centerX + 1, groundY - 0, 563 + 9, "Buildings", "AsteroidsWarpNext", ts); }
public override void Generate(AsteroidsDungeon location, ref Vector2 warpFromPrev, ref Vector2 warpFromNext) { Random rand = new Random(location.genSeed.Value); location.isIndoorLevel = true; var caveMap = Game1.game1.xTileContent.Load <Map>(Mod.instance.Helper.Content.GetActualAssetKey("assets/maps/MoonDungeonCave.tmx")); int x = (location.Map.Layers[0].LayerWidth - caveMap.Layers[0].LayerWidth) / 2; int y = (location.Map.Layers[0].LayerHeight - caveMap.Layers[0].LayerHeight) / 2; location.ApplyMapOverride(caveMap, "actual_map", null, new Rectangle(x, y, caveMap.Layers[0].LayerWidth, caveMap.Layers[0].LayerHeight)); var mp = Mod.instance.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); long id = mp.getNewID(); LunarAnimalType type = rand.Next(2) == 0 ? LunarAnimalType.Cow : LunarAnimalType.Chicken; location.Animals.Add(id, new LunarAnimal(type, new Vector2(x + caveMap.Layers[0].LayerWidth / 2, y + caveMap.Layers[0].LayerHeight / 2) * Game1.tileSize, id)); warpFromPrev = new Vector2(x + 6, y + 10); location.warps.Add(new Warp(x + 6, y + 11, "Custom_MM_MoonAsteroidsDungeon" + location.level.Value / 100, 1, location.level.Value % 100, false)); }
private void OnTimeChanged(object sender, TimeChangedEventArgs e) { AsteroidsDungeon.UpdateLevels10Minutes(e.NewTime); }
private void OnReturnedToTitle(object sender, ReturnedToTitleEventArgs e) { AsteroidsDungeon.ClearAllLevels(); }
protected string GetNextLocationName(AsteroidsDungeon location) { return(AsteroidsDungeon.BaseLocationName + (location.level.Value + 1)); }
public abstract void Generate(AsteroidsDungeon location, ref Vector2 warpFromPrev, ref Vector2 warpFromNext);
protected void PlaceChestAt(AsteroidsDungeon location, Random rand, int tx, int ty, bool rare) { Vector2 position = new Vector2(tx, ty); Chest chest = new Chest(playerChest: false, position); chest.dropContents.Value = true; chest.synchronized.Value = true; chest.type.Value = "interactive"; if (rare) { chest.SetBigCraftableSpriteIndex(227); switch (rand.Next(7)) { case 0: case 1: case 2: chest.addItem(new Necklace(Necklace.Type.Lunar)); break; case 3: case 4: chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.SoulSapphire) as ObjectPackData)); break; case 5: chest.addItem(new DynamicGameAssets.Game.CustomBoots(DynamicGameAssets.Mod.Find(ItemIds.CosmosBoots) as BootsPackData)); break; case 6: var item = new AnimalGauntlets(); var mp = Mod.instance.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); switch (rand.Next(5)) { case 0: case 1: case 2: break; case 3: item.holding.Value = new LunarAnimal(LunarAnimalType.Cow, Vector2.Zero, mp.getNewID()); break; case 4: item.holding.Value = new LunarAnimal(LunarAnimalType.Chicken, Vector2.Zero, mp.getNewID()); break; } chest.addItem(item); break; } } else { chest.SetBigCraftableSpriteIndex(223); switch (rand.Next(6)) { case 0: case 1: case 2: chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.MythiciteOre) as ObjectPackData) { Stack = 3 + rand.Next(12) }); break; case 3: chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.MythiciteBar) as ObjectPackData) { Stack = 1 + rand.Next(7) }); break; case 4: chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.StellarEssence) as ObjectPackData) { Stack = 4 + rand.Next(9) }); break; case 5: chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.PersistiumDust) as ObjectPackData) { Stack = 2 + rand.Next(6) }); break; } } if (location.netObjects.ContainsKey(position)) { location.netObjects.Remove(position); } location.netObjects.Add(position, chest); }
private void OnDayStarted(object sender, DayStartedEventArgs e) { AsteroidsDungeon.ClearAllLevels(); }