- int caproids = capping * roids->second[0];
- int freepods = hostiletemp->freeFleet(unittype, 1);
-
- if (freepods == 0)
- break;
- if (freepods < caproids)
- caproids = caproids - freepods;
-
- roids->second.push_back(roids->second[0] - caproids);
- hostiletemp->killFleet(unittype, caproids, 1);
+ setCapping(float(planetScore(tick - 1)) / hostile->score() / 10, tick);
+
+ cerr << "Capping is: " << capping(tick) << endl;
+
+ if (capping(tick) > 0)
+ {
+ for (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid)
+ {
+ int caproids = capping(tick) * roids(roid->first, tick - 1);
+ int freepods = hostiletemp->freeFleet(unittype, 1);
+
+ cerr << "Possible to steal " << caproids << " " << roid->first << " roids\n";
+ cerr << freepods << " free pods available\n";
+
+ if (freepods <= 0)
+ break;
+ if (freepods < caproids)
+ caproids = freepods;
+
+ cerr << caproids << " roids stolen\n";
+
+ takeRoids(roid->first, caproids, tick);
+
+ //FIXME: Going to move this to the distribute roids section instead.. Not really move, I'll keep this, but "regenerate" the pods in the distribute ships function.
+ hostiletemp->killFleet(unittype, caproids, 1);
+ //int totroids = caproids + hostiletemp->resource(roid->first, 0);
+ hostiletemp->addResource(roid->first, caproids, 1);
+
+ cerr << caproids << " stolen " << roid->first << " roids\n";
+ }
+ }