Example #1
0
 public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     double effectTickTime = self.GetSkillStateDoubleParam(skillConfig, key_EffectTickTime, self.GetSkillStateIndex(skillInfo));
     if (effectTickTime < 0)
     {
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetSkillID(skillInfo)));
         return LogicStateTickRet.TimeFinish;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     var leftTickTime = self.GetSkillDoubleParam(skillInfo, key_ticlLeftTime_SkillInfo);
     if (leftTickTime - self.GetSkillStateTime(skillInfo) >= effectTickTime)
     {
         self.SetSkillDoubleParam(skillInfo, leftTickTime - effectTickTime, key_ticlLeftTime_SkillInfo);
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect".F(self.GetID(), self.GetSkillID(skillInfo)));
         ret = LogicStateTickRet.OnEffect;
     }
     else if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     else
     {
         ret = LogicStateTickRet.None;
     }
     return ret;
 }
Example #2
0
        public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(skillInfo);
            var time  = self.GetSkillStateTime(skillConfig, index);

            self.SetSkillStateTime(skillInfo, time + fixTime);
        }
Example #3
0
 public override void InitState(SkillObj self, SkillInfo_New biffInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(biffInfo);
     var time = self.GetSkillStateTime(skillConfig, index) + fixTime;
     self.SetSkillStateTime(biffInfo, time);
     self.SetSkillDoubleParam(biffInfo, time, key_ticlLeftTime_SkillInfo);
 }
Example #4
0
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(skillInfo);
     var time = self.GetSkillStateTime(skillConfig, index);
     self.SetSkillStateTime(skillInfo, time + fixTime);
     self.LogInfo("State [{0}] NowTime bEGIN:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
 }
Example #5
0
        public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(skillInfo);
            var time  = self.GetSkillStateTime(skillConfig, index);

            self.SetSkillStateTime(skillInfo, time + fixTime);
            self.LogInfo("State [{0}] NowTime bEGIN:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
        }
Example #6
0
        public override void InitState(SkillObj self, SkillInfo_New biffInfo, SkillConfig_New skillConfig, double fixTime)
        {
            int index = self.GetSkillStateIndex(biffInfo);
            var time  = self.GetSkillStateTime(skillConfig, index) + fixTime;

            self.SetSkillStateTime(biffInfo, time);
            self.SetSkillDoubleParam(biffInfo, time, key_ticlLeftTime_SkillInfo);
        }
Example #7
0
 public override bool IsActionLimited(SkillObj self, ActionLimitType limit, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
 {
     int iLimit = -1;
     switch (limit)
     {
         case ActionLimitType.Attack:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionAttackLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         case ActionLimitType.Move:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionMoveLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         case ActionLimitType.UseSkill:
             iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionUseSkillLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
             break;
         default:
             System.Diagnostics.Debug.Assert(false, "limit == default IsActionLimited:[{0}]".F(limit));
             break;
     }
     if (iLimit == 1)
     {
         return true;
     }
     return false;
 }
Example #8
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;
            }
        }
Example #9
0
        public override bool IsActionLimited(SkillObj self, ActionLimitType limit, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            int iLimit = -1;

            switch (limit)
            {
            case ActionLimitType.Attack:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionAttackLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            case ActionLimitType.Move:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionMoveLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            case ActionLimitType.UseSkill:
                iLimit = self.GetSkillStateIntParam(skillConfig, key_ActionUseSkillLimit_SkillConfig, self.GetSkillStateIndex(skillInfo));
                break;

            default:
                System.Diagnostics.Debug.Assert(false, "limit == default IsActionLimited:[{0}]".F(limit));
                break;
            }
            if (iLimit == 1)
            {
                return(true);
            }
            return(false);
        }
Example #10
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            double effectTickTime = self.GetSkillStateDoubleParam(skillConfig, key_EffectTickTime, self.GetSkillStateIndex(skillInfo));

            if (effectTickTime < 0)
            {
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetSkillID(skillInfo)));
                return(LogicStateTickRet.TimeFinish);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            var leftTickTime = self.GetSkillDoubleParam(skillInfo, key_ticlLeftTime_SkillInfo);

            if (leftTickTime - self.GetSkillStateTime(skillInfo) >= effectTickTime)
            {
                self.SetSkillDoubleParam(skillInfo, leftTickTime - effectTickTime, key_ticlLeftTime_SkillInfo);
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Effect".F(self.GetID(), self.GetSkillID(skillInfo)));
                ret = LogicStateTickRet.OnEffect;
            }
            else if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("TickSkillState:skillObj[{0}] skill:[{1}] Tick Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            else
            {
                ret = LogicStateTickRet.None;
            }
            return(ret);
        }
Example #11
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;
            }
        }
 public override void InitState(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig, double fixTime)
 {
     int index = self.GetSkillStateIndex(skillInfo);
     var time = self.GetSkillStateTime(skillConfig, index);
     self.SetSkillStateTime(skillInfo, time + fixTime);
 }