@@ -1310,8 +1310,8 @@ private static void AddBarbarianCamps(WorldCharacteristics wc, GameMap m) {
13101310 ++ landTiles ;
13111311 }
13121312 }
1313- int totalPossibleBarbCamps = landTiles / 100 ;
1314- // TODO: Update this based on barbarian activity.
1313+
1314+ int totalPossibleBarbCamps = DeriveTotalPossibleBarbCamps ( wc , landTiles ) ;
13151315
13161316 int numCamps = 0 ;
13171317 for ( int i = 0 ; i < tileIndicies . Count && numCamps < totalPossibleBarbCamps ; ++ i ) {
@@ -1324,6 +1324,32 @@ private static void AddBarbarianCamps(WorldCharacteristics wc, GameMap m) {
13241324 }
13251325 }
13261326
1327+ /// <summary>
1328+ /// Apply barbarian activity level to barbarian camp spawn rate. Currently NOT based on Civ3 values.
1329+ /// TODO: Make configurable
1330+ /// TODO: Determine what these values are in Civ3
1331+ /// </summary>
1332+ private static int DeriveTotalPossibleBarbCamps ( WorldCharacteristics wc , int landTiles )
1333+ {
1334+ var totalCampsBaseline = landTiles / 100 ;
1335+ switch ( wc . barbarianActivity )
1336+ {
1337+ case BarbarianActivity . None :
1338+ return 0 ;
1339+ case BarbarianActivity . Sedentary :
1340+ return totalCampsBaseline ;
1341+ case BarbarianActivity . Roaming :
1342+ return totalCampsBaseline ;
1343+ case BarbarianActivity . Restless :
1344+ return ( int ) Math . Round ( totalCampsBaseline * 1.25 ) ; // extra 25%
1345+ case BarbarianActivity . Raging :
1346+ return ( int ) Math . Round ( totalCampsBaseline * 1.50 ) ; // extra 50%
1347+ default :
1348+ log . Warning ( "Unknown Barbarian Activity at barb camps derivation." ) ;
1349+ return totalCampsBaseline ;
1350+ }
1351+ }
1352+
13271353 private static bool IsValidForBarbarianCamp ( WorldCharacteristics wc , GameMap m , Tile t ) {
13281354 // No barbarian camps on water, volcanos, or mountains.
13291355 if ( ! t . IsLand ( ) || t == Tile . NONE || t . overlayTerrainType . Key == "volcano" || t . overlayTerrainType . Key == "mountains" ) {
0 commit comments