mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Minor formatting.
This commit is contained in:
parent
21e88c1ce3
commit
140bf42f60
1 changed files with 9 additions and 5 deletions
|
@ -87,15 +87,17 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Card get(UUID cardId, Game game) {
|
public Card get(UUID cardId, Game game) {
|
||||||
if (this.contains(cardId))
|
if (this.contains(cardId)) {
|
||||||
return game.getCard(cardId);
|
return game.getCard(cardId);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Card card) {
|
public void remove(Card card) {
|
||||||
if (card == null)
|
if (card == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this.remove(card.getId());
|
this.remove(card.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +111,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Card getRandom(Game game) {
|
public Card getRandom(Game game) {
|
||||||
if (this.size() == 0)
|
if (this.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
UUID[] cards = this.toArray(new UUID[0]);
|
UUID[] cards = this.toArray(new UUID[0]);
|
||||||
return game.getCard(cards[rnd.nextInt(cards.length)]);
|
return game.getCard(cards[rnd.nextInt(cards.length)]);
|
||||||
}
|
}
|
||||||
|
@ -118,9 +121,10 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
@Override
|
@Override
|
||||||
public int count(FilterCard filter, Game game) {
|
public int count(FilterCard filter, Game game) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (UUID card: this) {
|
for (UUID cardId: this) {
|
||||||
if (filter.match(game.getCard(card), game))
|
if (filter.match(game.getCard(cardId), game)) {
|
||||||
result++;
|
result++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue