No you still get excommunicated even if they abandon the province and you get that territory. As long as your forces stay in that territory, your not with the pope's will. And by the way, did anyone ever assassinate a pope? the percentage of success is almost impossible.The only exception to this is you can attack a province with the enemy ruler in it that turn , if they abandon the province = no excommunication. If they retreat to the castle you can leave the province without getting excommunicated or storm it if capturing / killing their ruler is more important to you!
Bookmarks