public override void OnCleared(Dungeon dungeon) { foreach (var member in dungeon.Party) member.TalkToNpc("_dungeonlostresident", "Lost Resident"); var rnd = RandomProvider.Get(); for (int i = 0; i < dungeon.Party.Count; ++i) { var member = dungeon.Party[i]; var treasureChest = new TreasureChest(); // Enchant var enchant = new Item(62005); switch (rnd.Next(3)) { case 0: enchant.OptionInfo.Prefix = 1506; break; // Swan Summoner's case 1: enchant.OptionInfo.Prefix = 1706; break; // Good case 2: enchant.OptionInfo.Prefix = 305; break; // Fine } treasureChest.Add(enchant); treasureChest.AddGold(rnd.Next(153, 768)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); for (int i = 0; i < dungeon.Party.Count; ++i) { var member = dungeon.Party[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Enchanted item Item item = null; switch (rnd.Next(2)) { case 0: item = Item.CreateEnchanted(40043, prefix: 20105); break; // Maltreat Rolling Pin case 1: item = Item.CreateEnchanted(40001, prefix: 20612); break; // Careful Wooden Stick } treasureChest.Add(item); } treasureChest.AddGold(rnd.Next(3360, 6272)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(170107, 2); // Lycanthrope dungeon.AddBoss(110102, 5); // Gorgon dungeon.PlayCutscene("bossroom_lycan"); }
public override void OnCleared(Dungeon dungeon) { var creators = dungeon.GetCreators(); var leader = creators[0].Party.Leader; if (leader.Keywords.Has("g1_38")) { leader.Keywords.Remove("g1"); leader.Keywords.Remove("g1_38"); leader.Keywords.Remove("g1_revive_of_glasgavelen"); leader.Keywords.Give("g1_complete"); leader.Keywords.Give("g1_KnightOfTheLight"); leader.Titles.Enable(WhoSavedTheGoddessTitle); leader.AcquireItem(Item.CreateEnchant(GoddessEnchant, 3600)); } dungeon.PlayCutscene("G1_41_b_Glas", cutscene => { foreach (var member in dungeon.GetCreators()) { member.Warp("Uladh_main/town_TirChonaill/TirChonaill_Spawn_A"); } }); }
/// <summary> /// Constructor /// </summary> /// <param name="eventsquare">EventSquare handle</param> /// <param name="dungeon">Dungeon handle</param> public EventSquareControl(EventSquare eventsquare, Dungeon dungeon) { InitializeComponent(); DirectionBox.DataSource = Enum.GetValues(typeof(CardinalPoint)); DirectionBox.SelectedItem = eventsquare.Direction; DisplayBorderBox.Checked = eventsquare.DisplayBorder; IntelligenceBox.Value = eventsquare.Intelligence; ColorPanelBox.BackColor = eventsquare.MessageColor; RemainingBox.Value = eventsquare.Remaining; TextBox.Text = eventsquare.Text; TextJustificationBox.DataSource = Enum.GetValues(typeof(TextJustification)); ActorControlBox.Actor = eventsquare; #region Choices ChoicesBox.DataSource = eventsquare.Choices; #endregion EventSquare = eventsquare; Dungeon = dungeon; }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(30018, 1); // Giant Spiderling dungeon.AddBoss(30019, 3); // Red Spiderling dungeon.PlayCutscene("bossroom_GiantSpider_kid"); }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); for (int i = 0; i < dungeon.Party.Count; ++i) { var member = dungeon.Party[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Enchanted item Item item = null; switch (rnd.Next(2)) { case 0: item = Item.CreateEnchanted(40004, prefix: 20105); break; // Artless Lute case 1: item = Item.CreateEnchanted(15022, prefix: 20612); break; // Splendit Popo's Skirt } treasureChest.Add(item); } treasureChest.AddGold(rnd.Next(2080, 4160)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); for (int i = 0; i < dungeon.Party.Count; ++i) { var member = dungeon.Party[i]; var treasureChest = new TreasureChest(); if (i == 0) { switch (rnd.Next(2)) { case 0: treasureChest.Add(Item.CreateEnchanted(16015, 20403, 0)); break; // Victorious Bracelet case 1: treasureChest.Add(Item.CreateEnchanted(40027, 0, 30311)); break; // Twilight Weeding Hoe } } treasureChest.AddGold(rnd.Next(5200, 7120)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Enchanted item Item item = null; switch (rnd.Next(2)) { case 0: item = Item.CreateEnchanted(40026, prefix: 20404); break; // Sacrificial Sickle case 1: item = Item.CreateEnchanted(18024, suffix: 30411); break; // Magnolia Hairband case 2: item = Item.CreateEnchanted(40003, suffix: 30514); break; // Hope Short Bow } treasureChest.Add(item); } treasureChest.AddGold(rnd.Next(4488, 8160)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Dagger var prefix = 0; switch (rnd.Next(3)) { case 0: prefix = 20501; break; // Simple case 1: prefix = 20502; break; // Scrupulous case 2: prefix = 20201; break; // Hard } treasureChest.Add(Item.CreateEnchanted(40006, prefix, 0)); } treasureChest.AddGold(rnd.Next(1072, 3680)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Mace int prefix = 0, suffix = 0; switch (rnd.Next(2)) { case 0: prefix = 20701; break; // Stiff case 1: prefix = 21003; break; // Fatal } switch (rnd.Next(2)) { case 0: suffix = 30506; break; // Belligerent case 1: suffix = 10807; break; // Considerate } treasureChest.Add(Item.CreateEnchanted(40079, prefix, suffix)); } treasureChest.AddGold(rnd.Next(2112, 5200)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(30007, 1); // Giant Red Spider dungeon.AddBoss(30013, 6); // Dark Blue Spider dungeon.PlayCutscene("bossroom_Albi_GiantSpider_DarkBlueSpider"); }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); // Fluted Short Sword int prefix = 0, suffix = 0; switch (rnd.Next(4)) { case 0: suffix = 30702; break; // Raven case 1: suffix = 30602; break; // Healer case 2: suffix = 30504; break; // Gold Goblin case 3: suffix = 30501; break; // Giant } treasureChest.Add(Item.CreateEnchanted(40015, prefix, suffix)); treasureChest.AddGold(rnd.Next(2384, 2992)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(170201, 5); // Werewolf dungeon.AddBoss(160101, 5); // Gray Gremlin dungeon.PlayCutscene("bossroom_WereWolf"); }
protected void Awake() { if(sInstance != null) { Destroy(gameObject); return; } sInstance = this; if (mDungeon == null) { mDungeon = FindObjectOfType<Dungeon>(); } if (mFollowCamera == null) { mFollowCamera = FindObjectOfType<FollowCamera>(); } if(mFader == null) { mFader = FindObjectOfType<Fader>(); } GameObject goalObj = SpawnPrefab(mGoalPrefab); mGoal = goalObj.GetComponent<Goal>(); GameObject playerObj = SpawnPrefab(GlobalData.sSelectedCharacter == SelectedCharacter.Rose ? mPlayerRosePrefab : mPlayerVuPrefab); mPlayer1 = playerObj.GetComponent<PlayerController>(); mFollowCamera.Init(mPlayer1.transform); }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(130002, 1); // Small Golem dungeon.AddBoss(11010, 6); // Metal Skeleton dungeon.PlayCutscene("bossroom_MetalskeletonArmorA_Golem"); }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(130004, 1); // Small Golem dungeon.AddBoss(160102, 6); // Green Gremlin dungeon.PlayCutscene("bossroom_small_golem"); }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); for (int i = 0; i < dungeon.Party.Count; ++i) { var member = dungeon.Party[i]; var treasureChest = new TreasureChest(); if (i == 0) { switch (rnd.Next(3)) { case 0: treasureChest.Add(Item.CreateEnchanted(40023, 20611, 0)); break; // Strict Gathering Knife case 1: treasureChest.Add(Item.CreateEnchanted(18006, 0, 30807)); break; // Prophet Wizard Hat case 2: treasureChest.Add(Item.CreateEnchanted(18012, 0, 30521)); break; // Fancy Tork Merchant Cap } } treasureChest.AddGold(rnd.Next(6630, 8670)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; member.TalkToNpc("_dungeonlostresident", "Lost Resident"); var treasureChest = new TreasureChest(); // Enchant var enchant = 0; switch (rnd.Next(3)) { case 0: enchant = 1506; break; // Swan Summoner's (Prefix) case 1: enchant = 1706; break; // Good (Prefix) case 2: enchant = 305; break; // Fine (Prefix) } treasureChest.Add(Item.CreateEnchant(enchant)); treasureChest.AddGold(rnd.Next(153, 768)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Cooking Knife int prefix = 0, suffix = 0; switch (rnd.Next(2)) { case 0: prefix = 20206; break; // Nervous case 1: prefix = 20711; break; // Famous } treasureChest.Add(Item.CreateEnchanted(40042, prefix, suffix)); } treasureChest.AddGold(rnd.Next(2880, 4380)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); // Warhammer int prefix = 0, suffix = 0; switch (rnd.Next(4)) { case 0: prefix = 1704; break; // Imitation case 1: prefix = 1705; break; // Cheap case 2: prefix = 1706; break; // Good case 3: prefix = 305; break; // Fine } treasureChest.Add(Item.CreateEnchanted(40016, prefix, suffix)); treasureChest.AddGold(rnd.Next(688, 1728)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(30022, 1); // Giant Spiderling dungeon.AddBoss(1002, 1); // Lost Resident dungeon.PlayCutscene("bossroom_tutorial_giantspider_kid"); }
static void Main(string[] args) { string mapPath = @"..\..\maps\"; var map = new Dungeon(mapPath + "Level1.txt"); map.Treasures.Add(new Weapon("Shadowmourne", 30)); map.Treasures.Add(new Spell("Storm of Glory", 25, 30, 2)); map.Treasures.Add(new Potion("Healing Potion", 50, PotionType.health)); map.Treasures.Add(new Potion("Mana Potion", 50, PotionType.mana)); map.PrintMap(); Console.WriteLine(); var hero = new Hero("Bron", "Dragonslayer", 100, 100, 2); var weap = new Weapon("Pacifer", 25); hero.Equip(weap); var spell = new Spell("Fireball", 20, 25, 2); hero.Learn(spell); map.Spawn(hero); map.PrintMap(); Console.WriteLine(); map.MoveHero(Direction.Right); map.MoveHero(Direction.Down); map.PrintMap(); Console.WriteLine(); map.HeroAttack("spell"); map.MoveHero(Direction.Down); map.MoveHero(Direction.Down); map.PrintMap(); Console.WriteLine(); map.HeroAttack("spell"); map.PrintMap(); Console.WriteLine(); }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(30004, 1); // Giant Spider dungeon.AddBoss(30003, 6); // Red Spider dungeon.PlayCutscene("bossroom_GiantSpider"); }
public override void OnCleared(Dungeon dungeon) { var rnd = RandomProvider.Get(); var creators = dungeon.GetCreators(); for (int i = 0; i < creators.Count; ++i) { var member = creators[i]; var treasureChest = new TreasureChest(); if (i == 0) { // Enchant var enchant = 0; switch (rnd.Next(6)) { case 0: enchant = 11105; break; // Health (Suffix) case 1: enchant = 11106; break; // Blood (Suffix) case 2: enchant = 11205; break; // Water (Suffix) case 3: enchant = 11206; break; // Fountain (Suffix) case 4: enchant = 11304; break; // Patience (Suffix) case 5: enchant = 11305; break; // Sustainer (Suffix) } treasureChest.Add(Item.CreateEnchant(enchant)); } treasureChest.AddGold(rnd.Next(640, 960)); // Gold treasureChest.Add(GetRandomTreasureItem(rnd)); // Random item dungeon.AddChest(treasureChest); member.GiveItemWithEffect(Item.CreateKey(70028, "chest")); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(130003, 1); // Small Golem dungeon.AddBoss(190001, 3); // Flying Sword dungeon.PlayCutscene("bossroom_SmallGolem_FlyingSword"); }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="dungeon"></param> public ForceFieldControl(ForceField field, Dungeon dungeon) { InitializeComponent(); switch (field.Type) { case ForceFieldType.Spin: SpinRadioBox.Checked = true; break; case ForceFieldType.Move: MoveRadioBox.Checked = true; break; case ForceFieldType.Block: BlockRadioBox.Checked = true; break; case ForceFieldType.FaceTo: FaceToBox.Checked = true; break; } AffectItemsBox.Checked = field.AffectItems; AffectMonstersBox.Checked = field.AffectMonsters; AffectTeamBox.Checked = field.AffectTeam; MoveDirectionBox.DataSource = Enum.GetValues(typeof(CardinalPoint)); MoveDirectionBox.SelectedItem = field.Direction; SpinDirectionBox.DataSource = Enum.GetValues(typeof(CompassRotation)); SpinDirectionBox.SelectedItem = field.Spin; Field = field; }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(30006, 1); // Giant Black Spider dungeon.AddBoss(30012, 6); // Burgundy Spider dungeon.PlayCutscene("bossroom_giant_spiderB"); }
public Dungeon MakeDungeon() { roomManager = GameObject.FindGameObjectWithTag("RoomManager").transform; if(roomManager == null) { Debug.LogError("There is no RoomManager in the scene. Level can't be built."); } else { roomManagerScript = roomManager.GetComponent<RoomManager>(); if (roomManagerScript == null) Debug.LogError("No RoomManager script attached to the RoomManager"); } dun = this.dFactory.createDungeon(gridWidth, gridHeight, linearProb); List<ConcreteRoom> rooms = dun.getDungeonRooms(); foreach(ConcreteRoom cRoom in dun.getDungeonRooms()) { cRoom.setRoomPrefab(roomManagerScript); cRoom.setWallPrefab(roomManagerScript); } spawnRooms(dun.getDungeonRooms()); return dun; }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(130008, 1); // Golem dungeon.AddBoss(11010, 6); // Metal Skeleton dungeon.PlayCutscene("bossroom_Metalskeleton_Golem4"); }
public void TestDungeonConstraints() { int level = 3; Dungeon d = new Dungeon(level); Player player = new Player(d.Start, 100, 10, d, null); d.DistributeItems(player); List <Node> path = d.ShortestPath(d.Start, d.Exit); bool pathContainsAllBridges = true; List <Node> bridges = new List <Node>(); foreach (Node n in GetAllNodesFromDungeon(d)) { if (d.IsBridge(n)) { bridges.Add(n); } } foreach (Node n in bridges) { if (!path.Contains(n)) { pathContainsAllBridges = false; } } Assert.IsTrue(pathContainsAllBridges); List <List <Node> > zones = d.Zones; foreach (List <Node> zone in zones) { int expectedMobs = 2 * (1 + zones.IndexOf(zone)) * Dungeon.TOTAL_MONSTERS / ((level + 1) * (level + 2)); int actualMobs = 0; foreach (Node n in zone) { foreach (Pack p in n.PacksInNode) { actualMobs += p.Size; } } Assert.AreEqual(expectedMobs, actualMobs); } float totalMonsterHealth = 0; float totalPotionHealth = 0; foreach (List <Node> zone in zones) { foreach (Node n in zone) { foreach (Pack p in n.PacksInNode) { totalMonsterHealth += p.Size * p.Monster.HitPoints; } foreach (Item pot in n.Items) { if (pot is HealingPotion) { totalPotionHealth += ((HealingPotion)pot).HealValue; } } } } float totalPlayerHealth = player.HitPoints; Assert.IsTrue(totalPotionHealth + totalPlayerHealth <= totalMonsterHealth); }
/// <summary> /// Generate a 'normal' dungeon /// </summary> /// <param name="width">Width of dungeon to create</param> /// <param name="height">Height of dungeon to create</param> /// <returns>Generated Dungeon</returns> public static Dungeon Generate(int width, int height, List <Passage> passages = null) { var dungeon = new Dungeon(width, height); // Set start to middle of room dungeon.StartLocation = new XY(dungeon.Width / 2, dungeon.Height / 2); // Until filled, place rooms! var possibleFeatures = GenerateFeatureLibrary(); Feature nextFeature; var possibleDoors = new List <XY>(); // Create starting door possibleDoors.Add(new XY(Next(dungeon.Width - 4) + 2, Next(dungeon.Height - 4) + 2)); var successfulDoors = new List <XY>(); int failures = 0; // Unsure if this should be true, or lambda - this seemed neat enough while ( (failures < MAX_FAILURES) && (possibleDoors.Count > 0) && dungeon.AnyEmpty()) { // Get random feature, in random rotation nextFeature = possibleFeatures[Next(possibleFeatures.Count)] .Rotate((Feature.Rotation)Next(4)); // Choose a door to build on var baseDoor = possibleDoors[Next(possibleDoors.Count)]; // List to put potentials in - doors on the opposite extremity in the feature // to the free side of the base door var possibleFeatureDoors = new List <XY>(); // Randomise order of featureDoors to make any possible possibleFeatureDoors = nextFeature.PossibleDoors.OrderBy((i) => Next()).ToList(); // Whether the feature was successfully placed bool placed = false; foreach (XY featureDoor in possibleFeatureDoors) { // Amount to add to feature to translate to global - this is baseDoor - door - // so, for instance - base door X of 20, and door x of 5 would mean we need // to add 15 to the feature x to translate it to the global x var translate = baseDoor - featureDoor; // If feature fits... if (FeatureFits(translate, dungeon, nextFeature)) { // Add the feature AddFeature(translate, dungeon, nextFeature); // And add its doors to the possible door list possibleDoors.AddRange(nextFeature.PossibleDoors.Select( i => (i + translate))); // Clear any doors that are no longer usable possibleDoors = possibleDoors.Where(door => { return // If in boundaries... ((door.X > 1) && (door.X < (dungeon.Width - 1)) && (door.Y > 1) && (door.Y < (dungeon.Height - 1)) && // And at least one part there is free ( dungeon.GetCell(new XY(door.X - 1, door.Y)) == DungeonCell.Empty || dungeon.GetCell(new XY(door.X + 1, door.Y)) == DungeonCell.Empty || dungeon.GetCell(new XY(door.X, door.Y - 1)) == DungeonCell.Empty || dungeon.GetCell(new XY(door.X, door.Y + 1)) == DungeonCell.Empty )); }).ToList(); // And go try a new feature placed = true; successfulDoors.Add(baseDoor); break; } } if (!placed) { // We failed. If we fail too often, we're done. failures += 1; } } // Make doors doors foreach (var door in successfulDoors) { dungeon.SetCell(door, DungeonCell.Door); } // Add passages to spawn areas... // They're guaranteed to be separated at least into different rooms foreach (var passage in passages ?? new List <Passage>()) { var area = dungeon.SpawnAreas.RandomItem(); var startPosition = area.Area.RandomItem(); // Remove spawn area from list - don't want surrounded soon as down, and don't want // multiple passages in same area dungeon.SpawnAreas.Remove(area); // Add passage to dungeon dungeon.Passages.Add(new Passage(passage.PassageType, passage.DestinationID, startPosition)); // Set tile to appropriate for passage type switch (passage.PassageType) { case Passage.PassageTypeEnum.StairsUp: dungeon.SetCell(startPosition, DungeonCell.StairUp); break; case Passage.PassageTypeEnum.StairsDown: dungeon.SetCell(startPosition, DungeonCell.StairDown); break; } } return(dungeon); }
private void BuildCorridor(Dungeon dungeon, DungeonCell firstCell, DungeonCell lastCell, bool leaveLastCellWalls, Vector3 floorDimensions, Material floorMaterial, float wallHeight, Material wallMaterial) { // Initialize list corridorTiles = new List <FloorTile>(); // Initialize game object corridor = new GameObject(); corridor.name = "Corridor"; // Set necessary variables DungeonCell startCell = firstCell; DungeonCell currentCell = firstCell; DungeonCell nextCell = firstCell; DungeonCell endCell = lastCell; // Traverse columns until the end cell column is reached while (true) { // If grid cell is empty place floor tile normally if (currentCell.getCellFloorTile() == null && currentCell.getCellColumnPositionInGrid() != endCell.getCellColumnPositionInGrid()) { // Create tile FloorTile tile = new FloorTile(currentCell, floorMaterial, floorDimensions, TileType.CorridorTile); // When traversing right or left the tile is going to need upper and down walls tile.placeWall(wallMaterial, wallHeight, Direction.Up); tile.placeWall(wallMaterial, wallHeight, Direction.Down); // Add tile to the list of corridor tiles corridorTiles.Add(tile); currentCell.setCellFloorTile(tile); } // Traverse right if (currentCell.getCellColumnPositionInGrid() < endCell.getCellColumnPositionInGrid()) { // If the grid cell has a tile with walls remove the ones that are not needed if (currentCell.getCellFloorTile().getTileType() == TileType.RoomOuterTile || currentCell.getCellFloorTile().getTileType() == TileType.CorridorTile) { // When traversing right always remove the right wall of current tile if there is one currentCell.getCellFloorTile().removeWall(Direction.Right); } // Get next cell nextCell = dungeon.getDungeonGrid()[currentCell.getCellRowPositionInGrid(), currentCell.getCellColumnPositionInGrid() + 1]; // Remove left wall of next cell if there is one if (nextCell.getCellFloorTile() != null) { nextCell.getCellFloorTile().removeWall(Direction.Left); } } // Traverse left else if (currentCell.getCellColumnPositionInGrid() > endCell.getCellColumnPositionInGrid()) { // If the grid cell has a tile with walls remove the ones that are not needed if (currentCell.getCellFloorTile().getTileType() == TileType.RoomOuterTile || currentCell.getCellFloorTile().getTileType() == TileType.CorridorTile) { // When traversing left always remove the left wall of current tile if there is one currentCell.getCellFloorTile().removeWall(Direction.Left); } nextCell = dungeon.getDungeonGrid()[currentCell.getCellRowPositionInGrid(), currentCell.getCellColumnPositionInGrid() - 1]; // Remove right wall of next cell if there is one if (nextCell.getCellFloorTile() != null) { nextCell.getCellFloorTile().removeWall(Direction.Right); } } // Current cell column and end cell column are the same else { // If grid cell is empty place floor tile with walls forming a corner if (currentCell.getCellFloorTile() == null) { // Check in which row direction (up or down) the corridor will go next Direction cornerWall1; if (currentCell.getCellRowPositionInGrid() < endCell.getCellRowPositionInGrid()) { // If the corridor needs to go down the corner wall needs to be placed up the current tile cornerWall1 = Direction.Up; } else { // If the corridor needs to go up the corner wall needs to be placed down the current tile cornerWall1 = Direction.Down; } // Check if the start cell is at the right or left of the current cell Direction cornerWall2; if (startCell.getCellColumnPositionInGrid() < currentCell.getCellColumnPositionInGrid()) { // When coming from the left, the wall of the corner corridor cell needs to be placed on the right cornerWall2 = Direction.Right; } else { // When coming from the right, the wall of the corner corridor cell needs to be placed on the left cornerWall2 = Direction.Left; } // Create tile FloorTile tile = new FloorTile(currentCell, floorMaterial, floorDimensions, TileType.CorridorTile); // Place corner tile walls if (!leaveLastCellWalls) { tile.placeWall(wallMaterial, wallHeight, cornerWall1); tile.placeWall(wallMaterial, wallHeight, cornerWall2); } // Add tile to the list of corridor tiles corridorTiles.Add(tile); currentCell.setCellFloorTile(tile); } // Exit loop break; } // Set current cell to next cell currentCell = nextCell; } // Traverse rows until the end cell row is reached while (true) { // If grid cell is empty place floor tile normally if (currentCell.getCellFloorTile() == null) { // Create tile FloorTile tile = new FloorTile(currentCell, floorMaterial, floorDimensions, TileType.CorridorTile); // When traversing up or down the tile is going to need right and left walls tile.placeWall(wallMaterial, wallHeight, Direction.Right); tile.placeWall(wallMaterial, wallHeight, Direction.Left); // Add tile to the list of corridor tiles corridorTiles.Add(tile); currentCell.setCellFloorTile(tile); } // Traverse down if (currentCell.getCellRowPositionInGrid() < endCell.getCellRowPositionInGrid()) { // If the grid cell has a tile with walls remove the ones that are not needed if (currentCell.getCellFloorTile().getTileType() == TileType.RoomOuterTile || currentCell.getCellFloorTile().getTileType() == TileType.CorridorTile) { // When traversing down always remove the down wall of current tile if there is one currentCell.getCellFloorTile().removeWall(Direction.Down); } // Get next cell nextCell = dungeon.getDungeonGrid()[currentCell.getCellRowPositionInGrid() + 1, currentCell.getCellColumnPositionInGrid()]; // Remove upper wall of next cell if there is one if (nextCell.getCellFloorTile() != null) { nextCell.getCellFloorTile().removeWall(Direction.Up); } } // Traverse up else if (currentCell.getCellRowPositionInGrid() > endCell.getCellRowPositionInGrid()) { // If the grid cell has a tile with walls remove the ones that are not needed if (currentCell.getCellFloorTile().getTileType() == TileType.RoomOuterTile || currentCell.getCellFloorTile().getTileType() == TileType.CorridorTile) { // When traversing up always remove the upper wall of current tile if there is one currentCell.getCellFloorTile().removeWall(Direction.Up); } nextCell = dungeon.getDungeonGrid()[currentCell.getCellRowPositionInGrid() - 1, currentCell.getCellColumnPositionInGrid()]; // Remove down wall of next cell if there is one if (nextCell.getCellFloorTile() != null) { nextCell.getCellFloorTile().removeWall(Direction.Down); } } // Current cell column and end cell column are the same, as the up or down traversal is done after the right or left, at this point the start and end cells are connected and no corners are needed else { // Exit loop break; } // Set current cell to next cell currentCell = nextCell; } // Set corridor game object in the tile at the middle of the tiles list corridor.transform.position = corridorTiles[corridorTiles.Count / 2].getCorrespondingDungeonCell().getCellWorldPosition(); // Set the tiles as children of the corridor game object foreach (FloorTile tile in corridorTiles) { tile.setParent(corridor, true); } }
public override bool CheckAction(bool isMove, Point deltaMove, bool otherMoveSuccess) { Dungeon dungeon = Game.Dungeon; Player player = Game.Dungeon.Player; //Restore currentTarget reference from ID, in case we have reloaded if (currentTargetID == -1) { target = null; } else { target = Game.Dungeon.GetCreatureByUniqueID(currentTargetID); } //No interruptions if (!isMove) { FailInterrupted(); return(false); } extraAttackThisTurn = false; Point locationAfterMove = player.LocationMap + deltaMove; //First move must be an attack in a square direction if (moveCounter == 0) { firstDeltaX = deltaMove.x; firstDeltaY = deltaMove.y; //Any non-diagonal move //if (firstDeltaX != 0 && firstDeltaY != 0) //{ //FailWrongPattern(); // return; //} //Check it is an attack SquareContents squareContents = dungeon.MapSquareContents(player.LocationLevel, new Point(locationAfterMove.x, locationAfterMove.y)); //Is there a monster here? If so, we will attack it if (squareContents.monster != null && !squareContents.monster.Charmed) { //Set move counter to 1 and drop back, the normal code will do the first attack moveCounter = 1; target = squareContents.monster; currentTargetID = squareContents.monster.UniqueID; monsterSquare = target.LocationMap; LogFile.Log.LogEntryDebug("OpenSpaceAttack Stage: " + moveCounter, LogDebugLevel.Medium); return(true); } else { //Not an attack moveCounter = 0; FailNotAnAttack(); return(false); } } //Move after an attack if (moveCounter == 1) { //Check this is a valid location to move into SquareContents squareContents = dungeon.MapSquareContents(player.LocationLevel, locationAfterMove); //Monster if (squareContents.monster != null) { FailBlocked(); return(false); } //Bad terrain if (!dungeon.MapSquareIsWalkable(player.LocationLevel, locationAfterMove)) { FailBlocked(); return(false); } //Check the sequence is correct int thisDeltaX = locationAfterMove.x - player.LocationMap.x; int thisDeltaY = locationAfterMove.y - player.LocationMap.y; //South if (firstDeltaX == 0 && firstDeltaY == 1) { if (thisDeltaX != 1 || thisDeltaY != 1) { FailWrongPattern(); return(false); } } //SW attack //Cheat to adopt the normal pattern if (firstDeltaX == -1 && firstDeltaY == 1) { if (thisDeltaX != 0 || thisDeltaY != 1) { FailWrongPattern(); return(false); } thisDeltaX = 1; thisDeltaY = 1; } //NW attack if (firstDeltaX == -1 && firstDeltaY == -1) { if (thisDeltaX != -1 || thisDeltaY != 0) { FailWrongPattern(); return(false); } thisDeltaX = -1; thisDeltaY = 1; } //NE attack if (firstDeltaX == 1 && firstDeltaY == -1) { if (thisDeltaX != 0 || thisDeltaY != -1) { FailWrongPattern(); return(false); } thisDeltaX = -1; thisDeltaY = 1; } //SE attack if (firstDeltaX == 1 && firstDeltaY == 1) { if (thisDeltaX != 1 || thisDeltaY != 0) { FailWrongPattern(); return(false); } thisDeltaX = 1; thisDeltaY = -1; } //East if (firstDeltaX == 1 && firstDeltaY == 0) { if (thisDeltaX != 1 || thisDeltaY != -1) { FailWrongPattern(); return(false); } } //North if (firstDeltaX == 0 && firstDeltaY == -1) { if (thisDeltaX != -1 || thisDeltaY != -1) { FailWrongPattern(); return(false); } } //West if (firstDeltaX == -1 && firstDeltaY == 0) { if (thisDeltaX != -1 || thisDeltaY != 1) { FailWrongPattern(); return(false); } } //Save this move lastDeltaX = thisDeltaX; lastDeltaY = thisDeltaY; //Check there the monster is still in its square and hasn't died //If reaped, we get null from it's id if (target == null) { FailTarget(); return(false); } if (!target.Alive) { FailTarget(); return(false); } if (target.LocationMap != monsterSquare) { FailTarget(); return(false); } //Monster is still alive and in right square - we will attack moveCounter = 2; //Store the delta between the player and the monster attackDeltaX = monsterSquare.x - player.LocationMap.x; attackDeltaY = monsterSquare.y - player.LocationMap.y; extraAttackThisTurn = false; LogFile.Log.LogEntryDebug("OpenSpaceAttack Stage: " + moveCounter, LogDebugLevel.Medium); //Will attack it during DoMove, and move into its square return(true); } //Later moves follow a clockwise box if (moveCounter > 1) { //Check this is a valid location to move into SquareContents squareContents = dungeon.MapSquareContents(player.LocationLevel, locationAfterMove); //Monster if (squareContents.monster != null) { FailBlocked(); return(false); } //Bad terrain if (!dungeon.MapSquareIsWalkable(player.LocationLevel, locationAfterMove)) { FailBlocked(); return(false); } //Check the sequence is correct int thisDeltaX = locationAfterMove.x - player.LocationMap.x; int thisDeltaY = locationAfterMove.y - player.LocationMap.y; //NE if (lastDeltaX == 1 && lastDeltaY == -1) { //SE if (thisDeltaX != 1 || thisDeltaY != 1) { FailWrongPattern(); return(false); } } //SE if (lastDeltaX == 1 && lastDeltaY == 1) { //SW if (thisDeltaX != -1 || thisDeltaY != 1) { FailWrongPattern(); return(false); } } //SW if (lastDeltaX == -1 && lastDeltaY == 1) { //NW if (thisDeltaX != -1 || thisDeltaY != -1) { FailWrongPattern(); return(false); } } //NW if (lastDeltaX == -1 && lastDeltaY == -1) { //NE if (thisDeltaX != 1 || thisDeltaY != -1) { FailWrongPattern(); return(false); } } //Save this move lastDeltaX = thisDeltaX; lastDeltaY = thisDeltaY; //Check there the monster is still in its square and hasn't died //If reaped, we get null from it's id if (target == null) { FailTarget(); return(false); } if (!target.Alive) { FailTarget(); return(false); } if (target.LocationMap != monsterSquare) { FailTarget(); return(false); } //Monster is still alive and in right square moveCounter++; //Store the delta between the player and the monster attackDeltaX = monsterSquare.x - player.LocationMap.x; attackDeltaY = monsterSquare.y - player.LocationMap.y; extraAttackThisTurn = false; LogFile.Log.LogEntryDebug("OpenSpaceAttack Stage: " + moveCounter, LogDebugLevel.Medium); //Will attack it during DoMove, and move into its square return(true); } LogFile.Log.LogEntryDebug("OpenSpaceAttack: moveCounter wrong", LogDebugLevel.Medium); return(false); }
public SampleDungeonNodeGraph(Dungeon pDungeon) : base((int)(pDungeon.size.Width * pDungeon.scale), (int)(pDungeon.size.Height * pDungeon.scale), (int)pDungeon.scale / 3) { Debug.Assert(pDungeon != null, "Please pass in a dungeon."); _dungeon = pDungeon; }
/// <summary> /// Called when the boss was killed. /// </summary> /// <param name="dungeon"></param> public virtual void OnCleared(Dungeon dungeon) { }
public override void OnCreation(Dungeon dungeon) { }
/// <summary> /// Called when the boss door opens. /// </summary> /// <param name="dungeon"></param> public virtual void OnBoss(Dungeon dungeon) { }
/// <summary> /// Called when the dungeon was just created. /// </summary> public virtual void OnCreation(Dungeon dungeon) { }
/// <summary> /// Called when a player leaves a dungeon via the first statue, /// logging out, or similar. /// </summary> /// <param name="dungeon"></param> /// <param name="creature"></param> public virtual void OnLeftEarly(Dungeon dungeon, Creature creature) { }
public void SetUp() { OpenDungeon = (new DefaultGenerator()).Generate(10, 10); }
/// <summary> /// Called when one of the boss monsters dies. /// </summary> /// <param name="dungeon"></param> /// <param name="deadBoss"></param> /// <param name="killer"></param> public virtual void OnBossDeath(Dungeon dungeon, Creature deadBoss, Creature killer) { }
private System.Collections.IEnumerator Dungeon_SpawnMobs(On.Dungeon.orig_SpawnMobs orig, Dungeon self, Room spawnRoom, float roomDifficultyValue, MobSpawnType spawnType, StaticString eventType, List <SelectedMob> elligibleMobs, Action <int> spawnCountSetter) { if (self.ShipName == mod.GetName()) { if (CurrentFloor != self.Level && spawnRoom.OpeningIndex >= 1) { List <SelectedMob> mobs = new List <SelectedMob>(); for (int i = 0; i < elligibleMobs.Count; i++) { MobClassConfig config = Databases.GetDatabase <MobClassConfig>(false).GetValue(elligibleMobs[i].MobCfg.Name); int index = (!elligibleMobs[i].IsNew) ? config.MinRoomOpeningIndex : config.MinRoomOpeningIndexIfNew; if (spawnRoom.OpeningIndex > index) { mobs.Add(elligibleMobs[i]); } } mod.Log("mobs.Count check!"); if (mobs.Count < 1) { return(orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, elligibleMobs, spawnCountSetter)); } SelectedMob s = mobs.GetWeightedRandom((SelectedMob m) => m.MobCfg.SpawnProbWeight.GetValue(spawnRoom)); mod.Log("Logging s: " + s); CurrentMobs = new List <SelectedMob>(); CurrentMobs.Add(s); mod.Log("Currently Selected mobs for floor: " + self.Level); foreach (SelectedMob q in CurrentMobs) { mod.Log(q.MobCfg.Name); } mod.Log("Out of:"); foreach (SelectedMob q in mobs) { mod.Log(q.MobCfg.Name); } CurrentFloor = self.Level; } if (CurrentMobs.Count > 0) { mod.Log("Attempting to spawn: " + CurrentMobs[0].MobCfg.Name); return(orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, CurrentMobs, spawnCountSetter)); } } return(orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, elligibleMobs, spawnCountSetter)); }
public DungeonEditorImplementation(PluginManager manager) { this.manager = manager; Box tmpBox, tmpBox2; Alignment tmpAlign; Box vbox = new Gtk.VBox(); vbox.Spacing = 3; Box hbox = new Gtk.HBox(); hbox.Spacing = 3; dungeonVreContainer = new Gtk.VBox(); roomVreContainer = new Gtk.VBox(); dungeonVre = null; roomVre = null; Alignment frame = new Alignment(0, 0, 0, 0); dungeonSpinButton = new SpinButton(0, 15, 1); floorSpinButton = new SpinButton(0, 15, 1); roomSpinButton = new SpinButtonHexadecimal(0, 255, 1); roomSpinButton.Digits = 2; dungeonSpinButton.ValueChanged += (a, b) => { DungeonChanged(); }; floorSpinButton.ValueChanged += (a, b) => { DungeonChanged(); }; frame.Add(vbox); tmpBox = new Gtk.HBox(); tmpBox.Add(new Gtk.Label("Dungeon ")); tmpBox.Add(dungeonSpinButton); tmpBox.Add(new Gtk.Label("Floor ")); tmpBox.Add(floorSpinButton); tmpAlign = new Alignment(0, 0, 0, 0); tmpAlign.Add(tmpBox); vbox.Add(tmpAlign); vbox.Add(hbox); // Leftmost column tmpBox = new VBox(); tmpBox.Add(dungeonVreContainer); var addFloorAboveButton = new Button("Add Floor Above"); addFloorAboveButton.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button); addFloorAboveButton.Clicked += (a, b) => { int floorIndex = floorSpinButton.ValueAsInt + 1; (minimap.Map as Dungeon).InsertFloor(floorIndex); DungeonChanged(); floorSpinButton.Value = floorIndex; }; tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0); tmpAlign.Add(addFloorAboveButton); tmpBox.Add(tmpAlign); var addFloorBelowButton = new Button("Add Floor Below"); addFloorBelowButton.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button); addFloorBelowButton.Clicked += (a, b) => { int floorIndex = floorSpinButton.ValueAsInt; (minimap.Map as Dungeon).InsertFloor(floorIndex); DungeonChanged(); }; tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0); tmpAlign.Add(addFloorBelowButton); tmpBox.Add(tmpAlign); var removeFloorButton = new Button("Remove Floor"); removeFloorButton.Image = new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button); removeFloorButton.Clicked += (a, b) => { Dungeon dungeon = minimap.Map as Dungeon; if (dungeon.NumFloors <= 1) { return; } Gtk.MessageDialog d = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.YesNo, "Really delete this floor?"); var response = (ResponseType)d.Run(); d.Dispose(); if (response == Gtk.ResponseType.Yes) { dungeon.RemoveFloor(floorSpinButton.ValueAsInt); DungeonChanged(); } }; tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0); tmpAlign.Add(removeFloorButton); tmpBox.Add(tmpAlign); hbox.Add(tmpBox); // Middle column (minimap) minimap = new Minimap(); minimap.AddTileSelectedHandler((sender, index) => { RoomChanged(); }); hbox.Add(minimap); // Rightmost column tmpAlign = new Alignment(0, 0, 0, 0); tmpAlign.Add(roomVreContainer); tmpBox2 = new HBox(); tmpBox2.Add(new Gtk.Label("Room ")); roomSpinButton.ValueChanged += (a, b) => { (minimap.Map as Dungeon).SetRoom(minimap.SelectedX, minimap.SelectedY, minimap.Floor, roomSpinButton.ValueAsInt); }; tmpBox2.Add(roomSpinButton); tmpBox = new VBox(); tmpBox.Add(tmpBox2); tmpBox.Add(tmpAlign); hbox.Add(tmpBox); Map map = manager.GetActiveMap(); if (map is Dungeon) { dungeonSpinButton.Value = (map as Dungeon).Index; } DungeonChanged(); dungeonEventWrapper.Bind <DungeonRoomChangedEventArgs>("RoomChangedEvent", (sender, args) => RoomChanged()); vbox.Destroyed += (a, b) => dungeonEventWrapper.UnbindAll(); this.Add(frame); ShowAll(); }
void ShowMonsterPicker(Dungeon selectedDungeon) { listening = true; _currentSelectedDungeon = selectedDungeon; EditorGUIUtility.ShowObjectPicker <Monster>(null, false, "l:Monster", 0); }
// Start is called before the first frame update void Start() { mainCamera = Camera.main; dungeon = gameObject.GetComponentInParent <Dungeon>(); }
protected IEnumerator ExpandHandleCombatWaves(PaydayDrillItem drillItem, Dungeon d, RoomHandler newRoom, Chest sourceChest) { DrillWaveDefinition[] wavesToUse = drillItem.D_Quality_Waves; switch (GameManager.Instance.RewardManager.GetQualityFromChest(sourceChest)) { case PickupObject.ItemQuality.C: wavesToUse = drillItem.C_Quality_Waves; break; case PickupObject.ItemQuality.B: wavesToUse = drillItem.B_Quality_Waves; break; case PickupObject.ItemQuality.A: wavesToUse = drillItem.A_Quality_Waves; break; case PickupObject.ItemQuality.S: wavesToUse = drillItem.S_Quality_Waves; break; } foreach (DrillWaveDefinition currentWave in wavesToUse) { int numEnemiesToSpawn = UnityEngine.Random.Range(currentWave.MinEnemies, currentWave.MaxEnemies + 1); for (int i = 0; i < numEnemiesToSpawn; i++) { string EnemyGUID = d.GetWeightedProceduralEnemy().enemyGuid; if (string.IsNullOrEmpty(EnemyGUID)) { List <string> FallbackGUIDs = new List <string>() { ExpandCustomEnemyDatabase.BootlegBullatGUID, ExpandCustomEnemyDatabase.BootlegBulletManGUID, ExpandCustomEnemyDatabase.BootlegBulletManBandanaGUID, ExpandCustomEnemyDatabase.BootlegShotgunManBlueGUID, ExpandCustomEnemyDatabase.BootlegShotgunManRedGUID }; FallbackGUIDs = FallbackGUIDs.Shuffle(); EnemyGUID = BraveUtility.RandomElement(FallbackGUIDs); } if (!EnemyDatabase.GetOrLoadByGuid(EnemyGUID).GetComponent <CompanionController>()) { AddSpecificEnemyToRoomProcedurallyFixed(newRoom, EnemyGUID, true); } } yield return(new WaitForSeconds(3f)); while (newRoom.GetActiveEnemiesCount(RoomHandler.ActiveEnemyType.RoomClear) > 0) { yield return(new WaitForSeconds(1f)); } if (newRoom.GetActiveEnemiesCount(RoomHandler.ActiveEnemyType.All) > 0) { List <AIActor> activeEnemies = newRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); for (int j = 0; j < activeEnemies.Count; j++) { if (activeEnemies[j].IsNormalEnemy) { activeEnemies[j].EraseFromExistence(false); } } } } yield break; }
protected IEnumerator ExpandHandleSeamlessTransitionToCombatRoomHook(Action <PaydayDrillItem, RoomHandler, Chest> orig, PaydayDrillItem self, RoomHandler sourceRoom, Chest sourceChest) { Dungeon dungeon = GameManager.Instance.Dungeon; if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.JUNGLEGEON) { GameManager.Instance.StartCoroutine(ExpandHandleTransitionToFallbackCombatRoom(self, sourceRoom, sourceChest)); yield break; } else { sourceChest.majorBreakable.TemporarilyInvulnerable = true; sourceRoom.DeregisterInteractable(sourceChest); int tmapExpansion = 13; RoomHandler newRoom = dungeon.RuntimeDuplicateChunk(sourceRoom.area.basePosition, sourceRoom.area.dimensions, tmapExpansion, sourceRoom, true); newRoom.CompletelyPreventLeaving = true; List <Transform> movedObjects = new List <Transform>(); string[] c_rewardRoomObjects = ReflectionHelpers.ReflectGetField <string[]>(typeof(PaydayDrillItem), "c_rewardRoomObjects", self); for (int i = 0; i < c_rewardRoomObjects.Length; i++) { Transform transform = sourceRoom.hierarchyParent.Find(c_rewardRoomObjects[i]); if (transform) { movedObjects.Add(transform); ExpandMoveObjectBetweenRooms(transform, sourceRoom, newRoom); } } ExpandMoveObjectBetweenRooms(sourceChest.transform, sourceRoom, newRoom); if (sourceChest.specRigidbody) { PathBlocker.BlockRigidbody(sourceChest.specRigidbody, false); } Vector3 m_baseChestOffset = ReflectionHelpers.ReflectGetField <Vector3>(typeof(PaydayDrillItem), "m_baseChestOffset", self); Vector3 m_largeChestOffset = ReflectionHelpers.ReflectGetField <Vector3>(typeof(PaydayDrillItem), "m_largeChestOffset", self); Vector3 chestOffset = m_baseChestOffset; if (sourceChest.name.Contains("_Red") || sourceChest.name.Contains("_Black")) { chestOffset += m_largeChestOffset; } GameObject spawnedVFX = SpawnManager.SpawnVFX(self.DrillVFXPrefab, sourceChest.transform.position + chestOffset, Quaternion.identity); tk2dBaseSprite spawnedSprite = spawnedVFX.GetComponent <tk2dBaseSprite>(); spawnedSprite.HeightOffGround = 1f; spawnedSprite.UpdateZDepth(); Vector2 oldPlayerPosition = GameManager.Instance.BestActivePlayer.transform.position.XY(); Vector2 playerOffset = oldPlayerPosition - sourceRoom.area.basePosition.ToVector2(); Vector2 newPlayerPosition = newRoom.area.basePosition.ToVector2() + playerOffset; Pixelator.Instance.FadeToColor(0.25f, Color.white, true, 0.125f); Pathfinder.Instance.InitializeRegion(dungeon.data, newRoom.area.basePosition, newRoom.area.dimensions); GameManager.Instance.BestActivePlayer.WarpToPoint(newPlayerPosition, false, false); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(GameManager.Instance.BestActivePlayer).ReuniteWithOtherPlayer(GameManager.Instance.BestActivePlayer, false); } yield return(null); for (int j = 0; j < GameManager.Instance.AllPlayers.Length; j++) { GameManager.Instance.AllPlayers[j].WarpFollowersToPlayer(false); GameManager.Instance.AllPlayers[j].WarpCompanionsToPlayer(false); } yield return(dungeon.StartCoroutine(HandleCombatRoomExpansion(self, sourceRoom, newRoom, sourceChest))); self.DisappearDrillPoof.SpawnAtPosition(spawnedSprite.WorldBottomLeft + new Vector2(-0.0625f, 0.25f), 0f, null, null, null, new float?(3f), false, null, null, false); UnityEngine.Object.Destroy(spawnedVFX.gameObject); sourceChest.ForceUnlock(); AkSoundEngine.PostEvent("Stop_OBJ_paydaydrill_loop_01", GameManager.Instance.gameObject); AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", GameManager.Instance.gameObject); bool goodToGo = false; while (!goodToGo) { goodToGo = true; for (int k = 0; k < GameManager.Instance.AllPlayers.Length; k++) { float num = Vector2.Distance(sourceChest.specRigidbody.UnitCenter, GameManager.Instance.AllPlayers[k].CenterPosition); if (num > 3f) { goodToGo = false; } } yield return(null); } GameManager.Instance.MainCameraController.SetManualControl(true, true); GameManager.Instance.MainCameraController.OverridePosition = GameManager.Instance.BestActivePlayer.CenterPosition; for (int l = 0; l < GameManager.Instance.AllPlayers.Length; l++) { GameManager.Instance.AllPlayers[l].SetInputOverride("shrinkage"); } yield return(dungeon.StartCoroutine(HandleCombatRoomShrinking(newRoom))); for (int m = 0; m < GameManager.Instance.AllPlayers.Length; m++) { GameManager.Instance.AllPlayers[m].ClearInputOverride("shrinkage"); } Pixelator.Instance.FadeToColor(0.25f, Color.white, true, 0.125f); AkSoundEngine.PostEvent("Play_OBJ_paydaydrill_end_01", GameManager.Instance.gameObject); GameManager.Instance.MainCameraController.SetManualControl(false, false); GameManager.Instance.BestActivePlayer.WarpToPoint(oldPlayerPosition, false, false); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(GameManager.Instance.BestActivePlayer).ReuniteWithOtherPlayer(GameManager.Instance.BestActivePlayer, false); } ExpandMoveObjectBetweenRooms(sourceChest.transform, newRoom, sourceRoom); for (int n = 0; n < movedObjects.Count; n++) { ExpandMoveObjectBetweenRooms(movedObjects[n], newRoom, sourceRoom); } sourceRoom.RegisterInteractable(sourceChest); FieldInfo m_inEffectField = typeof(PaydayDrillItem).GetField("m_inEffect", BindingFlags.Instance | BindingFlags.NonPublic); m_inEffectField.SetValue(self, false); } yield break; }
public override void OnCreation(Dungeon dungeon) { dungeon.SetRole(0, "#giantspider"); }
protected IEnumerator ExpandHandleTransitionToFallbackCombatRoom(PaydayDrillItem drillItem, RoomHandler sourceRoom, Chest sourceChest) { Dungeon d = GameManager.Instance.Dungeon; sourceChest.majorBreakable.TemporarilyInvulnerable = true; sourceRoom.DeregisterInteractable(sourceChest); // RoomHandler newRoom = ExpandUtility.Instance.AddCustomRuntimeRoom(drillItem.GenericFallbackCombatRoom, true, false, lightStyle: DungeonData.LightGenerationStyle.STANDARD); RoomHandler newRoom = d.AddRuntimeRoom(drillItem.GenericFallbackCombatRoom, null, DungeonData.LightGenerationStyle.FORCE_COLOR); newRoom.CompletelyPreventLeaving = true; Vector3 oldChestPosition = sourceChest.transform.position; sourceChest.transform.position = newRoom.Epicenter.ToVector3(); if (sourceChest.transform.parent == sourceRoom.hierarchyParent) { sourceChest.transform.parent = newRoom.hierarchyParent; } SpeculativeRigidbody component = sourceChest.GetComponent <SpeculativeRigidbody>(); if (component) { component.Reinitialize(); PathBlocker.BlockRigidbody(component, false); } tk2dBaseSprite component2 = sourceChest.GetComponent <tk2dBaseSprite>(); if (component2) { component2.UpdateZDepth(); } Vector3 m_baseChestOffset = ReflectionHelpers.ReflectGetField <Vector3>(typeof(PaydayDrillItem), "m_baseChestOffset", drillItem); Vector3 m_largeChestOffset = ReflectionHelpers.ReflectGetField <Vector3>(typeof(PaydayDrillItem), "m_largeChestOffset", drillItem); Vector3 chestOffset = m_baseChestOffset; if (sourceChest.name.Contains("_Red") || sourceChest.name.Contains("_Black")) { chestOffset += m_largeChestOffset; } GameObject spawnedVFX = SpawnManager.SpawnVFX(drillItem.DrillVFXPrefab, sourceChest.transform.position + chestOffset, Quaternion.identity); tk2dBaseSprite spawnedSprite = spawnedVFX.GetComponent <tk2dBaseSprite>(); spawnedSprite.HeightOffGround = 1f; spawnedSprite.UpdateZDepth(); Vector2 oldPlayerPosition = GameManager.Instance.BestActivePlayer.transform.position.XY(); Vector2 newPlayerPosition = newRoom.Epicenter.ToVector2() + new Vector2(0f, -3f); Pixelator.Instance.FadeToColor(0.25f, Color.white, true, 0.125f); Pathfinder.Instance.InitializeRegion(d.data, newRoom.area.basePosition, newRoom.area.dimensions); GameManager.Instance.BestActivePlayer.WarpToPoint(newPlayerPosition, false, false); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(GameManager.Instance.BestActivePlayer).ReuniteWithOtherPlayer(GameManager.Instance.BestActivePlayer, false); } yield return(null); for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { GameManager.Instance.AllPlayers[i].WarpFollowersToPlayer(false); GameManager.Instance.AllPlayers[i].WarpCompanionsToPlayer(false); } yield return(new WaitForSeconds(drillItem.DelayPostExpansionPreEnemies)); yield return(GameManager.Instance.StartCoroutine(ExpandHandleCombatWaves(drillItem, d, newRoom, sourceChest))); drillItem.DisappearDrillPoof.SpawnAtPosition(spawnedSprite.WorldBottomLeft + new Vector2(-0.0625f, 0.25f), 0f, null, null, null, new float?(3f), false, null, null, false); UnityEngine.Object.Destroy(spawnedVFX.gameObject); AkSoundEngine.PostEvent("Stop_OBJ_paydaydrill_loop_01", GameManager.Instance.gameObject); AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", GameManager.Instance.gameObject); sourceChest.ForceUnlock(); bool goodToGo = false; while (!goodToGo) { goodToGo = true; for (int j = 0; j < GameManager.Instance.AllPlayers.Length; j++) { float num = Vector2.Distance(sourceChest.specRigidbody.UnitCenter, GameManager.Instance.AllPlayers[j].CenterPosition); if (num > 3f) { goodToGo = false; } } yield return(null); } Pixelator.Instance.FadeToColor(0.25f, Color.white, true, 0.125f); GameManager.Instance.BestActivePlayer.WarpToPoint(oldPlayerPosition, false, false); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(GameManager.Instance.BestActivePlayer).ReuniteWithOtherPlayer(GameManager.Instance.BestActivePlayer, false); } sourceChest.transform.position = oldChestPosition; if (sourceChest.transform.parent == newRoom.hierarchyParent) { sourceChest.transform.parent = sourceRoom.hierarchyParent; } SpeculativeRigidbody component3 = sourceChest.GetComponent <SpeculativeRigidbody>(); if (component3) { component3.Reinitialize(); } tk2dBaseSprite component4 = sourceChest.GetComponent <tk2dBaseSprite>(); if (component4) { component4.UpdateZDepth(); } sourceRoom.RegisterInteractable(sourceChest); FieldInfo m_inEffectField = typeof(PaydayDrillItem).GetField("m_inEffect", BindingFlags.Instance | BindingFlags.NonPublic); m_inEffectField.SetValue(drillItem, false); // m_inEffect = false; yield break; }
private void InitObjectMods(Dungeon dungeon) { if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.JUNGLEGEON) { GameObject JungleRainPlacable = new GameObject("ExpandJungleThunderStorm", new System.Type[] { typeof(ExpandThunderStormPlacable) }) { layer = 0 }; JungleRainPlacable.transform.parent = dungeon.gameObject.transform; ExpandThunderStormPlacable ThunderstormPlacable = JungleRainPlacable.GetComponent <ExpandThunderStormPlacable>(); ThunderstormPlacable.useCustomIntensity = true; ThunderstormPlacable.RainIntensity = 425f; ThunderstormPlacable.enableLightning = true; ThunderstormPlacable.isSecretFloor = false; ThunderstormPlacable.ConfigureOnPlacement(null); } if (GameManager.Instance.CurrentFloor == 1) { ExpandStats.HasSpawnedSecretBoss = false; } // Disable victory music for Ser Manuel if not on tutorial floor. (it can cause double music bug if you kill him on other floors) if (dungeon.LevelOverrideType != GameManager.LevelOverrideState.TUTORIAL) { ExpandPrefabs.SerManuel.GetComponent <HealthHaver>().forcePreventVictoryMusic = true; } else { ExpandPrefabs.SerManuel.GetComponent <HealthHaver>().forcePreventVictoryMusic = false; } // Assign pitfall destination to entrance on Floor 1 if in Bossrush mode and special entrance room to Miniboss room path is available. // Glitch Chest floors now added for this since they now have elevator entrance rooms. if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH | GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH | dungeon.IsGlitchDungeon) { foreach (RoomHandler specificRoom in dungeon.data.rooms) { if (!string.IsNullOrEmpty(specificRoom.GetRoomName())) { if (specificRoom.GetRoomName().ToLower().StartsWith("elevatormaintenance") && (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON | dungeon.IsGlitchDungeon)) { if (dungeon.data.Entrance != null && dungeon.data.Entrance.GetRoomName().ToLower().StartsWith("elevator entrance")) { dungeon.data.Entrance.TargetPitfallRoom = specificRoom; dungeon.data.Entrance.ForcePitfallForFliers = true; } } } } } if (dungeon.IsGlitchDungeon | ExpandDungeonFlow.isGlitchFlow) { dungeon.BossMasteryTokenItemId = ItemAPI.CustomMasterRounds.CanyonMasterRoundID; foreach (AIActor enemy in FindObjectsOfType <AIActor>()) { if (!enemy.IsBlackPhantom && !enemy.healthHaver.IsBoss && !string.IsNullOrEmpty(enemy.EnemyGuid) && enemy.optionalPalette == null && (string.IsNullOrEmpty(enemy.OverrideDisplayName) | !enemy.OverrideDisplayName.StartsWith("Corrupted"))) { if (!ExpandLists.DontGlitchMeList.Contains(enemy.EnemyGuid)) { if (Random.value <= 0.6f) { ExpandShaders.Instance.BecomeGlitched(enemy, 0.04f, 0.07f, 0.05f, 0.07f, 0.05f); ExpandGlitchedEnemies.GlitchExistingEnemy(enemy); } if (Random.value <= 0.25f && !ExpandLists.blobsAndCritters.Contains(enemy.EnemyGuid) && enemy.GetComponent <ExpandSpawnGlitchObjectOnDeath>() == null) { enemy.gameObject.AddComponent <ExpandSpawnGlitchObjectOnDeath>(); } } } } foreach (BraveBehaviour targetObject in FindObjectsOfType <BraveBehaviour>()) { if (Random.value <= 0.05f && targetObject.gameObject && !targetObject.gameObject.GetComponent <AIActor>() && !targetObject.gameObject.GetComponent <Chest>()) { if (string.IsNullOrEmpty(targetObject.gameObject.name) | (!targetObject.gameObject.name.ToLower().StartsWith("glitchtile") && !targetObject.gameObject.name.ToLower().StartsWith("ex secret door") && !targetObject.gameObject.name.ToLower().StartsWith("lock") && !targetObject.gameObject.name.ToLower().StartsWith("chest"))) { float RandomIntervalFloat = Random.Range(0.02f, 0.04f); float RandomDispFloat = Random.Range(0.06f, 0.08f); float RandomDispIntensityFloat = Random.Range(0.07f, 0.1f); float RandomColorProbFloat = Random.Range(0.035f, 0.1f); float RandomColorIntensityFloat = Random.Range(0.05f, 0.1f); ExpandShaders.Instance.BecomeGlitched(targetObject, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); } } } ExpandPlaceGlitchedEnemies m_GlitchEnemyRandomizer = new ExpandPlaceGlitchedEnemies(); m_GlitchEnemyRandomizer.PlaceRandomEnemies(dungeon, GameManager.Instance.CurrentFloor); Destroy(m_GlitchEnemyRandomizer); MaybeSetupGlitchEnemyStun(dungeon); } }
public Composer(Dungeon d) { dungeon = d; }
public override void OnLeftEarly(Dungeon dungeon, Creature creature) { dungeon.PlayCutscene("G1_LeaveDungeon"); }
public override void OnCreation(Dungeon dungeon) { dungeon.SetRole(0, "#mores"); }
override public void Update(System.TimeSpan delta) { if (this.launchedOn != null && (DateTime.Now - this.launchedOn.Value).TotalMilliseconds >= 100) { Dungeon dungeon; // https://trello.com/c/XSE5Shge/142-reach-b10-quit-new-we-have-omnisight Options.EnableOmniSight = false; if (this.loadGame) { var serialized = File.ReadAllText(Serializer.SaveGameFileName); dungeon = Serializer.Deserialize <Dungeon>(serialized); // Go in and re-pair power-ups which are not paired any more foreach (var floor in dungeon.Floors) { floor.PairPowerUps(); floor.InitializeMapAndFov(); floor.RecreateSubclassedMonsters(); } dungeon.CurrentFloor.RecalculatePlayerFov(); Dungeon.Instance = dungeon; Console.WriteLine($"Loaded game {dungeon.GameSeed}."); LastGameLogger.Instance.Log($"Loaded game {dungeon.GameSeed}."); if (dungeon.CurrentFloorNum == 9) // B10 { Options.EnableOmniSight = true; } } else { dungeon = new Dungeon(this.Width, this.Height, gameSeed); dungeon.GoToNextFloor(); } SadConsole.Global.CurrentScreen = new CoreGameConsole(this.Width, this.Height, dungeon); // Show intro events after all event bus handlers are set if (dungeon.CurrentFloorNum == 0 && !loadGame) { // New game. Show intro data cube, now that event handlers are set up. dungeon.Floors[0].ShowIntroCube(); } } if (optionsMenu == null) { if (this.keyboard.IsKeyPressed(Key.Escape)) { this.Quit(); } else if (this.keyboard.IsKeyPressed(Key.N)) { this.StartNewGame(); } else if (this.keyboard.IsKeyPressed(Key.L)) { this.LoadGame(); } else if (this.keyboard.IsKeyPressed(Key.O)) { this.ShowOptions(); } if (this.keyboard.IsKeyPressed(Options.KeyBindings[GameAction.MoveUp])) { this.currentItemIndex -= 1; if (this.currentItemIndex == -1) { this.currentItemIndex = Enum.GetValues(typeof(MenuItem)).Length - 1; } this.DrawMenu(); } else if (this.keyboard.IsKeyPressed(Options.KeyBindings[GameAction.MoveDown])) { var numItems = File.Exists(Serializer.SaveGameFileName) ? 4 : 3; this.currentItemIndex = (this.currentItemIndex + 1) % numItems; this.DrawMenu(); } if (this.keyboard.IsKeyPressed(Options.KeyBindings[GameAction.SkipTurn])) { var currentItem = this.GetCurrentItem(); switch (currentItem) { case MenuItem.NewGame: this.StartNewGame(); break; case MenuItem.LoadGame: this.LoadGame(); break; case MenuItem.Options: this.ShowOptions(); break; case MenuItem.Quit: this.Quit(); break; } } } else { optionsMenu.Draw(this); optionsMenu.ProcessInput(this.keyboard); } }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(12001, 6); // Ghost Armor dungeon.PlayCutscene("G1_18_b_MoresRP"); }
public override void OnBoss(Dungeon dungeon) { dungeon.AddBoss(130014, 1); // Small Golem dungeon.PlayCutscene("bossroom_small_golem_Ciar"); }
public abstract byte[] Run(Dungeon D);
public void TeleportToGlitchRoom() { try { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; Dungeon dungeon = GameManager.Instance.Dungeon; ChaosRoomRandomizer roomRandomizer = new ChaosRoomRandomizer(); int SelectedRoomIndex = UnityEngine.Random.Range(0, roomRandomizer.MasterRoomArray.Length); int SelectedCombatRoomIndex = UnityEngine.Random.Range(0, ChaosPrefabs.CustomRoomTable.includedRooms.elements.Count); if (BraveUtility.RandomBool()) { SelectedPrototypeDungeonRoom = Instantiate(roomRandomizer.MasterRoomArray[SelectedRoomIndex]); } else { SelectedPrototypeDungeonRoom = Instantiate(ChaosPrefabs.CustomRoomTable.includedRooms.elements[SelectedCombatRoomIndex].room); } Destroy(roomRandomizer); // roomRandomizer = null; if (SelectedPrototypeDungeonRoom == null) { Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } if (SelectedPrototypeDungeonRoom.category == PrototypeDungeonRoom.RoomCategory.SECRET) { SelectedPrototypeDungeonRoom.category = PrototypeDungeonRoom.RoomCategory.NORMAL; } SelectedPrototypeDungeonRoom.name = ("Glitched " + SelectedPrototypeDungeonRoom.name); GlitchRoom = ChaosUtility.Instance.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom); // Spawn Rainbow chest. This room doesn't spawn NPC it seems.(unless player hasn't unlocked it yet? Not likely. Most would have unlocked this one by now) if (GlitchRoom.GetRoomName().ToLower().EndsWith("earlymetashopcell")) { IntVector2 SpecialChestLocation = new IntVector2(10, 14); WeightedGameObject wChestObject = new WeightedGameObject(); Chest RainbowChest = GameManager.Instance.RewardManager.Rainbow_Chest; wChestObject.rawGameObject = RainbowChest.gameObject; WeightedGameObjectCollection wChestObjectCollection = new WeightedGameObjectCollection(); wChestObjectCollection.Add(wChestObject); Chest PlacableChest = GlitchRoom.SpawnRoomRewardChest(wChestObjectCollection, (SpecialChestLocation + GlitchRoom.area.basePosition)); } primaryPlayer.EscapeRoom(PlayerController.EscapeSealedRoomStyle.TELEPORTER, true, GlitchRoom); primaryPlayer.WarpFollowersToPlayer(); Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { GameManager.Instance.GetOtherPlayer(secondaryPlayer).ReuniteWithOtherPlayer(primaryPlayer, false); } } catch (Exception ex) { if (ChaosConsole.debugMimicFlag) { ETGModConsole.Log("[DEBUG] Error! Exception occured while attempting to generate glitch room!", false); ETGModConsole.Log(ex.Message, false); ETGModConsole.Log(ex.Source, false); ETGModConsole.Log(ex.StackTrace, false); ETGModConsole.Log(ex.TargetSite.ToString(), false); Debug.LogException(ex); } Invoke("TentacleRelease", 1f); Invoke("TentacleShowPlayer", 1.45f); Invoke("Unfreeze", 2f); return; } return; }
public static void GenerateDungeon() { Dungeon dungeon = DungeonGenerator.Generate(); PartySelectUI.Show(); }