Ejemplo n.º 1
0
        private void _atackUserVsNpc(IDbConnection connection, TmpAtackModel am)
        {
            am.SourceUser.Fleet   = am.TaskItem.SourceFleet;
            am.SourceUser.Premium = _storeService.GetPremiumWorkModel(connection, am.SourceUser.User.Id);
            am.SourceUser.Mother  = _motherRunner.RunUser(connection, _mothershipService.GetMother(connection, am.SourceUser.User.Id),
                                                          am.SourceUser.Premium, _mothershipService, _motherJumpService);
            var allianceUser = _allianceService.GetAllianceUserByUserId(connection, am.SourceUser.User.Id);

            am.SourceUser.AllianceTech = _allianceService.GetAllianceTech(connection, allianceUser.AllianceId);
            am.SourceUser.UnitMods     = BattleStatCalculationService.GetUnitStatsAndMods(connection, am.SourceUser.Mother,
                                                                                          am.SourceUser.AllianceTech, _confederationService, _storeService);


            am.DefendorUser.Fleet    = am.DefendorPlanet.Hangar;
            am.DefendorUser.Mother   = am.Npc.NpcMother;
            am.DefendorUser.UnitMods = BattleStatCalculationService.CreateSkagryMods(am.Npc);

            _atackReport(connection, am);

            //atacker user  win
            if (am.ReportDataModel.AtackerWin)
            {
                am.OnAtackerWin(connection, _gDetailPlanetService, _allianceService);
                //calc  cc by damage
                am.SourceUser.Alliance  = _allianceService.GetAllianceById(connection, allianceUser.AllianceId, false);
                am.NewTotalWinnerUserCc = _updateCc(connection, _calcCc(am.DefendorUser.Report, false), am.SourceUser);
            }
            //defendor npc win
            else
            {
                am.FinalizeDefendorWin(connection, _gDetailPlanetService);
            }

            am.FinalizeAtack(connection, _uTaskService);
        }
Ejemplo n.º 2
0
        private void _atackNpcVsUser(IDbConnection connection, TmpAtackModel am)
        {
            //todo  можно ввести зеркало с атки по деф планете для кол ва юнитов
            am.SourceUser.Fleet    = am.TaskItem.SourceFleet.CloneDeep();
            am.SourceUser.Mother   = am.Npc.NpcMother;
            am.SourceUser.Alliance = am.Npc.NpcAlliance;
            am.SourceUser.UnitMods = BattleStatCalculationService.CreateSkagryMods(am.Npc);

            am.DefendorUser.Fleet  = am.DefendorPlanet.Hangar;
            am.DefendorUser.Mother = _motherRunner.RunUser(connection, _mothershipService.GetMother(connection, am.DefendorUser.User.Id),
                                                           am.DefendorUser.Premium, _mothershipService, _motherJumpService);
            am.DefendorUser.AllianceTech = _allianceService.GetAllianceTech(connection, am.DefendorPlanet.AllianceId);
            am.DefendorUser.UnitMods     = BattleStatCalculationService.GetUnitStatsAndMods(connection, am.DefendorUser.Mother,
                                                                                            am.DefendorUser.AllianceTech, _confederationService, _storeService);

            _atackReport(connection, am);

            //atacker npc  win
            if (am.ReportDataModel.AtackerWin)
            {
                am.OnAtackerWin(connection, _gDetailPlanetService, _allianceService);
            }
            //defendor user win
            else
            {
                am.DefendorUser.Alliance = _allianceService.GetAllianceById(connection, am.DefendorUser.AllianceTech.Id, false);

                //calc  cc by damage
                am.NewTotalWinnerUserCc = _updateCc(connection, _calcCc(am.SourceUser.Report, true), am.DefendorUser);
                am.FinalizeDefendorWin(connection, _gDetailPlanetService);
            }


            am.FinalizeAtack(connection, _uTaskService);
        }
Ejemplo n.º 3
0
        private void _atackUserVsUser(IDbConnection connection, TmpAtackModel am)
        {
            am.SourceUser.Fleet = am.TaskItem.SourceFleet;

            am.SourceUser.Premium = _storeService.GetPremiumWorkModel(connection, am.SourceUser.User.Id);
            am.SourceUser.Mother  = _motherRunner.RunUser(connection, _mothershipService.GetMother(connection, am.SourceUser.User.Id),
                                                          am.SourceUser.Premium, _mothershipService, _motherJumpService);
            var sourceAllianceUser = _allianceService.GetAllianceUserByUserId(connection, am.SourceUser.User.Id);

            am.SourceUser.AllianceTech = _allianceService.GetAllianceTech(connection, sourceAllianceUser.AllianceId);
            am.SourceUser.UnitMods     = BattleStatCalculationService.GetUnitStatsAndMods(connection, am.SourceUser.Mother,
                                                                                          am.SourceUser.AllianceTech, _confederationService, _storeService);

            am.DefendorUser.Fleet  = am.DefendorPlanet.Hangar;
            am.DefendorUser.Mother = _motherRunner.RunUser(connection, _mothershipService.GetMother(connection, am.DefendorUser.User.Id),
                                                           am.DefendorUser.Premium, _mothershipService, _motherJumpService);
            am.DefendorUser.AllianceTech = _allianceService.GetAllianceTech(connection, am.DefendorPlanet.AllianceId);
            am.DefendorUser.UnitMods     = BattleStatCalculationService.GetUnitStatsAndMods(connection, am.DefendorUser.Mother,
                                                                                            am.DefendorUser.AllianceTech, _confederationService, _storeService);

            _atackReport(connection, am);

            //atacker   win
            if (am.ReportDataModel.AtackerWin)
            {
                am.OnAtackerWin(connection, _gDetailPlanetService, _allianceService);
                am.SourceUser.Alliance = _allianceService.GetAllianceById(connection, sourceAllianceUser.AllianceId, false);
                var battlePvp = _calcBattlePvp(am.SourceUser.Report, am.DefendorUser.Report,
                                               am.ReportDataModel.AtackerResultStatus);
                am.SourceUser.Alliance.PvpRating += battlePvp;
                am.SourceUser.Alliance            = _allianceService.AddOrUpdate(connection, am.SourceUser.Alliance);
                am.SourceUser.User.PvpPoint      += battlePvp;
                am.SourceUser.User = _gameUserService.AddOrUpdate(connection, am.SourceUser.User);
            }
            //defendor win
            else
            {
                am.FinalizeDefendorWin(connection, _gDetailPlanetService);
            }

            am.FinalizeAtack(connection, _uTaskService);
        }