Skip to content

Commit

Permalink
sup
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Hill committed Mar 30, 2017
1 parent 0e74032 commit 0a2ab88
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 26 deletions.
Binary file modified bin/controller/Cashflow.class
Binary file not shown.
58 changes: 41 additions & 17 deletions src/controller/Cashflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,13 @@ public static void main(String[] args)
/*
* Just testing stuff in here for now. Main method will call the go() method when game is built
*/
BigDealStack ms = new BigDealStack();
int initialSize = ms.getSize();
for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}


System.out.println("Just popped: " + ms.pop().getTitle());

for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}
testCards();


}



public void go()
{
// Joe
Expand Down Expand Up @@ -82,5 +69,42 @@ public boolean isWinner()
}
}


public static void testCards()
{
BigDealStack ms = new BigDealStack();
int initialSize = ms.getSize();
for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}


System.out.println("Just popped: " + ms.pop().getTitle());

for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}


}

}
















10 changes: 7 additions & 3 deletions src/model/DealTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public void buyIncomeProperty(Player p, DealCard d)
{
FinancialStatement f = p.getFinancialStatement();

f.increaseCashBalance(-d.getDownPayment()); // Watch out for negatives
f.increasePassiveIncome(d.getCashFlowChange());

OwnedRealEstate newProperty = new OwnedRealEstate(d.getTitle(), d.getCost(), d.getDownPayment());
f.addProperty(newProperty);

// Add functionality in this ^^ to do this:

//f.increaseCashBalance(-d.getDownPayment()); // Watch out for negatives
//f.increasePassiveIncome(d.getCashFlowChange());


}

public void updateStockPrice(DealCard d)
Expand Down
12 changes: 6 additions & 6 deletions src/model/GameBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ public GameBoard()
}


// TODO This method will move the player and return true if they passed a payday along the way.
// TODO This method will move the player and returns the number of paydays they passed along the way.
// It also removes the player from the _players ArrayList of their initial tile and adds them to the
// arraylist of the tile they land on
public boolean movePlayer(Player p, int distance)
// arraylist of the tile they land on.
public int movePlayer(Player p, int distance)
{
int currentLocation = p.getLocation();
Node currentNode = _tiles.get(currentLocation);
Tile currentTile = _tiles.elementAt(currentLocation);
currentTile.removePlayer(p);
boolean passedPayday = false;
int passedPaydays = 0;
for(int i=0; i<distance; i++)
{
Node nextNode = currentNode.getNext();
if(nextNode.getData().getName().equals("Payday"))
{
passedPayday = true;
passedPaydays++;
}
currentNode = nextNode;
}
currentNode.getData().addPlayer(p);
p.setLocation(currentNode.getData().getBoardIndex());
return passedPayday;
return passedPaydays;
}


Expand Down

0 comments on commit 0a2ab88

Please sign in to comment.