Esempio n. 1
0
        //增加buff
        public BuffData AddBuff(BuffList _this,
                                int buffId,
                                int bufflevel,
                                ObjCharacter caster,
                                ObjCharacter bear,
                                float fBili,
                                eHitType hitType)
        {
#if DEBUG
            if (caster is ObjPlayer)
            {
                Logger.Info("id={0}给{1}释放了{2}的Buff", caster.ObjId, bear.ObjId, buffId);
            }
#endif
            var tbbuff = Table.GetBuff(buffId);

            var buff = ObjectPool <BuffData> .NewObject();

            //var buff = ObjectPool<BuffData>.NewObject();
            buff.mBuff = caster.Skill.ModifyBuff(tbbuff, bufflevel);
            buff.Reset(GetNextUniqueId(_this), buffId, bufflevel, caster, buff.mBuff, bear, hitType, fBili);
            //mBuff = tbbuff,
            buff.Init();
            _this.mData.Add(buff);
            _this.mObj.MarkDbDirty();
            return(buff);
        }
Esempio n. 2
0
 //查询相同释放者的互斥ID
 public BuffData Get_Same_Caster_Huchi_Buff(BuffList _this, int huchiid, ObjCharacter sameCaster = null)
 {
     if (sameCaster == null)
     {
         foreach (var buff in _this.mData)
         {
             if (buff.GetActive() == false)
             {
                 continue;
             }
             if (buff.m_nHuchi == huchiid)
             {
                 return(buff);
             }
         }
         return(null);
     }
     foreach (var buff in _this.mData)
     {
         if (buff.GetActive() == false)
         {
             continue;
         }
         if (buff.m_nHuchi == huchiid && buff.mCasterId == sameCaster.ObjId)
         {
             return(buff);
         }
     }
     return(null);
 }
Esempio n. 3
0
 //删除buff
 public bool DelBuff(BuffList _this, BuffData thisbuff)
 {
     if (thisbuff == null)
     {
         return(false);
     }
     thisbuff.SetActive(false);
     return(true);
 }
Esempio n. 4
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;
     }
 }
Esempio n. 5
0
 //判断是否可以移动
 public bool IsNoMove(BuffList _this)
 {
     if (!_this.mSpecialStateFlag)
     {
         return(_this._mNoMove);
     }
     _this.mSpecialStateFlag = false;
     _this._mNoMove          = GetEffectParam_Bin(_this, eEffectType.SpecialState, 0, 0);
     return(_this._mNoMove);
 }
Esempio n. 6
0
 //获得一个某事件是干净标记的Buff
 public BuffData Get_Event_Buff(BuffList _this, eEffectEventType ebuffeventtype)
 {
     foreach (var buff in _this.mData)
     {
         if (buff.m_Flag.GetFlag((int)ebuffeventtype) == 0)
         {
             buff.m_Flag.SetFlag((int)ebuffeventtype);
             return(buff);
         }
     }
     return(null);
 }
Esempio n. 7
0
        //获得一个某事件是干净标记的Buff
        public List <BuffData> CopyBuff(BuffList _this)
        {
            var bufflist = new List <BuffData>();

            foreach (var buff in _this.mData)
            {
                if (buff.GetActive())
                {
                    bufflist.Add(buff);
                }
            }
            return(bufflist);
        }
Esempio n. 8
0
 //死亡时时取消Buff
 public void DelBuffByOnDie(BuffList _this)
 {
     foreach (var data in _this.mData)
     {
         if (data.mBuff.DieDisappear == 1)
         {
             MissBuff.DoEffect(_this.mObj.Scene, _this.mObj, data);
             _this.mObj.DeleteBuff(data, eCleanBuffType.Die);
         }
     }
     //Do_Del_Buff(_this);
     //DeleteBuff(_this);
 }
Esempio n. 9
0
 //删除打了标记的Buff
 public void Do_Del_Buff(BuffList _this)
 {
     foreach (var buffData in _this.mData)
     {
         if (!buffData.GetActive())
         {
             _this.mRemoveBuff.Add(buffData);
             //buffData.OnDestroy();
         }
     }
     _this.mData.RemoveAll(h => h.GetActive() == false);
     _this.mObj.MarkDbDirty();
 }
Esempio n. 10
0
        //获得某BuffId的Buff
        public List <BuffData> GetBuffById(BuffList _this, int buffid)
        {
            var buffs = new List <BuffData>();

            foreach (var buff in _this.mData)
            {
                if (buff.GetBuffId() == buffid)
                {
                    buffs.Add(buff);
                }
            }
            return(buffs);
        }
