X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Fplanet.cpp;h=c374a99ff9cc7f726fd18392cad21aeb0890a5b2;hp=443b3b13695a31c2ba7d71854750acfcc2bd3241;hb=bd23b35be6c105946c9ecf87785f409f69a24714;hpb=8589e08e508806885b737682ed25b6f711d0fdee diff --git a/bs/planet.cpp b/bs/planet.cpp index 443b3b1..c374a99 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -144,6 +144,7 @@ void Planet::runBattle(std::vector friendly, std::vector hostile allFriends.distributeLossesGains(friends, tick); allHostiles.distributeLossesGains(hostiles, tick); + allHostiles.distributeCappedRoids(hostiles, tick); /* for (RoidList::iterator i = m_Roids.begin(); i != m_Roids.end(); ++i) setRoids(i->first, roids(i->first, 1), tick);*/ @@ -192,38 +193,41 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::mapscore() / 10; - - cerr << "Capping is: " << capping << endl; - - if (capping > 0.15) - capping = 0.15; - if (capping <= 0) - break; - - for (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid) + if (m_iScore > 0) { - int caproids = capping * 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); - - hostiletemp->killFleet(unittype, caproids, 1); - int totroids = caproids + hostiletemp->resource(roid->first, 0); - hostiletemp->setResource(roid->first, totroids, 1); - - cerr << totroids << " stolen " << roid->first << " roids\n"; + float capping = float(m_iScore) / hostile->score() / 10; + + cerr << "Capping is: " << capping << endl; + + if (capping > 0.15) + capping = 0.15; + if (capping > 0) + { + for (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid) + { + int caproids = capping * 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.. + 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"; + } + } } }