Esempio n. 1
0
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                SelfDescribed described = warParam.described;

                if (described.srcEnd != null && described.srcEnd.param1 > 0)
                {
                    //转发消息
                    ServerNPC tag = npcMgr.TagNpc("Trigger");

                    switch (described.act)
                    {
                    case Verb.LineEnemy:
                        warParam.cmdType = WarMsg_Type.LineEnemy;
                        //创建一个触发器
                        warMgr.triMgr.CreateTrigger(described.src, described.srcEnd.param1, null);
                        npcMgr.SendMessageAsync(tag.UniqueID, tag.UniqueID, msg);
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
 public void Init(ServerNPC parent, WarMsgParam param)
 {
     owner = parent;
     wmMgr = WarServerManager.Instance;
     tran  = transform;
     if (param is WarSrcAnimParam)
     {
         WarSrcAnimParam wp = param as WarSrcAnimParam;
         sphereParam = wp;
         WarTarAnimParam[] tars = wp.InjureTar;
         speed  = wp.described.targetEnd.param8;
         maxDis = wp.described.targetEnd.param9;
         if (tars != null && tars.Length > 0)
         {
             SelfDescribed sd = tars[0].described;
             npcId = sd.targetEnd.param5;
             if (wmMgr != null)
             {
                 target = wmMgr.npcMgr.GetNPCByUniqueID(npcId);
                 if (target != null && parent.outLog)
                 {
                     Debug.Log("Sphere target : " + target.name);
                 }
             }
         }
         else
         {
             target = null;
         }
     }
     inited = true;
 }
Esempio n. 3
0
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            //TODO : do something
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                //杀死人,described只有一个元素
                SelfDescribed described = warParam.described;
                if (described.srcEnd != null)
                {
                    ///
                    /// 杀死别人,自己身上的Buff和Trigger消失
                    ///
                    int casterId = described.srcEnd.param1;
                    //int sufferId = described.srcEnd.param2;
                    if (casterId == HangUpNpcId)
                    {
                        ///
                        /// 概率上的检测
                        ///

                        bool happed = PseudoRandom.getInstance().happen(cfg.Prob);
                        if (happed)
                        {
                            OnEnd();
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        public void Suffer(ServerNPC caster, ServerNPC sufferer, SelfDescribed des, WarServerNpcMgr npcMgr)
        {
            //拿到算子
            InjuryOp CoreS = OperatorMgr.instance.getImplement <InjuryOp>(EffectOp.Injury);

            //TODO: find buff
            EffectConfigData[] help = null;

            handled = new Treat {
                treatValue = des.targetEnd.param1,
                treatType  = (SkillTypeClass)des.targetEnd.param3,
                isCritical = des.targetEnd.param2 == 1,
            };

            SufTreat res = CoreS.toSufferTreat(ref handled, sufferer.data, caster.data, help);

            if (res.isCureProtectioin)
            {
                //TODO : add Info here.
            }

            ///
            /// 最终结果的计算
            ///
            NPCRuntimeData rtdata = sufferer.data.rtData;

            rtdata.curHp += (int)handled.treatValue;
            rtdata.curHp  = rtdata.curHp > rtdata.totalHp ? rtdata.totalHp : rtdata.curHp;
        }
Esempio n. 5
0
        public void analyze(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                SelfDescribed des = warParam.described;

                int castor   = des.srcEnd.param1;
                int sufferer = des.srcEnd.param2;

                ServerNPC bCast = npcMgr.GetNPCByUniqueID(castor);
                ServerNPC bSuf  = npcMgr.GetNPCByUniqueID(sufferer);

                if (bCast != null && bSuf != null)
                {
                    Pair pair = new Pair()
                    {
                        CastorNum = bCast.data.num,
                        KilledNum = bCast.data.num,
                    };
                    killingInfo.Add(pair);
                }
            }
        }
Esempio n. 6
0
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                SelfDescribed described = warParam.described;
                if (described.srcEnd != null)
                {
                    ///
                    /// 每次被攻击几率对周围造成伤害
                    ///
                    int casterId = described.srcEnd.param1;
                    int sufferId = described.srcEnd.param2;

                    //不能自己打自己也反弹
                    if (sufferId == casterId)
                    {
                        return;
                    }

                    if (sufferId == HangUpNpcId)
                    {
                        //选择自己和目标
                        //目标也是自己
                        ServerNPC        castor  = npcMgr.GetNPCByUniqueID(sufferId);
                        List <ServerNPC> targets = new List <ServerNPC>();
                        targets.Add(castor);

                        warMgr.triMgr.trigCastor.cast(castor, targets, cfg);
                    }
                }
            }
        }
Esempio n. 7
0
        //更多的buff结束处理
        public void EndCastStep2(RtBufData rtBf)
        {
            container.Clear();
            ///
            /// 通知UI,去除Buff的UI显示
            ///
            int action = rtBf.BuffCfg.BuffAction;

            if (action > 0)
            {
                ///分析BuffAction的信息
                SelfDescribed des = new SelfDescribed()
                {
                    src       = rtBf.CastorNpcID,
                    target    = rtBf.HangUpNpcID,
                    act       = Verb.BuffEffect,
                    targetEnd = null,
                    srcEnd    = new EndResult()
                    {
                        param2 = action,
                        param3 = 1,
                    },
                };

                WarTarAnimParam warUI = new WarTarAnimParam()
                {
                    OP        = EffectOp.DotHot,
                    HitAction = action,
                    described = des,
                };
                container.Add(warUI);

                dispatchMsg(container, null);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Suffer the specified caster, target and damage.
        /// 收到伤害的时候,没有返回值.
        /// </summary>
        /// <param name="caster">释放者</param>
        /// <param name="target">目标者</param>
        /// <param name="damage">伤害值</param>
        public void Suffer(ServerNPC caster, ServerNPC sufferer, SelfDescribed des, WarServerNpcMgr npcMgr)
        {
            //拿到算子
            InjuryOp sufOp = OperatorMgr.instance.getImplement <InjuryOp>(EffectOp.Injury);

            handled = new Dmg {
                dmgValue   = des.targetEnd.param1,
                dmgType    = (SkillTypeClass)des.targetEnd.param3,
                isCritical = des.targetEnd.param2 == 1,
                hitCls     = (HurtHitClass)Enum.ToObject(typeof(HurtHitClass), des.targetEnd.param4),
            };

            //TODO: find buff
            EffectConfigData[] help = null;
            suf = sufOp.toSuffer(ref handled, sufferer.data, caster.data, help);
            ///
            ///更多的事情发生了,比如护盾,吸血,反弹
            ///
            report(caster.UniqueID, sufferer.UniqueID, suf, npcMgr);

            ///
            /// --------- 最终结算 --------
            ///
            sufferer.data.rtData.curHp -= (int)handled.dmgValue;


            ///
            /// --------- 通知Trigger,OnKilled ----------
            ///
            toTriggerMsg(caster, sufferer, npcMgr);
        }
Esempio n. 9
0
        // Update is called once per frame
        public void Update()
        {
            if (inited)
            {
                lifeTime -= Time.deltaTime;
                if (lifeTime < 0f)
                {
                    inited = false;
                    WarTarAnimParam deadParam = new WarTarAnimParam();
                    deadParam.OP = EffectOp.Injury;

                    SelfDescribed des = new SelfDescribed()
                    {
                        src       = UniqueID,
                        target    = UniqueID,
                        act       = Verb.Punch,
                        srcEnd    = null,
                        targetEnd = new EndResult()
                        {
                            param1 = 9999999,
                            param2 = 0,
                            param3 = 0,
                            param4 = 0,
                        },
                    };

                    deadParam.described = des;

                    deadParam.Sender   = UniqueID;
                    deadParam.Receiver = UniqueID;

                    wmMgr.npcMgr.SendMessage(UniqueID, UniqueID, deadParam);
                }
            }
        }
Esempio n. 10
0
 public void CastSk(params Object[] args)
 {
     if (castor != null && param != null)
     {
         WarSrcAnimParam srcParam = param as WarSrcAnimParam;
         if (srcParam != null)
         {
             SelfDescribed sd = srcParam.described;
             if (sd != null)
             {
                 EndResult result = sd.targetEnd;
                 if (result != null)
                 {
                     WarServerManager mgr = WarServerManager.Instance;
                     int       target     = result.param3;
                     ServerNPC npc        = mgr.npcMgr.GetNPCByUniqueID(target);
                     if (npc != null)
                     {
                         Vector3 dir = npc.transform.position;
                         dir.y = castor.transform.position.y;
                         dir   = dir - castor.transform.position;
                         Quaternion rot = Quaternion.LookRotation(dir, Vector3.up);
                         castor.transform.rotation = rot;
                         LeanTween.cancel(castor.gameObject);
                         LeanTween.move(castor.gameObject, npc.transform.position, 0.2f);
                         castor.SendNpcMoveMsg(true);
                     }
                 }
             }
         }
     }
 }
Esempio n. 11
0
        /// <summary>
        /// 释放技能效果
        /// </summary>
        /// <param name="src">效果发起者</param>
        /// <param name="target">目标参数无效</param>
        /// <param name="skDirectHurt">是否是技能的直接伤害, 这个没有伤害</param>
        /// <param name="container">所有数据展现的容器,本次Effect施法的效果会依次加入</param>
        /// <param name="skTarget">Sk target.</param>
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
                        #if DEBUG
            Utils.Assert(skCfg == null, "Skill Configure is null in BulletNpcEffect routine.");
                        #endif

            WarSrcAnimParam SrcParam = new WarSrcAnimParam()
            {
                OP             = EffectOp.Bullet_NPC,
                ShootAction    = skCfg.ShootAction,
                ShootTime      = skCfg.ShootTime,
                ShootEventTime = skCfg.ShootEventTime,
            };
            ///
            /// 有延迟的伤害类技能,伤害的结算都推后
            ///
            SelfDescribed des = new SelfDescribed()
            {
                src       = src.UniqueID,
                target    = src.UniqueID,
                act       = Verb.Creature,
                srcEnd    = null,
                targetEnd = new EndResult()
                {
                    param1 = src.UniqueID,
                    param2 = cfg.ID,
                    param3 = cfg.Param1,
                }
            };

            SrcParam.described = des;
            container.Add(SrcParam);
        }
Esempio n. 12
0
        void Report(MsgParam result)
        {
            if (outLog)
            {
                ConsoleEx.DebugLog("Msg is sending now : = " + fastJSON.JSON.Instance.ToJSON(result));
            }
            valid = false;
            WarAnimParam warParam = result as WarAnimParam;

            warParam.cmdType = WarMsg_Type.UseSkill;

            if (warParam.described != null)
            {
                SelfDescribed decribed = warParam.described;
                //如果不是自己则发送消息出去
                if (decribed.target != UniqueId)
                {
                    npcMgr.SendMessageAsync(UniqueId, decribed.target, result);
                }
                else
                {
                    //否则,自己给自己的消息就直接转过去
                    WarMsgParam param = result as WarMsgParam;
                    if (param != null && broadcast != null)
                    {
                        broadcast(param);
                    }
                }
            }

            skMsg.index    = result.arg1;
            skMsg.uniqueID = UniqueId;
            skMsg.baseCD   = runSkMd.getRuntimeSkill((short)skMsg.index).skillCfg.BaseCD;
            WarServerManager.Instance.realServer.proxyCli.NpcSkillCD(skMsg);
        }
Esempio n. 13
0
        /// <summary>
        /// Suffer the specified caster, sufferer, des and npcMgr.
        /// </summary>
        /// <param name="caster">Caster.</param>
        /// <param name="sufferer">Sufferer.</param>
        /// <param name="des">SelfDescribed src = arg1, target = arg2 </param>
        /// <param name="npcMgr">Npc mgr.</param>
        public void Suffer(ServerNPC caster, ServerNPC sufferer, SelfDescribed des, WarServerNpcMgr npcMgr)
        {
            WarMsgParam warMsg = new WarMsgParam();

            warMsg.Sender   = caster.UniqueID;
            warMsg.Receiver = sufferer.UniqueID;
            warMsg.arg1     = des.src;
            warMsg.arg2     = des.target;
            HandleOnAttack(warMsg, npcMgr);
        }
Esempio n. 14
0
        public void Suffer(ServerNPC caster, ServerNPC sufferer, SelfDescribed des, WarServerNpcMgr npcMgr)
        {
            int  CasterId   = caster.UniqueID;
            int  SufferId   = sufferer.UniqueID;
            int  idx        = des.targetEnd.param2;
            bool finalTar   = des.targetEnd.param3 == SufferId;
            bool maxDis     = des.targetEnd.param4 == 1;
            bool returnback = des.targetEnd.param5 == 1;
            int  effectId   = des.targetEnd.param1;

            HandleOnAttack(CasterId, SufferId, idx, finalTar, maxDis, returnback, effectId, npcMgr);
        }
Esempio n. 15
0
        SelfDescribed toSelf(int casterID)
        {
            SelfDescribed described = new SelfDescribed()
            {
                src       = casterID,
                target    = casterID,
                act       = Verb.DotHot,
                srcEnd    = null,
                targetEnd = null,
            };

            return(described);
        }
Esempio n. 16
0
        //收到伤害
        protected void BeInjured(WarTarAnimParam param)
        {
            if (param == null)
            {
                ConsoleEx.DebugWarning("BeInjured :: BeInjured :: param is null");
                return;
            }


            if (param.described != null)
            {
                SufferInjureEffect sufInjury = warServerMgr.sufMgr.getImplement <SufferInjureEffect>(EffectOp.Injury);
                SelfDescribed      des       = param.described;

                //记录攻击自己的人的ID
                data.btData.atkerID = des.src;

                if (des.target == UniqueId && IsAlive)
                {
                    ServerNPC caster = npcMgr.GetNPCByUniqueID(des.src);
                    sufInjury.Suffer(caster, this, des, npcMgr);
                    Dmg oneDmg = sufInjury.getHandled;

                    hpMsg.uniqueId = UniqueID;
                    hpMsg.deltaHp  = (int)oneDmg.dmgValue;
                    hpMsg.curHp    = data.rtData.curHp;
                    hpMsg.totalHp  = data.rtData.totalHp;
                    hpMsg.isDamage = true;
                    hpMsg.srcID    = des.src;
                    warServerMgr.realServer.proxyCli.NPChp(hpMsg);

//                    if (caster.UniqueID == npcMgr.ActiveHero.UniqueId)
//                    {
//                        if (OnHitByActiveHero != null)
//                        {
//                            Vector3 posIn2D = Vector3.zero;
//                            Vector3 posIn3D = transform.position;
//                            posIn3D.y += 3.5f;
//                            wmMgr.GetUIPos_Ref3DPos (posIn3D, ref posIn2D);
//                            OnHitByActiveHero ((int)oneDmg.dmgValue, true, oneDmg.isCritical, posIn2D);
//                        }
//                    }

                    //检查自己是否被杀
                    if (data.rtData.curHp <= 0)
                    {
                        BeKillded();
                    }
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 释放技能效果
        /// </summary>
        /// <param name="src">效果发起者</param>
        /// <param name="skTarget">技能选择的目标, 技能目标忽略</param>
        /// <param name="target">技能先选择目标后,再次Effect选择后的目标,忽略</param>
        /// <param name="skDirectHurt">是否是技能的直接伤害, 这个没有伤害</param>
        /// <param name="container">所有数据展现的容器,本次Effect施法的效果会依次加入</param>
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
            //获取本地的EffectAttribute
            var efType         = GetType();
            var classAttribute = (EffectAttribute)Attribute.GetCustomAttribute(efType, typeof(EffectAttribute));

            WarSrcAnimParam param = new WarSrcAnimParam();

            param.OP             = classAttribute.OP;
            param.ShootAction    = skCfg.ShootAction;
            param.ShootTime      = skCfg.ShootTime;
            param.ShootEventTime = skCfg.ShootEventTime;

            /// 将自己位移到符合<param1>条件的子物体位置,原有子物体是否存在由<param2>决定
            MvToChildCon   con   = (MvToChildCon)Enum.ToObject(typeof(MvToChildCon), cfg.Param1);
            MvToChildAlive alive = (MvToChildAlive)Enum.ToObject(typeof(MvToChildAlive), cfg.Param2);


            IEnumerable <ServerNPC> reTargets = select(src, ((ServerNPC)src).getChildNpc, con);

            if (reTargets.Any())
            {
                ServerNPC final = reTargets.First();
                if (final != null)
                {
                    UVec3 pos = final.transform.position;

                    SelfDescribed desc = new SelfDescribed()
                    {
                        src    = src.UniqueID,
                        target = src.UniqueID,
                        act    = Verb.Blink,
                        srcEnd = new EndResult()
                        {
                            param1  = (int)alive,
                            param2  = final.UniqueID,
                            param8  = pos.x,
                            param9  = pos.y,
                            param10 = pos.z,
                        },
                        targetEnd = null,
                    };

                    param.described = desc;
                }
            }

            container.Add(param);
        }
Esempio n. 18
0
        //治疗消息
        protected void BeTreated(WarTarAnimParam param)
        {
            if (param == null)
            {
                ConsoleEx.DebugWarning("BeTreated :: BeTreated :: param is null");
                return;
            }

            if (param.described != null)
            {
                SufferTreatEffect treatInjury = warServerMgr.sufMgr.getImplement <SufferTreatEffect>(EffectOp.Treat);

                SelfDescribed des    = param.described;
                ServerNPC     caster = npcMgr.GetNPCByUniqueID(des.src);
                if (des.target == UniqueId)
                {
                    treatInjury.Suffer(caster, this, des, npcMgr);
                    Treat oneTreat = treatInjury.getHandled;

                    if (oneTreat.treatValue > 0)
                    {
                        hpMsg.uniqueId = UniqueID;
                        hpMsg.deltaHp  = (int)oneTreat.treatValue;
                        hpMsg.curHp    = data.rtData.curHp;
                        hpMsg.totalHp  = data.rtData.totalHp;
                        hpMsg.isDamage = false;
                        hpMsg.srcID    = des.src;
                        warServerMgr.realServer.proxyCli.NPChp(hpMsg);
                    }

//                    //回血UI
//                    caster = npcMgr.GetNPCByUniqueID (des.target);
//                    if (caster.UniqueID == warServerMgr.teamMgr.selfActiveHero.UniqueId && data.rtData.curHp < data.rtData.totalHp)
//                    {
//                        if (OnHitByActiveHero != null)
//                        {
//                            if (wmMgr != null)
//                            {
//                                Vector3 posIn2D = Vector3.zero;
//                                Vector3 posIn3D = transform.position;
//                                posIn3D.y += 3.5f;
//                                wmMgr.GetUIPos_Ref3DPos (posIn3D, ref posIn2D);
//                                OnHitByActiveHero ((int)oneTreat.treatValue, false, oneTreat.isCritical, posIn2D);
//                            }
//                        }
//                    }
                }
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 触发条件满足,或者说感兴趣的事情发生了。
        /// 但是是不是要真的处理什么逻辑,还不一定
        /// </summary>
        /// <param name="msg">Message</param>
        /// <param name="npcMgr">Npc mgr.</param>
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            checkList.Clear();
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                SelfDescribed des  = warParam.described;
                Pair          pair = new Pair();
                pair.castor = npcMgr.GetNPCByUniqueID(des.src);
                pair.target = npcMgr.GetNPCByUniqueID(des.target);

                checkList.Add(pair);
            }
        }
Esempio n. 20
0
        void BulletNPCCreator(WarAnimParam warParam, WarServerNpcMgr npcMgr)
        {
            ServerNPC caster = npcMgr.GetNPCByUniqueID(warParam.Sender);
            ServerNPC suffer = npcMgr.GetNPCByUniqueID(warParam.Receiver);

            SelfDescribed des = new SelfDescribed()
            {
                src    = warParam.arg1,
                target = warParam.arg2,
            };

            SufferBulletEffect bulletSuf = warMgr.sufMgr.getImplement <SufferBulletEffect>(EffectOp.Bullet_NPC);

            bulletSuf.Suffer(caster, suffer, des, npcMgr);
        }
Esempio n. 21
0
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
                        #if DEBUG
            Utils.Assert(src == null, "Treat Effect can't find attacker.");
                        #endif

            Verb verb = Verb.Punch;
            if (cfg.Param1 > 0)
            {
                verb = (Verb)Enum.ToObject(typeof(Verb), cfg.Param1 + 0xA5);
            }
            if (cfg.Param2 > 0)
            {
                verb = (Verb)Enum.ToObject(typeof(Verb), cfg.Param2 + 0xC5);
            }

            List <ServerNPC> effTarget = target.ToList();
            int count = effTarget.Count;
            if (count > 0)
            {
                for (int i = 0; i < count; ++i)
                {
                    WarTarAnimParam param = new WarTarAnimParam();

                    ServerNPC tar = effTarget[i];

                    SelfDescribed des = new SelfDescribed()
                    {
                        src    = src.UniqueID,
                        target = tar.UniqueID,
                        act    = verb,
                        srcEnd = new EndResult()
                        {
                            param1 = cfg.Param4,
                            param2 = cfg.Param3,
                            param3 = cfg.Param1 > 0 ? 0 : 1,
                        },
                        targetEnd = null,
                    };

                    param.OP        = EffectOp.Trigger;
                    param.SkillId   = skCfg.ID;
                    param.described = des;

                    container.Add(param);
                }
            }
        }
Esempio n. 22
0
        public override void Init(ServerNPC owner, WarMsgParam param)
        {
            parent = owner;
            ConsoleEx.DebugLog(parent.name);
            wmMgr    = WarServerManager.Instance;
            UniqueId = wmMgr.npcMgr.SignID(this);
            Camp     = Camp.set(owner.Camp);
            WarSrcAnimParam wp = param as WarSrcAnimParam;

            if (wp != null)
            {
                SelfDescribed sd     = wp.described;
                EndResult     result = sd.srcEnd;
                lifeTime = result.param8;
            }
            inited = true;
        }
Esempio n. 23
0
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            //TODO : do something
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                SelfDescribed described = warParam.described;
                if (described.srcEnd != null)
                {
                    //转发消息
                    ServerNPC tag = npcMgr.TagNpc("Trigger");
                    warParam.cmdType = WarMsg_Type.RmBufIfKilling;
                    npcMgr.SendMessageAsync(tag.UniqueID, tag.UniqueID, warParam);
                }
            }
        }
Esempio n. 24
0
        public void OnHappen(MsgParam msg, WarServerNpcMgr npcMgr)
        {
            WarAnimParam warParam = msg as WarAnimParam;

            if (warParam != null && warParam.described != null)
            {
                //转发消息
                ServerNPC tag = npcMgr.TagNpc("Trigger");

                SelfDescribed described = warParam.described;
                if (described.srcEnd != null)
                {
                    warParam.cmdType = WarMsg_Type.CounterAttack;
                    npcMgr.SendMessageAsync(tag.UniqueID, tag.UniqueID, warParam);
                }
            }
        }
Esempio n. 25
0
        public void CastSk(params Object[] args)
        {
            if (castor != null && param != null)
            {
                WarSrcAnimParam srcParam = param as WarSrcAnimParam;
                if (srcParam != null)
                {
                    SelfDescribed sd = srcParam.described;
                    if (sd != null)
                    {
                        EndResult result = sd.srcEnd;
//                        float x = result.param8;
//                        float z = result.param9;
                        Vector3 pos = Vector3.zero;
//                        castor.transform.position = pos;
//                        castor.SendNpcMoveMsg(true);
                        if (castor is ServerLifeNpc)
                        {
                            ServerLifeNpc sCastor = castor as ServerLifeNpc;
                            sCastor.HitAnimReset();
                        }
                        int clearFlag = result.param1;
                        if (clearFlag == 0)
                        {
                            ServerNPC npc = castor.getOneChildNpc(result.param2);
                            if (npc != null)
                            {
                                pos   = npc.transform.position;
                                pos.y = 0.1f;
                                castor.transform.position = pos;
                                castor.SendNpcMoveMsg(true);
                                castor.removeChild(npc);
                                WarServerManager mgr = WarServerManager.Instance;
                                IpcDestroyNpcMsg msg = new IpcDestroyNpcMsg();
                                msg.id = npc.UniqueID;
                                mgr.realServer.proxyCli.NpcDestroy(msg);
                                UnityEngine.GameObject.Destroy(npc.gameObject);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 26
0
        /// <summary>
        /// 释放技能效果
        /// </summary>
        /// <param name="src">效果发起者</param>
        /// <param name="skTarget">技能选择的目标,本参数在这里无意义</param>
        /// <param name="target">技能先选择目标后,再次Effect选择后的目标。本参数数量 >= 0 </param></param>
        /// <param name="skDirectHurt">是否是技能的直接伤害, 这个没有伤害</param>
        /// <param name="container">所有数据展现的容器,本次Effect施法的效果会依次加入</param>
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
                        #if DEBUG
            Utils.Assert(cfg == null, "Effect configure is null in DotHotEffect.");
            Utils.Assert(skCfg == null, "skill configure is null in DotHotEffect.");
                        #endif

            foreach (ServerNPC bnpc in target)
            {
                WarTarAnimParam param = new WarTarAnimParam()
                {
                    OP        = EffectOp.DotHot,
                    HitAction = cfg.HitAction,
                };

                BuffMgr bufMgr = WarServerManager.Instance.bufMgr;

                BuffCtorParamEx ctor = new BuffCtorParamEx()
                {
                    fromNpcId = src.UniqueID,
                    toNpcId   = bnpc.UniqueID,
                    cfg       = base.cfg,
                };
                //创建BUff
                RtBufData maybe = bufMgr.createBuff(ctor);
                //statistics
                SelfDescribed des = statistics(maybe, src, bnpc);
                param.described = des;
                container.Add(param);
            }

            //通知给技能释放者的目标
            WarSrcAnimParam SrcParam = new WarSrcAnimParam()
            {
                OP             = EffectOp.DotHot,
                ShootAction    = skCfg.ShootAction,
                ShootTime      = skCfg.ShootTime,
                ShootEventTime = skCfg.ShootEventTime,
                described      = toSelf(src.UniqueID),
            };
            container.Add(SrcParam);
        }
Esempio n. 27
0
        SelfDescribed record(int CasterId, int SufferId, Dmg damage, int i)
        {
            //统计数据
            SelfDescribed des = new SelfDescribed()
            {
                src       = CasterId,
                target    = SufferId,
                act       = Verb.Strike,
                srcEnd    = null,
                targetEnd = new EndResult()
                {
                    param1 = (int)damage.dmgValue,
                    param2 = damage.isCritical ? 1 : 0,
                    param3 = (int)damage.dmgType,
                    param4 = (int)damage.hitCls,
                }
            };

            return(des);
        }
Esempio n. 28
0
        ///分析BuffAction的信息
        SelfDescribed statistics(RtBufData maybeCreated, ServerNPC src, ServerNPC target)
        {
            SelfDescribed described = null;
            int           action    = maybeCreated.BuffCfg.BuffAction;

            if (action > 0)
            {
                described           = new SelfDescribed();
                described.src       = src.UniqueID;
                described.target    = target.UniqueID;
                described.act       = Verb.BuffEffect;
                described.targetEnd = null;
                described.srcEnd    = new EndResult()
                {
                    param2 = action,
                    param3 = 0,
                };
            }
            return(described);
        }
        /// <summary>
        /// 释放技能效果
        /// </summary>
        /// <param name="src">效果发起者</param>
        /// <param name="skTarget">技能选择的目标</param>
        /// <param name="target">技能先选择目标后,再次Effect选择后的目标</param>
        /// <param name="skDirectHurt">是否是技能的直接伤害</param>
        /// <param name="container">所有数据展现的容器,本次Effect施法的效果会依次加入</param>
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
                        #if DEBUG
            Utils.Assert(cfg == null, "Effect Configure is null in SwitchNpcEffect.");
                        #endif
            //有且只有一个
            //Utils.Assert(target.Count() != 1, "HookNpcEffect is DisWhenFinalTar type, so only one target is allowed.");
            int targetId = 0;

            if (target != null && target.Count() > 0)
            {
                targetId = target.First().UniqueID;
            }

            WarSrcAnimParam SrcParam = new WarSrcAnimParam()
            {
                OP             = EffectOp.MoveTarget,
                ShootAction    = skCfg.ShootAction,
                ShootTime      = skCfg.ShootTime,
                ShootEventTime = skCfg.ShootEventTime,
                SkillId        = skCfg.ID,
            };

            SelfDescribed des = new SelfDescribed()
            {
                src       = src.UniqueID,
                target    = src.UniqueID,
                act       = Verb.Move,
                srcEnd    = null,
                targetEnd = new EndResult()
                {
                    param1 = cfg.ID,
                    param2 = src.UniqueID,
                    param3 = targetId,
                }
            };

            SrcParam.described = des;
            container.Add(SrcParam);
        }
Esempio n. 30
0
        /// <summary>
        /// 释放技能效果
        /// </summary>
        /// <param name="src">效果发起者</param>
        /// <param name="target">目标参数无效</param>
        /// <param name="skDirectHurt">是否是技能的直接伤害, 这个没有伤害</param>
        /// <param name="container">所有数据展现的容器,本次Effect施法的效果会依次加入</param>
        /// <param name="skTarget">Sk target.</param>
        public void Cast(ServerNPC src, IEnumerable <ServerNPC> skTarget, IEnumerable <ServerNPC> target, bool skDirectHurt, List <MsgParam> container)
        {
                        #if DEBUG
            Utils.Assert(skCfg == null, "Skill Configure is null in BulletNpcEffect routine.");
                        #endif

            int finalTarget = 0;
            HookNpcDisappearType disappearType = (HookNpcDisappearType)Enum.ToObject(typeof(HookNpcDisappearType), cfg.Param2);
            if (disappearType == HookNpcDisappearType.DisWhenFinalTar)
            {
                Utils.Assert(target.Count() != 1, "HookNpcEffect is DisWhenFinalTar type, so only one target is allowed.");
                finalTarget = target.First().UniqueID;
            }

            WarSrcAnimParam SrcParam = new WarSrcAnimParam()
            {
                OP             = EffectOp.Bullet_NPC,
                ShootAction    = skCfg.ShootAction,
                ShootTime      = skCfg.ShootTime,
                SkillId        = skCfg.ID,
                ShootEventTime = skCfg.ShootEventTime,
            };

            SelfDescribed des = new SelfDescribed()
            {
                src       = src.UniqueID,
                target    = src.UniqueID,
                act       = Verb.Creature,
                srcEnd    = null,
                targetEnd = new EndResult()
                {
                    param1 = src.UniqueID,
                    param2 = cfg.ID,
                    param3 = finalTarget,
                }
            };

            SrcParam.described = des;
            container.Add(SrcParam);
        }