public void StartBattle(ExplorerPositionData position)
 {
     _contextLogic.TurnType = BattleTurnResultType.StartTurn;
     _battleLogic.StartBattle();
     _contextLogic.SetAbilityContext(-1, -1, false);
     _impactLogic.ExecuteImpact(_contextLogic.ImpactInit);
     _battleLogic.BatchEventBattle();
     _contextLogic.TurnType = BattleTurnResultType.PassiveAbility;
     foreach (var temp in _battle.LiveAllies)
     {
         _contextLogic.TurnType = BattleTurnResultType.PassiveAbility;
         ExecuteStartAbility(temp, false);
     }
     foreach (var temp in _battle.LiveEnemies)
     {
         _contextLogic.TurnType = BattleTurnResultType.PassiveAbility;
         ExecuteStartAbility(temp, true);
         if (_contextLogic.MobImpacts.TryGetValue(temp, out var impact))
         {
             _contextLogic.SetAbilityContext(temp, null, true);
             _impactLogic.ExecuteImpact(impact);
         }
     }
     _contextLogic.TurnType   = BattleTurnResultType.EndTurn;
     _explorer.State.Position = position;
     _battleLogic.UpdateMobs();
     _battleLogic.BatchEventBattle();
     LogicLog.SetBattle(LogBattleType.Start, _explorer.State.LastInteractiveId, _explorer.State.RoomId, _explorer.CurrentStage);
 }
Exemplo n.º 2
0
        public void Activation(ExplorerImpactType type, int impactId, ExplorerPositionData position)
        {
            if (type != ExplorerImpactType.StageInit)
            {
                _explorer.State.Position = position;
            }

            IImpact impact = null;

            switch (type)
            {
            case ExplorerImpactType.StageInit:
                impact = _explorer.GetStageImpact(impactId, true);
                break;

            case ExplorerImpactType.StageFinish:
                //impact = _explorer.GetStageImpact(impactId, false);
                break;

            case ExplorerImpactType.RoomsInit:
                impact = _explorer.GetRoomImpact(impactId);
                break;

            case ExplorerImpactType.PlayerLevels:
                impact = Player.GetImpact(impactId);
                break;

            default:
                throw new Exception($"Unknown activationType = {type}");
            }
            if (impact != null)
            {
                _impactLogic.ExecuteImpact(impact);
            }
        }
 public void PreSave()
 {
     _AchievementState.PreSave();
     Internal_IAchievementState_Achievements = _AchievementState._Achievements;
     _BattleState.PreSave();
     _CutSceneState.PreSave();
     Internal_ICutSceneState_CompletedCutScene = _CutSceneState._CompletedCutScene;
     _ExplorerState.PreSave();
     Internal_IExplorerState_StageId           = _ExplorerState._StageId;
     Internal_IExplorerState_RoomId            = _ExplorerState._RoomId;
     Internal_IExplorerState_Stages            = _ExplorerState._Stages;
     Internal_IExplorerState_Inventory         = _ExplorerState._Inventory;
     Internal_IExplorerState_Position          = _ExplorerState._Position;
     Internal_IExplorerState_LastInteractiveId = _ExplorerState._LastInteractiveId;
     Internal_IExplorerState_PlayerBuffs       = _ExplorerState._PlayerBuffs;
     Internal_IExplorerState_IsRun             = _ExplorerState._IsRun;
     Internal_IExplorerState_RefreshNumber     = _ExplorerState._RefreshNumber;
     _InventoryState.PreSave();
     Internal_IInventoryState_Items = _InventoryState._Items;
     Internal_IInventoryState_Gacha = _InventoryState._Gacha;
     _LogState.PreSave();
     Internal_ILogState_Log = _LogState._Log;
     _PlayerState.PreSave();
     Internal_IPlayerState_Level         = _PlayerState._Level;
     Internal_IPlayerState_Exp           = _PlayerState._Exp;
     Internal_IPlayerState_RegisterTime  = _PlayerState._RegisterTime;
     Internal_IPlayerState_LastLoginTime = _PlayerState._LastLoginTime;
     Internal_IPlayerState_SyncTime      = _PlayerState._SyncTime;
     _ScorersState.PreSave();
     Internal_IScorersState_Values       = _ScorersState._Values;
     Internal_IScorersState_BattleValues = _ScorersState._BattleValues;
     Internal_IScorersState_ImpactValues = _ScorersState._ImpactValues;
     _SettingsState.PreSave();
     Internal_ISettingsState_MusicOff       = _SettingsState._MusicOff;
     Internal_ISettingsState_SoundOff       = _SettingsState._SoundOff;
     Internal_ISettingsState_RegTime        = _SettingsState._RegTime;
     Internal_ISettingsState_LoginTime      = _SettingsState._LoginTime;
     Internal_ISettingsState_SyncTime       = _SettingsState._SyncTime;
     Internal_ISettingsState_Locale         = _SettingsState._Locale;
     Internal_ISettingsState_Server         = _SettingsState._Server;
     Internal_ISettingsState_CurrentVersion = _SettingsState._CurrentVersion;
     Internal_ISettingsState_Build          = _SettingsState._Build;
     Internal_ISettingsState_RandomState    = _SettingsState._RandomState;
     Internal_ISettingsState_PushStatus     = _SettingsState._PushStatus;
     _ShopState.PreSave();
     Internal_IShopState_Groups       = _ShopState._Groups;
     Internal_IShopState_Offers       = _ShopState._Offers;
     Internal_IShopState_Transactions = _ShopState._Transactions;
     _UnitsState.PreSave();
     Internal_IUnitsState_Units    = _UnitsState._Units;
     Internal_IUnitsState_Assist   = _UnitsState._Assist;
     Internal_IUnitsState_LastTeam = _UnitsState._LastTeam;
 }
 public void StartBattle(ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.BattleModule.StartBattle(position);
     }
     catch (Exception e)
     {
         Logger.ErrorEmulate(e);
         return;
     }
     PostCommand();
 }
 public void ActivationObject(Int32 id, Int32 index, PerkExecuteData data, ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.ActivationModule.ActivationObject(id, index, data, position);
     }
     catch (Exception e)
     {
         Logger.ErrorEmulate(e);
         return;
     }
     PostCommand();
 }
 public void Activation(ExplorerImpactType type, Int32 impactId, ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.ActivationModule.Activation(type, impactId, position);
     }
     catch (Exception e)
     {
         Logger.ErrorEmulate(e);
         return;
     }
     PostCommand();
 }
 public void StartBattle(ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.BattleModule.StartBattle(position);
     }
     catch (Exception e)
     {
         Logger.Exception(e, "StartBattle", new object[] { (object)position });
         return;
     }
     PostCommand("StartBattle", new object[] { (object)position });
 }
 public void ActivationObject(Int32 id, Int32 index, PerkExecuteData data, ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.ActivationModule.ActivationObject(id, index, data, position);
     }
     catch (Exception e)
     {
         Logger.Exception(e, "ActivationObject", new object[] { (object)id, (object)index, (object)data, (object)position });
         return;
     }
     PostCommand("ActivationObject", new object[] { (object)id, (object)index, (object)data, (object)position });
 }
 public void Activation(ExplorerImpactType type, Int32 impactId, ExplorerPositionData position)
 {
     PreCommand();
     try
     {
         _modules.ActivationModule.Activation(type, impactId, position);
     }
     catch (Exception e)
     {
         Logger.Exception(e, "Activation", new object[] { (object)(int)type, (object)impactId, (object)position });
         return;
     }
     PostCommand("Activation", new object[] { (object)(int)type, (object)impactId, (object)position });
 }
