コード例 #1
0
        public virtual TBaseObject sub_4A9C78(byte bt05)
        {
            TBaseObject result;
            TAbility    WAbil;
            int         n10;
            TBaseObject BaseObject;

            result        = null;
            m_btDirection = bt05;
            WAbil         = m_WAbil;
            n10           = HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC);
            if (n10 > 0)
            {
                SendRefMsg(Grobal2.RM_HIT, m_btDirection, m_nCurrX, m_nCurrY, 0, "");
                BaseObject = GetPoseCreate();
                if ((BaseObject != null) && IsProperTarget(BaseObject) && (HUtil32.Random(BaseObject.m_btSpeedPoint) < m_btHitPoint))
                {
                    n10 = BaseObject.GetMagStruckDamage(this, n10);
                    if (n10 > 0)
                    {
                        BaseObject.StruckDamage(n10);
                        BaseObject.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, n10,
                                                BaseObject.m_WAbil.HP, BaseObject.m_WAbil.MaxHP, Parse(this), "", 300);
                        if (HUtil32.Random(BaseObject.m_btAntiPoison + 20) == 0)
                        {
                            BaseObject.MakePosion(Grobal2.POISON_STONE, 5, 0);
                        }
                        result = BaseObject;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 被击中
        /// </summary>
        /// <param name="hiter"></param>
        public virtual void Struck(TBaseObject hiter)
        {
            byte btDir = 0;

            this.m_dwStruckTick = HUtil32.GetTickCount();
            if (hiter != null)
            {
                if ((this.m_TargetCret == null) || this.GetAttackDir(this.m_TargetCret, ref btDir) || (HUtil32.Random(6) == 0))
                {
                    if (this.IsProperTarget(hiter))
                    {
                        this.SetTargetCreat(hiter);
                    }
                }
            }
            if (this.m_boAnimal) // 是动物
            {
                this.m_nMeatQuality = this.m_nMeatQuality - HUtil32.Random(300);
                if (this.m_nMeatQuality < 0)
                {
                    this.m_nMeatQuality = 0;
                }
            }
            this.m_dwHitTick = Convert.ToUInt32(this.m_dwHitTick + (150 - HUtil32._MIN(130, this.m_Abil.Level * 4)));
        }
コード例 #3
0
        public override void Run()
        {
            int         nAbs;
            int         nRage = 9999;
            TBaseObject BaseObject;
            TBaseObject TargeTBaseObject = null;

            if (!this.m_boDeath && !this.m_boGhost && (this.m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
            {
                if ((HUtil32.GetTickCount() - this.m_dwSearchEnemyTick) >= 5000)
                {
                    this.m_dwSearchEnemyTick = HUtil32.GetTickCount();
                    if (this.m_VisibleActors.Count > 0)
                    {
                        for (int I = 0; I < this.m_VisibleActors.Count; I++)
                        {
                            BaseObject = this.m_VisibleActors[I].BaseObject;
                            if (BaseObject.m_boDeath)
                            {
                                continue;
                            }
                            if (this.IsProperTarget(BaseObject))
                            {
                                if (!BaseObject.m_boHideMode || this.m_boCoolEye)
                                {
                                    nAbs = Math.Abs(this.m_nCurrX - BaseObject.m_nCurrX) + Math.Abs(this.m_nCurrY - BaseObject.m_nCurrY);
                                    if (nAbs < nRage)
                                    {
                                        nRage            = nAbs;
                                        TargeTBaseObject = BaseObject;
                                    }
                                }
                            }
                        }
                    }
                    if (TargeTBaseObject != null)
                    {
                        this.SetTargetCreat(TargeTBaseObject);
                    }
                }
                if (((0 - this.m_dwWalkTick) > this.m_nWalkSpeed) && (this.m_TargetCret != null))
                {
                    if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 4) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 4))
                    {
                        if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2))
                        {
                            if (HUtil32.Random(5) == 0)
                            {
                                this.GetBackPosition(ref this.m_nTargetX, ref this.m_nTargetY);
                            }
                        }
                        else
                        {
                            this.GetBackPosition(ref this.m_nTargetX, ref this.m_nTargetY);
                        }
                    }
                }
            }
            base.Run();
        }
