Oh, then this should probably work, as it only kills everyone if all living members are petrified:
That said, I still highly recommend changing your petrify state to a number after 3, in which case you'd change value in isStateAffected.
Code:
var party = $gameParty.aliveMembers();
var petrified = 0;
for (i in party) if (party[i].isStateAffected(2)) petrified++;
if (petrified == party.length) for (i in party) party[i].addState(1);
That said, I still highly recommend changing your petrify state to a number after 3, in which case you'd change value in isStateAffected.