public override void OnDie(SkillObj self, SkillObj attacker, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            return;

            if (self.GetBuffIntParam(buffInfo, Key_Int_Bombed_BuffInfo) != Key_Int_Bombed_Value)
            {
                var targetSelectName = self.GetTargetSelect(buffConfig);
                var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);
                if (targetSelect == null)
                {
                    self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName));
                    return;
                }
                var targetTypeName = self.GetTargetType(buffConfig);
                var targetType     = BattleModule.GetTargetType(targetTypeName);
                if (targetType == null)
                {
                    self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName));
                    return;
                }
                var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig);
                foreach (var tar in targets.Where(t => !t.IsDead()))
                {
                    OnEffect(self, tar, buffInfo, buffConfig);
                }
            }
        }
Exemple #2
0
        public override bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig)
        {
            bool ret = base.InitSkillInfo(self, skillInfo, skillConfig);

            var targetSelectName = "Range";
            var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);

            if (targetSelect == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName));
                return(false);
            }
            var targetTypeName = "Harm";
            var targetType     = BattleModule.GetTargetType(targetTypeName);

            if (targetType == null)
            {
                self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                Debug.Assert(false, "targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName));
                return(false);
            }
            var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig).ToList();

            if (targets == null || targets.Count <= 0)
            {
                return(true);
            }
            int count     = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig);
            int realCount = 0;
            int index     = 0;

            foreach (var tar in targets)
            {
                if (index < count)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + index++, tar.GetID());
                    realCount++;
                }
                else
                {
                    break;
                }
            }
            if (index < count)
            {
                var tank = targets.OrderBy(t => t.GetHP()).FirstOrDefault();
                for (int i = index; i < count; i++)
                {
                    self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + i, tank.GetID());
                    realCount++;
                }
            }
            self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, 0);
            ret = true;
            return(ret);
        }
Exemple #3
0
        public virtual void Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig)
        {
            if (!CommonCheck(self, buffInfo, buffConfig))
            {
                return;
            }
            var logicState = BattleModule.GetBuffLogicState(buffInfo, self);

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

            switch (ret)
            {
            case LogicStateTickRet.TimeFinish:
                BuffOnEnd(self, buffInfo, buffConfig);
                break;

            case LogicStateTickRet.NextState:
                int    index         = self.GetBuffStateIndex(buffInfo);
                string nextStateName = self.GetLogicState(buffConfig, ++index);
                if (nextStateName == null || nextStateName.Equals(""))
                {
                    BuffOnEnd(self, buffInfo, buffConfig);
                    return;
                }
                var nextLogicState = BattleModule.GetBuffLogicState(nextStateName);
                if (nextLogicState == null)
                {
                    self.LogInfo("startLogicState {0} not found".F(nextStateName));
                    return;
                }
                double fixTime = logicState.OnStateChanged(nextStateName, self, buffInfo, buffConfig);
                self.SetBuffStateIndex(buffInfo, index);
                nextLogicState.InitState(self, buffInfo, buffConfig, fixTime);
                self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.ChangeState_Buff, BattleNotifyTime.TickEnd);
                break;

            case LogicStateTickRet.OnEffect:
                //var srcObj = self.GetBuffSrcObj(buffInfo);
            {
                var targetSelectName = self.GetTargetSelect(buffConfig);
                var targetSelect     = BattleModule.GetTargetSelect(targetSelectName);
                if (targetSelect == null)
                {
                    self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName));
                    return;
                }
                var targetTypeName = self.GetTargetType(buffConfig);
                var targetType     = BattleModule.GetTargetType(targetTypeName);
                if (targetType == null)
                {
                    self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName));
                    return;
                }
                var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig);
                foreach (var tar in targets)
                {
                    OnEffect(self, tar, buffInfo, buffConfig);
                }
            }
            break;
            }
        }