}
if (Person::players[k]->animTarget != rabbitrunninganim && Person::players[k]->animTarget != wolfrunninganim) {
if (!Person::players[k]->isPlayerControlled()) {
- Person::players[k]->victim = Person::players[0];
+ if (Person::players[k]->isPlayerFriend()) {
+ bool found = false;
+ for (unsigned k2 = 1; k2 < Person::players.size(); k2++) {
+ if (k != k2 &&
+ !Person::players[k2]->dead &&
+ Person::players[k2]->aitype == attacktypecutoff) {
+ Person::players[k]->victim = Person::players[k2];
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ Person::players[k]->attackkeydown = 0;
+ }
+ } else {
+ Person::players[k]->victim = Person::players[0];
+ }
}
//attack key pressed
if (Person::players[k]->attackkeydown) {
Person::players[i]->aitype == gethelptype ||
Person::players[i]->aitype == searchtype) &&
!Person::players[i]->dead &&
+ !Person::players[i]->isPlayerFriend() &&
(Person::players[i]->animTarget != sneakattackedanim &&
Person::players[i]->animTarget != knifesneakattackedanim &&
Person::players[i]->animTarget != swordsneakattackedanim)) {