public void StartExplorer(int stage)
        {
            var stageData  = _explorer.GetStage(stage);
            var staticData = _explorer.Stages[stage];

            //UpdateExplorerSlots();
            foreach (var temp in _units.State.LastTeam)
            {
                var data = _units.GetUnit(temp.Key).data;
                data.ExplorerPosition = temp.Value;
                data.Reserve          = false;
            }

            if (_units.ExplorerUnits.Length == 0)
            {
                throw new Exception("The number of selected units in exploration should be: 0 < count < 3");
            }
            if (!stageData.IsUnlock)
            {
                throw new Exception($"Stage is locked. stage_id = {stage}");
            }
            if (stageData.DailyNumber <= 0)
            {
                throw new Exception($"Ended up trying for today. stage_id = {stage}.");
            }
            if (!staticData.NoExit)
            {
                stageData.DailyNumber--;
            }
            _scorers.Spend(staticData.Price, _formula);
            _explorerLogic.StartExplorer(stage);
            LogicLog.SetExplorer(stage, LogExplorerType.Start);
        }
        public void CheatEndExplorer()
        {
            CompleteStageFull(_explorer.CurrentStage);
            var scorer = _scorers.GetScorer(HardCodeIds.CurrentStage);

            _scorers.State.Values[scorer.Id]++;
            _battle.State.Data = null;
            LogicLog.SetExplorer(_explorer.CurrentStage, LogExplorerType.FinishImpact);
            _explorerLogic.FinishExplorer(true);
        }
 public void RefreshStamina()
 {
     if (!_explorer.State.IsRun)
     {
         Logger.Error($"Attempting to record stamina for stage outside of explorer", this);
         return;
     }
     _explorer.GetStage(_explorer.CurrentStage).Values[_scorers.StaminaId] += _settings.Settings.PlayerSettings.BuyStamina;
     _scorers.Spend(_settings.GetPriceStamina(_explorer.State.RefreshNumber), _formula);
     _explorer.State.RefreshNumber++;
     LogicLog.ExploreRenew(_explorer.State.StageId, _explorer.State.RefreshNumber);
     LogicLog.SetExplorer(_explorer.CurrentStage, LogExplorerType.BuyStamina);
 }
Exemple #4
0
        public void StageAutowin(int selectedStageId, int tryCount)
        {
            var stage     = _explorer.Stages[selectedStageId];
            var stageData = _explorer.GetStage(stage.Id);

            for (var i = 0; i < tryCount; i++)
            {
                _explorer.SetCurrentStage(selectedStageId);
                Impact.ExecuteImpact(stage.ImpactAutowin);
                Scorers.Spend(stage.Price, Formula);
                _explorer.ClearCurrentStage();
                LogicLog.SetExplorer(selectedStageId, LogExplorerType.AutoWin);
            }

            stageData.DailyNumber = Mathf.Clamp(stageData.DailyNumber - tryCount, 0, int.MaxValue);
        }
 public void EndExplorer(int[] inventoryIds, LogExplorerType result)
 {
     if (result == LogExplorerType.Start)
     {
         throw new Exception("Invalid exploration end state");
     }
     if (result == LogExplorerType.FinishImpact)
     {
         if (inventoryIds.Length > 10)
         {
             throw new Exception("The number of selected items must not exceed 100");
         }
         foreach (var id in inventoryIds)
         {
             _inventory.AddItem(id, _explorer.State.Inventory[id]);
         }
     }
     _battle.State.Data = null;
     LogicLog.SetExplorer(_explorer.State.StageId, result);
     _explorerLogic.FinishExplorer(result == LogExplorerType.FinishImpact);
 }