So my view on how this works is that the number of dice is determined by the hill terrain. Maximum 2 dice uphill and 3 dice from hill to hill (except cavalry).
The ramparts allow the occupant to ignore 1 flag and 1 Sword if across a rampart hexside, be it uphill or hill to hill.
This would be those two normal terrain rules working together.
"I will either find a way, or make one."
attrib to Hannibal Barca