Page 1 of 1

Buffs that decrease duration of debuffs

Posted: Sun Jun 01, 2014 6:07 pm
by pwnz0r
Hello. Since I cannot post in relevant areas due to amount of my posts, I'm going to ask here, but first some necessary info.
I'm using nightly SVN, high five (http://www.l2jserver.com/nightly/ latest unstable)
version=6445
builddate=29/05/2014 05:00

Anyway, due to some specifics that I plan to add to our pvp server, I need to change the way some of current buffs are working. A good example: I want Arcane Protection instead of giving 30 resistance to cancel and 20 resistance to debuffs, to just shorten the duration of all incoming debuffs by 20%. If someone roots me, it would root me for 10 seconds, but with this reworked buff on me I would get rooted for 8 seconds only, you got the point.
Something like tenacity from League of Legends.

Is it even possible? Is there a specific variable that I cannot find? Any help?

PS: Sorry if I posted in the wrong area, as I said I don't have enough posts to start a topic in areas that I find more relevant. :roll:

Re: Buffs that decrease duration of debuffs

Posted: Sun Jun 01, 2014 6:21 pm
by DrHouse
Just before any other more qualified guy comes here to help you out, there we go with my 2 cents:

It's easy to do but, as far as I know, it will require to modify the source code or some scripts and recompile it, so you may need some basic/medium knowledge of our sources. If you think you can do it, go to the piece of code where effects are added to the character (look around Effect constructor to simplify it) and put there your tweak. You will need a new skill stat so you can later decide the % of reduction for each buff.

Re: Buffs that decrease duration of debuffs

Posted: Sun Jun 01, 2014 6:25 pm
by Zoey76
It's possible, you need to create a new effect, let's call it Tenacity and there is a method that allow custom buff/debuff durations, so you can check if the user has that effect, then you modify the duration with a simple multiplication.

Re: Buffs that decrease duration of debuffs

Posted: Sun Jun 01, 2014 6:28 pm
by DrHouse
Zoey76 wrote:It's possible, you need to create a new effect, let's call it Tenacity and there is a method that allow custom buff/debuff durations, so you can check if the user has that effect, then you modify the duration with a simple multiplication.
Glad to see how much things have improved!!

Re: Buffs that decrease duration of debuffs

Posted: Sun Jun 29, 2014 6:59 am
by cesabmx
thanks for sharing :D

Re: Buffs that decrease duration of debuffs

Posted: Sun Jun 29, 2014 5:35 pm
by pwnz0r
Thanks for replies and sorry for such a long time for me to show up :)

I forgot to specify that I want to change L2 in a way that:
Let's say you got Arcane Protection, which gives (let's say) 5% tenacity. Then you equip some epic jewelry and it also gives 5% (which stacks with the buff you already have and now you have 10% tenacity overall). Then you turn on some toggle skill that gives 5% tenacity as well and now you have 15% tenacity. So basically time duration of any incoming debuff regardless of what it does will be reduced by 15% (but maximum overall tenacity on a character should never go over 50%), it should always rely on overall tenacity on a character. Later on I plant to edit descriptions to skills/items accordingly, so it's not a problem if tenacity won't really be shown anywhere in-game, a smart player can just do a little bit of math by checking his gear and buffs to learn how much tenacity he has.
I really want to make this work, because people are excited to see this live (this will change PvP dramatically, less random and more strategy/thinking). We have some drastic changes for classes/skills incoming that hopefully will deliver brand new and fresh pvp, but all of it will be useless without tenacity.
While I'm very comfortable with XML files, I'm very new to programming on this level.

Right now I'd like to know if I made tenacity effect properly to begin with.

In EffectTemplate.java I've created (right under public final ChanceCondition chanceCondition;):

Code: Select all

public final int tenacityEffect;
then I changed "public EffectTemplate" to

Code: Select all

public EffectTemplate(Condition pAttachCond, Condition pApplayCond, String func, Lambda pLambda, int pCounter, int pAbnormalTime, AbnormalEffect pAbnormalEffect, AbnormalEffect[] pSpecialEffect, AbnormalEffect pEventEffect, String pAbnormalType, byte pAbnormalLvl, boolean showicon, double ePower, int trigId, int trigLvl, ChanceCondition chanceCond, int pTenacityEffect) 
and after "chanceCondition = chanceCond;" I've added

Code: Select all

tenacityEffect = pTenacityEffect;
Then in DocumentBase.java I added right after int "abnormalTime = 1;" (although I don't understand exactly what it does, but by default without any buffs/items players should have 0 tenacity)

Code: Select all

int tenacityEffect = 1;
and changed line

Code: Select all

final EffectTemplate lt = new EffectTemplate(attachCond, applayCond, name, lambda, count, abnormalTime, abnormalVisualEffect, special, event, abnormalType, abnormalLvl, icon, effectPower, trigId, trigLvl, chance, tenacityEffect);
Is this correct? Is this it? Tenacity effect is now created and should work correctly?

If yes, now all I have to do is to edit in BaseDocument.java formulas where ENABLE_MODIFY_SKILL_DURATION is mentioned?
And do I have to create new L2TraitType called tenacity and new stat (in Stats.java) called tenacity?

I really appreciate your help!