Exemple #1
0
        public virtual bool InitBuffInfo(SkillObj self, SkillObj srcObj, BattleReason reason, BuffInfo_New buffInfo, BuffConfig_New buffConfig, bool RefreshGUID = true)
        {
            var buffId = self.GetBuffID(buffConfig);

            self.SetBuffId(buffInfo, buffId);
            if (RefreshGUID)
            {
                var guid = BattleModule.BattleID;
                self.SetBuffGuid(buffInfo, guid);
            }
            self.SetBuffStateIndex(buffInfo, 0);
            if (srcObj != null)
            {
                if (srcObj.GetParentID() > 0)
                {
                    self.SetSrcID(buffInfo, srcObj.GetParentID());
                }
                else
                {
                    self.SetSrcID(buffInfo, srcObj.GetID());
                }
            }
            var startLogicStateName = self.GetLogicState(buffConfig, 0);
            var startLogicState     = BattleModule.GetBuffLogicState(startLogicStateName);

            if (startLogicState == null)
            {
                self.LogInfo("startLogicState == null BuffId:[{0}] startLogicStateName:[{1}]".F(buffId, startLogicStateName));
                return(false);
            }
            //init
            startLogicState.InitBuff(self, buffInfo, buffConfig, 0);
            startLogicState.InitState(self, buffInfo, buffConfig, 0);

            var targetSelectName = self.GetTargetSelect(buffConfig);

            if (targetSelectName != null)
            {
                var targetSelect = BattleModule.GetTargetSelect(targetSelectName);
                if (targetSelect == null)
                {
                    self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(buffId, targetSelectName));
                    return(false);
                }
                targetSelect.Init(self, buffInfo, buffConfig);
            }
            return(true);
        }