public void TestThatIntersectionCanGetAndSetPlayerWhoOwnsIt() { Player player = new Player(); Intersection intersection = new Intersection(new Point(2, 2)); intersection.setPlayer(player); Assert.AreEqual(player, intersection.getPlayer()); }
public Connection(Intersection rightOrBot, Intersection leftOrTop) { connectedToRightOrBot = rightOrBot; connectedToLeftOrTop = leftOrTop; built = false; roadColor = Color.White; }
public void TestThatPortAddsIntersection() { var port = new Port("Ore", 2); var intersection = new Intersection(new Point(3, 3), port); port.addIntersection(intersection); Assert.AreEqual(intersection, port.getIntersections().ElementAt(0)); }
public void TestThatRoadColorGetsSet() { Intersection i = new Intersection(new Point(1, 1)); Intersection i2 = new Intersection(new Point(1, 2)); Connection c = new Connection(i, i2); c.setRoadColor(Color.HotPink); Assert.AreEqual(Color.HotPink, c.getRoadColor()); }
public void TestIfIntersectionHasPort() { var target = new Intersection(new Point(4, 4)); Assert.False(target.hasPort()); target = new Intersection(new Point(4, 4), new Port("Ore", 2)); Assert.True(target.hasPort()); }
public void TestThatResourcesAreGeneratedBasedOnSettlementOrCity() { Intersection intersection = new Intersection(new Point(2, 2)); Assert.AreEqual(0, intersection.getNumOfResourcesToGenerate()); intersection.build(Global_Variables.GAME_PIECE.SETTLEMENT); Assert.AreEqual(1, intersection.getNumOfResourcesToGenerate()); intersection.build(Global_Variables.GAME_PIECE.CITY); Assert.AreEqual(2, intersection.getNumOfResourcesToGenerate()); }
private void initMap() { for (int r = 0; r < 6; r++) { for (int c = 0; c < 11; c++) { // 3:1 ports if ((r == 0 && (c == 2 || c == 3)) || (r == 1 && (c == 8 || c == 9)) || ((r == 2 || r == 3) && c == 10) || (r == 5 && (c == 2 || c == 3))) { map[r, c] = new Intersection(new Point(r, c), new Port("Anything", 3)); } // Resource ports else if (r == 0 && (c == 5 || c == 6)) { map[r, c] = new Intersection(new Point(r, c), new Port("Wool", 2)); } else if ((r == 1 || r == 2) && c == 1) { map[r, c] = new Intersection(new Point(r, c), new Port("Ore", 2)); } else if ((r == 3 || r == 4) && c == 1) { map[r, c] = new Intersection(new Point(r, c), new Port("Grain", 2)); } else if (r == 4 && (c == 8 || c == 9)) { map[r, c] = new Intersection(new Point(r, c), new Port("Brick", 2)); } else if (r == 5 && (c == 5 || c == 6)) { map[r, c] = new Intersection(new Point(r, c), new Port("Lumber", 2)); } // An intersection that doesn't have any ports else { map[r, c] = new Intersection(new Point(r, c)); } } } }
public void addIntersection(Intersection i) { this.ints.Add(i); }
private void giveAllResourcesForThisIntersection(Intersection intersection, bool isItBeginningOfTheGame) { Hand hand = intersection.getPlayer().getHand(); int amount = intersection.getNumOfResourcesToGenerate(); foreach (Hex h in intersection.resourceHexes) { try { if (isItBeginningOfTheGame || h.getToken() == currentRoll) { if (h != this.robberHex) { this.dealFromBank(h.getResourceType(), amount, hand); // hand.modifyResources(h.getResourceType(), amount); } } } catch (NullReferenceException) { // Do nothing } } }