I'd probably create an "attack queue" on the hero.
It's a history of recent attacks, stored as a Lua table.
When you press "attack":
1. The game reviews the current attack queue,
2. determines what the attack action will be based on that queue,
3. then performs the attack action
4. and pushes it on the queue.
You could add a cooldown timer to the hero, like `hero.cooldown = sol.timer.start(hero, 1000, function() hero:reset_attack_queue() end)`
Then whenever you handle an attack, call `hero.cooldown:set_remaining_time(1000)` to reset the cooldown.
You will probably have to tweak this concept to make it really work, but this is the way I'd approach it.