Formulas

A MajorMUD remake

Moderator: lucid2310

Post Reply
User avatar
lucid2310
Posts: 27
Joined: Thu Mar 17, 2016 3:31 am
Location: Palm Bay, FL

Formulas

Post by lucid2310 » Thu Oct 25, 2018 1:37 am

Keep track of formulas/algorithms here for posterity.

Martial Arts Calculation (method = _calculate_secondary_attack):

Code: Select all

            int dynCrit = _get_user_ability_value(AbilityTypes.Crits);

            long resultOne = (((((player.Level)))) / 10 + (((player.PrimaryStats.MaxIntellect)) & 0xffffffce) / 10 +
                (((player.PrimaryStats.MaxAgility)) & 0xffffffce) / 20 + ((((player.PrimaryStats.MaxCharm)) & 0xffffffce) / 30));

            if (resultOne <= 75)
            {
                if (resultOne < 1)
                {
                    resultOne = 1;
                }
            }
            else
            {
                resultOne = 75;
            }

            int dodgeValue = _get_user_ability_value(AbilityTypes.Dodge);

            var maxCharm = player.PrimaryStats.MaxCharm / 10;
            var maxAgility = player.PrimaryStats.MaxAgility / 5;
            var playerLevel = player.Level / 5;

            dodgeValue = (int)(((((dodgeValue) + ((resultOne) + (dynCrit))) + (maxCharm)) + (maxAgility)) + (playerLevel));

            player.MartialArts = (short)(dodgeValue);

            bool playerHasJK = _user_has_ability(AbilityTypes.JumpKick);

            if (playerHasJK == true)
            {
                short jkResult = (short)((player.MartialArts) + ((player.Level)));
                jkResult = (short)((jkResult) + (jkResult));
                player.MartialArts = jkResult;
            }
Coin Weight (method = _get_coint_weight):

Code: Select all

                coinWeight = (player.Currency.Runic / 3 + player.Currency.Platinum / 3 +
                              player.Currency.Gold / 3 + player.Currency.Silver / 3 +
                              player.Currency.Copper / 3);
Maximum Weight (method = _get_max_weight):

Code: Select all

            int maxWeight = 0;

            int encumbranceModifier = _get_user_ability_value(player, AbilityTypes.Encumbrance);
    
            maxWeight = (encumbranceModifier + 100) * player.MaximumEncumbrance / 100;

            return maxWeight;
Convert Currency To Coppyer (method = _convert_currency):

Code: Select all

            ulong tmpCopper;
            int tmpSilver;
            int tmpGold;
            int tmpPlatinum;

            int totalRunic;
            int totalPlatinum;
            int totalGold;
            int totalSilver;

            tmpCopper = (ulong)copper;
            tmpSilver = silver;
            tmpGold = gold;
            tmpPlatinum = platinum;

            totalRunic = runic * 100;

            if ((totalRunic) < (runic))
            {
                totalRunic = runic;
            }

            if ((tmpPlatinum) <= ((totalRunic) + (tmpPlatinum)))
            {
                tmpPlatinum = ((tmpPlatinum) + (totalRunic));
            }

            totalPlatinum = ((tmpPlatinum) * (100));

            if ((tmpPlatinum) > (totalPlatinum))
            {
                totalPlatinum = tmpPlatinum;
            }

            if ((tmpGold) <= ((totalPlatinum) + (tmpGold)))
            {
                tmpGold = ((tmpGold) + (totalPlatinum));
            }

            totalGold = ((tmpGold) * (10));

            if ((tmpGold) > (totalGold))
            {
                totalGold = tmpGold;
            }

            if ((tmpSilver) <= ((totalGold) + (tmpSilver)))
            {
                tmpSilver = ((tmpSilver) + (totalGold));
            }

            totalSilver = ((tmpSilver) * (10));

            if ((tmpSilver) > (totalSilver))
            {
                totalSilver = tmpSilver;
            }

            if ((tmpCopper) <= ((ulong)(totalSilver) + (tmpCopper)))
            {
                tmpCopper = ((tmpCopper) + (ulong)(totalSilver));
            }

            return tmpCopper;


Post Reply