There are few ways to do this but everything efficient that I can think of requires a bit of coding knowledge. Of course there are also ways to do it using common events and skill formulae but everything depends on things like attack buff cap or
when you want that buff effect to actually take place.
This answer requires a much longer explanation but I will offer you a possible solution that - in my opinion and based on what little I know about what you are trying to achieve - might work in your situation.
Spoiler: Part ONE: How to set up your damage formulae
This requires a lot of work if you don't want to add a script. You should add a check to all your damage formulae that inflict damage of that said element (Thunder or Darkness) to see if the target is actually the character you want to go berserker. If that's the case you should increase a variable (in my example I am going to use variable 99). This variable will be used later to calculate your enhanced attack and decreased defense.
I cannot access the engine right now but if I am not wrong you can do it using something like this:
Code:
v[99]+=1 if ((b==$game_actors[actor_id])&&(v[99]<20));
Just be sure to change "actor_id" to be the actual id. It is supposed to be a number. This covers the thunder/darkness skill formulae.
Spoiler: Part TWO: How to use those damage formulae
After doing that you should also edit the damage formula for each skill usable by that character to take that variable into account. You should also set a cap to that said buff. In my example I am going to use a buff that's +5% of maximum attack and -3% of maximum defense per stack that caps at 20 stacks (+100% max attack and -60% max defense).
Whenever you use a.atk in your skill formula you should use the following instead.
Code:
(a==$game_actors[actor_id] ? (a.atk*(1+0.05*v[99])).to_i : a.atk)
Then you have to add something similar to each other skill that can be used against the player to check for the defense. As for the previous part replace b.def in your formulae with the following.
Code:
(b==$game_actors[actor_id] ? (b.def*(1+0.05*v[99])).to_i : b.def)
Spoiler: Part THREE: Don't forget to reset the buff after each battle!
Of course you don't want your character to start the next battle with the buff on (or do you?). To reset that said buff, whenever a battle ends you should reset that variable to 0 as well. To do so you can use a common autorun event triggered by a switch to reset that variable to 0 and then turn the triggering switch off (this is extremely important or your game will not progress any further).
The most important part about this is that you have to remember to turn that switch on at the beginning of each battle using troop events. Of course you can decide to do it in your damage formulae instead. I am just assuming it is faster to do it via troop events but if you want to do it in your damage formulae you should add this to all your thunder/darkness skills.
As you can probably guess I used switch[80] in this example. Feel free to change that value to be the ID of the switch you really want to use or just use that. It will work either way.
IMPORTANT NOTE: VX Ace formula box doesn't allow too many characters in so if you have to use a.atk or b.def more times in a single formula it is wise to store that value in a local variable first or using the code I provided twice won't work. You can do it using the following code and then using "ma" (without quotation marks) instead of a.atk or "md" (without quotation marks) instead of b.def.
This is the one you have to use when you want to replace a.atk.
Code:
ma=(a==$game_actors[actor_id] ? (a.atk*(1+0.05*v[99])).to_i : a.atk)
This is the one you have to use when replacing b.def.
Code:
md=(b==$game_actors[actor_id] ? (b.def*(1+0.05*v[99])).to_i : b.def)
If it still does not fit you can put those in a little script like this.
Code:
MATK="(a==$game_actors[actor_id] ? (a.atk*(1+0.05*v[99])).to_i : a.atk)"
MDEF="(b==$game_actors[actor_id] ? (b.def*(1+0.05*v[99])).to_i : b.def)"
Then you have to use eval(MATK) instead of a.atk or eval(MDEF) instead of b.def.