Luffy motivations in Dressrosa arc change two times. First his motivation to take down Doflamingo was to follow Trafalgar Law plan of destroying the SMILE factory so Kaido goes against Doflamingo. I’m completely sure that Luffy never understood that plan at all, most likely he thought it would be a fun adventure. At least his crew understood things. However after the Straw Hats came to know the real history of Dressrosa Franky makes an epic speech that involve not following Law plan anymore and becoming part of the Tontatta forces to take down Doflamingo. Now Luffy motivation to win is to fight alongside the Tontattas and save their country. Actually he says so himself on episode 682: