bool TangibleObjectImplementation::isAttackableBy(CreatureObject* object) {
	if (isImperial() && !(object->isRebel())) {
		return false;
	} else if (isRebel() && !(object->isImperial())) {
		return false;
	} else if (object->isPlayerCreature() && object->getPlayerObject()) {
		if (isImperial() && (object->getPlayerObject())->getFactionStatus() == 0) {
			return false;
		}

		if (isRebel() && (object->getPlayerObject())->getFactionStatus() == 0) {
			return false;
		}

	} else if (object->isAiAgent()) {
		AiAgent* ai = object->asAiAgent();

		if (ai->getHomeObject().get() == asTangibleObject()) {
			return false;
		}

		if (ai->isPet()) {
			ManagedReference<PetControlDevice*> pcd = ai->getControlDevice().get().castTo<PetControlDevice*>();
			if (pcd != NULL && pcd->getPetType() == PetManager::FACTIONPET && isNeutral()) {
				return false;
			}
		}
	}

	return pvpStatusBitmask & CreatureFlag::ATTACKABLE;
}
bool TangibleObjectImplementation::isAttackableBy(CreatureObject* object) {
	if (isImperial() && !(object->isRebel())) {
		return false;
	} else if (isRebel() && !(object->isImperial())) {
		return false;
	} else if (object->isPlayerCreature() && object->getPlayerObject()) {
		if (isImperial() && (object->getPlayerObject())->getFactionStatus() == 0) {
			return false;
		}

		if (isRebel() && (object->getPlayerObject())->getFactionStatus() == 0) {
			return false;
		}

	} else if (object->isAiAgent()) {
		AiAgent* ai = cast<AiAgent*>(object);

		if (ai->getHomeObject() == _this.get()) {
			return false;
		}
	}

	return pvpStatusBitmask & CreatureFlag::ATTACKABLE;
}