mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Merge branch 'magefree/master'
This commit is contained in:
commit
3ac80b45f3
45 changed files with 338 additions and 62 deletions
|
|
@ -24,15 +24,13 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if permanent was paid tribute to as it entered the battlefield
|
||||
*
|
||||
|
|
@ -42,7 +40,8 @@ public class TributeNotPaidCondition implements Condition {
|
|||
|
||||
private static TributeNotPaidCondition fInstance = null;
|
||||
|
||||
private TributeNotPaidCondition() {}
|
||||
private TributeNotPaidCondition() {
|
||||
}
|
||||
|
||||
public static Condition getInstance() {
|
||||
if (fInstance == null) {
|
||||
|
|
@ -53,9 +52,9 @@ public class TributeNotPaidCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Object tribute = game.getState().getValue(new StringBuilder("tributeValue").append(source.getSourceId()).toString());
|
||||
Object tribute = game.getState().getValue("tributeValue" + source.getSourceId());
|
||||
if (tribute != null) {
|
||||
return ((String)tribute).equals("no");
|
||||
return ((String) tribute).equals("no");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import java.util.Iterator;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
|
|
@ -110,7 +109,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
|
||||
@Override
|
||||
public Card getRandom(Game game) {
|
||||
if (this.size() == 0) {
|
||||
if (this.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
UUID[] cards = this.toArray(new UUID[this.size()]);
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -52,6 +52,7 @@ import mage.util.RandomUtil;
|
|||
*/
|
||||
public class Library implements Serializable {
|
||||
|
||||
private static Random rnd = new Random();
|
||||
private boolean emptyDraw;
|
||||
private final Deque<UUID> library = new ArrayDeque<>();
|
||||
private final UUID playerId;
|
||||
|
|
@ -74,7 +75,7 @@ public class Library implements Serializable {
|
|||
public void shuffle() {
|
||||
UUID[] shuffled = library.toArray(new UUID[0]);
|
||||
for (int n = shuffled.length - 1; n > 0; n--) {
|
||||
int r = RandomUtil.nextInt(n);
|
||||
int r = rnd.nextInt(n);
|
||||
UUID temp = shuffled[n];
|
||||
shuffled[n] = shuffled[r];
|
||||
shuffled[r] = temp;
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||
*/
|
||||
public class RandomUtil {
|
||||
|
||||
private static ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
private final static ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
public static Random getRandom(){
|
||||
public static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
|
||||
public static int nextInt(){
|
||||
public static int nextInt() {
|
||||
return random.nextInt();
|
||||
}
|
||||
|
||||
public static int nextInt(int max){
|
||||
public static int nextInt(int max) {
|
||||
return random.nextInt(max);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue