God’s Got a Better Plan

I know that David was told by God not to kill Saul, but goodness gracious Saul was breaking so many rules (his own promises included), so didn’t he deserve to be attacked when David clearly had the chance? And more than that, didn’t David deserve success instead of all the cave-hiding he was doing? And why did God present these opportunities and expect David not to act? Did God forget he had anointed him?