예제 #1
0
        public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            double effectTickTime = self.GetBuffStateDoubleParam(buffConfig, key_EffectTickTime, self.GetBuffStateIndex(buffInfo));

            if (effectTickTime < 0)
            {
                self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetBuffID(buffInfo)));
                return(LogicStateTickRet.TimeFinish);
            }
            self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
            var leftTickTime = self.GetBuffStateDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo);

            if (leftTickTime - self.GetBuffStateTime(buffInfo) >= effectTickTime)
            {
                self.SetBuffStateDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo, leftTickTime - effectTickTime);
                self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect".F(self.GetID(), self.GetBuffID(buffInfo)));
                ret = LogicStateTickRet.OnEffect;
            }
            else if (self.GetBuffStateTime(buffInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
            }
            else
            {
                ret = LogicStateTickRet.None;
            }
            return(ret);
        }
예제 #2
0
 public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     double effectTickTime = self.GetBuffStateDoubleParam(buffConfig, key_EffectTickTime, self.GetBuffStateIndex(buffInfo));
     if(effectTickTime < 0)
     {
         self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetBuffID(buffInfo)));
         return LogicStateTickRet.TimeFinish;
     }
     self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
     var leftTickTime = self.GetBuffDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo);
     if (leftTickTime - self.GetBuffStateTime(buffInfo) >= effectTickTime)
     {
         self.SetBuffDoubleParam(buffInfo, leftTickTime - effectTickTime, key_ticlLeftTime_BuffInfo);
         self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect".F(self.GetID(), self.GetBuffID(buffInfo)));
         ret = LogicStateTickRet.OnEffect;
     }
     else if (self.GetBuffStateTime(buffInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
     }
     else
     {
         ret = LogicStateTickRet.None;
     }
     return ret;
 }
 public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
     //help harm 判断是否停留
     int harmHelpType = self.GetBuffStateIntParam(buffConfig, Key_Int__BuffConfig, self.GetBuffStateIndex(buffInfo));
     bool needNextState = false;
     switch(harmHelpType)
     {
         case 1:
             //这个是友好,没错
             needNextState = self.GetCamp() != self.GetSrcCamp(buffInfo);
             break;
         case 2:
             //这个是友好,没错敌对
             needNextState = self.GetCamp() == self.GetSrcCamp(buffInfo);
             break;
     }
     if (self.GetBuffStateTime(buffInfo) <= 0 || needNextState)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
     }
     return ret;
 }
예제 #4
0
        public override LogicStateTickRet Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            LogicStateTickRet ret = base.Tick(self, skillInfo, skillConfig);

            self.SetSkillTime(skillInfo, self.GetSkillTime(skillInfo) - self.GetDeltaTime());
            if (self.GetSkillTime(skillInfo) <= 0)
            {
                ret = LogicStateTickRet.TimeFinish;
                self.LogInfo("SkillLogicState:skillObj[{0}] skill:[{1}] [{2}]".F(self.GetID(), self.GetSkillID(skillInfo), ret.ToString()));
            }
            return(ret);
        }
예제 #5
0
        public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);

            self.SetBuffTime(buffInfo, self.GetBuffTime(buffInfo) - self.GetDeltaTime());
            if (self.GetBuffTime(buffInfo) <= 0)
            {
                ret = LogicStateTickRet.TimeFinish;
                self.LogInfo("BuffLogicState:buffObj[{0}] buff:[{1}] [{2}]".F(self.GetID(), self.GetBuffID(buffInfo), ret.ToString()));
            }
            return(ret);
        }
예제 #6
0
 public override void OnEffect(SkillObj self, SkillObj tarObj, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     int key = Key_Double_AddTime1_BuffConfig;
     if (self.GetSrcID(buffInfo) == tarObj.GetID() || self.GetSrcParentID(buffInfo) == tarObj.GetID())
     {
         key = Key_Double_AddTime1_BuffConfig;
     }
     else
     {
         key = Key_Double_AddTime2_BuffConfig;
     }
     foreach (var buff in self.GetBuffList(true))
     {
         int buffId = self.GetBuffID(buff);
         if (buffId > 0 && buffId == self.GetBuffIntParam(buffConfig, Key_Int_BuffId_BuffConfig))
         {
             double addTime = self.GetBuffDoubleParam(buffConfig, key);
             self.SetBuffTime(buff, self.GetBuffTime(buff) + addTime);
             self.SetBuffStateTime(buff, self.GetBuffStateTime(buff) + addTime);
             self.NotifyBuffInfo(buff, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd);
         }
     }
 }
예제 #7
0
 public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
 {
     LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);
     if (ret == LogicStateTickRet.TimeFinish)
     {
         return ret;
     }
     self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
     if (self.GetBuffStateTime(buffInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
     }
     return ret;
 }
예제 #8
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;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ShowEffectSkillState:skillObj[{0}] skill:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     return ret;
 }
예제 #9
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);
        }
예제 #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;
     }
     self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
     //self.LogInfo("State [{0}] Time:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetSkillStateTime(skillInfo)));
     if (self.GetSkillStateTime(skillInfo) <= 0)
     {
         self.LogInfo("State [{0}] NowTime fINISH:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
         ret = LogicStateTickRet.NextState;
         self.LogInfo("ChargeState:skillObj[{0}] skill:[{1}] Charge Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
     }
     return ret;
 }
예제 #11
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);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            //self.LogInfo("State [{0}] Time:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetSkillStateTime(skillInfo)));
            if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                self.LogInfo("State [{0}] NowTime fINISH:[{1}]".F(self.GetSkillLogicStateName(skillInfo), self.GetNowTime()));
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ChargeState:skillObj[{0}] skill:[{1}] Charge Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            return(ret);
        }
