-
Notifications
You must be signed in to change notification settings - Fork 1
/
subCard.java
156 lines (139 loc) · 5.47 KB
/
subCard.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import java.util.*;
import java.io.*;
class AttackCard extends Card{
protected int damage;
public AttackCard(String Name, String desc, int dmg){
super(Name,desc);
damage = dmg;
}
public void PlayCard(){
int targetpl = SelectTarget();
System.out.println("Played: " + this);
int targettilestatus =0;
if(!Game.getPlayers().get(targetpl).getImun()){
System.out.println("Player: " + targetpl + " mundur " + damage + " langkah");
targettilestatus = Game.getBoard().move(Game.getPlayers().get(targetpl), targetpl, damage*-1);
Game.getPlayers().get(targetpl).Attacked(damage);
if(targettilestatus==88){
Game.TrapTriggered(targetpl);
}
}
else{
System.out.println("Player " + targetpl + " terlindungi dari serangan");
}
}
public void PlayCard(int target){
System.out.println("Played: " + this);
if(!Game.getPlayers().get(target).getImun()){
System.out.println("Player: " + target + " mundur " + damage + " langkah");
int targettilestatus;
targettilestatus = Game.getBoard().move(Game.getPlayers().get(target), target, damage*-1);
Game.getPlayers().get(target).Attacked(damage);
if(targettilestatus==88){
Game.TrapTriggered(target);
}
}
else{
System.out.println("Player " + target + " terlindungi dari serangan");
}
}
}
class BoostCard extends Card{
private int damage;
public BoostCard(String Name, String desc, int dmg){
super(Name,desc);
damage = dmg;
}
public void PlayCard(){
System.out.println("Played: " + this);
System.out.println("Karakter anda maju " + damage + " langkah");
int targettilestatus = Game.getBoard().move(Game.getCurrentPlayer(), Game.getCurrentPlayerIdx(), damage);
Game.getCurrentPlayer().Boost(damage);
if(targettilestatus==88){
Game.TrapTriggered(Game.getCurrentPlayerIdx());
}
}
}
class StopCard extends Card{
protected int damage;
public StopCard(String Name, String desc, int dmg){
super(Name,desc);
damage = dmg;
}
public void PlayCard(){
int targetpl = SelectTarget();
System.out.println("Played: " + this);
if(!Game.getPlayers().get(targetpl).getImun()){
System.out.println("Player " + targetpl + " berhenti " + damage + " putaran");
Game.getPlayers().get(targetpl).Stopped(damage);
}
else{
System.out.println("Player " + targetpl + " terlindungi dari serangan");
}
}
public void PlayCard(int targetpl){
System.out.println("Played: " + this);
if(!Game.getPlayers().get(targetpl).getImun()){
System.out.println("Player " + targetpl + " berhenti " + damage + " putaran");
Game.getPlayers().get(targetpl).Stopped(damage);
}
else{
System.out.println("Player " + targetpl + " terlindungi dari serangan");
}
}
}
class TrapSetCard extends Card{
public TrapSetCard(String Name, String desc){
super(Name,desc);
}
public void PlayCard(){
System.out.println("Played: " + this);
System.out.println("Satu petak di belakang anda menjadi petak perangkap");
if(!Game.getPlayers().get(Game.getCurrentPlayerIdx()).getImun()){
if(Game.getPlayers().get(Game.getCurrentPlayerIdx()).getPosition()==0){
Game.getBoard().setTrap(41);
}
else{
Game.getBoard().setTrap(Game.getPlayers().get(Game.getCurrentPlayerIdx()).getPosition()-1);
}
}
}
}
class DisarmCard extends Card{
protected int damage;
public DisarmCard(String Name, String desc, int dmg){
super(Name,desc);
damage = dmg;
}
public void PlayCard(){
int targetpl = SelectTarget();
System.out.println("Played: " + this);
if(!Game.getPlayers().get(targetpl).getImun()){
System.out.println("Player " + targetpl + " membuang 1 kartunya secara random");
Random index = new Random();
for (int i = 0; i < damage; i++)
{
int pil = index.nextInt(Game.getPlayers().get(targetpl).getHand().getSize());
Game.getPlayers().get(targetpl).getHand().Discard(pil);
}
}
else{
System.out.println("Player " + targetpl + " terlindungi dari serangan");
}
}
public void PlayCard(int targetpl){
System.out.println("Played: " + this);
if(!Game.getPlayers().get(targetpl).getImun()){
System.out.println("Player " + targetpl + " membuang 1 kartunya secara random");
Random index = new Random();
for (int i = 0; i < damage; i++)
{
int pil = index.nextInt(Game.getPlayers().get(targetpl).getHand().getSize());
Game.getPlayers().get(targetpl).getHand().Discard(pil);
}
}
else{
System.out.println("Player " + targetpl + " terlindungi dari serangan");
}
}
}