コード例 #4
0
        public override void Run()
        {
            int nPower;

            try
            {
                if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
                {
                    if ((m_TargetCret != null) && (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2))
                    {
                        m_dwHitTick = HUtil32.GetTickCount();
                        if ((HUtil32.Random(4) == 0))// 癫狂状态
                        {
                            if ((M2Share.g_EventManager.GetEvent(m_PEnvir, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, Grobal2.ET_FIRE) == null))
                            {
                                MagMakeFireCross(this, GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))), 4, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);// 火墙
                            }
                            else if ((HUtil32.Random(4) == 0))
                            {
                                if (IsProperTarget(m_TargetCret))
                                {
                                    if (HUtil32.Random(m_TargetCret.m_btAntiPoison + 7) <= 6)                                                                  // 施毒
                                    {
                                        nPower = GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))); // 中毒类型 - 绿毒
                                        m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DECHEALTH, nPower, Parse(this), 4, "", 150);
                                    }
                                }
                            }
                            else
                            {
                                AttackTarget();// 物理攻击
                            }
                        }
                        else
                        {
                            if (HUtil32.Random(4) == 0)
                            {
                                if (IsProperTarget(m_TargetCret))
                                {
                                    if (HUtil32.Random(m_TargetCret.m_btAntiPoison + 7) <= 6)                                                                  // 施毒
                                    {
                                        nPower = GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))); // 中毒类型 - 绿毒
                                        m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DECHEALTH, nPower, Parse(this), 4, "", 150);
                                    }
                                }
                            }
                            else if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2))
                            {
                                AttackTarget();// 物理攻击
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TSalamanderATMonster.Run");
            }
            base.Run();
        }
コード例 #5
0
ファイル: TFairyMonster.cs プロジェクト: xvwvx/MirServer-CNet
        public bool AutoAvoid_GetAvoidXY(ref int nTargetX, ref int nTargetY)
        {
            bool result;
            int  n10;
            int  nDir;
            int  nX;
            int  nY;

            nX     = nTargetX;
            nY     = nTargetY;
            result = AutoAvoid_GetGotoXY(m_btLastDirection, ref nTargetX, ref nTargetY);
            n10    = 0;
            while (true)
            {
                if (n10 >= 10)
                {
                    break;
                }
                if (result)
                {
                    break;
                }
                nTargetX = nX;
                nTargetY = nY;
                nDir     = HUtil32.Random(7);
                result   = AutoAvoid_GetGotoXY(nDir, ref nTargetX, ref nTargetY);
                n10++;
            }
            return(result);
        }
コード例 #6
0
 public TSpitSpider()
     : base()
 {
     m_dwSearchTime = Convert.ToUInt32(HUtil32.Random(1500) + 1500);
     m_boAnimal     = true;
     m_boUsePoison  = true;
 }
コード例 #7
0
ファイル: ObjMon.cs プロジェクト: xvwvx/MirServer-CNet
        private bool Think()
        {
            bool result = false;
            int  nOldX;
            int  nOldY;

            if ((HUtil32.GetTickCount() - m_dwThinkTick) > 3000)
            {
                m_dwThinkTick = HUtil32.GetTickCount();
                if (m_PEnvir.GetXYObjCount(m_nCurrX, m_nCurrY) >= 2)
                {
                    m_boDupMode = true;
                }
                if (!IsProperTarget(m_TargetCret))
                {
                    m_TargetCret = null;
                }
            }
            if (m_boDupMode)
            {
                nOldX = m_nCurrX;
                nOldY = m_nCurrY;
                WalkTo((byte)HUtil32.Random(8), false);
                if ((nOldX != m_nCurrX) || (nOldY != m_nCurrY))
                {
                    m_boDupMode = false;
                    result      = true;
                }
            }
            return(result);
        }
コード例 #8
0
 public TScultureMonster()
     : base()
 {
     base.m_dwSearchTime  = Convert.ToUInt32(HUtil32.Random(1500) + 1500);
     base.m_nViewRange    = 7;
     base.m_boStoneMode   = true;
     base.m_nCharStatusEx = Grobal2.STATE_STONE_MODE;
 }
コード例 #9
0
ファイル: TFairyMonster.cs プロジェクト: xvwvx/MirServer-CNet
 public TFairyMonster()
     : base()
 {
     m_dwSearchTime       = Convert.ToUInt32(HUtil32.Random(1500) + 1500);
     m_boIsUseAttackMagic = false;
     nHitCount            = 0;// 轻击计数
     m_nViewRange         = 8;
 }