Exemplo n.º 10
0
        public void ActivationObject(int id, int index, PerkExecuteData data, ExplorerPositionData position)
        {
            _changeLogic.SetMode(ApplyMode.Manual);
            LogicLog.Activate(id, index);
            var activation = _explorer.GetActivation(id, index);

            _explorer.State.Position = position;
            _impactLogic.ExecuteImpact(activation.Impact);
            var staminaId = _scorers.StaminaId;

            if (data != null)
            {
                var perk = _units.Static.Perks[data.PerkId];
                if (perk.ClassId != activation.Source.PerkClassId)
                {
                    throw new Exception($"Perk cannot be applied. UnitId = {data.UnitId} perkId = {data.PerkId} perk class id = {perk.ClassId}  activation perkClassId = {activation.Source.PerkClassId}");
                }
                if (activation.Source.UnitId != 0 && activation.Source.UnitId != data.UnitId)
                {
                    throw new Exception($"Perk cannot be applied. UnitId = {data.UnitId} need unit id = {activation.Source.UnitId}");
                }
                var(unit, _) = _units.GetUnit(data.UnitId);
                if (!unit.PerkStars.TryGetValue(data.PerkId, out var stars) || stars < activation.Source.PerkLevel)
                {
                    throw new Exception($"Not enough stars to use the perk. UnitId = {data.UnitId} perkId = {data.PerkId} perkStars = {stars} activation stars = {activation.Source.PerkLevel} ");
                }
                if (!unit.PerkCharges.TryGetValue(data.PerkId, out var value) || value == 0)
                {
                    throw new Exception($"НNot enough stars to use the perk. UnitId = {data.UnitId} perkId = {data.PerkId}");
                }
                unit.PerkCharges[data.PerkId]--;
            }
            else
            {
                if (activation.Source.PerkClassId != 0)
                {
                    throw new Exception($"Can't complete activation without perk. activation perkClassId = {activation.Source.PerkClassId}");
                }
            }
            //_explorer.SpendScorer(staminaId, (int)_formulaLogic.Calculate(activation.Cost.Stamina));
            //_explorer.ActivateInteractiveObject(id);
            _explorer.State.LastInteractiveId = id;


            _changeLogic.BatchCutScene(0);
            _changeLogic.SetMode(ApplyMode.Auto);
        }