public void OnAction(EventAction e) { var sword = Curio.GetBehavior <BehaviorSword>(); if (sword == null || !Enflamed) { return; } var slashes = e.Actions.GetEffectsBy <ActionSwordSlash>(Curio); var stabs = e.Actions.GetEffectsBy <ActionSwordStab>(Curio); foreach (var slash in slashes.ToList()) { e.Actions.Insert(0, new ActionFireSlash(Curio, slash).InSlot(ActionSlot.Active)); } foreach (var stab in stabs.ToList()) { e.Actions.Insert(0, new ActionFireStab(Curio, stab).InSlot(ActionSlot.Active)); } }
private void FireDaggers() { var world = Origin.GetWorld(); var tile = Origin.GetMainTile(); //new TimeFade(world, 0.05f, LerpHelper.ExponentialIn, 20); int index = 0; var position = SlashEnd; var angle = Origin.GetAngle() + position * MathHelper.PiOver4; var offset = Util.AngleToVector(angle).ToTileOffset(); var neighbor = tile.GetNeighborOrNull(offset.X, offset.Y); if (neighbor != null) { var dagger = new Curio(Template.BloodThorn); dagger.MoveTo(tile); dagger.GetBehavior <BehaviorProjectile>().Fire(Origin, Util.AngleToVector(angle), 3, 20); } index++; }
public void OnAction(EventAction e) { var sword = Curio.GetBehavior <BehaviorSword>(); if (sword == null) { return; } var slashes = e.Actions.GetEffectsBy <ActionSwordSlash>(Curio); foreach (var slash in slashes.ToList()) { if (slash.SlashStart == 0 && slash.SlashEnd == -3) { e.Actions.Add(new ActionButterflyKnives(slash.Origin, -1, -3).InSlot(ActionSlot.Active)); } if (slash.SlashStart == 0 && slash.SlashEnd == 3) { e.Actions.Add(new ActionButterflyKnives(slash.Origin, 1, 3).InSlot(ActionSlot.Active)); } } }
private void FireDaggers() { var world = Origin.GetWorld(); var tile = Origin.GetMainTile(); var areaPositions = Enumerable.Range(Math.Min(SlashStart, SlashEnd), Math.Abs(SlashEnd - SlashStart) + 1); new TimeFade(world, 0.05f, LerpHelper.ExponentialIn, 20); int index = 0; foreach (var position in areaPositions) { var angle = Origin.GetAngle() + position * MathHelper.PiOver4; var offset = Util.AngleToVector(angle).ToTileOffset(); var neighbor = tile.GetNeighborOrNull(offset.X, offset.Y); if (neighbor != null) { var dagger = new Curio(Template.EnergyKnife); dagger.MoveTo(tile); dagger.GetBehavior <BehaviorProjectile>().Fire(Origin, Util.AngleToVector(angle), 3, 20); } index++; } }
public Finish(Curio curio, MapTile source, MapTile destination) : base(curio, source, destination) { }
public EventCurio(Curio curio) { Curio = curio; }
public BehaviorOnTile(MapTile mapTile, Curio curio) { MapTile = mapTile; Curio = curio; }
public void LoadCurioLoot(Curio curio, CurioInteraction interaction, CurioResult curioResult, RaidInfo raid, bool keepLoot) { KeepLoot = keepLoot; if (keepLoot) { takeAllButton.gameObject.SetActive(false); passButton.gameObject.SetActive(false); partyInventory.SetDeactivated(); } else { takeAllButton.gameObject.SetActive(true); passButton.gameObject.SetActive(true); partyInventory.SetActivated(); } LootType = LootEventType.Curio; ActionType = LootResultType.Waiting; gameObject.SetActive(true); partyInventory.DiscardAll(); if (curio.IsQuestCurio) { if (curioResult != null) { partyInventory.DistributeItem(new ItemDefinition("quest_item", curioResult.Item, 1)); } } else { if (curioResult.IsCombined) { foreach (var result in interaction.Results) { if (result.IsCombined && result.Item != "Nothing") { foreach (var item in RaidSolver.GenerateLoot(result, raid)) { partyInventory.DistributeItem(item); } } } } else if (curioResult.Item != "Nothing") { foreach (var item in RaidSolver.GenerateLoot(curioResult, raid)) { partyInventory.DistributeItem(item); } } if (RaidSceneManager.RaidPanel.SelectedHero != null) { var extraLoot = RaidSceneManager.RaidPanel.SelectedHero.HeroClass.ExtraCurioLoot; if (extraLoot != null) { foreach (var item in RaidSolver.GenerateLoot(extraLoot.Code, extraLoot.Count, raid)) { partyInventory.DistributeItem(item); } } } } partyInventory.DeactivateEmptySlots(); title.text = LocalizationManager.GetString("str_overlay_loot_chest_title"); description.text = LocalizationManager.GetString("str_overlay_loot_chest_description"); if (partyInventory.HasSomething()) { ScrollOpened(); } else { Close(); } }
private static void PopulateQuestGoals(Dungeon dungeon, Quest quest, List <GenRoom> existingRooms, DungeonEnviromentData envData) { switch (quest.Goal.Type) { case "kill_monster": var killData = quest.Goal.QuestData as QuestKillMonsterData; if (killData != null) { var bossGenRoom = FindLongestPathRoom(existingRooms.Find(room => room.Id == dungeon.StartingRoomId), existingRooms); var bossRoom = dungeon.Rooms[bossGenRoom.Id]; bossRoom.Type = AreaType.Boss; var bossEncounter = envData.BattleMashes.Find(mash => mash.MashId == quest.Difficulty). BossEncounters.Find(encounter => encounter.MonsterSet.Contains(killData.MonsterNameIds[0])); bossRoom.BattleEncounter = new BattleEncounter(bossEncounter.MonsterSet); } else { Debug.LogError("Missing boss data in dungeon!"); } break; case "activate": var activateData = quest.Goal.QuestData as QuestActivateData; if (activateData != null) { var lastRoom = FindLongestPathRoom(existingRooms.Find(room => room.Id == dungeon.StartingRoomId), existingRooms); for (int i = 0; i < activateData.Amount; i++) { var availableRooms = existingRooms.FindAll(room => room.MinPath >= (float)i / activateData.Amount * lastRoom.MinPath && room.MinPath <= (float)(i + 1) / activateData.Amount * lastRoom.MinPath); int randomRoom = Random.Range(0, availableRooms.Count - 1); var questRoom = dungeon.Rooms[availableRooms[randomRoom].Id]; if (questRoom.Type == AreaType.Empty) { var curio = new Curio(activateData.CurioName) { IsQuestCurio = true }; if (quest.Goal.StartingItems.Count > 0) { curio.ItemInteractions.Add(new ItemInteraction() { Chance = 1, ItemId = quest.Goal.StartingItems[0].Id, ResultType = "loot", Results = new List <CurioResult>(), }); } questRoom.Type = AreaType.Curio; questRoom.Prop = curio; } else { i--; } } } break; case "gather": if (quest.Goal.QuestData is QuestGatherData) { var gatherData = quest.Goal.QuestData as QuestGatherData; var lastRoom = FindLongestPathRoom(existingRooms.Find(room => room.Id == dungeon.StartingRoomId), existingRooms); for (int i = 0; i < gatherData.Item.Amount; i++) { var availableRooms = existingRooms.FindAll(room => room.MinPath >= (float)i / gatherData.Item.Amount * lastRoom.MinPath && room.MinPath <= (float)(i + 1) / gatherData.Item.Amount * lastRoom.MinPath); int randomRoom = Random.Range(0, availableRooms.Count - 1); var questRoom = dungeon.Rooms[availableRooms[randomRoom].Id]; if (questRoom.Type == AreaType.Empty) { var curio = new Curio(gatherData.CurioName) { IsQuestCurio = true }; var curioInteraction = new CurioInteraction(); curioInteraction.Chance = 1; curioInteraction.ResultType = "loot"; curioInteraction.Results = new List <CurioResult>(); curioInteraction.Results.Add(new CurioResult() { Chance = 1, Draws = 1, Item = gatherData.Item.Id, }); curio.Results.Add(curioInteraction); questRoom.Type = AreaType.Curio; questRoom.Prop = curio; } else { i--; } } } break; } }
public void LoadCurioLoot(Curio curio, CurioInteraction interaction, CurioResult result, bool keepLoot = false) { loot.LoadCurioLoot(curio, interaction, result, RaidSceneManager.Raid, keepLoot); }
public void LoadInteraction(Curio curio, IRaidArea areaView) { itemInteraction.LoadInteraction(curio, areaView); }
public BehaviorMovable(Curio curio, Mask mask) { Curio = curio; Mask = mask; }
public BehaviorActionHolder(Curio curio, ActionSlot type) { Curio = curio; Type = type; }
public BehaviorShadow(Curio curio) { Curio = curio; }
public static Dungeon GenerateDungeon(Quest quest, int seed = 0) { if (seed != 0) { Random.InitState(seed); } string[] lengthes = new string[] { "", "short", "medium", "long" }; Dungeon dungeon = new Dungeon(); DungeonGenerationData genData = DarkestDungeonManager.Data.DungeonGenerationData.Find(item => item.Dungeon == quest.Dungeon && item.Length == lengthes[quest.Length] && item.QuestType == quest.Type); DungeonEnviromentData envData = DarkestDungeonManager.Data.DungeonEnviromentData[quest.Dungeon]; int RoomsLeft = genData.BaseRoomNumber; int HallsLeft = genData.BaseCorridorNumber; int xSize = genData.GridSizeX; int ySize = genData.GridSizeY; dungeon.GridSizeX = xSize; dungeon.GridSizeY = ySize; List <GenRoom> Areas = new List <GenRoom>(); GenRoom[,] areaGrid = new GenRoom[xSize, ySize]; GenerateRooms(Areas, areaGrid, RoomsLeft, xSize, ySize); GenRoom hub = GetHub(Areas); List <GenRoom> ExistingRooms = ForceBorderRooms(Areas, hub, RoomsLeft); List <GenHall> ExistingHalls = ForceHallConnection(Areas, hub, ExistingRooms, HallsLeft); dungeon.Rooms = GetFinalRooms(ExistingRooms, genData); dungeon.Hallways = GetFinalHallways(dungeon, ExistingHalls, genData); MarkEntrance(dungeon); switch (quest.Goal.Type) { case "kill_monster": if (quest.Goal.QuestData is QuestKillMonsterData) { var bossData = quest.Goal.QuestData as QuestKillMonsterData; envData.BattleMashes.Find(mash => mash.BossEncounters.Find(encounter => encounter.MonsterSet.Contains(bossData.MonsterNameIds[0])) != null); var bossGenRoom = LongestPathRoom(ExistingRooms.Find(room => room.Id == dungeon.StartingRoomId), ExistingRooms); var bossRoom = dungeon.Rooms[bossGenRoom.Id]; bossRoom.Type = AreaType.Boss; var bossEncounter = envData.BattleMashes.Find(mash => mash.MashId == quest.Difficulty). BossEncounters.Find(encounter => encounter.MonsterSet.Contains(bossData.MonsterNameIds[0])); bossRoom.BattleEncounter = new BattleEncounter(bossEncounter.MonsterSet); } else { Debug.LogError("Missing boss data in dungeon!"); } break; case "activate": if (quest.Goal.QuestData is QuestActivateData) { var activateData = quest.Goal.QuestData as QuestActivateData; var lastRoom = LongestPathRoom(ExistingRooms.Find(room => room.Id == dungeon.StartingRoomId), ExistingRooms); for (int i = 0; i < activateData.Amount; i++) { var availableRooms = ExistingRooms.FindAll(room => room.MinPath >= (float)i / activateData.Amount * lastRoom.MinPath && room.MinPath <= (float)(i + 1) / activateData.Amount * lastRoom.MinPath); int randomRoom = Random.Range(0, availableRooms.Count - 1); var questRoom = dungeon.Rooms[availableRooms[randomRoom].Id]; if (questRoom.Type == AreaType.Empty) { var curio = new Curio(activateData.CurioName); curio.IsQuestCurio = true; if (quest.Goal.StartingItems.Count > 0) { curio.ItemInteractions.Add(new ItemInteraction() { Chance = 1, ItemId = quest.Goal.StartingItems[0].Id, ResultType = "loot", Results = new List <CurioResult>(), }); } questRoom.Type = AreaType.Curio; questRoom.Prop = curio; } else { i--; } } } break; case "gather": if (quest.Goal.QuestData is QuestGatherData) { var gatherData = quest.Goal.QuestData as QuestGatherData; var lastRoom = LongestPathRoom(ExistingRooms.Find(room => room.Id == dungeon.StartingRoomId), ExistingRooms); for (int i = 0; i < gatherData.Item.Amount; i++) { var availableRooms = ExistingRooms.FindAll(room => room.MinPath >= (float)i / gatherData.Item.Amount * lastRoom.MinPath && room.MinPath <= (float)(i + 1) / gatherData.Item.Amount * lastRoom.MinPath); int randomRoom = Random.Range(0, availableRooms.Count - 1); var questRoom = dungeon.Rooms[availableRooms[randomRoom].Id]; if (questRoom.Type == AreaType.Empty) { var curio = new Curio(gatherData.CurioName); curio.IsQuestCurio = true; var curioInteraction = new CurioInteraction(); curioInteraction.Chance = 1; curioInteraction.ResultType = "loot"; curioInteraction.Results = new List <CurioResult>(); curioInteraction.Results.Add(new CurioResult() { Chance = 1, Draws = 1, Item = gatherData.Item.Id, }); curio.Results.Add(curioInteraction); questRoom.Type = AreaType.Curio; questRoom.Prop = curio; } else { i--; } } } break; default: break; } PopulateRooms(dungeon, genData); LoadRoomEnviroment(dungeon, envData, quest.Difficulty); PopulateHalls(dungeon, genData); LoadHallEnviroment(dungeon, envData, quest.Difficulty); dungeon.GridSizeX = 1 + (xSize - 1) * 7; dungeon.GridSizeY = 1 + (ySize - 1) * 7; dungeon.Name = quest.Dungeon; dungeon.DungeonMash = envData.BattleMashes.Find(mash => mash.MashId == quest.Difficulty); dungeon.SharedMash = DarkestDungeonManager.Data.DungeonEnviromentData["shared"]. BattleMashes.Find(mash => mash.MashId == quest.Difficulty); return(dungeon); }
public EventMove(Curio curio, MapTile source, MapTile destination) : base(curio) { Source = source; Destination = destination; }
public override IEnumerable <MapTile> GetImpactArea() { var tile = Curio.GetMainTile(); return(tile.GetNearby(1)); }
void OnTriggerEnter2D(Collider2D other) { if (isPartyInside) { return; } isPartyInside = true; if (Area != null) { if (Area.Type == AreaType.Curio) { DarkestSoundManager.ExecuteNarration("curio", NarrationPlace.Raid); } if (Area.Knowledge == Knowledge.Hidden) { RaidSceneManager.TorchMeter.DecreaseTorch(6); } else { RaidSceneManager.TorchMeter.DecreaseTorch(1); } RaidSceneManager.Raid.EnteredSector(Area as HallSector); RaidSceneManager.Raid.CurrentLocation = Area; RaidSceneManager.HallwayView.CurrentSector = this; if (Area.Type == AreaType.Battle) { #region Battle Checks RaidSceneManager.MapPanel.SetCurrentIndicator(Area as HallSector); if (!Area.BattleEncounter.Cleared) { if (RaidSceneManager.Raid.Dungeon.SharedMash != null) { if (RaidSceneManager.TorchMeter.CurrentRange.RangeType == TorchRangeType.Out) { if (!RaidSceneManager.Raid.Dungeon.SharedMashExecutionIds.Contains(0)) { RaidSceneManager.Raid.Dungeon.SharedMashExecutionIds.Add(0); if (RandomSolver.CheckSuccess((float)RaidSceneManager.Raid.Dungeon. SharedMash.HallEncounters[0].Chance / 100)) { Area.BattleEncounter = new BattleEncounter(RaidSceneManager.Raid.Dungeon. SharedMash.HallEncounters[0].MonsterSet); } } } if (RaidSceneManager.Inventory.PercentageFull >= 0.65f) { if (!RaidSceneManager.Raid.Dungeon.SharedMashExecutionIds.Contains(1)) { RaidSceneManager.Raid.Dungeon.SharedMashExecutionIds.Add(1); if (RandomSolver.CheckSuccess((float)RaidSceneManager.Raid.Dungeon. SharedMash.HallEncounters[1].Chance / 100)) { Area.BattleEncounter = new BattleEncounter(RaidSceneManager.Raid.Dungeon. SharedMash.HallEncounters[1].MonsterSet); } } } } RaidSceneManager.Instanse.EncounterMonsters(this); } #endregion } else if (Area.Type == AreaType.Door) { Area.Knowledge = Knowledge.Completed; return; } #region Force Curio Tag if (Area.Type == AreaType.Curio && (Area.Knowledge == Knowledge.Hidden || Area.Knowledge == Knowledge.Scouted)) { Curio curio = Area.Prop as Curio; if (curio.IsQuestCurio == false) { foreach (var triggeredHero in RaidSceneManager.Formations.heroes.party.Units) { if (triggeredHero.Character.Trait != null) { if (triggeredHero.Character.Trait.CurioTag == "All" || curio.Tags.Contains(triggeredHero.Character.Trait.CurioTag)) { if (RandomSolver.CheckSuccess(triggeredHero.Character.Trait.TagChance)) { triggeredHero.OverlaySlot.UnitSelected(); if (!(Prop as RaidCurio).Investigated) { RaidSceneManager.Instanse.ActivateCurio(this, triggeredHero.Character.Trait); } break; } } } var hero = triggeredHero.Character as Hero; foreach (var triggerQuirk in hero.Quirks) { if (triggerQuirk.Quirk.CurioTag == "All" || curio.Tags.Contains(triggerQuirk.Quirk.CurioTag)) { if (RandomSolver.CheckSuccess(triggerQuirk.Quirk.CurioTagChance)) { triggeredHero.OverlaySlot.UnitSelected(); if (!(Prop as RaidCurio).Investigated) { RaidSceneManager.Instanse.ActivateCurio(this, triggerQuirk.Quirk); } break; } } } } } } #endregion if (Area.Knowledge != Knowledge.Completed) { if (Area.Type == AreaType.Hunger) { Area.Knowledge = Knowledge.Completed; if (RaidSceneManager.Raid.HungerCooldown <= 0) { RaidSceneManager.Instanse.ActivateHunger(this); } RaidSceneManager.Raid.ResetHungerCooldown(); } else if (Area.Type == AreaType.Empty) { Area.Knowledge = Knowledge.Completed; RaidSceneManager.Raid.HungerCooldown--; } else if (Area.Knowledge == Knowledge.Hidden || Area.Knowledge == Knowledge.Scouted) { Area.Knowledge = Knowledge.Visited; RaidSceneManager.Raid.HungerCooldown--; } } RaidSceneManager.MapPanel.SetCurrentIndicator(Area as HallSector); RaidSceneManager.MapPanel.OnHallSectorEnter(Area as HallSector); RaidSceneManager.MapPanel.FocusTarget(); } }