-
Notifications
You must be signed in to change notification settings - Fork 0
/
Prison.java
59 lines (56 loc) · 2.37 KB
/
Prison.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
public class Prison extends Property{
public Prison() {
super("Prison", 13);
}
public void prison(Player currentPlayer) {
System.out.println("You are in prison");
do {
Continue = true;
System.out.println("1-release by chanceCard 2-stay 3-pay 50 $ to release");
switch (input.nextInt()) {
case 1:
if (currentPlayer.getChanceToRelease() >= 1) {
currentPlayer.setChanceToRelease(currentPlayer.getChanceToRelease() - 1);
currentPlayer.setIndex(currentPlayer.getIndex()+1);
break;
} else {
System.out.println("You do not have enough card!");
Continue = false;
}
break;
case 2:
if (currentPlayer.getBalance() < 10) {
System.out.println("You do not have enough money to pay");
System.out.println("1- sell property 2- return");
if (input.nextInt() == 1) {
currentPlayer.sellProperty();
currentPlayer.lowBalance = true;
} else {
Continue = false;
}
break;
} else
currentPlayer.addBalance(-10);
break;
case 3:
if (currentPlayer.getBalance() < 50) {
System.out.println("You do not have enough money to pay");
System.out.println("1- Use another option 2-sell property");
switch (input.nextInt()) {
case 1:
Continue = false;
break;
case 2:
currentPlayer.lowBalance = true;
currentPlayer.sellProperty();
break;
}
} else {
currentPlayer.addBalance(-50);
currentPlayer.setIndex(currentPlayer.getIndex()+1);
}
break;
}
} while (!Continue);
}
}