Exemple #1
0
        //刷新守城方的buff
        private void RefreshDefenderBuff(int buffId, bool isAdd)
        {
            var players = Camps[DefenderCampId].Players;

            if (isAdd)
            {
                foreach (var player in players)
                {
                    player.AddBuff(buffId, 1, player);
                }
            }
            else
            {
                foreach (var player in players)
                {
                    var buffs = player.BuffList.GetBuffById(buffId);
                    if (buffs.Count > 0)
                    {
                        var buff  = buffs[0];
                        var layer = buff.GetLayer();
                        if (layer > 1)
                        {
                            buff.SetLayer(layer - 1);
                            var replyMsg   = new BuffResultMsg();
                            var buffResult = new BuffResult
                            {
                                SkillObjId  = buff.mCasterId,
                                TargetObjId = player.ObjId,
                                BuffTypeId  = buffId,
                                BuffId      = buff.mId,
                                Type        = BuffType.HT_EFFECT,
                                ViewTime    = Extension.AddTimeDiffToNet(0)
                            };
                            if (buff.mBuff.IsView == 1)
                            {
                                buffResult.Param.Add(buff.GetLastSeconds());
                                buffResult.Param.Add(buff.GetLayer());
                                buffResult.Param.Add(buff.m_nLevel);
                            }
                            replyMsg.buff.Add(buffResult);
                            player.BroadcastBuffList(replyMsg);
                            GetBuff.DoEffect(this, player, buff, 0);
                        }
                        else
                        {
                            MissBuff.DoEffect(this, player, buff);
                            player.DeleteBuff(buff, eCleanBuffType.Clear);
                        }
                    }
                    else
                    {
                        Logger.Error("In RefreshDefenderBuff(). DeleteBuff error! buffs.Count == 0! player name = {0}",
                                     player.GetName());
                    }
                }
            }
        }
Exemple #2
0
 public void OnEnterScene(BuffList _this)
 {
     if (_this.mRetinueBuff != null)
     {
         var obj = _this.mRetinueBuff.GetBear();
         GetBuff.DoEffect(obj.Scene, obj, _this.mRetinueBuff, 0);
         _this.mRetinueBuff = null;
     }
 }