chenxin
2020-11-17 40b918d5189a154bc0ff31627e69867742934720
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Collections.Generic;
 
/**
 * 无尽模式buff基类
 * @Author: chenxin
 * @Date: 2020-11-16 18:21:10
 */
namespace KTGMGemClient
{
    public class EndlessBuff
    {
        public EndlessBuff()
        {
            BuffList = new List<EndlessBuffConfig>();
        }
 
        /// <summary>
        /// 属于自己这个类别的buff列表
        /// </summary>
        public List<EndlessBuffConfig> BuffList;
 
        /// <summary>
        /// 添加buff的时候会调用Handle处理函数
        /// </summary>
        public virtual void Handle()
        {
 
        }
 
        /// <summary>
        /// 当buff失效时会调用次函数
        /// </summary>
        public virtual void LoseEffect()
        {
 
        }
 
        /// <summary>
        /// 判断buff是否生效
        /// </summary>
        /// <param name="gemId"></param>
        protected bool IsEffective(EndlessBuffConfig buffData, int gemId)
        {
            bool isEffective = false;
 
            switch (buffData.UseTarget)
            {
                case EndlessBuffUseTarget.All:
                    isEffective = true;
                    break;
                case EndlessBuffUseTarget.Element:
                    isEffective = gemId == buffData.Config.target_type[1];
                    break;
                case EndlessBuffUseTarget.Designated:
                    isEffective = gemId == buffData.Config.target_type[1];
                    break;
            }
 
            return isEffective;
        }
    }
}