how to add a.tp+=20 into this custom formula?

I have been toying around with my custom formula. The situation is if $game_variables[1] is set to 1, it can deal 50% extra damage and it works wonderfully without any problem. However; if I would like to add a.tp+=20 after the extra damage, where should I put it in to make the formula works correctly?

Correctly you say? Yes, I mean that.

I try add "&& a.tp+=20" after "e*1.5", I do gain 20 TP every time the spell is cast but the damage keeps increasing cumulatively every time (which I don't want it).

Kindly help me to fix this and what could be the cause of the increase of the spell damage.

Thanks!

Code:
class Game_Battler < Game_BattlerBase  def fireball_dmg(a,    c=((a.mat/2*1.05)-b.mdf/4).to_i    d=c/11+1    e=(c-d..c+d).to_a.sample    if c>=1;e;elsif c<=0;if rand(10)+1>=4;1;else;0;end;end    if $game_variables[1]==1    return e*1.5  else     return e    end  endend
I never use the a and b constructs outside of the formula box so I'm not 100% sure this will work, but try adding the a.tp += 20 on the line ABOVE the return (and space it out as shown if it doesn't work at first).

The && operator is a logical operator so it will look to see whether "e * 1.5" and "a.tp += 20" are both true, rather than executing both of the actions.
I never use the a and b constructs outside of the formula box so I'm not 100% sure this will work, but try adding the a.tp += 20 on the line ABOVE the return (and space it out as shown if it doesn't work at first).

The && operator is a logical operator so it will look to see whether "e * 1.5" and "a.tp += 20" are both true, rather than executing both of the actions.
It works perfectly now! Even it is a basic of Ruby, I think I have learned a lot from this.

Thank you for your quick answer and also pointing out the reason of the increase of the damage. 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-tp-20-into-this-custom-formula.38694/