GetCurrentX() публичный Метод

public GetCurrentX ( ) : short
Результат short
Пример #1
0
 //取该坐标点是否有对象[优先判断是否有阻挡]
 public bool GetPointOfObj(BaseObject obj, short x, short y)
 {
     if (!CanMove(x, y))
     {
         return(true);
     }
     obj.RefreshVisibleObject();
     foreach (RefreshObject baseobj in obj.GetVisibleList().Values)
     {
         BaseObject _obj = baseobj.obj;
         if (_obj.GetCurrentX() == x && _obj.GetCurrentY() == y)
         {
             return(true);
         }
     }
     if (mListAddObj.Count > 0)
     {
         for (int i = 0; i < mListAddObj.Count; i++)
         {
             BaseObject _obj = mListAddObj[i];
             if (_obj.GetCurrentX() == x && _obj.GetCurrentY() == y)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #2
0
        protected override void ProcessAction_Die(GameStruct.Action act)
        {
            PlayerObject play    = act.GetObject(0) as PlayerObject;
            BaseObject   baseobj = act.GetObject(0) as BaseObject;

            if (play == null && baseobj.type == OBJECTTYPE.EUDEMON)
            {
                play = (baseobj as EudemonObject).GetOwnerPlay();
            }
            //根据打出的伤害获得经验值
            uint injured = (uint)act.GetObject(1);

            NetMsg.MsgMonsterDieInfo info = new NetMsg.MsgMonsterDieInfo();
            info.roleid       = baseobj.GetTypeId();
            info.role_x       = baseobj.GetCurrentX();
            info.role_y       = baseobj.GetCurrentY();
            info.injuredvalue = 0;
            info.monsterid    = this.GetTypeId();
            byte[] msg = info.GetBuffer();


            //掉落道具
            this.DropItem(baseobj);

            //RefreshVisibleObject();
            //if (mRefreshList.Count > 0)
            //{


            //    this.GetGameMap().BroadcastBuffer(this,msg);
            //    //掉落道具
            //    this.DropItem(play);

            //}
            this.BrocatBuffer(msg);
            LastDieTime = System.Environment.TickCount;
            if (play == null && baseobj.type != OBJECTTYPE.EUDEMON)
            {
                return;
            }
            //计算经验
            play.AddExp((int)injured, play.GetLevel(), this.GetLevel());
            //死亡的幻兽加灵气值复活
            play.GetEudemonSystem().Eudemon_Alive(this);

            this.GetAi().Die();

            this.GetAi().SetAttackTarget(null);

            mAliveTime.Update();
            //执行死亡脚本- 最后一击的击杀者执行该脚本
            if (mInfo.die_scripte_id > 0 && play != null)
            {
                ScripteManager.Instance().ExecuteAction(mInfo.die_scripte_id, play);
            }
        }
Пример #3
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);
        }
Пример #4
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);

            }
        }
Пример #5
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);
        }
Пример #6
0
        //npc
        public void SendNpcInfo(BaseObject obj)
        {
            if (GetGameSession() == null) return;
            NetMsg.MsgNpcInfo info = new NetMsg.MsgNpcInfo();
            info.Create(null, session.GetGamePackKeyEx());
            int lookface = (obj as NpcObject).mInfo.lookface;
            info.Init(obj.GetID(), obj.GetCurrentX(), obj.GetCurrentY(), lookface);

            this.SendData(info.GetBuffer());
        }