So I did some testing.
- The damage for Hammer Slam occurs before the mana cost is deducted. This means that if you do enough damage to fill your mana bar your end mana will be at your max mana minus the cost of the hammer slam.
You hammer slam for 1 million damage, your max mana is 5000 and your hammer slam ability costs 2000 mana. After the hammer slam you will have 3000 mana (5000 max-2000 slam cost).
2. Knock back deaths deal no damage and therefore no mana gain.
If you kill 1 million things with knockback, you will gain no mana. Units that can be killed via knockback are archers and soldier reinforcements.
3. Hammer Slam deals a knock back (or metaimpact event) first, then follows up with the damage attacks. This means that all warriors and archers you hit with the center of the blast will be killed via knockback. Only those units outside the knockback zone and within the AOE zone will end up giving mana.
4. Structural Transfer gives mana when used with the blade of serpents buff.