public void FinishBattle() { StallingRoundNumber = 0; var darkenessLoot = DarkestDungeonManager.Data.LootDatabase.DarknessLoot["battle"]; for (int i = darkenessLoot.Count - 1; i >= 0; i--) { if (darkenessLoot[i].DarknessLevel == RaidSceneManager.TorchMeter.CurrentRange.Min) { if (RandomSolver.CheckSuccess(darkenessLoot[i].Chance)) { for (int j = 0; j < darkenessLoot[i].Codes.Count; j++) { BattleLoot.Add(new LootDefinition() { Code = darkenessLoot[i].Codes[j], Count = 1 }); } } break; } } for (int i = 0; i < HeroParty.Units.Count; i++) { var hero = (Hero)HeroParty.Units[i].Character; if (hero.HeroClass.ExtraBattleLoot != null) { BattleLoot.Add(hero.HeroClass.ExtraBattleLoot); } } HeroFormation.RectTransform.SetParent(Rect.parent, false); RaidSceneManager.DungeonCamera.target = HeroFormation.ranks.RectTransform; MonsterFormation.overlay.ResetOverlay(); MonsterParty.DeleteFormation(); MonsterFormation.gameObject.SetActive(false); ResetIds(); backdrop.Deactivate(); Round.OrderedUnits.Clear(); RaidSceneManager.TorchMeter.ClearModifier(); if (SharedHealth.IsActive) { SharedHealth.Reset(); } }
public void ReadBattlegroundData(BinaryReader br) { RoundNumber = br.ReadInt32(); RoundStatus = (RoundStatus)br.ReadInt32(); TurnType = (TurnType)br.ReadInt32(); TurnStatus = (TurnStatus)br.ReadInt32(); HeroAction = (HeroTurnAction)br.ReadInt32(); BattleStatus = (BattleStatus)br.ReadInt32(); SurpriseStatus = (SurpriseStatus)br.ReadInt32(); StallingRoundNumber = br.ReadInt32(); SelectedUnitId = br.ReadInt32(); SelectedTargetId = br.ReadInt32(); LastSkillUsed = br.ReadString(); int orderedUnitsCount = br.ReadInt32(); OrderedUnitsCombatIds.Clear(); for (int i = 0; i < orderedUnitsCount; i++) { OrderedUnitsCombatIds.Add(br.ReadInt32()); } int combatIdsCount = br.ReadInt32(); CombatIds.Clear(); for (int i = 0; i < combatIdsCount; i++) { CombatIds.Add(br.ReadInt32()); } int companionsCount = br.ReadInt32(); Companions.Clear(); for (int i = 0; i < companionsCount; i++) { Companions.Add(br.ReadInt32()); } int capturesCount = br.ReadInt32(); Captures.Clear(); for (int i = 0; i < capturesCount; i++) { Captures.Add(br.ReadInt32()); } int controlsCount = br.ReadInt32(); Controls.Clear(); for (int i = 0; i < controlsCount; i++) { Controls.Add(br.ReadInt32()); } int lastDamagedCount = br.ReadInt32(); LastDamaged.Clear(); for (int i = 0; i < lastDamagedCount; i++) { LastDamaged.Add(br.ReadString()); } int battleLootCount = br.ReadInt32(); BattleLoot.Clear(); for (int i = 0; i < battleLootCount; i++) { var newBattleLoot = new LootDefinition() { Code = br.ReadString(), Count = br.ReadInt32(), }; BattleLoot.Add(newBattleLoot); } int removedUnitsCount = br.ReadInt32(); RemovedUnits.Clear(); for (int i = 0; i < removedUnitsCount; i++) { var newFormationUnitData = new FormationUnitSaveData(); newFormationUnitData.ReadFormationUnitData(br); RemovedUnits.Add(newFormationUnitData); } MonsterFormation.ReadFormationData(br); }