It’s true that earthquakes can create tsunami waves that often devastate distant coastlines.
Strangely, though, they don’t do much damage until they actually approach land. That’s because in the open sea, a tsunami is a lateral wave that travels far beneath the surface of the water.
Traveling underwater at great speed, it barely affects the surface of the water until it is forced upward by the shallows of a continental shelf.
People obliviously dancing a fox-trot on a ship’s deck would likely not even notice a tsunami passing underneath—the effect would be an imperceptible raising or lowering of the ship by a few feet, lasting a few minutes to an hour.
Generally, a ship on the ocean isn’t a bad place to be in seismically unstable times.
Unless it’s tied to a dock that’s lurching around because it’s attached to land, a floating watercraft is pretty well insulated from an earthquake’s damage.