EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Focus Effect - > Max Level effectiveness reduction question (https://www.eqemulator.org/forums/showthread.php?t=30374)

bad_captain 01-22-2010 12:57 PM

Focus Effect - > Max Level effectiveness reduction question
 
Is there a way to make a focus effect max level an actual max level and not begin effectiveness reduction?

Code:

                case SE_LimitMaxLevel:{
                        int lvldiff = (spell.classes[(GetClass()%16) - 1]) - focus_spell.base[i];

                        if(lvldiff > 0){ //every level over cap reduces the effect by spell.base2[i] percent
                                lvlModifier -= spell.base2[i]*lvldiff;
                                if(lvlModifier < 1)
                                        return 0;
                        }
                        break;
                }

This code checks to see if the spell level is > maxlevel for the focus effect, then reduces the effectiveness by the lvldiff, which should be specified in the spell table.

The focus effect in question (Pet Focus) has 0 for base2[i], which should be a percentage to reduce per level. With a 0 for per lvl reduction, spell.base2[i]*lvldiff; will = 0, which means lvl modifier will stay at 100. Unless I'm wrong, this means the focus effect will stay at 100% effectiveness for every level, no matter the maxlevel.

Would there be any issue with changing
Code:

if(lvlModifier < 1)
    return 0;

to

Code:

if((lvlModifier < 1) || (spell.base2[i] == 0))
        return 0;

This would make any focus effect which has a per level over maxlevel reduction percentage of 0 stop working completely if the spell level is above the focus effects maxlevel.

If I get this worked out, then I will have finished a relatively scalable pet focus solution, but I want to make sure it will not adversely affect any other spells or code, as I'm not that familiar with spells.

KLS 01-22-2010 06:23 PM

Simply change the base2 of that effect to 100 instead of 5/10/20 it is normally.

bad_captain 02-03-2010 10:59 AM

Okay, I have written up scripts to change the pet focus effects to not work after the max level of the effect by setting base2[i] =0. I still think it might be best to change the code to check for the base2[i] == 0, as it appears any focus effects that are supposed to completely stop working after the maxlevel, have a base2[i] of 0. I did a search of spells, and I found 10-15 focus effects that have an absolute max level, and each have a base2[i] of 0. Some are: Academic's Foresight, Anger of Taelosia, and the Abysmal Armor effects (Min and max lvl of 65), and some AA effects such as Gift of Mana, Nature's Presence. While some say in the description that they decay after the max level, there's nothing in the db to suggest anything other than that they stop working completely. Unless these effects are to be changed as well, (plus any new spells we get from lucy), I think it would make sense to make the change in code.

bad_captain 02-03-2010 11:20 AM

Also, I believe the calculation for post max level decay is incorrect. It is my understanding that a 30% focus effect that falls off 5% per level would completely decay in 6 levels. 95% of focus effects fall off 5% per level, even ones that have a focus effect of 75%, with a few at 10%. It appears the code only takes off 5% of 30, which would be 28.5% after 1 level, and would take 20 levels to completely fall off.

Code:

int lvlModifier = 100;

.....


case SE_LimitMaxLevel:{
                        int lvldiff = (spell.classes[(GetClass()%16) - 1]) - focus_spell.base[i];

                        if(lvldiff > 0){ //every level over cap reduces the effect by spell.base2[i] percent
                                lvlModifier -= spell.base2[i]*lvldiff;
                                if(lvlModifier < 1)
                                        return 0;
                        }
                        break;
                }

....

return(value*lvlModifier/100);

So currently, for a 1 level difference, lvlModifier -= spell.base2[i]*lvldiff would be 100 -= 5*1 which equals 95. Then, it would return 30 * 95/100, which would be 28.5.

It seems like it should be
Code:

int lvlModifier = 0;

.....

case SE_LimitMaxLevel:{
                        int lvldiff = (spell.classes[(GetClass()%16) - 1]) - focus_spell.base[i];

                        if(lvldiff > 0){ //every level over cap reduces the effect by spell.base2[i] percent
                                lvlModifier = spell.base2[i]*lvldiff;  //%perLvl * lvls
                                if(lvlModifier >= value)  //too many lvl diff. - effectiveness now 0
                                        return 0;
                        }
                        break;
                }

....

return(value - lvlModifier);

So with this code, for a 1 level difference, lvlModifier = spell.base2[i]*lvldiff would be lvlModifier = 5*1 which equals 5. Then, it would return 30 - 5, which would be 25, leaving it at 25% focus effect.

Unless I am incorrect in my understanding of how the falloff works, then I guess disregard. But as a Magician summoning focus effect items all the time, I'm almost certain I remember talk of focus effects losing effectiveness after 4-5 levels.

gaeorn 02-03-2010 08:11 PM

Do we know if the 5% reduction after max level is 5% of the total or 5% of the reduction? In other words, the correct formula would be what I use for one of the following two examples:

lets assume the following
max focus = 30%
reduction after max level = 5%
current level is five levels over max

option one:
the reduction is a direct reduction of the focus percentage
0.30 - (5 * 0.05) = 0.05
resulting focus is 5%

option two:
the reduction is a percentage of the focus that is reduced
0.30 - (5 * 0.05 * 0.30) = 0.225
resulting focus is 22.5%

I never found that information referenced anywhere but perhaps someone else knows. This should also be pretty easy to test on live.

bad_captain 02-03-2010 09:26 PM

Hmm.. It appears I was wrong. I did some more reasearch and found two examples of charts showing the reduction per level, and it was 1.5 per level. (i.e. 30 * 5% per level) It just seems off that focus effects are still 50% effective after 10 levels. Reminds me how long ago I played on live. :confused:

gaeorn 02-03-2010 10:28 PM

Quote:

Originally Posted by bad_captain (Post 183790)
Hmm.. It appears I was wrong. I did some more reasearch and found two examples of charts showing the reduction per level, and it was 1.5 per level. (i.e. 30 * 5% per level) It just seems off that focus effects are still 50% effective after 10 levels. Reminds me how long ago I played on live. :confused:

I suppose it could be argued either way. The biggest reason why I would agree with the smaller reduction is back when I played live, there were items that were difficult for a level 65 (max back then) to obtain that had a 25% focus with 5% reduction per level. That would make them worthless to a level 65 if it were the larger reduction per level. In any case, I'm glad the correct formula was confirmed.


All times are GMT -4. The time now is 02:39 AM.

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