| 3855 | } |
| 3856 | |
| 3857 | bool cHardwareBCR::testAttack(cAvidaContext& ctx) |
| 3858 | { |
| 3859 | if (m_use_avatar && m_use_avatar != 2) return false; |
| 3860 | |
| 3861 | if (m_world->GetConfig().PRED_PREY_SWITCH.Get() < 0) return false; |
| 3862 | |
| 3863 | if (!m_use_avatar && !m_organism->IsNeighborCellOccupied()) return false; |
| 3864 | else if (m_use_avatar == 2 && !m_organism->GetOrgInterface().FacedHasPreyAV()) return false; |
| 3865 | |
| 3866 | // prevent killing on refuges |
| 3867 | const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib(); |
| 3868 | for (int i = 0; i < resource_lib.GetSize(); i++) { |
| 3869 | if (resource_lib.GetResource(i)->GetRefuge()) { |
| 3870 | if (!m_use_avatar && m_organism->GetOrgInterface().GetFacedResourceVal(ctx, i) >= resource_lib.GetResource(i)->GetThreshold()) return false; |
| 3871 | else if (m_use_avatar == 2 && m_organism->GetOrgInterface().GetAVFacedResourceVal(ctx, i) >= resource_lib.GetResource(i)->GetThreshold()) return false; |
| 3872 | } |
| 3873 | } |
| 3874 | return true; |
| 3875 | } |
| 3876 | |
| 3877 | bool cHardwareBCR::testAttackChance(cAvidaContext& ctx, cOrganism* target, sAttackReg& reg, double odds) |
| 3878 | { |
nothing calls this directly
no test coverage detected