EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Fix: Low level damage cap (https://www.eqemulator.org/forums/showthread.php?t=36068)

jsr 12-03-2012 03:16 AM

Fix: Low level damage cap
 
Server rules for lower level melee damage caps aren't working as intended.

In attack.cpp.client::attack;

I think this:
Code:

                if(GetLevel() < 10 && max_hit > 20)
                        max_hit = (RuleI(Combat, HitCapPre10));
                else if(GetLevel() < 20 && max_hit > 40)
                        max_hit = (RuleI(Combat, HitCapPre20));

Should be more like this:

Code:

                if(GetLevel() < 10 && max_hit > RuleI(Combat, HitCapPre10))
                        max_hit = (RuleI(Combat, HitCapPre10));
                else if(GetLevel() < 20 && max_hit > RuleI(Combat, HitCapPre20))
                        max_hit = (RuleI(Combat, HitCapPre20));

Not sure if it's efficient to use a variable instead for the rule value.

Drajor 12-03-2012 04:49 AM

Without looking at the code for getting rule values, I would use a few static const variables in this instance. Assuming you do not need to update these values during run-time.

jsr 12-03-2012 05:05 AM

I removed the code altogether for my purposes :)

Drajor 12-03-2012 05:16 AM

Haha me too!

Akkadius 12-03-2012 10:04 AM

Kind of dumb to replace a dynamic rule that you can change yourself in the rules table then to change code with a static value.

You can set the values of those rules in the `rules_values` table.

Drajor 12-03-2012 10:25 AM

I meant read the value from the DB into a static const.

jsr 12-03-2012 10:27 AM

Hi Akkadius,

Not sure if you realised from my original post, but with the current code, if you change the pre-10 cap to 100, it will mean that if a player uses a 12 damage weapon and hit for 24, their max damage becomes the cap (100). The cap needs to be included in the if statement.

Secrets 12-03-2012 10:33 AM

I'll add this into SVN later. Good catch.

lerxst2112 12-03-2012 10:43 AM

Rules can be changed at runtime, so it probably would not be good to cache the value. Even if you did all you're saving is a function call and a lookup by index in a static array, so I'd say not worth worrying about at all.

Tabasco 12-03-2012 02:45 PM

I didn't realize this hadn't made it in yet.
http://www.eqemulator.org/forums/showthread.php?t=35541

Secrets 12-03-2012 04:22 PM

To be honest me either Tabasco. I recall you posting it ages ago D:

lerxst2112 12-04-2012 12:45 AM

It looks like part of it made it in, because Bots were changed as well where before they didn't use the rules at all, but not completely.


All times are GMT -4. The time now is 08:28 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.