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

public GetMinAck ( ) : int
Результат int
Пример #1
0
        //计算伤害
        public static uint AdjustDamage(BaseObject attack, BaseObject def, bool isMagicAck = false /*是否是魔法伤害*/)
        {
            //玩家与玩家伤害计算用战斗力表示
            if (attack.type == OBJECTTYPE.PLAYER && def.type == OBJECTTYPE.PLAYER)
            {
                return(AdjustDamage(attack as PlayerObject, def as PlayerObject, isMagicAck));
            }
            int nMaxRand = 50 + attack.GetLuck();
            int nAtk     = 0;

            if (IRandom.Random(0, 100) < nMaxRand)
            {
                //魔法攻击只适用于法师
                if (isMagicAck &&
                    attack.type == OBJECTTYPE.PLAYER &&
                    (attack as PlayerObject).GetBaseAttr().profession == JOB.MAGE)
                {
                    nAtk = attack.GetMagicAck() +
                           IRandom.Random(0, attack.GetMaxMagixAck() - attack.GetMagicAck());
                }
                else
                {
                    nAtk = attack.GetMaxAck() +
                           IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck());
                }
            }
            else
            {
                if (isMagicAck &&
                    attack.type == OBJECTTYPE.PLAYER &&
                    (attack as PlayerObject).GetBaseAttr().profession == JOB.MAGE)
                {
                    nAtk = attack.GetMagicAck() + IRandom.Random(0, attack.GetMaxMagixAck() - attack.GetMagicAck());
                }
                else
                {
                    nAtk = attack.GetMinAck() + IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck());
                }
            }

            int nDef = 0;

            if (isMagicAck)
            {
                nDef = def.GetMagicDefense();
            }
            else
            {
                nDef = def.GetDefense();
            }
            int nDamage = nAtk - nDef;

            if (attack.type == OBJECTTYPE.PLAYER)
            {
                nDamage += attack.GetLevel() / 10;
            }

            if (nDamage <= 0)
            {
                nDamage = IRandom.Random(1, 100) >= 50  ? 1 : 0;
                if (!isMagicAck)
                {
                    nDamage = 1;
                }
            }


            return((uint)nDamage);
        }
Пример #2
0
        public override bool Run()
        {
            if (this.GetAi() == null)
            {
                return(true);
            }
            base.Run();
            //单体魔法攻击延迟死亡
            if (mDieMagicInfo != null &&
                System.Environment.TickCount - mnDieMagicTick >= 500)
            {
                GameStruct.Action action = new GameStruct.Action(GameStruct.Action.DIE, null);
                action.AddObject(mDieMagicInfo.GetObject(0));
                action.AddObject(mDieMagicInfo.GetObject(1));

                this.PushAction(action);
                mDieMagicInfo = null;
                return(true);
            }
            else if (mDieMagicInfo != null)
            {
                return(true);
            }
            this.GetAi().Run();


            if (this.IsLock())
            {
                if (!this.CheckLockTime())
                {
                    this.UnLock(false);
                    if (IsDie())
                    {
                        GameStruct.Action action;
                        //死亡
                        action = new GameStruct.Action(GameStruct.Action.DIE, null);
                        action.AddObject(mTarget);
                        action.AddObject((uint)mTarget.GetMinAck()); //取最小攻击为经验值
                        this.PushAction(action);
                        LastDieTime = System.Environment.TickCount;
                    }
                }
            }

            //死亡后三秒后发送清除怪物消息
            if (IsDie() && !this.IsLock())
            {
                if (!IsClear() && System.Environment.TickCount - LastDieTime > 3000)
                {
                    this.ClearThis();
                }
            }

            ////复活
            //if (IsClear() && IsDie() && mRebirthTime > 0)
            //{
            //    if (System.Environment.TickCount - LastDieTime > mRebirthTime)
            //    {
            //        Alive(false);
            //    }
            //}
            if (IsClear() && IsDie() && mAliveTime.ToNextTime())
            {
                Alive(false);
            }
            return(true);
        }
Пример #3
0
        public const byte EXPLODE_ITEM_CHANCE4 = 3; //大爆

        #endregion Fields

        #region Methods

        //计算伤害
        public static uint AdjustDamage(BaseObject attack, BaseObject def,bool isMagicAck = false/*是否是魔法伤害*/)
        {
            //玩家与玩家伤害计算用战斗力表示
            if (attack.type == OBJECTTYPE.PLAYER && def.type == OBJECTTYPE.PLAYER)
            {
                return AdjustDamage(attack as PlayerObject, def as PlayerObject, isMagicAck);
            }
            int nMaxRand = 50 + attack.GetLuck();
            int nAtk = 0;
            if (IRandom.Random(0, 100) < nMaxRand)
            {
                //魔法攻击只适用于法师
                if (isMagicAck &&
                    attack.type == OBJECTTYPE.PLAYER &&
                    (attack as PlayerObject).GetBaseAttr().profession == JOB.MAGE)
                {
                    nAtk = attack.GetMagicAck() +
                IRandom.Random(0, attack.GetMaxMagixAck() - attack.GetMagicAck()) ;
                }
                else
                {
                    nAtk = attack.GetMaxAck() +
                 IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck()) ;
                }

            }
            else
            {
                if (isMagicAck &&
                     attack.type == OBJECTTYPE.PLAYER &&
                     (attack as PlayerObject).GetBaseAttr().profession == JOB.MAGE)
                {
                    nAtk = attack.GetMagicAck() + IRandom.Random(0, attack.GetMaxMagixAck() - attack.GetMagicAck());
                }
                else
                {
                    nAtk = attack.GetMinAck() + IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck()) ;
                }

            }

            int nDef = 0;
            if (isMagicAck)
            {
               nDef = def.GetMagicDefense();
            }
            else
            {
               nDef = def.GetDefense();
            }
            int nDamage = nAtk - nDef;

            if (attack.type == OBJECTTYPE.PLAYER)
            {
                nDamage += attack.GetLevel() / 10;
            }

            if (nDamage <= 0)
            {
                nDamage = IRandom.Random(1, 100) >= 50  ? 1 : 0;
                if (!isMagicAck) nDamage = 1;
             }

            return (uint)nDamage;
        }