This is calculated by the following function.(FE8U)
0802BD50 B5F0 push {r4,r5,r6,r7,lr} //ApplyUnitPromotion
...
0802BE2E 7011 strb r1, [r2, #0x0]
Perhaps, to briefly explain this routine, it looks like this:
ramunit->wexp_sw = ramunit->wexp_sw
- current_class->base_wexp_sw
+ new_class->base_wexp_sw
ramunit->wexp_lnc = ramunit->wexp_lnc
- current_class->base_wexp_lnc
+ new_class->base_wexp_lnc
...
In a nutshell, the wexp you have learned will be added to the new class of wexp.
Suppose your base’s class base wexp is 1.
Suppose you get 9 wexp for sw.(You swung iron sword 9 times.)
In that case, the current sw wexp is 10.
1 + 9 = 10
Immediately after that, You performed Promotion.
Suppose your new Class sw base wexp is 31.
At this time, the following calculation is performed.
10 - 1 = 9 //You have mastered wexp for only 9.
9 + 31 = 40 //Add only that value to the new class wexp.
So your sw wexp should be 40.
Let’s look at the actual data.
When he Promotes to Paladin …
His sw wexp is now 40.
This is as calculated above.