LPCHARACTER FindVictim(LPCHARACTER pkChr, int iMaxDistance) { FuncFindMobVictim f(pkChr, iMaxDistance); if (pkChr->GetSectree() != NULL) { pkChr->GetSectree()->ForEachAround(f); } return f.GetVictim(); }
bool battle_is_attackable(LPCHARACTER ch, LPCHARACTER victim) { // 상대방이 죽었으면 중단한다. if (victim->IsDead()) return false; // 안전지대면 중단 { SECTREE *sectree = NULL; sectree = ch->GetSectree(); if (sectree && sectree->IsAttr(ch->GetX(), ch->GetY(), ATTR_BANPK)) return false; sectree = victim->GetSectree(); if (sectree && sectree->IsAttr(victim->GetX(), victim->GetY(), ATTR_BANPK)) return false; } // 내가 죽었으면 중단한다. if (ch->IsStun() || ch->IsDead()) return false; if (ch->IsPC() && victim->IsPC()) { CGuild* g1 = ch->GetGuild(); CGuild* g2 = victim->GetGuild(); if (g1 && g2) { if (g1->UnderWar(g2->GetID())) return true; } } if (IS_CASTLE_MAP(ch->GetMapIndex()) && false==castle_can_attack(ch, victim)) return false; if (CArenaManager::instance().CanAttack(ch, victim) == true) return true; return CPVPManager::instance().CanAttack(ch, victim); }