Esempio n. 1
0
        public override bool TakeAction()
        {
            if (CombatHelper.IsBossKill(_activeId))
            {
                this.ErrorCode = 1;
                this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                return(false);
            }
            BossCombat bossCombat = new BossCombat(_activeId);

            _gameActive = bossCombat.GameActive;
            CombatStatus combatStatus = _gameActive.RefreshStatus();

            if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat)
            {
                bossCombat.Append(ContextUser);
                BossUser bossUser = bossCombat.GetCombatUser(Uid);
                if (bossUser != null)
                {
                    _inspirePercent       = bossUser.InspirePercent;
                    _reliveInspirePercent = bossUser.ReliveInspirePercent;
                    _reLiveNum            = bossUser.ReliveNum;
                    _combatNum            = bossUser.CombatNum;
                    _damageNum            = bossUser.DamageNum;
                    _codeTime             = bossUser.CodeTime;
                }
            }
            List <BossUser> userList = bossCombat.GetCombatUser();

            _regNum = userList.Count;
            int recordCount = 0;

            _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount);

            CombatGeneral boss = bossCombat.Boss;

            if (boss != null)
            {
                _bossLiftNum = boss.LifeNum;
                _bossMaxLift = boss.LifeMaxNum;
            }
            return(true);
        }
Esempio n. 2
0
 private void RefEnableTime(GameActive gameActive, ref DateTime enableTime, ref DateTime endTime, ref short isEnable)
 {
     try
     {
         gameActive = gameActive ?? new GameActive();
         if (gameActive.ActiveType == FunctionEnum.Gonghui && !string.IsNullOrEmpty(ContextUser.MercenariesID))
         {
             if (gameActive.ActiveId == UserGuild.ActiveID)
             {
                 enableTime = guildBossDate(ContextUser.MercenariesID);
                 endTime    = enableTime.AddMinutes(gameActive.Minutes);
                 guild.GuildBossRefreshStatus();
                 //gameActive.RefreshStatus();
                 if (guild.CombatStatus == CombatStatus.Wait || guild.CombatStatus == CombatStatus.Combat)
                 {
                     isEnable = 1;
                 }
                 else if (guild.CombatStatus == CombatStatus.Over)
                 {
                     isEnable = 2;//已结束
                 }
                 else if (guild.CombatStatus == CombatStatus.Killed)
                 {
                     isEnable = 3;//已被击杀
                 }
                 if (guild.GuildBossInfo != null && !UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate))
                 {
                     isEnable = 2;
                 }
             }
             else
             {
                 enableTime = gameActive.BeginTime.ToDateTime(DateTime.MinValue);
                 DateTime intervalDate = gameActive.BeginTime.AddMinutes(gameActive.WaitMinutes);
                 endTime = enableTime.AddMinutes(gameActive.Minutes);
                 if (gameActive.ActiveId == 11 && intervalDate < DateTime.Now && DateTime.Now < endTime)
                 {
                     isEnable = 4; //置灰
                 }
                 else
                 {
                     if (DateTime.Now < enableTime)
                     {
                         isEnable = 0;
                     }
                     else if (DateTime.Now > endTime)
                     {
                         isEnable = 2;
                     }
                     else
                     {
                         isEnable = 1;
                     }
                 }
             }
         }
         else
         {
             endTime    = gameActive.EndTime;
             enableTime = gameActive.BeginTime;
             gameActive.RefreshStatus();
             if (gameActive.CombatStatus == CombatStatus.Wait || gameActive.CombatStatus == CombatStatus.Combat)
             {
                 isEnable = 1;
             }
             else if (gameActive.CombatStatus == CombatStatus.Over)
             {
                 isEnable = 2;//已结束
             }
             else if (gameActive.CombatStatus == CombatStatus.Killed)
             {
                 isEnable = 3;//已被击杀
             }
         }
     }
     catch (Exception ex)
     {
         SaveLog(ex);
     }
 }
Esempio n. 3
0
        public override bool TakeAction()
        {
            BossCombat   bossCombat   = new BossCombat(_activeId);
            GameActive   gameActive   = bossCombat.GameActive;
            CombatStatus combatStatus = gameActive.RefreshStatus();

            if (combatStatus == CombatStatus.Killed || CombatHelper.IsBossKill(_activeId))
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                return(false);
            }
            else if (combatStatus == CombatStatus.Wait)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_CombatWait;
                return(false);
            }
            else if (combatStatus == CombatStatus.Over)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_CombatOver;
                return(false);
            }
            else if (combatStatus == CombatStatus.Combat)
            {
                var cuser = bossCombat.GetCombatUser(Uid);
                if (cuser != null && cuser.CodeTime > 0)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St5402_IsReliveError;
                    return(false);
                }
                var boss = bossCombat.Boss;
                if (boss.IsOver)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return(false);
                }
                lock (thisLock)
                {
                    if (boss.IsOver)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                        return(false);
                    }
                    IsWin = bossCombat.Combat(ContextUser, bossProcess);
                }
                _userTalPriority = CombatHelper.TotalPriorityNum(ContextUser.UserID, 0);
                _npcTalPriority  = 0;
            }
            else
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                return(false);
            }
            selfAbilityEffectList = UserAbilityHelper.GetSelfAbilityEffectList(ContextUser.UserID, 0);
            return(true);
        }