Calculating special EXP bonus

If certain conditions are met I want the party to receive a small EXP bonus based on the total exp awarded for a particular troop. So, for example, if I have 3 enemies in the troop each giving 18 exp, the total exp is 54, giving a bonus of 5 (10% rounded up/down).

My problem is that I cannot see how to get that 54, or whatever it is for the particular troop.

Is this possible?

Thanks
why calculate it at all? give the party a state with an exp-gain *110% and make sure that the state expires not on battle but shortly after.
After you win the battle you could try and see if this works for you, it's from the MV version so i'm unsure if MZ has it different.
$gameVariables.setValue(14,$gameTroop.expTotal());
If certain conditions are met I want the party to receive a small EXP bonus based on the total exp awarded for a particular troop. So, for example, if I have 3 enemies in the troop each giving 18 exp, the total exp is 54, giving a bonus of 5 (10% rounded up/down).

My problem is that I cannot see how to get that 54, or whatever it is for the particular troop.

Is this possible?

Thanks
You can get the 54 value using $gameTroop.expTotal(), however it is only accurate after all enemies are dead. It is set to 0 at the beginning of each battle, and it updates incrementally each time an enemy dies.
@Andar @Johnny_Ray and @Arthran
Thank you all for your suggestions. To go from zero possibilities to 3 in one go is quite something!

I shall try them all and see which one fits most easily into the other things going on.

Once again, many thanks for your time and attention to this.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/calculating-special-exp-bonus.148421/