예제 #1
0
        /// <summary>
        /// 检测刷新真爱buff怪物
        /// </summary>
        /// <param name="scene"></param>
        private void CheckFlushZhenAiMonster(CoupleArenaCopyScene scene)
        {
            if (!scene.IsZhenAiMonsterExist && !scene.EnterRoleSide.ContainsKey(scene.ZhenAiBuff_Role))
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapCode, out gameMap))
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少情侣竞技地图 {0}", scene.MapCode));
                    return;
                }

                CoupleArenaBuffCfg buffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.ZhenAiBuffCfgType);
                if (buffCfg == null)
                {
                    return;
                }

                var pos = buffCfg.RandPosList[Global.GetRandomNumber(0, buffCfg.RandPosList.Count)];

                GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapCode, buffCfg.MonsterId,
                                                              scene.CopyMap.CopyMapID, 1,
                                                              pos.X / gameMap.MapGridWidth, pos.Y / gameMap.MapGridHeight, pos.R, 0,
                                                              SceneUIClasses.CoupleArena, null);

                scene.IsZhenAiMonsterExist = true;
            }
        }
예제 #2
0
        /// <summary>
        /// 玩家离开副本
        /// </summary>
        /// <param name="client"></param>
        public void OnLeaveFuBen(GameClient client)
        {
            lock (Mutex)
            {
                CoupleArenaCopyScene scene = null;
                if (FuBenSeq2CopyScenes.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    if (scene.m_eStatus < GameSceneStatuses.STATUS_BEGIN)
                    {
                        // 尚未开始,退出也没事
                        scene.EnterRoleSide.Remove(client.ClientData.RoleID);
                    }
                    else if (scene.m_eStatus < GameSceneStatuses.STATUS_END)
                    {
                        CoupleArenaBuffCfg zhenAiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.ZhenAiBuffCfgType);
                        CoupleArenaBuffCfg yongQiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.YongQiBuffCfgType);
                        ModifyBuff(scene, client, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, false);
                        ModifyBuff(scene, client, BufferItemTypes.CoupleArena_ZhenAi_Buff, zhenAiBuffCfg, false);

                        scene.EnterRoleSide.Remove(client.ClientData.RoleID);
                        var leftSide = scene.EnterRoleSide.Values.ToList();
                        if (leftSide.Count(_s => _s == client.ClientData.BattleWhichSide) <= 0)
                        {
                            // 本方没人了, 剩下的对方胜利, 如果没有剩余的一方,那么本次pk无效
                            scene.WinSide = leftSide.Count > 0 ? leftSide[0] : 0;
                            ProcessEnd(scene, TimeUtil.NowDateTime(), TimeUtil.NOW());
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 怪物死亡,检测给予玩家buff
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="client"></param>
        /// <param name="monster"></param>
        private void OnMonsterDead(CoupleArenaCopyScene scene, GameClient client, Monster monster)
        {
            lock (Mutex)
            {
                if (scene.m_eStatus < GameSceneStatuses.STATUS_BEGIN || scene.m_eStatus >= GameSceneStatuses.STATUS_END)
                {
                    return;
                }

                if (!scene.EnterRoleSide.ContainsKey(client.ClientData.RoleID))
                {
                    return;
                }

                CoupleArenaBuffCfg zhenAiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.ZhenAiBuffCfgType);
                CoupleArenaBuffCfg yongQiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.YongQiBuffCfgType);
#if ___CC___FUCK___YOU___BB___
                // 击杀真爱怪物,将获得真爱Buff
                if (scene.IsZhenAiMonsterExist &&
                    monster.XMonsterInfo.MonsterId == zhenAiBuffCfg.MonsterId)
                {
                    scene.IsZhenAiMonsterExist = false;
                    // 真爱buff 会 顶掉勇气buff, 先移除勇气buff,再添加真爱buff
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, false);
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_ZhenAi_Buff, zhenAiBuffCfg, true);
                }

                // 击杀勇气怪物,将获得勇气Buff
                if (scene.IsYongQiMonsterExist &&
                    monster.XMonsterInfo.MonsterId == yongQiBuffCfg.MonsterId)
                {
                    scene.IsYongQiMonsterExist = false;
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, true);
                }
#else
                if (scene.IsZhenAiMonsterExist &&
                    monster.MonsterInfo.ExtensionID == zhenAiBuffCfg.MonsterId)
                {
                    scene.IsZhenAiMonsterExist = false;
                    // 真爱buff 会 顶掉勇气buff, 先移除勇气buff,再添加真爱buff
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, false);
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_ZhenAi_Buff, zhenAiBuffCfg, true);
                }
                // 击杀勇气怪物,将获得勇气Buff
                if (scene.IsYongQiMonsterExist &&
                    monster.MonsterInfo.ExtensionID == yongQiBuffCfg.MonsterId)
                {
                    scene.IsYongQiMonsterExist = false;
                    ModifyBuff(scene, client, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, true);
                }
#endif
            }
        }
