An analytical procedure for the derivation of state-dependent fragility curves for masonry buildings