|
|
@ -78,6 +78,12 @@ void Scenario::RunAI(Resources&enemy_resources,std::vector<std::shared_ptr<Colle |
|
|
|
geom2d::line<float>toCP2={cp2->pos,baseOfOperations.lock()->GetPos()}; |
|
|
|
geom2d::line<float>toCP2={cp2->pos,baseOfOperations.lock()->GetPos()}; |
|
|
|
return toCP1.length()<toCP2.length();}); |
|
|
|
return toCP1.length()<toCP2.length();}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int maxOfResources=enemy_resources.health; |
|
|
|
|
|
|
|
maxOfResources=std::max(maxOfResources,enemy_resources.atkSpd); |
|
|
|
|
|
|
|
maxOfResources=std::max(maxOfResources,enemy_resources.moveSpd); |
|
|
|
|
|
|
|
maxOfResources=std::max(maxOfResources,enemy_resources.procedure); |
|
|
|
|
|
|
|
maxOfResources=std::max(maxOfResources,enemy_resources.range); |
|
|
|
|
|
|
|
if(maxOfResources<10){ |
|
|
|
for(auto&cp:collectionPoints){ |
|
|
|
for(auto&cp:collectionPoints){ |
|
|
|
if(cp->attachedUnit.expired()){ |
|
|
|
if(cp->attachedUnit.expired()){ |
|
|
|
if(cpCheckTimer.count(cp.get())==0||cpCheckTimer[cp.get()]<=0){ |
|
|
|
if(cpCheckTimer.count(cp.get())==0||cpCheckTimer[cp.get()]<=0){ |
|
|
@ -93,6 +99,7 @@ void Scenario::RunAI(Resources&enemy_resources,std::vector<std::shared_ptr<Colle |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
for(auto&key:cpCheckTimer){ |
|
|
|
for(auto&key:cpCheckTimer){ |
|
|
|
cpCheckTimer[key.first]=std::max(0.0f,cpCheckTimer[key.first]-game.GetPGE()->GetElapsedTime()); |
|
|
|
cpCheckTimer[key.first]=std::max(0.0f,cpCheckTimer[key.first]-game.GetPGE()->GetElapsedTime()); |
|
|
|
} |
|
|
|
} |
|
|
|