i will second this…my nissan has a dist/cap/rotor and all that junk and once when it was raining i believe something got wet and she would cut off anytime i tried to move while in gear…would rev fine but couldn’t exert and force. My car doesn’t shut off when applying the brake but the lights sometimes dim slightly the second the brake light is tripped by the pedal being pressed on. I’d say check the alty and the dist&rotor
well i removed the IAC off the car and cleaned it. it was disgustingly dirty. put it back on, and reset the ecu. fired it up and let the car relearn its stuff, has been fine since last thursday so far. running much much better