Mob Damage (Redux)

11/04/2018 15:36 LepEatWorld#1
Hello, I'm currently using the Redux source to toy around with it. I was wondering how I would go about on making the max damage on monsters. I would like to do something like "DbMonstertype.Life * 600 = MaxDamage" which would be Pheasant(33HP) * 600 = 19800 Max Damage <--- Actual CO Max. Any help would be appreciated, I haven't touched anything that has to do with C# in years, and even then I was a beginner.
11/06/2018 06:20 Yupmoh#2
Since you're using the Redux source base, You need to go to the Entity class where there's a method to calculate damage depending on what type of attack it is (Archer, Magic, Melee).
All you need to do is to call a Math.MinMax between the attacker's damage calculated and monster life * 600. That way it will output the damage limit if the attacker's damage is higher than monster life * 600.
11/07/2018 00:46 LepEatWorld#3
Thanks for your reply. I added 2 lines to the script, not sure if this is how you were trying to explain things but this is what I did. I found the current code:
Code:
public virtual uint CalculatePhysicalDamage(Entity _target, DbMagicType _spell, bool _canDodge = false)
        {
            var dmg = Common.Random.Next(CombatStats.MinimumDamage, CombatStats.MaximumDamage) * (CombatStats.BonusAttackPct + CombatStats.DragonGemPct) / 100;
            if (_target is Monster)
                dmg *= GetLevelBonusDamageFactor(Level, _target.Level);
            if (_spell != null && _spell.Power > 0)
                dmg = (int)((double)dmg * (double)(_spell.Power % 1000) / (double)100);
            if (HasEffect(ClientEffect.Superman))
                if (_target is Monster)
                    dmg *= 10;
                else
                    dmg *= 2;
            dmg = dmg * (100 - _target.CombatStats.BlessPct) / 100;
            dmg = dmg * (100 - _target.CombatStats.TortGemPct) / 100;
            dmg -= _target.CombatStats.Defense * CombatStats.BonusDefensePct / 100;
            if (dmg < 1)
                dmg = 1;
            if (_canDodge && !Common.PercentSuccess(Math.Max(40, 90 - _target.CombatStats.Dodge + CombatStats.Accuracy)))
                dmg = 0;

            return (uint)dmg;
        }
And I added the following lines:
Code:
            if (_target is Monster && dmg > _target.MaximumLife * 600)
                dmg = (int)_target.MaximumLife * 600;
So it currently looks like:
Code:
        public virtual uint CalculatePhysicalDamage(Entity _target, DbMagicType _spell, bool _canDodge = false)
        {
            var dmg = Common.Random.Next(CombatStats.MinimumDamage, CombatStats.MaximumDamage) * (CombatStats.BonusAttackPct + CombatStats.DragonGemPct) / 100;
            if (_target is Monster)
                dmg *= GetLevelBonusDamageFactor(Level, _target.Level);
            if (_spell != null && _spell.Power > 0)
                dmg = (int)((double)dmg * (double)(_spell.Power % 1000) / (double)100);
            if (HasEffect(ClientEffect.Superman))
                if (_target is Monster)
                    dmg *= 10;
                else
                    dmg *= 2;
            dmg = dmg * (100 - _target.CombatStats.BlessPct) / 100;
            dmg = dmg * (100 - _target.CombatStats.TortGemPct) / 100;
            dmg -= _target.CombatStats.Defense * CombatStats.BonusDefensePct / 100;
            if (dmg < 1)
                dmg = 1;
            if (_target is Monster && dmg > _target.MaximumLife * 600)
                dmg = (int)_target.MaximumLife * 600;
            if (_canDodge && !Common.PercentSuccess(Math.Max(40, 90 - _target.CombatStats.Dodge + CombatStats.Accuracy)))
                dmg = 0;

            return (uint)dmg;
        }
Not sure if this is what you were recommending, but it seems to work perfectly fine. If there's a better way of doing this, I would like a tip or two. Thanks again.
03/11/2019 05:55 Yupmoh#4
Quote:
Originally Posted by LepEatWorld View Post
Thanks for your reply. I added 2 lines to the script, not sure if this is how you were trying to explain things but this is what I did. I found the current code:
Code:
public virtual uint CalculatePhysicalDamage(Entity _target, DbMagicType _spell, bool _canDodge = false)
        {
            var dmg = Common.Random.Next(CombatStats.MinimumDamage, CombatStats.MaximumDamage) * (CombatStats.BonusAttackPct + CombatStats.DragonGemPct) / 100;
            if (_target is Monster)
                dmg *= GetLevelBonusDamageFactor(Level, _target.Level);
            if (_spell != null && _spell.Power > 0)
                dmg = (int)((double)dmg * (double)(_spell.Power % 1000) / (double)100);
            if (HasEffect(ClientEffect.Superman))
                if (_target is Monster)
                    dmg *= 10;
                else
                    dmg *= 2;
            dmg = dmg * (100 - _target.CombatStats.BlessPct) / 100;
            dmg = dmg * (100 - _target.CombatStats.TortGemPct) / 100;
            dmg -= _target.CombatStats.Defense * CombatStats.BonusDefensePct / 100;
            if (dmg < 1)
                dmg = 1;
            if (_canDodge && !Common.PercentSuccess(Math.Max(40, 90 - _target.CombatStats.Dodge + CombatStats.Accuracy)))
                dmg = 0;

            return (uint)dmg;
        }
And I added the following lines:
Code:
            if (_target is Monster && dmg > _target.MaximumLife * 600)
                dmg = (int)_target.MaximumLife * 600;
So it currently looks like:
Code:
        public virtual uint CalculatePhysicalDamage(Entity _target, DbMagicType _spell, bool _canDodge = false)
        {
            var dmg = Common.Random.Next(CombatStats.MinimumDamage, CombatStats.MaximumDamage) * (CombatStats.BonusAttackPct + CombatStats.DragonGemPct) / 100;
            if (_target is Monster)
                dmg *= GetLevelBonusDamageFactor(Level, _target.Level);
            if (_spell != null && _spell.Power > 0)
                dmg = (int)((double)dmg * (double)(_spell.Power % 1000) / (double)100);
            if (HasEffect(ClientEffect.Superman))
                if (_target is Monster)
                    dmg *= 10;
                else
                    dmg *= 2;
            dmg = dmg * (100 - _target.CombatStats.BlessPct) / 100;
            dmg = dmg * (100 - _target.CombatStats.TortGemPct) / 100;
            dmg -= _target.CombatStats.Defense * CombatStats.BonusDefensePct / 100;
            if (dmg < 1)
                dmg = 1;
            if (_target is Monster && dmg > _target.MaximumLife * 600)
                dmg = (int)_target.MaximumLife * 600;
            if (_canDodge && !Common.PercentSuccess(Math.Max(40, 90 - _target.CombatStats.Dodge + CombatStats.Accuracy)))
                dmg = 0;

            return (uint)dmg;
        }
Not sure if this is what you were recommending, but it seems to work perfectly fine. If there's a better way of doing this, I would like a tip or two. Thanks again.
Sorry for the late response but this is what I meant.

Code:
if (_target is Monster)
{
    dmg = Math.Min(dmg, (uint)(_target.MaximumLife * 600));
}
This will result in damage not exceeding target's maximum life * 600 since it will take that if the damage is higher and if not then it will take the damage.

Edit: Add me on discord if you wish to contact me directly Moh #0530 :)