Just give shield_wall to hoplites and most other non-phalanx closed-rank spearmen. And give can_swim to pretty much any unit with light or no armour.

Perhaps not 100% accurate, but pretty close, I'd say.