示例#1
0
        /// <summary>
        // 杀怪接口
        /// </summary>
        public void KillMonster(GameClient client, Monster monster)
        {
            if (client.ClientData.FuBenSeqID < 0 || client.ClientData.CopyMapID < 0 || !IsElementWarCopy(client.ClientData.FuBenID))
            {
                return;
            }

            ElementWarScene scene = null;

            if (!_sceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene) || scene == null)
            {
                return;
            }

            //如果是重复记录击杀同一只怪,则直接返回
            if (!scene.AddKilledMonster(monster))
            {
                return;
            }

            if (scene.SceneStatus >= GameSceneStatuses.STATUS_END)
            {
                return;
            }

            lock (scene)
            {
                scene.MonsterCountKill++;

                scene.ScoreData.MonsterCount -= 1;
                scene.ScoreData.MonsterCount  = scene.ScoreData.MonsterCount < 0 ? 0 : scene.ScoreData.MonsterCount;
                GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_ELEMENT_WAR_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);

                if (scene.IsMonsterFlag == 1 && scene.MonsterCountKill >= scene.MonsterCountCreate && scene.ScoreData.MonsterCount <= 0)
                {
                    scene.MonsterWaveOld = scene.MonsterWave;
                    if (scene.MonsterWave >= scene.MonsterWaveTotal)
                    {
                        scene.SceneStatus = GameSceneStatuses.STATUS_END;
                    }
                    else
                    {
                        scene.IsMonsterFlag = 0;

                        scene.MonsterCountKill   = 0;
                        scene.MonsterCountCreate = 0;
                    }
                }
            }//lock
        }
示例#2
0
 public void KillMonster(GameClient client, Monster monster)
 {
     if (client.ClientData.FuBenSeqID >= 0 && client.ClientData.CopyMapID >= 0 && this.IsElementWarCopy(client.ClientData.FuBenID))
     {
         ElementWarScene scene = null;
         if (this._sceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene) && scene != null)
         {
             if (scene.AddKilledMonster(monster))
             {
                 if (scene.SceneStatus < GameSceneStatuses.STATUS_END)
                 {
                     lock (scene)
                     {
                         scene.MonsterCountKill++;
                         scene.ScoreData.MonsterCount -= 1L;
                         scene.ScoreData.MonsterCount  = ((scene.ScoreData.MonsterCount < 0L) ? 0L : scene.ScoreData.MonsterCount);
                         GameManager.ClientMgr.BroadSpecialCopyMapMessage <ElementWarScoreData>(1014, scene.ScoreData, scene.CopyMapInfo);
                         if (scene.IsMonsterFlag == 1 && scene.MonsterCountKill >= scene.MonsterCountCreate && scene.ScoreData.MonsterCount <= 0L)
                         {
                             scene.MonsterWaveOld = scene.MonsterWave;
                             if (scene.MonsterWave >= scene.MonsterWaveTotal)
                             {
                                 scene.SceneStatus = GameSceneStatuses.STATUS_END;
                             }
                             else
                             {
                                 scene.IsMonsterFlag      = 0;
                                 scene.MonsterCountKill   = 0;
                                 scene.MonsterCountCreate = 0;
                             }
                         }
                     }
                 }
             }
         }
     }
 }