diff --git a/olcCodeJam2023Entry/Scenario.cpp b/olcCodeJam2023Entry/Scenario.cpp index 8abc5dc..ed6c8c9 100644 --- a/olcCodeJam2023Entry/Scenario.cpp +++ b/olcCodeJam2023Entry/Scenario.cpp @@ -78,18 +78,25 @@ void Scenario::RunAI(Resources&enemy_resources,std::vectortoCP2={cp2->pos,baseOfOperations.lock()->GetPos()}; return toCP1.length()attachedUnit.expired()){ - if(cpCheckTimer.count(cp.get())==0||cpCheckTimer[cp.get()]<=0){ - for(auto&u:units){ - if(!u->IsFriendly()&&u->IsAllocator()&&u->attachTarget.expired()){ - //Tell this unit to move towards that collection point. - u->SetTargetCollectionPoint(cp,u); - break; + 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){ + if(cp->attachedUnit.expired()){ + if(cpCheckTimer.count(cp.get())==0||cpCheckTimer[cp.get()]<=0){ + for(auto&u:units){ + if(!u->IsFriendly()&&u->IsAllocator()&&u->attachTarget.expired()){ + //Tell this unit to move towards that collection point. + u->SetTargetCollectionPoint(cp,u); + break; + } } + //Hasn't been checked recently. + cpCheckTimer[cp.get()]=60; } - //Hasn't been checked recently. - cpCheckTimer[cp.get()]=60; } } } diff --git a/olcCodeJam2023Entry/pge.wasm b/olcCodeJam2023Entry/pge.wasm index 1fe0a84..40c0eab 100644 Binary files a/olcCodeJam2023Entry/pge.wasm and b/olcCodeJam2023Entry/pge.wasm differ