コード例 #10
0
        /// <summary>
        /// 鞋子腰带极品
        /// </summary>
        /// <param name="UserItem"></param>
        public unsafe void RandomUpgradeBoots(TUserItem *UserItem)
        {
            int nC;
            int n10;

            nC = GetRandomRange(M2Share.g_Config.nBootsACAddValueMaxLimit, M2Share.g_Config.nBootsACAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nBootsACAddRate) == 0)
            {
                UserItem->btValue[0] = Convert.ToByte(nC + 1);// 防御
                if (UserItem->btValue[0] > M2Share.g_Config.nBootsACAddValueMaxLimit)
                {
                    UserItem->btValue[0] = M2Share.g_Config.nBootsACAddValueMaxLimit;//限制上限
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nBootsMACAddValueMaxLimit, M2Share.g_Config.nBootsMACAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nBootsMACAddRate) == 0)
            {
                UserItem->btValue[1] = Convert.ToByte(nC + 1);// 魔御
                if (UserItem->btValue[1] > M2Share.g_Config.nBootsMACAddValueMaxLimit)
                {
                    UserItem->btValue[1] = M2Share.g_Config.nBootsMACAddValueMaxLimit;//限制上限
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nBootsDCAddValueMaxLimit, M2Share.g_Config.nBootsDCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nBootsDCAddRate) == 0)
            {
                UserItem->btValue[2] = Convert.ToByte(nC + 1);// 攻击力
                if (UserItem->btValue[2] > M2Share.g_Config.nBootsDCAddValueMaxLimit)
                {
                    UserItem->btValue[2] = M2Share.g_Config.nBootsDCAddValueMaxLimit;//限制上限
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nBootsMCAddValueMaxLimit, M2Share.g_Config.nBootsMCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nBootsMCAddRate) == 0)
            {
                UserItem->btValue[3] = Convert.ToByte(nC + 1);// 魔法
                if (UserItem->btValue[3] > M2Share.g_Config.nBootsMCAddValueMaxLimit)
                {
                    UserItem->btValue[3] = M2Share.g_Config.nBootsMCAddValueMaxLimit;//限制上限
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nBootsSCAddValueMaxLimit, M2Share.g_Config.nBootsSCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nBootsSCAddRate) == 0)
            {
                UserItem->btValue[4] = Convert.ToByte(nC + 1);// 道术
                if (UserItem->btValue[4] > M2Share.g_Config.nBootsSCAddValueMaxLimit)
                {
                    UserItem->btValue[4] = M2Share.g_Config.nBootsSCAddValueMaxLimit;//限制上限
                }
            }
            nC = GetRandomRange(6, 12);
            if (HUtil32.Random(4) < 3)
            {
                n10 = (nC + 1) * 1000;
                UserItem->DuraMax = (ushort)HUtil32._MIN(65000, UserItem->DuraMax + n10);
                UserItem->Dura    = (ushort)HUtil32._MIN(65000, UserItem->Dura + n10);
            }
        }
