Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public virtual bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var guid = BattleModule.BattleID;
            //var time = self.GetSkillTime(skillConfig);
            var skillId = self.GetSkillID(skillConfig);

            //var nowTime = self.GetNowTime();
            //var activeNum = self.GetActiveNum(skillConfig);
            self.SetSkillId(skillInfo, skillId);
            //self.SetSkillTime(skillInfo, time);
            self.SetSkillGuid(skillInfo, guid);
            //self.SetSkillStateTime(skillInfo, nowTime);
            //self.SetSkillSrcObj(skillInfo, self);
            //self.SetActiveNum(skillInfo, activeNum);
            self.SetSkillStateIndex(skillInfo, 0);
            var startLogicStateName = self.GetLogicState(skillConfig, 0);
            var startLogicState     = BattleModule.GetSkillLogicState(startLogicStateName);

            if (startLogicState == null)
            {
                self.LogInfo("startLogicState == null skillId:[{0}] startLogicStateName:[{1}]".F(skillId, startLogicStateName));
                return(false);
            }
            //init
            startLogicState.InitSkill(self, skillInfo, skillConfig, 0);
            startLogicState.InitState(self, skillInfo, skillConfig, 0);

            var targetSelectName = self.GetTargetSelect(skillConfig);
            var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);

            if (targetSelect == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(skillId, targetSelectName));
                return(false);
            }
            targetSelect.Init(self, skillInfo, skillConfig);
            return(true);
        }
Ejemplo n.º 3
0
        public virtual void Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            if (!CommonCheck(self, skillInfo, skillConfig))
            {
                return ;
            }
            var logicState = BattleModule.GetSkillLogicState(skillInfo, self);
            if(logicState == null)
            {
                return;
            }
            var ret = logicState.Tick(self, skillInfo, skillConfig);
            switch(ret)
            {
                case LogicStateTickRet.TimeFinish:
                    SkillOnEnd(self, skillInfo, skillConfig);
                    break;
                case LogicStateTickRet.NextState:
                    int index = self.GetSkillStateIndex(skillInfo);
                    string nextStateName = self.GetLogicState(skillConfig, ++index);
                    if (nextStateName == null || nextStateName.Equals(""))
                    {
                        SkillOnEnd(self, skillInfo, skillConfig);
                        return;
                    }
                    var nextLogicState = BattleModule.GetSkillLogicState(nextStateName);
                    if (nextLogicState == null)
                    {
                        self.LogInfo("startLogicState {0} not found".F(nextStateName));
                        return;
                    }
                    double fixTime = logicState.OnStateChanged(nextStateName, self, skillInfo, skillConfig);
                    self.SetSkillStateIndex(skillInfo, index);
                    nextLogicState.InitState(self, skillInfo, skillConfig, fixTime);
                    self.NotifySkillInfo(skillInfo, BattleInfoNotifyType.ChangeState_Skill, BattleNotifyTime.TickEnd);
                    break;
                case LogicStateTickRet.OnEffect:
                    //var srcObj = self.GetSkillSrcObj(skillInfo);
                    {
                        var targetSelectName = self.GetTargetSelect(skillConfig);
                        var targetSelect = BattleModule.GetTargetSelect(targetSelectName);
                        if (targetSelect == null)
                        {
                            self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                            return;
                        }
                        var targetTypeName = self.GetTargetType(skillConfig);
                        var targetType = BattleModule.GetTargetType(targetTypeName);
                        if (targetType == null)
                        {
                            self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                            return;
                        }
                        var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig);
                        foreach (var tar in targets)
                        {
                            OnEffect(self, tar, skillInfo, skillConfig);
                        }
                    }

                    break;
            }
        }
Ejemplo n.º 4
0
        public virtual bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            var guid = BattleModule.BattleID;
            //var time = self.GetSkillTime(skillConfig);
            var skillId = self.GetSkillID(skillConfig);
            //var nowTime = self.GetNowTime();
            //var activeNum = self.GetActiveNum(skillConfig);
            self.SetSkillId(skillInfo, skillId);
            //self.SetSkillTime(skillInfo, time);
            self.SetSkillGuid(skillInfo, guid);
            //self.SetSkillStateTime(skillInfo, nowTime);
            //self.SetSkillSrcObj(skillInfo, self);
            //self.SetActiveNum(skillInfo, activeNum);
            self.SetSkillStateIndex(skillInfo, 0);
            var startLogicStateName = self.GetLogicState(skillConfig, 0);
            var startLogicState = BattleModule.GetSkillLogicState(startLogicStateName);
            if (startLogicState == null)
            {
                self.LogInfo("startLogicState == null skillId:[{0}] startLogicStateName:[{1}]".F(skillId, startLogicStateName));
                return false;
            }
            //init
            startLogicState.InitSkill(self, skillInfo, skillConfig, 0);
            startLogicState.InitState(self, skillInfo, skillConfig, 0);

            var targetSelectName = self.GetTargetSelect(skillConfig);
            var targetSelect = BattleModule.GetTargetSelect(targetSelectName);
            if(targetSelect == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(skillId, targetSelectName));
                return false;
            }
            targetSelect.Init(self, skillInfo, skillConfig);
            return true;
        }
Ejemplo n.º 5
0
        public virtual void Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            if (!CommonCheck(self, skillInfo, skillConfig))
            {
                return;
            }
            var logicState = BattleModule.GetSkillLogicState(skillInfo, self);

            if (logicState == null)
            {
                return;
            }
            var ret = logicState.Tick(self, skillInfo, skillConfig);

            switch (ret)
            {
            case LogicStateTickRet.TimeFinish:
                SkillOnEnd(self, skillInfo, skillConfig);
                break;

            case LogicStateTickRet.NextState:
                int    index         = self.GetSkillStateIndex(skillInfo);
                string nextStateName = self.GetLogicState(skillConfig, ++index);
                if (nextStateName == null || nextStateName.Equals(""))
                {
                    SkillOnEnd(self, skillInfo, skillConfig);
                    return;
                }
                var nextLogicState = BattleModule.GetSkillLogicState(nextStateName);
                if (nextLogicState == null)
                {
                    self.LogInfo("startLogicState {0} not found".F(nextStateName));
                    return;
                }
                double fixTime = logicState.OnStateChanged(nextStateName, self, skillInfo, skillConfig);
                self.SetSkillStateIndex(skillInfo, index);
                nextLogicState.InitState(self, skillInfo, skillConfig, fixTime);
                self.NotifySkillInfo(skillInfo, BattleInfoNotifyType.ChangeState_Skill, BattleNotifyTime.TickEnd);
                break;

            case LogicStateTickRet.OnEffect:
                //var srcObj = self.GetSkillSrcObj(skillInfo);
            {
                var targetSelectName = self.GetTargetSelect(skillConfig);
                var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);
                if (targetSelect == null)
                {
                    self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                    return;
                }
                var targetTypeName = self.GetTargetType(skillConfig);
                var targetType     = BattleModule.GetTargetType(targetTypeName);
                if (targetType == null)
                {
                    self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                    return;
                }
                var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig);
                foreach (var tar in targets)
                {
                    OnEffect(self, tar, skillInfo, skillConfig);
                }
            }

            break;
            }
        }