1
This commit is contained in:
parent
f7f8dcbc57
commit
4876f68369
@ -507,5 +507,31 @@ void HeroAI::UpdateSweepMine()
|
|||||||
|
|
||||||
RoomObstacle* HeroAI::FindObstacleTarget()
|
RoomObstacle* HeroAI::FindObstacleTarget()
|
||||||
{
|
{
|
||||||
return nullptr;
|
Hero* myself = (Hero*)owner;
|
||||||
|
RoomObstacle* target = nullptr;
|
||||||
|
if (!myself->master.Get()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& pair : myself->room->mine_objects) {
|
||||||
|
if (pair.second.Get() &&
|
||||||
|
!pair.second.Get()->IsDead(myself->room) &&
|
||||||
|
(pair.second.Get()->meta->sweep_tags & ai_meta->bits_param2) != 0) {
|
||||||
|
if (pair.second.Get()->GetTeamId(myself->room) == myself->master.Get()->team_id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (target) {
|
||||||
|
if (myself->GetPos().ManhattanDistance(target->GetPos()) >
|
||||||
|
myself->GetPos().ManhattanDistance(pair.second.Get()->GetPos())) {
|
||||||
|
target = pair.second.Get();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
target = pair.second.Get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (target && target->GetPos().Distance(myself->GetPos()) > ai_meta->int_param2) {
|
||||||
|
target = nullptr;
|
||||||
|
}
|
||||||
|
return target;
|
||||||
}
|
}
|
||||||
|
@ -1170,6 +1170,14 @@ namespace MetaData
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i->ai_kind() == kAI_MineSweeper) {
|
||||||
|
for (int n : int_list_param2) {
|
||||||
|
if (n <= 0 || n > 63) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
a8::SetBitFlag(bits_param2, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AI::Init2()
|
void AI::Init2()
|
||||||
|
@ -317,6 +317,8 @@ namespace MetaData
|
|||||||
std::set<int> int_set_param4;
|
std::set<int> int_set_param4;
|
||||||
std::set<int> int_set_param5;
|
std::set<int> int_set_param5;
|
||||||
|
|
||||||
|
long long bits_param2 = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::tuple<int, int> random_move_idle_time_;
|
std::tuple<int, int> random_move_idle_time_;
|
||||||
std::tuple<int, int> random_move_time_;
|
std::tuple<int, int> random_move_time_;
|
||||||
|
@ -407,6 +407,9 @@ void RoomObstacle::Die(Room* room)
|
|||||||
if (!IsDead(room)) {
|
if (!IsDead(room)) {
|
||||||
Obstacle::Die(room);
|
Obstacle::Die(room);
|
||||||
DetachFromMaster();
|
DetachFromMaster();
|
||||||
|
if (meta->sweep_tags != 0) {
|
||||||
|
room->mine_objects.erase(GetUniId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user