コード例 #11
0
        /// <summary>
        /// 随机升级-分类19物品(幸运类项链)
        /// </summary>
        /// <param name="UserItem"></param>
        public unsafe void RandomUpgrade19(TUserItem *UserItem)
        {
            int nC;
            int n10;

            nC = GetRandomRange(M2Share.g_Config.nNeckLace19ACAddValueMaxLimit, M2Share.g_Config.nNeckLace19ACAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nNeckLace19ACAddRate) == 0)
            {
                UserItem->btValue[0] = Convert.ToByte(nC + 1);
                if (UserItem->btValue[0] > M2Share.g_Config.nNeckLace19ACAddValueMaxLimit)
                {
                    UserItem->btValue[0] = M2Share.g_Config.nNeckLace19ACAddValueMaxLimit;//限制上线
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nNeckLace19MACAddValueMaxLimit, M2Share.g_Config.nNeckLace19MACAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nNeckLace19MACAddRate) == 0)
            {
                UserItem->btValue[1] = Convert.ToByte(nC + 1);
                if (UserItem->btValue[1] > M2Share.g_Config.nNeckLace19MACAddValueMaxLimit)
                {
                    UserItem->btValue[1] = M2Share.g_Config.nNeckLace19MACAddValueMaxLimit;//限制上线
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nNeckLace19DCAddValueMaxLimit, M2Share.g_Config.nNeckLace19DCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nNeckLace19DCAddRate) == 0)
            {
                UserItem->btValue[2] = Convert.ToByte(nC + 1);
                if (UserItem->btValue[2] > M2Share.g_Config.nNeckLace19DCAddValueMaxLimit)
                {
                    UserItem->btValue[2] = M2Share.g_Config.nNeckLace19DCAddValueMaxLimit;//限制上线
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nNeckLace19MCAddValueMaxLimit, M2Share.g_Config.nNeckLace19MCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nNeckLace19MCAddRate) == 0)
            {
                UserItem->btValue[3] = Convert.ToByte(nC + 1);
                if (UserItem->btValue[3] > M2Share.g_Config.nNeckLace19MCAddValueMaxLimit)
                {
                    UserItem->btValue[3] = M2Share.g_Config.nNeckLace19MCAddValueMaxLimit;//限制上线
                }
            }
            nC = GetRandomRange(M2Share.g_Config.nNeckLace19SCAddValueMaxLimit, M2Share.g_Config.nNeckLace19SCAddValueRate);
            if (HUtil32.Random(M2Share.g_Config.nNeckLace19SCAddRate) == 0)
            {
                UserItem->btValue[4] = Convert.ToByte(nC + 1);
                if (UserItem->btValue[4] > M2Share.g_Config.nNeckLace19SCAddValueMaxLimit)
                {
                    UserItem->btValue[4] = M2Share.g_Config.nNeckLace19SCAddValueMaxLimit;//限制上线
                }
            }
            nC = GetRandomRange(6, 10);
            if (HUtil32.Random(4) < 3)
            {
                n10 = (nC + 1) * 1000;
                UserItem->DuraMax = (ushort)HUtil32._MIN(65000, UserItem->DuraMax + n10);
                UserItem->Dura    = (ushort)HUtil32._MIN(65000, UserItem->Dura + n10);
            }
        }
コード例 #12
0
ファイル: TDigOutZombi.cs プロジェクト: xvwvx/MirServer-CNet
 public TDigOutZombi()
     : base()
 {
     m_nViewRange      = 7;
     m_dwSearchTime    = Convert.ToUInt32(HUtil32.Random(1500) + 2500);
     m_dwSearchTick    = HUtil32.GetTickCount();
     m_btRaceServer    = 95;
     m_boFixedHideMode = true;
 }
コード例 #13
0
 public TStoneMineEvent(TEnvirnoment Envir, int nX, int nY, int nType)
     : base(Envir, nX, nY, nType, 0, false)
 {
     this.m_Envir.AddToMapMineEvent(nX, nY, Grobal2.OS_EVENTOBJECT, this);
     this.m_boVisible     = false;
     m_nMineCount         = HUtil32.Random(200);
     m_dwAddStoneMineTick = HUtil32.GetTickCount();
     this.m_boActive      = false;
     m_nAddStoneCount     = HUtil32.Random(80);
 }
コード例 #14
0
ファイル: TZilKinZombi.cs プロジェクト: xvwvx/MirServer-CNet
 public override void Die()
 {
     base.Die();
     if (nZilKillCount > 0)
     {
         dw558 = HUtil32.GetTickCount();
         dw560 = Convert.ToUInt32(HUtil32.Random(20) + 4 * 1000);
     }
     nZilKillCount -= 1;
 }
コード例 #15
0
 public TCowKingMonster()
     : base()
 {
     m_dwSearchTime = Convert.ToUInt32(HUtil32.Random(1500) + 500);
     dw558          = HUtil32.GetTickCount();
     bo2BF          = true;
     n560           = 0;
     bo55C          = false;
     bo55D          = false;
 }
