Every tower can be set to target: first, (what all defenses are currently set at) where it attacks whatever troop is closest to the tower, last, where it targets whatever troop is furthest away, strong, where it targets the strongest unit in range (based on max hp not current hp), and weak, where it targets the weakest unit in range (again, based on max hp not current hp)
