GetMaxMagixAck() public method

public GetMaxMagixAck ( ) : int
return int
Beispiel #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);
        }
Beispiel #2
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;
        }