Formulas

A MajorMUD remake

Moderator: lucid2310

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

Formulas

Post by lucid2310 » Fri Jan 11, 2019 11:44 am

Keep track of formulas/algorithms here for posterity.

Martial Arts Calculation (method = _calculate_secondary_stats):

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;
Find Traps Calculation (method = _calculate_secondary_stats):):

Code: Select all

            // Get the FindTraps ability value.
            bool findTrapExists = _user_has_ability(player, AbilityTypes.FindTraps);

            int tmpLevel = 0;
            // if findtraps is zero, set Traps and SubTraps to 0.
            if (findTrapExists == false)
            {
                player.Traps = 0;
                player.BaseTraps = 0;
            }
            else
            {
                if (player.Level <= 15)
                {
                    tmpLevel = player.Level;
                }
                else
                {
                    int tLevel = (player.Level & 0xFFF1) >> 1;

                    tLevel += tLevel;

                    tmpLevel = tLevel + 15;
                }

                player.Traps = (short)(((player.MaxIntellect) + (player.MaxAgility) + (player.MaxCharm + player.MaxCharm) + tmpLevel) * 28 / 7);
                player.BaseTraps = player.Traps;

                short findTrapsValue = (short)_get_user_ability_value(player, AbilityTypes.FindTraps); // Ability ID 40.

                player.Traps += findTrapsValue;

                short findTrapsAlterValue = (short)_get_user_ability_value(player, AbilityTypes.FindTrapsValue); // Ability ID 179.

                player.Traps += findTrapsAlterValue;
                player.BaseTraps = player.Traps;

                if (player.Traps < 0)
                {
                    player.Traps = 0;
                    player.BaseTraps = 0;
                }
            }


Last bumped by lucid2310 on Fri Jan 11, 2019 11:44 am.


Post Reply