Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehrMSP committed May 6, 2019
2 parents ca52a80 + 8047679 commit f94e8a9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/models/Deck.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,12 @@ public boolean hasCard(int cardID) {
}

public boolean isValid() {

return this.cards.size() == CARD_CAPACITY && this.getHero() != null;
}

public Deck getCopy() {
YaGson yaGson = new YaGson();
String json = yaGson.toJson(this);
Deck newDeck = yaGson.fromJson(json, this.getClass());
String json = new YaGson().toJson(this);
Deck newDeck = new YaGson().fromJson(json, this.getClass());
return newDeck;
}
}
2 changes: 1 addition & 1 deletion src/models/Initializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private static void addMinions(ArrayList<Card> cards) {
.setTargetSociety(new OneUnit(TargetType.MINION, TargetTeam.FRIEND, TargetAttackType.ANY))
.addBuff(new Buff.BuffBuilder()
.setDeltaHP(10)
.setDuration(Buff.INFINITY)
.setHalfTurnDuration()
.create())
.create())
.setAttackType(new Ranged(3))
Expand Down
2 changes: 1 addition & 1 deletion src/models/artificialIntelligence/AIPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private Cell getNearestCell(ArrayList<Cell> cells, Cell cell) {
int distance = 123; //just for sure!!
Cell resultCell = null;
for (Cell cell1 : cells) {
if (Table.getDistance(cell1, cell) < distance) {
if (Table.getDistance(cell1, cell) < distance && !cell1.hasUnit()) {
distance = Table.getDistance(cell1, cell);
resultCell = cell1;
}
Expand Down
5 changes: 2 additions & 3 deletions src/models/item/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ public String getDescription() {
public abstract void use(Player player, Cell cell);

public Item getCopy(boolean setCollectionID) {
YaGson yaGson = new YaGson();
String json = yaGson.toJson(this);
Item newItem = yaGson.fromJson(json, this.getClass());
String json = new YaGson().toJson(this);
Item newItem = new YaGson().fromJson(json, this.getClass());
if (setCollectionID) {
newItem.collectionID = UniqueIDGenerator.getCollectionUniqueID();
}
Expand Down

0 comments on commit f94e8a9

Please sign in to comment.