Injured() public method

public Injured ( BaseObject obj, uint value, NetMsg info ) : void
obj BaseObject
value uint
info NetMsg
return void
Exemplo n.º 1
0
        public override bool Run()
        {
            base.Run();
            if (System.Environment.TickCount - mnTick > mnTime)
            {
                this.ClearThis();
                return(false);
            }

            //会攻击的特效-- 降灵咒雨
            if (mnEffID == Define.JIANGLINGZHOUYU)
            {
                if (System.Environment.TickCount - mnAttackTick > 1000)
                {
                    mnAttackTick = System.Environment.TickCount;

                    NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                    magicattack.roleid  = (uint)mnEffID;
                    magicattack.role_x  = this.GetCurrentX();
                    magicattack.role_y  = this.GetCurrentY();
                    magicattack.tag     = 21;
                    magicattack.magicid = (ushort)Define.JIANGLINGZHOUYU_MAGICID;
                    magicattack.magiclv = 0;

                    this.BrocatBuffer(magicattack.GetBuffer());

                    NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                    magicattackex.nID      = mPlay.GetTypeId();
                    magicattackex.nX       = this.GetCurrentX();
                    magicattackex.nY       = this.GetCurrentY();
                    magicattackex.nMagicID = (ushort)Define.JIANGLINGZHOUYU_MAGICID;
                    magicattackex.nMagicLv = 0;
                    magicattackex.bDir     = this.GetDir();
                    NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo();
                    info.tag = 21;
                    //---攻击 暂时只攻击怪物
                    foreach (RefreshObject refobj in this.GetVisibleList().Values)
                    {
                        BaseObject obj = refobj.obj;
                        if (obj.type == OBJECTTYPE.MONSTER)
                        {
                            if (this.GetPoint().CheckVisualDistance(obj.GetCurrentX(), obj.GetCurrentY(), Define.JIANGLINGZHOUYU_DIS))
                            {
                                uint nValue = BattleSystem.AdjustDamage(mPlay, obj, true);
                                magicattackex.AddObject(obj.GetTypeId(), (int)nValue);

                                obj.Injured(mPlay, nValue, info);
                            }
                        }
                    }
                    this.BrocatBuffer(magicattackex.GetBuffer());
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        //连击技能
        private void ComboMagic(NetMsg.MsgAttackInfo info, BaseObject target)
        {
            byte[] msg = null;
            ushort magiclv = play.GetMagicSystem().GetMagicLevel(info.skillid);
            GameStruct.MagicTypeInfo baseinfo = ConfigManager.Instance().GetMagicTypeInfo(info.usType);

            //施法动作
            NetMsg.MsgMonsterMagicInjuredInfo magicinfo = new NetMsg.MsgMonsterMagicInjuredInfo();
            magicinfo.roleid = play.GetTypeId();
            magicinfo.role_x = play.GetCurrentX();
            magicinfo.role_y = play.GetCurrentY();
            magicinfo.injuredvalue = 0;
            magicinfo.monsterid = play.GetTypeId();
            magicinfo.tag = 21;
            magicinfo.magicid = (ushort)info.usType;
            magicinfo.magiclv = magiclv;
            msg = magicinfo.GetBuffer();
            play.BroadcastBuffer(msg);
            //play.GetGameMap().BroadcastBuffer(play, msg);
            int _locktime = ConfigManager.Instance().GetTrackTime(baseinfo.track_id);
            int _target_locktime = ConfigManager.Instance().GetTrackTime(baseinfo.track_id2);

            int trackcount = ConfigManager.Instance().GetTrackNumber(baseinfo.track_id);
            //锁定自己与目标
            play.Lock(_locktime);
            target.Lock(_target_locktime, target.type == OBJECTTYPE.PLAYER);
            //计算伤害值
             NetMsg.MsgMagicAttackInfo magicattack ;
            for (int i = 0; i < trackcount; i++)
            {
                ////如果是影轮回,就有几率穿透伤害
                //magicattack = new NetMsg.MsgMagicAttackInfo();
                //magicattack.id = play.GetTypeId();

                //magicattack.value = 0;
                //magicattack.magicid = (ushort)GameStruct.MagicTypeInfo.ZHENSHIDAJI;
                //magicattack.level = magiclv;
                //magicattack.targetid = target.GetTypeId();
                //msg = magicattack.GetBuffer();
                //play.BroadcastBuffer(msg, true);
               // target.Injured(play, injured, info);

                //优先攻击合体的幻兽
                uint target_id = target.GetTypeId();
                if (target.type == OBJECTTYPE.PLAYER)
                {
                    EudemonObject eudemon_obj = (target as PlayerObject).GetEudemonSystem().GetInjuredEudemon();
                    if (eudemon_obj != null)
                    {
                        target_id = eudemon_obj.GetTypeId();
                    }
                }

                magicattack = new NetMsg.MsgMagicAttackInfo();
                magicattack.id = play.GetTypeId();
                uint injured = BattleSystem.AdjustDamage(play, target);
                magicattack.value = injured;
                magicattack.magicid = (ushort)info.usType;
                magicattack.level = magiclv;
                magicattack.targetid = target_id;
                msg = magicattack.GetBuffer();
                play.BroadcastBuffer(msg, true);
                target.Injured(play, injured, info);
            }

            if (baseinfo.track_id > 0)
            {
                //取得攻击方向
                byte attackdir = GameStruct.DIR.GetDirByPos(play.GetCurrentX(), play.GetCurrentY(), target.GetCurrentX(), target.GetCurrentY());
                play.SetDir(attackdir);
                target.SetDir(attackdir);

                NetMsg.MsgCombo combo = new NetMsg.MsgCombo();
                combo.CalcTag(info.usType, play, target);
                short x = 0;
                short y = 0;
                GameStruct.TrackInfo trackinfo = ConfigManager.Instance().GetTrackInfo(baseinfo.track_id);
                GameStruct.TrackInfo track2 = ConfigManager.Instance().GetTrackInfo(baseinfo.track_id2);
                for (int i = 0; i < trackcount; i++)
                {
                    //怪物
                    if (track2.step > 0)
                    {
                        if (GameStruct.DIR.GetNexPoint(target, ref x, ref y)) { target.SetPoint(x, y); }
                    }
                    //角色
                    if (trackinfo.step > 0)
                    {
                        for (int j = 0; j < trackinfo.step;j++ )
                        {
                            if (GameStruct.DIR.GetNexPoint(play, ref x, ref y)) { play.SetPoint(x, y); }
                        }

                    }

                    combo.AddComboInfo(info.usType, play, target, trackinfo.action, track2.action);

                    trackinfo = ConfigManager.Instance().GetTrackInfo(trackinfo.id_next);
                    if (track2.id_next != 0)
                    {
                        track2 = ConfigManager.Instance().GetTrackInfo(track2.id_next);
                    }
                }
                msg = combo.GetBuffer();
                play.BroadcastBuffer(msg, true);

            }
        }
Exemplo n.º 3
0
        public override bool Run()
        {
            bool ret = base.Run();

            //距离超出-
            if (!this.GetPoint().CheckVisualDistance(mPlay.GetCurrentX(), mPlay.GetCurrentY(), DIS))
            {
                mPlay.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_MINGGUOSHENGNV);
                return(false);
            }
            //刷新周围对象以便寻找目标
            if (this.GetAi().GetTargetObject() == null)
            {
                if (System.Environment.TickCount - mnRefreshTick > REFRESHTIME)
                {
                    this.RefreshVisibleObject();
                    mnRefreshTick = System.Environment.TickCount;
                }
            }
            if (mMagicAttackTime.ToNextTime())
            {
                this.RefreshVisibleObject();

                NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                magicattack.roleid  = this.GetTypeId();
                magicattack.role_x  = this.GetCurrentX();
                magicattack.role_y  = this.GetCurrentY();
                magicattack.tag     = 21;
                magicattack.magicid = 6051;
                magicattack.magiclv = 0;
                this.BrocatBuffer(magicattack.GetBuffer());



                NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                magicattackex.nID      = this.GetTypeId();
                magicattackex.nX       = this.GetCurrentX();
                magicattackex.nY       = this.GetCurrentY();
                magicattackex.nMagicID = 6051;
                magicattackex.nMagicLv = 0;
                magicattackex.bDir     = this.GetDir();
                foreach (RefreshObject refobj in this.GetVisibleList().Values)
                {
                    //只攻击怪物
                    if (refobj.obj.type == OBJECTTYPE.MONSTER)
                    {
                        BaseObject obj = refobj.obj;
                        if (this.GetPoint().CheckVisualDistance(obj.GetCurrentX(), obj.GetCurrentY(), 10))
                        {
                            uint injured = BattleSystem.AdjustDamage(mPlay, obj, true);
                            NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo();
                            info.tag = 21;
                            obj.Injured(this, injured, info);
                            magicattackex.AddObject(obj.GetTypeId(), (int)injured);
                        }
                    }
                }
                this.BrocatBuffer(magicattackex.GetBuffer());
            }
            return(ret);
        }