Esempio n. 11
0
        //获得某BuffId的Buff
        public bool IsHaveBuffById(BuffList _this, int buffid)
        {
            var buffs = new List <BuffData>();

            foreach (var buff in _this.mData)
            {
                if (buff.GetBuffId() == buffid)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 12
0
 //删除已经添加到移除列表,但是还没有还给池的
 public void DeleteBuff(BuffList _this)
 {
     foreach (var buffData in _this.mRemoveBuff)
     {
         try
         {
             buffData.OnDestroy();
         }
         catch (Exception ex)
         {
             Logger.Error(ex.ToString());
         }
     }
     _this.mRemoveBuff.Clear();
 }
Esempio n. 13
0
 //查询相同释放者的同BuffId
 public BuffData Get_Same_Caster_Same_Buff(BuffList _this, int buffId, ObjCharacter sameCaster)
 {
     foreach (var buff in _this.mData)
     {
         if (buff.GetActive() == false)
         {
             continue;
         }
         if (buff.m_nBuffId == buffId && buff.mCasterId == sameCaster.ObjId)
         {
             return(buff);
         }
     }
     return(null);
 }
Esempio n. 14
0
 //查询相同释放者的某BuffID的Buff
 public BuffData GetCasterBuff(BuffList _this, int buffid, ObjCharacter caster)
 {
     foreach (var buff in _this.mData)
     {
         if (buff.GetActive() == false)
         {
             continue;
         }
         if (buff.GetBuffId() == buffid && buff.mCasterId == caster.ObjId)
         {
             return(buff);
         }
     }
     return(null);
 }
Esempio n. 15
0
 //设置特殊状态改变标记
 public void SetSpecialStateNoMove(BuffList _this, ObjCharacter caster)
 {
     _this.mSpecialStateFlag = false;
     _this._mNoMove          = true;
     if (_this.mObj.IsMoving())
     {
         _this.mObj.StopMove();
         if (_this.mObj.GetObjType() == ObjType.PLAYER)
         {
             var player = _this.mObj as ObjPlayer;
             player.SendForceStopMove();
         }
     }
     _this.mObj.OnTrapped(caster);
 }
Esempio n. 16
0
 //析构
 public void OnDestroy(BuffList _this)
 {
     DeleteBuff(_this);
     foreach (var buff in _this.mData)
     {
         try
         {
             buff.OnDestroy();
         }
         catch (Exception ex)
         {
             Logger.Error(ex.ToString());
         }
     }
     _this.mData.Clear();
 }
Esempio n. 17
0
 //查询是否有某个效果ID
 public bool IsHaveEffectId(BuffList _this, eEffectType effectid)
 {
     foreach (var i in _this.mData)
     {
         if (i.GetActive() == false)
         {
             continue;
         }
         var tbBuff = i.mBuff;
         for (var j = 0; j != tbBuff.effectid.Length; ++j)
         {
             if (tbBuff.effectid[j] == (int)effectid)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 18
0
        //计算属性
        public int Calculate(BuffList _this, ObjCharacter obj, eAttributeType type, ref double dBili)
        {
            var value = 0;

            foreach (var i in _this.mData)
            {
                if (i.GetActive() == false)
                {
                    continue;
                }
                var tbBuff      = i.mBuff;
                var effectCount = tbBuff.effectid.Length;
                for (var j = 0; j != effectCount; ++j)
                {
                    var param = tbBuff.effectparam;
                    if (tbBuff.effectid[j] != (int)eEffectType.RefAttr)
                    {
                        continue;
                    }
                    if (type != (eAttributeType)param[j, 0])
                    {
                        continue;
                    }
                    value += param[j, 3] * i.GetLayer();
                    if (param[j, 1] == -1)
                    {
                        continue;
                    }
                    if (param[j, 1] != param[j, 0])
                    {
                        value +=
                            (int)
                            (obj.Attr.GetDataValue((eAttributeType)param[j, 1]) *
                             ((double)param[j, 2] * i.GetLayer() / 10000));
                    }
                    else
                    {
                        dBili = dBili * (10000 + param[j, 2] * i.GetLayer()) / 10000;
                    }
                }
            }
            return(value);
        }
Esempio n. 19
0
 public void OnLost(BuffList _this)
 {
     //_this.mRemoveBuff.Clear();
     _this.mRetinueBuff = null;
     foreach (var data in _this.mData)
     {
         if (data.Retinue != null && data.GetBear() != null)
         {
             _this.mRetinueBuff = data;
             data.GetBear().RemoveRetinue(data.Retinue);
             data.Retinue = null;
         }
         if (data.mBuff.DownLine == 1 && data.GetActive())
         {
             MissBuff.DoEffect(_this.mObj.Scene, _this.mObj, data);
             data.SetActive(false);
         }
     }
     Do_Del_Buff(_this);
     DeleteBuff(_this);
 }
Esempio n. 20
0
 //获得BUFF中某个效果ID的某个参数(二进制检查)
 public bool GetEffectParam_Bin(BuffList _this, eEffectType effectid, int paramid, int value)
 {
     foreach (var i in _this.mData)
     {
         if (i.GetActive() == false)
         {
             continue;
         }
         var tbBuff = i.mBuff;
         for (var j = 0; j != tbBuff.effectid.Length; ++j)
         {
             if (tbBuff.effectid[j] == (int)effectid)
             {
                 if (BitFlag.GetLow(tbBuff.effectparam[j, paramid], value))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 21
0
 //获取UniqueId
 public uint GetNextUniqueId(BuffList _this)
 {
     return(BuffList.mUniqueId++);
 }
Esempio n. 22
0
 //设置特殊状态改变标记
 public void SetSpecialStateFlag(BuffList _this)
 {
     _this.mSpecialStateFlag = true;
 }
Esempio n. 23
0
 //刷新Buff的事件触发标记
 public void UpdataBuff_Flag(BuffList _this, BuffData buff)
 {
     buff.m_Flag.ReSetAllFlag();
 }