/* validEntity will check if the given entity can be targeted in the AoE. */ bool CTargetFind::validEntity(CBattleEntity* PTarget) { if(m_targets.size() > MAX_AOE_TARGETS) return false; if(!(m_findFlags & FINDFLAGS_DEAD) && PTarget->isDead()) { return false; } if (m_PTarget == PTarget || PTarget->getZone() != m_zone || PTarget->IsNameHidden()) { return false; } // this is first target, always add him first if(m_PTarget == NULL) { return true; } // shouldn't add if target is charmed by the enemy if(PTarget->PMaster != NULL) { if(m_findType == FIND_MONSTER_PLAYER){ if(PTarget->PMaster->objtype == TYPE_MOB){ return false; } } else if(m_findType == FIND_PLAYER_MONSTER){ if(PTarget->PMaster->objtype == TYPE_PC){ return false; } } else if(m_findType == FIND_MONSTER_MONSTER || m_findType == FIND_PLAYER_PLAYER){ return false; } } // check placement // force first target to be added // this will be removed when conal targetting is polished if(m_conal) { if(isWithinCone(&PTarget->loc.p)) { return true; } } else { if((m_findFlags & FINDFLAGS_UNLIMITED) || isWithinArea(&PTarget->loc.p)) { return true; } } return false; }
/* validEntity will check if the given entity can be targeted in the AoE. */ bool CTargetFind::validEntity(CBattleEntity* PTarget) { if (std::find(m_targets.begin(), m_targets.end(), PTarget) != m_targets.end()) { return false; } if (!(m_findFlags & FINDFLAGS_DEAD) && PTarget->isDead()) { return false; } if (m_PBattleEntity->StatusEffectContainer->GetConfrontationEffect() != PTarget->StatusEffectContainer->GetConfrontationEffect()) { return false; } if (m_PTarget == PTarget || PTarget->getZone() != m_zone || PTarget->IsNameHidden()) { return false; } // this is first target, always add him first if (m_PTarget == nullptr) { return true; } if (m_PTarget->allegiance != PTarget->allegiance) { return false; } // shouldn't add if target is charmed by the enemy if (PTarget->PMaster != nullptr) { if (m_findType == FIND_MONSTER_PLAYER){ if (PTarget->PMaster->objtype == TYPE_MOB){ return false; } } else if (m_findType == FIND_PLAYER_MONSTER){ if (PTarget->PMaster->objtype == TYPE_PC){ return false; } } else if (m_findType == FIND_MONSTER_MONSTER || m_findType == FIND_PLAYER_PLAYER){ return false; } } // check placement // force first target to be added // this will be removed when conal targetting is polished if (m_conal) { if (isWithinCone(&PTarget->loc.p)) { return true; } } else { if ((m_findFlags & FINDFLAGS_UNLIMITED) || isWithinArea(&PTarget->loc.p)) { return true; } } return false; }