New York has a self-defense law based on the castle doctrine, but it is considered weaker than castle doctrine laws in other states. In New York, a duty to retreat exists in any place outside ones home. Within the home, the statute authorizes deadly force as long as the resident is not the initial aggressor. Outside the home, however, persons must retreat from attackers if they can do so safely.
With respect to victims who are inside their own home, New Yorks law states in part:
A person in possession or control of, or licensed or privileged to be in, a dwelling or an occupied building, who reasonably believes that another person is committing or attempting to commit a burglary of such dwelling or building, may use deadly physical force upon such other person when he or she reasonably believes such to be necessary to prevent or terminate the commission or attempted commission of such burglary.
That's the castle doctrine law on the books. I live in NYC and it's nearly impossible to buy a gun for self defense here. My mom's house got burglarized twice and it's not like she can defend herself from a home invader. So when the laws says, you may use deadly physical force to terminate a burglary does that mean you can kill the person once you witness he's trying to steal your stuff? It doesn't say you have to retreat when you're in your home.