GetLevel() public method

public GetLevel ( ) : byte
return byte
Example #1
0
        //计算爆率.. 0.不爆 1.小爆 2 ~ 5
        //2.中爆 6 ~ 9
        //3.大爆 10 ~ 15
        public static byte AdjustDrop(BaseObject attack, BaseObject Def)
        {
            byte attklv = attack.GetLevel();
            byte deflv  = Def.GetLevel();

            int dislv = attklv - deflv;

            if (dislv >= 0)                  //攻击者高于被攻击者
            {
                if (dislv <= 5 && dislv > 3) //差距小于5级
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE3 : EXPLODE_ITEM_CHANCE1);
                }
                else if (dislv <= 9 && dislv > 6)//差距小于10级
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE2 : EXPLODE_ITEM_CHANCE1);
                }
                else //大爆 就算大爆不了,也小爆
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE4 : EXPLODE_ITEM_CHANCE2);
                }
            }
            else //攻击者低于被攻击者
            {
                if (dislv <= -5 && dislv > -3)//差距小于5级
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE3 : EXPLODE_ITEM_CHANCE2);
                }
                else if (dislv <= -9 && dislv > -6)//差距小于10级
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE2 : EXPLODE_ITEM_CHANCE1);
                }
                else //大爆 就算大爆不了,也小爆
                {
                    return(IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE4 : EXPLODE_ITEM_CHANCE2);
                }
            }
        }
Example #2
0
        //计算爆率.. 0.不爆 1.小爆 2 ~ 5
        //2.中爆 6 ~ 9
        //3.大爆 10 ~ 15
        public static byte AdjustDrop(BaseObject attack, BaseObject Def)
        {
            byte attklv = attack.GetLevel();
            byte deflv = Def.GetLevel();

            int dislv = attklv - deflv;

            if (dislv >= 0) //攻击者高于被攻击者
            {
                if (dislv <= 5 && dislv > 3)//差距小于5级
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE3 : EXPLODE_ITEM_CHANCE1;
                }
                else if (dislv <= 9 && dislv > 6)//差距小于10级
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE2 : EXPLODE_ITEM_CHANCE1;
                }
                else //大爆 就算大爆不了,也小爆
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE4 : EXPLODE_ITEM_CHANCE2;
                }
            }
            else //攻击者低于被攻击者
            {
                if (dislv <= -5 && dislv > -3)//差距小于5级
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE3 : EXPLODE_ITEM_CHANCE2;
                }
                else if (dislv <= -9 && dislv > -6)//差距小于10级
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE2 : EXPLODE_ITEM_CHANCE1;
                }
                else //大爆 就算大爆不了,也小爆
                {
                    return IRandom.Random(0, 100) < 50 ? EXPLODE_ITEM_CHANCE4 : EXPLODE_ITEM_CHANCE2;
                }
            }
        }
Example #3
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);
        }
Example #4
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;
        }