예제 #4
0
        /// <summary>
        /// 玩家死亡,检测玩家buff变更
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="deader"></param>
        /// <param name="killer"></param>
        private void OnPlayerDead(CoupleArenaCopyScene scene, GameClient deader, GameClient killer)
        {
            lock (Mutex)
            {
                if (scene.m_eStatus < GameSceneStatuses.STATUS_BEGIN || scene.m_eStatus >= GameSceneStatuses.STATUS_END)
                {
                    return;
                }

                if (!scene.EnterRoleSide.ContainsKey(deader.ClientData.RoleID))
                {
                    return;
                }

                // 有可能是被怪杀死的,killer为null
                if (killer != null && !scene.EnterRoleSide.ContainsKey(killer.ClientData.RoleID))
                {
                    return;
                }

                CoupleArenaBuffCfg zhenAiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.ZhenAiBuffCfgType);
                CoupleArenaBuffCfg yongQiBuffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.YongQiBuffCfgType);

                // 拥有真爱buff的玩家死亡,转移真爱buff
                if (scene.ZhenAiBuff_Role == deader.ClientData.RoleID)
                {
                    ModifyBuff(scene, deader, BufferItemTypes.CoupleArena_ZhenAi_Buff, zhenAiBuffCfg, false);
                    // 真爱buff 会 顶掉勇气buff, 先移除勇气buff,再添加真爱buff
                    ModifyBuff(scene, killer, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, false);
                    ModifyBuff(scene, killer, BufferItemTypes.CoupleArena_ZhenAi_Buff, zhenAiBuffCfg, true);
                }

                // 拥有勇气buff的玩家死亡,移除勇气buff
                if (scene.YongQiBuff_Role == deader.ClientData.RoleID)
                {
                    ModifyBuff(scene, deader, BufferItemTypes.CoupleArena_YongQi_Buff, yongQiBuffCfg, false);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 检测刷新勇气buff怪物
        /// </summary>
        /// <param name="scene"></param>
        private void CheckFlushYongQiMonster(CoupleArenaCopyScene scene)
        {
            CoupleArenaBuffCfg buffCfg = BuffCfgList.Find(_b => _b.Type == CoupleAreanConsts.YongQiBuffCfgType);

            if (buffCfg == null)
            {
                return;
            }
            bool isInFlusTime = false;

            foreach (int sec in buffCfg.FlushSecList)
            {
                if (scene.m_lPrevUpdateTime - scene.m_lBeginTime <= sec * 1000 &&
                    scene.m_lCurrUpdateTime - scene.m_lBeginTime >= sec * 1000)
                {
                    isInFlusTime = true;
                    break;
                }
            }

            if (isInFlusTime && !scene.IsYongQiMonsterExist && !scene.EnterRoleSide.ContainsKey(scene.YongQiBuff_Role))
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapCode, out gameMap))
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少情侣竞技地图 {0}", scene.MapCode));
                    return;
                }

                var pos = buffCfg.RandPosList[Global.GetRandomNumber(0, buffCfg.RandPosList.Count)];

                GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapCode, buffCfg.MonsterId,
                                                              scene.CopyMap.CopyMapID, 1,
                                                              pos.X / gameMap.MapGridWidth, pos.Y / gameMap.MapGridHeight, pos.R, 0,
                                                              SceneUIClasses.CoupleArena, null);

                scene.IsYongQiMonsterExist = true;
            }
        }
예제 #6
0
        /// <summary>
        /// 添加、移除buff
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="client"></param>
        /// <param name="buffType"></param>
        /// <param name="buffCfg"></param>
        /// <param name="bAdd"></param>
        private void ModifyBuff(CoupleArenaCopyScene scene, GameClient client, BufferItemTypes buffType, CoupleArenaBuffCfg buffCfg, bool bAdd)
        {
            if (scene == null || client == null || buffCfg == null)
            {
                return;
            }

            lock (Mutex)
            {
                bool       bChanged = false;
                BufferData buffData = Global.GetBufferDataByID(client, (int)buffType);

                int noSaveDbBuffType = 1;

                if (bAdd && (buffData == null || Global.IsBufferDataOver(buffData)))
                {
                    // 持有真爱buff的玩家无法获得勇气buff
                    if (buffType != BufferItemTypes.CoupleArena_YongQi_Buff ||
                        scene.ZhenAiBuff_Role != client.ClientData.RoleID)
                    {
                        double[] bufferParams = new double[1] {
                            1
                        };
                        Global.UpdateBufferData(client, buffType, bufferParams, noSaveDbBuffType);

                        foreach (var prop in buffCfg.ExtProps)
                        {
                            client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.CoupleArena, (int)prop.Key, prop.Value);
                        }

                        bChanged = true;
                    }
                }

                if (!bAdd && buffData != null && !Global.IsBufferDataOver(buffData))
                {
                    double[] bufferParams = new double[1] {
                        0
                    };
                    Global.UpdateBufferData(client, buffType, bufferParams, noSaveDbBuffType);

                    foreach (var prop in buffCfg.ExtProps)
                    {
                        client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.CoupleArena, (int)prop.Key, 0);
                    }

                    bChanged = true;
                }

                if (bChanged)
                {
                    if (buffType == BufferItemTypes.CoupleArena_ZhenAi_Buff)
                    {
                        if (bAdd)
                        {
                            scene.ZhenAiBuff_Role    = client.ClientData.RoleID;
                            scene.ZhenAiBuff_StartMs = TimeUtil.NOW();
                        }
                        else
                        {
                            scene.ZhenAiBuff_Role = 0;
                        }
                    }
                    else if (buffType == BufferItemTypes.CoupleArena_YongQi_Buff)
                    {
                        if (bAdd)
                        {
                            scene.YongQiBuff_Role = client.ClientData.RoleID;
                        }
                        else
                        {
                            scene.YongQiBuff_Role = 0;
                        }
                    }

                    NtfBuffHoldData(scene);
                    GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    // 总生命值和魔法值变化通知(同一个地图才需要通知)
                    GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                }
            }
        }