Example #1
0
        public void AddBuff(int buffId, int blevel, double dura)
        {
            BuffConfig buffConfig = ConfigData.GetBuffConfig(buffId);
            var immuneRate = GetBuffImmuneRate(buffConfig.Group);
            if (immuneRate >= 1)//免疫了
            {
                return;
            }
            if (immuneRate > 0)
            {
                dura *= (1 - immuneRate);
            }

            MemBaseBuff buffdata;
            if (buffDict.TryGetValue(buffId, out buffdata))
            {
                buffdata.TimeLeft = Math.Max(buffdata.TimeLeft, dura);
            }
            else
            {
                Buff buff = new Buff(buffId);
                buff.UpgradeToLevel(blevel);
                buffdata = new MemBaseBuff(buff, dura);
                //buff.CheckBuffEffect(this, 1);
                buffdata.OnAddBuff(self);
                buffDict.Add(buffId, buffdata);
            }
        }
Example #2
0
 public MemBaseBuff(Buff buff, double timeLeft)
 {
     BuffInfo = buff;
     TimeLeft = timeLeft;
     RoundMark = 0;
 }