コード例 #1
0
        public virtual bool IsActionLimited(SkillObj self, ActionLimitType limit, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            if (!CommonCheck(self, skillInfo, skillConfig))
            {
                return(false);
            }
            var logicState = BattleModule.GetSkillLogicState(skillInfo, self);

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

            return(ret);
        }
コード例 #2
0
        public virtual double DataFix(SkillObj self, PropertyType pType, double pValue, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            if (!CommonCheck(self, skillInfo, skillConfig))
            {
                return(pValue);
            }
            var logicState = BattleModule.GetSkillLogicState(skillInfo, self);

            if (logicState == null)
            {
                return(pValue);
            }
            if (logicState.NeedDataFix(self, pType, pValue, skillInfo, skillConfig))
            {
                pValue = OnDataFix(self, pType, pValue, skillInfo, skillConfig);
            }
            return(pValue);
        }
コード例 #3
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);
        }
コード例 #4
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;
            }
        }