bool gemActor::CanBeAttackedBy(gemActor* attacker, gemActor*& lastAttacker) const{ lastAttacker = NULL; csTicks lasttime = csGetTicks(); for (int i = (int)GetDamageHistoryCount(); i>0; i--) { const AttackerHistory* lasthit = GetDamageHistory(i-1); // any 15 second gap is enough to make us stop looking if (lasttime - lasthit->TimeOfAttack() > 15000) return true; lasttime = lasthit->TimeOfAttack(); gemActor* attacker = lasthit->Attacker(); Error2("found attack history entry by %p", attacker); if (!attacker) continue; // ignore disconnects lastAttacker = attacker; // If someone else, except for attacker pet, hit first and attacker not grouped with them, // attacker locked out if (lastAttacker != attacker && !attacker->IsGroupedWith(lastAttacker, true) && !attacker->IsMyPet(lastAttacker)) { return false; } } return true;}