Easy fix
If I am understanding the question right simply add
if(!$this->isAssigned()){
$this->assignStaff($thisuser->getId(), 'Assigned to '.$thisuser->getName().' upon reply');
}
after,
$this->onResponse(); //do house cleaning..
but before,
if(!$canalert) //No alert/response
in the function postResponse(...)
in the file class.ticket.php
and there you go. Every time someone replies to a ticket that is not already assigned, it will be assigned to them.