(idiomatic) After a plan against an enemy is drafted, there will be unexpected elements from the opposition that will call for improvisation.
(broadly) Even with a preexisting plan, unexpected circumstances will require one to think on one's feet.
Source: en.wiktionary.org