Example #1
0
        ///
        /// 根据NPC的ID来构造技能数据模型
        ///
        public RtNpcSkillModel(int NpcNum, int NpcId)
        {
            this.NpcId = NpcId;

            AllSkill  = new List <RtSkData>();
            NormalHit = new List <RtSkData>();

            NPCModel      model = Core.Data.getIModelConfig <NPCModel>();
            NPCConfigData npc   = model.get(NpcNum);

            Utils.Assert(npc == null, "Can't find NPC configure. Npc Num = " + NpcNum);

            RtSkData sk    = null;
            int      count = npc.skill.Length;

            for (int i = 0; i < count; ++i)
            {
                int skillId = npc.skill[i];
                if (skillId != 0)
                {
                    sk = new RtSkData(skillId, (short)i);
                    AllSkill.Add(sk);
                }
                else
                {
                    AllSkill.Add(null);
                }
            }

            if (npc.specialskill != 0)
            {
                sk = new RtSkData(npc.specialskill, 3);
                AllSkill.Add(sk);
            }
            else
            {
                AllSkill.Add(null);
            }

            ///普通的攻击其实也是技能
            if (npc.normalHit != null)
            {
                foreach (int skillId in npc.normalHit)
                {
                    if (skillId != 0)
                    {
                        sk = new RtSkData(skillId, -1);
                        NormalHit.Add(sk);
                    }
                    else
                    {
                        NormalHit.Add(null);
                    }
                }
            }

            ConCastor = ConditionCastor.instance;
        }
Example #2
0
        public RtBufData(int bufNum, int bufId, int fromNpcId, int toNpcId, OriginOfBuff o, int initLayer, float duration = -1F, int level = 0)
        {
            BeginFunc = new List <Action <RtBufData> >();
            CycleFunc = new List <Action <RtBufData> >();
            EndFunc   = new List <Action <RtBufData> >();
            TriFunc   = new List <Action <RtBufData> >();

            SkBufferModel bfModel = Core.Data.getIModelConfig <SkBufferModel>();

            BuffCfg = bfModel.get(bufNum);

            Utils.Assert(BuffCfg == null, "RtBufData can't get buff config. buf num = " + bufNum);

            if (BuffCfg.ScriptStart > 0)
            {
                OnStartSkill = new RtSkData(BuffCfg.ScriptStart, -1);
            }

            if (BuffCfg.ScriptCycle > 0)
            {
                onCycleskill = new RtSkData(BuffCfg.ScriptCycle, -1);
            }

            if (BuffCfg.ScriptEnd > 0)
            {
                OnEndSkill = new RtSkData(BuffCfg.ScriptEnd, -1);
            }

            //初始层数
            curLayers = BuffCfg.Stacks > initLayer ? initLayer : BuffCfg.Stacks;

            alive        = 0;
            coolDown     = BuffCfg.DelayTime;
            castRightNow = BuffCfg.DelayTime <= 0F;

            curCastTime = 0;

            origin = o;
            Cycle  = false;

            ID = bufId;

            CastorNpcID = fromNpcId;
            HangUpNpcID = toNpcId;

            if (duration <= 0F)
            {
                curDuration = BuffCfg.Duration;
            }
            else
            {
                curDuration = duration;
            }

            isInFinity = curDuration == -1;
        }
Example #3
0
        /// <summary>
        /// 激活其他技能
        /// </summary>
        /// <returns>The to skill.</returns>
        /// <param name="pos">Position.</param>
        public RtSkData switchToSkill(short pos, int skillId, bool isRest)
        {
            SkillModel      skMo     = Core.Data.getIModelConfig <SkillModel>();
            SkillConfigData skillCfg = skMo.get(skillId);

            //被激活的技能
            RtSkData InciteSk = null;

            if (skillCfg.IsAlive == 1)
            {
                InciteSk = new RtFakeSkData(skillId, pos);
                ((RtFakeSkData)InciteSk).lifeNpcId = this.NpcId;
                ///
                /// 判定是否是重置的技能
                ///
                int curCnt = -1;
                if (isRest)
                {
                    RtFakeSkData oldSk = AllSkill[pos] as RtFakeSkData;
                    curCnt = oldSk.curCounting;
                    ((RtFakeSkData)InciteSk).curCounting = curCnt;
                }

                ConsoleEx.DebugLog("--incide RtFakeSkData -", ConsoleEx.RED);
            }
            else
            {
                InciteSk = new RtSkData(skillId, pos);
                ConsoleEx.DebugLog("--incide RtSkData -", ConsoleEx.RED);
            }

            if (InciteSk == null)
            {
                ConsoleEx.DebugLog("Can't find Skill. Skill ID = " + skillId);
            }
            else
            {
                //设置技能CD
                InciteSk.coolDown = InciteSk.skillCfg.BaseCD;
                AllSkill[pos]     = InciteSk;
            }

            return(InciteSk);
        }
Example #4
0
        ///
        /// 调用CD
        ///
        public void Update(float deltatime)
        {
            int len = AllSkill.Count;

            for (int i = 0; i < len; ++i)
            {
                RtSkData sk = AllSkill[i];
                if (sk != null && sk.canCast == false)
                {
                    sk.coolDown -= deltatime;
                }

                //记录中间技能的时间
                if (sk != null && sk.isAliveSk)
                {
                    RtFakeSkData fakeSk = (RtFakeSkData)sk;
                    fakeSk.aliveDur += deltatime;
                    ConCastor.EnterIncite(fakeSk);
                }
            }
        }