Beispiel #1
0
 private void PlaceCombatant(SafeDictionary <ICombatant, IntVector2> locations, double x, double y, ICombatant comb)
 {
     // scramble all tile-filling combatants in rings around the largest
     if (comb.FillsCombatTile)
     {
         for (int r = 0; ; r++)
         {
             bool done  = false;
             var  tiles = IntVector2.AtRadius(r);
             foreach (var tile in tiles.Shuffle(Dice))
             {
                 var atHere = locations.Where(q => q.Key.FillsCombatTile && q.Value == tile);
                 if (!atHere.Any())
                 {
                     locations.Add(comb, new IntVector2((int)x + tile.X, (int)y + tile.Y));
                     done = true;
                     break;
                 }
             }
             if (done)
             {
                 break;
             }
         }
     }
     else             // put non-filling combatants in the center
     {
         locations.Add(comb, new IntVector2((int)x, (int)y));
     }
 }