Zen Buddhism addresses this question more directly than mainstream Buddhism. Zen takes the Taoist idea of spontaneity to a more serious level, with a goal of having a mind that is not exactly 'empty' but does not 'get stuck' on any particular emotion or thought.

This goal might have remained in the province of the monks except for the circumstance that a samurai clan leader became friends with the influential monk Takuan Soho. Munenori wrote a book for his clan descendents that was later published as The Sword and the Mind. In this work, Munenori explains in great detail how the constantly shifting mind is a huge advantage for the warrior and how it applies in battle.

Be nice, until it's time to not be nice.