コード例 #16
0
        public override void Run()
        {
            int nPower = 0;

            try
            {
                if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
                {
                    // 走路间隔
                    if ((HUtil32.GetTickCount() - m_dwWalkTick > m_nWalkSpeed) && (m_TargetCret != null) && (!m_TargetCret.m_boDeath))
                    {
                        // 目标不为空
                        if (boIsSpiderMagic)
                        {
                            // 喷出网后,延时1100毫秒显示目标的效果
                            if (HUtil32.GetTickCount() - m_dwSpiderMagicTick > 1100)
                            {
                                boIsSpiderMagic = false;// 是否喷出蜘蛛网
                                SpiderMagicAttack(nPower / 2, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, 3);
                                base.Run();
                                return;
                            }
                        }
                        if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2))
                        {
                            if ((HUtil32.Random(4) == 0) && (m_TargetCret.m_wStatusTimeArr[Grobal2.STATE_LOCKRUN] == 0))
                            {
                                // 喷出蜘蛛网
                                if (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime)
                                {
                                    m_dwHitTick = HUtil32.GetTickCount();
                                    nPower      = GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC)));
                                    SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(m_TargetCret), "");
                                    m_dwSpiderMagicTick = HUtil32.GetTickCount(); // 喷出蜘蛛网计时,用于延时处理目标身上的小网显示
                                    boIsSpiderMagic     = true;                   // 是否喷出蜘蛛网
                                }
                            }
                            else
                            {
                                AttackTarget();
                            }
                        }
                        else
                        {
                            this.GotoTargetXY();
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TYanLeiWangSpider.Run");
            }
            base.Run();
        }
コード例 #17
0
 public TScultureKingMonster()
     : base()
 {
     m_dwSearchTime    = Convert.ToUInt32(HUtil32.Random(1500) + 1500);
     m_nViewRange      = 8;
     m_boStoneMode     = true;
     m_nCharStatusEx   = Grobal2.STATE_STONE_MODE;
     m_btDirection     = 5;
     m_nDangerLevel    = 5;
     m_SlaveObjectList = new List <TBaseObject>();
 }
