Multiattack. The pirate makes three attacks, using Rapier or Pistol in any combination.
Rapier. Melee Attack Roll: +7, reach 5 ft. Hit: 13 (2d8+4) Piercing damage, and the pirate has Advantage on the next attack roll it makes before the end of this turn.
Pistol. Ranged Attack Roll: +7, range 30/90 ft. Hit: 15 (2d10+ 4) Piercing damage.
Captain's Charm. Wisdom Saving Throw: DC 14, one creature the pirate can see within 30 feet. Failure: The target has the Charmed condition until the start of the pirate's next turn.
Riposte. Trigger: The pirate is hit by a melee attack roll while holding a weapon. Response: The pirate adds 3 to its AC against that attack, possibly causing the attack to miss. On a miss, the pirate makes one Rapier attack against the triggering creature if within range.