Just rewrite hero:on_state_changed.
To disable the spin attack, the state we need to unfreeze the hero is called "sword loading"
You can still access game function through.
This way, it is more convenient since you rewrite the function it belongs to
hero:register_event("on_state_changed", function(hero, state)
if state == "sword loading" then
local game = hero:get_game()
if not game:get_value("skill_spin_attack") then
game:simulate_command_released("attack")
end
end
end