コード例 #18
0
        private void SpitAttack(byte btDir)
        {
            TAbility    WAbil;
            int         nC;
            int         n10;
            int         n14;
            int         n18;
            int         n1C;
            TBaseObject BaseObject;

            this.m_btDirection = btDir;
            WAbil = this.m_WAbil;
            n1C   = HUtil32.Random((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1 + HUtil32.LoWord(WAbil.DC);
            if (n1C <= 0)
            {
                return;
            }
            SendRefMsg(Grobal2.RM_HIT, m_btDirection, m_nCurrX, m_nCurrY, 0, "");
            nC = 0;
            while ((nC < 5))
            {
                n10 = 0;
                while ((n10 < 5))
                {
                    if (M2Share.g_Config.SpitMap[btDir, nC, n10] == 1)
                    {
                        n14        = m_nCurrX - 2 + n10;
                        n18        = m_nCurrY - 2 + nC;
                        BaseObject = m_PEnvir.GetMovingObject(n14, n18, true);
                        if ((BaseObject != null) && (BaseObject != this) && (IsProperTarget(BaseObject)) &&
                            (HUtil32.Random(BaseObject.m_btSpeedPoint) < m_btHitPoint))
                        {
                            n1C = BaseObject.GetMagStruckDamage(this, n1C);
                            if (n1C > 0)
                            {
                                BaseObject.StruckDamage(n1C);
                                BaseObject.SetLastHiter(this);
                                BaseObject.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, n1C, m_WAbil.HP, m_WAbil.MaxHP, Parse(this), "", 300);
                                if (m_boUsePoison)
                                {
                                    if (HUtil32.Random(m_btAntiPoison + 20) == 0)
                                    {
                                        BaseObject.MakePosion(Grobal2.POISON_DECHEALTH, 30, 1);
                                    }
                                }
                            }
                        }
                    }
                    n10++;
                }
                nC++;
            }
        }
コード例 #19
0
ファイル: ObjMon.cs プロジェクト: xvwvx/MirServer-CNet
 public TMonster()
     : base()
 {
     m_boDupMode    = false;
     m_dwThinkTick  = HUtil32.GetTickCount();
     m_nViewRange   = 6;
     m_nRunTime     = 250;
     m_dwSearchTime = Convert.ToUInt32(3000 + HUtil32.Random(2000));
     m_dwSearchTick = HUtil32.GetTickCount();
     m_btRaceServer = 80;
     m_boAddToMaped = false;// 地图是否计数
 }
コード例 #20
0
ファイル: TFairyMonster.cs プロジェクト: xvwvx/MirServer-CNet
        private void FlyAxeAttack(TBaseObject Target)
        {
            TAbility WAbil;
            int      nDamage;

            // 重击几率,目标等级不高于自己,才使用重击
            if (((HUtil32.Random(M2Share.g_Config.nFairyDuntRate) == 0) && (Target.m_Abil.Level <= m_Abil.Level)) ||
                (nHitCount >= HUtil32._MIN((3 + M2Share.g_Config.nFairyDuntRateBelow),
                                           (m_btSlaveExpLevel + M2Share.g_Config.nFairyDuntRateBelow))))
            {
                // 月灵重击次数,达到次数时按等级出重击
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;// 重击倍数
                nDamage       = (int)HUtil32._MAX(0, (int)HUtil32.Round((double)((HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1))
                                                                                 + HUtil32.LoWord(WAbil.DC)) * M2Share.g_Config.nFairyAttackRate / 100));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, Parse(this), "",
                                    (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount      = 0;// 攻击计数
            }
            else
            {
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;
                nDamage       = HUtil32._MAX(0, HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1)
                                             + HUtil32.LoWord(WAbil.DC));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP,
                                    Target.m_WAbil.MaxHP, Parse(this), "", (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount++;// 攻击计数
            }
        }
コード例 #21
0
        public unsafe void GiveMine(TPlayObject PlayObject, string[] @Params)
        {
            string     sMINEName  = @Params.Length > 0 ? @Params[0] : "";
            int        nMineCount = @Params.Length > 0 ? int.Parse(@Params[1]) : 0;
            int        nDura      = @Params.Length > 0 ? int.Parse(@Params[2]) : 0;
            TUserItem *UserItem   = null;
            TStdItem * StdItem;

            if ((sMINEName == "") || ((sMINEName != "") && (sMINEName[0] == '?')) || (nMineCount <= 0))
            {
                if (M2Share.g_Config.boGMShowFailMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, this.Attributes.Name, GameMsgDef.g_sGameCommandGIVEMINEHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (nDura <= 0)// 如纯度不填,则随机给纯度
            {
                nDura = HUtil32.Random(18) + 3;
            }
            for (int I = 0; I < nMineCount; I++)
            {
                UserItem = (TUserItem *)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(sMINEName, UserItem))
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if ((StdItem != null) && (StdItem->StdMode == 43))
                    {
                        if (PlayObject.IsAddWeightAvailable(StdItem->Weight * nMineCount))
                        {
                            UserItem->Dura = Convert.ToUInt16(Convert.ToInt16(nDura * 1000));
                            if (UserItem->Dura > UserItem->DuraMax)
                            {
                                UserItem->Dura = UserItem->DuraMax;
                            }
                            PlayObject.m_ItemList.Add((IntPtr)UserItem);
                            PlayObject.SendAddItem(UserItem);
                            if (StdItem->NeedIdentify == 1)
                            {
                                M2Share.AddGameDataLog("5" + "\09" + PlayObject.m_sMapName + "\09" + PlayObject.m_nCurrX + "\09" + PlayObject.m_nCurrY + "\09" +
                                                       PlayObject.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + UserItem->MakeIndex + "\09" + UserItem->Dura + "/" + UserItem->DuraMax + "\09" + PlayObject.m_sCharName);
                            }
                        }
                    }
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                    break;
                }
            }
        }
コード例 #22
0
        private int GetRandomRange(int nCount, int nRate)
        {
            int result = 0;

            for (int I = 0; I < nCount; I++)
            {
                if (HUtil32.Random(nRate) == 0)
                {
                    result++;
                }
            }
            return(result);
        }
コード例 #23
0
ファイル: TZilKinZombi.cs プロジェクト: xvwvx/MirServer-CNet
 public TZilKinZombi()
     : base()
 {
     m_nViewRange   = 6;
     m_dwSearchTime = Convert.ToUInt32(HUtil32.Random(1500) + 2500);
     m_dwSearchTick = HUtil32.GetTickCount();
     m_btRaceServer = 96;
     nZilKillCount  = 0;
     if (HUtil32.Random(3) == 0)
     {
         nZilKillCount = HUtil32.Random(3) + 1;
     }
 }
コード例 #24
0
        public override TBaseObject sub_4A9C78(byte bt05)
        {
            TBaseObject result;
            TBaseObject BaseObject;

            BaseObject = base.sub_4A9C78(bt05);
            if ((BaseObject != null) && (HUtil32.Random(3) == 0) && (BaseObject.m_boHideMode))
            {
                BaseObject.m_wStatusTimeArr[Grobal2.STATE_TRANSPARENT] = 1;
            }
            result = BaseObject;
            return(result);
        }
コード例 #25
0
 public TAnimalObject()
     : base()
 {
     m_nTargetX               = -1;
     this.dwTick3F4           = HUtil32.GetTickCount();
     this.m_btRaceServer      = Grobal2.RC_ANIMAL;
     this.m_dwHitTick         = HUtil32.GetTickCount() - (uint)HUtil32.Random(3000);
     this.m_dwWalkTick        = HUtil32.GetTickCount() - (uint)HUtil32.Random(3000);
     this.m_dwSearchEnemyTick = HUtil32.GetTickCount();
     m_boRunAwayMode          = false;
     m_dwRunAwayStart         = HUtil32.GetTickCount();
     m_dwRunAwayTime          = 0;
     this.m_nCopyHumanLevel   = 0;
 }
コード例 #26
0
ファイル: Magic.cs プロジェクト: wnmqaubb08/Mir2Engine
        public static int GetRPow(int wInt)
        {
            int result = 0;

            if (HUtil32.HiWord(wInt) > HUtil32.LoWord(wInt))
            {
                result = HUtil32.Random(HUtil32.HiWord(wInt) - HUtil32.LoWord(wInt) + 1) + HUtil32.LoWord(wInt);
            }
            else
            {
                result = HUtil32.LoWord(wInt);
            }
            return(result);
        }
コード例 #27
0
 public virtual void Wondering()
 {
     if ((HUtil32.Random(20) == 0))
     {
         if ((HUtil32.Random(4) == 1))
         {
             this.TurnTo(HUtil32.Random(8));
         }
         else
         {
             this.WalkTo(this.m_btDirection, false);
         }
     }
 }
コード例 #28
0
 public override void Run()
 {
     if (HUtil32.Random(40) == 0)
     {
         this.TurnTo(HUtil32.Random(8));
     }
     else
     {
         if (HUtil32.Random(30) == 0)
         {
             this.SendRefMsg(Grobal2.RM_HIT, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, "");
         }
     }
     base.Run();
 }
コード例 #29
0
        public override bool AttackTarget()
        {
            bool result = false;

            if (this.m_TargetCret == null)
            {
                return(result);
            }
            if ((HUtil32.GetTickCount() - this.m_dwHitTick) > this.m_nNextHitTime)
            {
                this.m_dwHitTick = HUtil32.GetTickCount();
                if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 7) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 7))
                {
                    if ((m_nAttackMax - 1) > m_nAttackCount)
                    {
                        m_nAttackCount++;
                        this.m_dwTargetFocusTick = HUtil32.GetTickCount();
                        FlyAxeAttack(this.m_TargetCret);
                    }
                    else
                    {
                        if (HUtil32.Random(5) == 0)
                        {
                            m_nAttackCount = 0;
                        }
                    }
                    result = true;
                    return(result);
                }
                if (this.m_TargetCret.m_PEnvir == this.m_PEnvir)
                {
                    if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11))
                    {
                        this.SetTargetXY(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);
                    }
                }
                else
                {
                    this.DelTargetCreat();
                }
            }
            return(result);
        }
