Here's how
When the unit attacks another unit
Get that unit's armor type and armor value
Create a new unit with armor type and use bonus to set armor value to target unit's armor value
Keep using UnitDamageTarget until you get an exact match. This will get you the damage type.
Set dummy unit's armor value to half the armor value of the attacked unit
Apply UnitDamageTarget using found attack type
Clean dummy unit
Set damage to resulting damage
This method will correctly ignore half of the attacked unit's armor.
Be sure to use a DDS with priorities so that other libraries that manipulate damage don't get messed up. You want to apply offensive abilities first (linear, then percent), then defensive abilities (once again linear, then percent).