The max power your battery is able to output is: W = IV = (8A * 30c) * 4.2 * 6 cells = 6048W. The 30C in this case is the C rating of your battery. Also if we tweak the equation a little Wh = Ah*V = (8Ah * 30C) * 3.7V *6 cells = 177.6Wh. This gives us Wh which is also more or less the capacity/power of your battery in relationship to time.
The max power your vesc will allow to pass through will be set based on your motor max and battery max settings.
The motor max setting is how much current the vesc is allowed to give to your motors.
The battery max setting is how much current the vesc is allowed to take from your batteries.
Because of the flow (battery -> vesc -> motor), whichever has the lowest settings will determine your max output.
So to answer your question, motor max will affect power output if it’s the lowest and battery max will affect battery output if it’s the lowest.
Edit: Thank you @FredrikHems for pointing out a very dumb mistake I did in my math