コード例 #30
0
        public bool AttackTarget()
        {
            bool     result = false;
            int      nX;
            int      nY;
            int      nPower;
            string   str;
            string   Str1 = "";
            string   s30  = "";
            string   s2C  = "";
            TAbility WAbil;

            try
            {
                if ((HUtil32.GetTickCount() - this.m_dwHitTick) > this.m_nNextHitTime)
                {
                    this.m_dwHitTick = HUtil32.GetTickCount();
                    if (s_AttickXY.IndexOf("|") > 0) // 根据配置文件的攻击坐标,发消息显示场景
                    {
                        WAbil  = this.m_WAbil;
                        nPower = (HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC));
                        str    = s_AttickXY;
                        for (int I = 0; I <= AttackTarget_IsChar(s_AttickXY); I++)
                        {
                            str = HUtil32.GetValidStr3(str, ref Str1, new string[] { "|" });
                            if (Str1 != "")
                            {
                                s30 = HUtil32.GetValidStr3(Str1, ref s2C, new string[] { ",", "\09" });// X,Y
                                nX  = HUtil32.Str_ToInt(s2C, 0);
                                nY  = HUtil32.Str_ToInt(s30, 0);
                                MagBigExplosion(nPower, nX, nY, 1);
                            }
                        }
                    }
                    result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TFireDragonGuard.AttackTarget");
            }
            return(result);
        }