예제 #12
0
        public override void OnEffect(SkillObj self, SkillObj tarObj, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            int key = Key_Double_AddTime1_BuffConfig;

            if (self.GetSrcID(buffInfo) == tarObj.GetID() || self.GetSrcParentID(buffInfo) == tarObj.GetID())
            {
                key = Key_Double_AddTime1_BuffConfig;
            }
            else
            {
                key = Key_Double_AddTime2_BuffConfig;
            }
            foreach (var buff in self.GetBuffList(true))
            {
                int buffId = self.GetBuffID(buff);
                if (buffId > 0 && buffId == self.GetBuffIntParam(buffConfig, Key_Int_BuffId_BuffConfig))
                {
                    double addTime = self.GetBuffDoubleParam(buffConfig, key);
                    self.SetBuffTime(buff, self.GetBuffTime(buff) + addTime);
                    self.SetBuffStateTime(buff, self.GetBuffStateTime(buff) + addTime);
                    self.NotifyBuffInfo(buff, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd);
                }
            }
        }
예제 #13
0
        public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
            if (self.GetBuffStateTime(buffInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
            }
            return(ret);
        }
예제 #14
0
        public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig);

            if (ret == LogicStateTickRet.TimeFinish)
            {
                return(ret);
            }
            self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime());
            //help harm 判断是否停留
            int  harmHelpType  = self.GetBuffStateIntParam(buffConfig, Key_Int__BuffConfig, self.GetBuffStateIndex(buffInfo));
            bool needNextState = false;

            switch (harmHelpType)
            {
            case 1:
                //这个是友好,没错
                needNextState = self.GetCamp() != self.GetSrcCamp(buffInfo);
                break;

            case 2:
                //这个是友好,没错敌对
                needNextState = self.GetCamp() == self.GetSrcCamp(buffInfo);
                break;
            }
            if (self.GetBuffStateTime(buffInfo) <= 0 || needNextState)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo)));
            }
            return(ret);
        }
예제 #15
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);
            }
            self.SetSkillStateTime(skillInfo, self.GetSkillStateTime(skillInfo) - self.GetDeltaTime());
            if (self.GetSkillStateTime(skillInfo) <= 0)
            {
                ret = LogicStateTickRet.NextState;
                self.LogInfo("ShowEffectSkillState:skillObj[{0}] skill:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetSkillID(skillInfo)));
            }
            return(ret);
        }
예제 #16
0
        /// <summary>
        /// 造成伤害或治疗
        /// </summary>
        /// <param name="tarObj"></param>
        /// <param name="srcObj"></param>
        /// <param name="damage">大于0是伤害,小于0是治疗</param>
        public static void DamageTarget(SkillObj tarObj, SkillObj srcObj, Damage damage)
        {
            SkillObj realSrcObj = srcObj;

            if (tarObj == null || tarObj.IsDead())
            {
                return;
            }
            if (realSrcObj != null && damage.srcId > 0 && realSrcObj.GetID() != damage.srcId)
            {
                realSrcObj = tarObj.GetSkillObj(damage.srcId);
            }
            BattleModule.CalcDamage(tarObj, realSrcObj, damage);
            //先修正伤害
            BattleModule.DamageFix(tarObj, realSrcObj, damage);
            //质量和造成伤害都是这个
            //造成伤害
            if (damage.value >= 0)
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            else
            {
                tarObj.OnDamage(damage, realSrcObj);
            }
            //检查技能与BUFF的相应触发
            if (realSrcObj != null && !realSrcObj.IsDead())
            {
                var srcSkillList = realSrcObj.GetSkillList();
                var srcBuffList  = realSrcObj.GetBuffList();
                //Source skill fix
                if (srcSkillList != null)
                {
                    foreach (var skillInfo in srcSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, realSrcObj);
                        int        skillId    = realSrcObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = realSrcObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnDamageTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnHealTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Source buff fix
                if (srcBuffList != null)
                {
                    foreach (var buffInfo in srcBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, realSrcObj);
                        int       buffId    = realSrcObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = realSrcObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnDamageTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnHealTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            realSrcObj.LogInfo("something error in BattleModule.DamageTarget src buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            var tarSkillList = tarObj.GetSkillList();
            var tarBuffList  = tarObj.GetBuffList();

            //Target skill fix
            if (!tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int        skillId    = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            if (damage.value >= 0)
                            {
                                skillLogic.OnBeHurt(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                            else
                            {
                                skillLogic.OnBeHeal(tarObj, realSrcObj, damage, skillInfo, skillConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int       buffId    = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            if (damage.value >= 0)
                            {
                                buffLogic.OnBeHurt(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                            else
                            {
                                buffLogic.OnBeHeal(tarObj, realSrcObj, damage, buffInfo, buffConfig);
                            }
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
            }

            if (tarObj.IsDead())
            {
                if (tarSkillList != null)
                {
                    foreach (var skillInfo in tarSkillList)
                    {
                        SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj);
                        int        skillId    = tarObj.GetSkillID(skillInfo);
                        if (skillLogic != null)
                        {
                            SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId);
                            skillLogic.OnDie(tarObj, realSrcObj, skillInfo, skillConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId));
                        }
                    }
                }
                //Target buff fix
                if (tarBuffList != null)
                {
                    foreach (var buffInfo in tarBuffList)
                    {
                        BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj);
                        int       buffId    = tarObj.GetBuffID(buffInfo);
                        if (buffLogic != null)
                        {
                            BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId);
                            buffLogic.OnDie(tarObj, realSrcObj, buffInfo, buffConfig);
                        }
                        else
                        {
                            tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId));
                        }
                    }
                }
                bool ret = tarObj.OnDie(realSrcObj);
            }
        }