Merge upstream master

This commit is contained in:
Imagery-Wizard 2017-07-08 12:35:49 -04:00
commit ee2705a899
57 changed files with 2634 additions and 2583 deletions

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-common</artifactId>

View file

@ -40,8 +40,8 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
*/
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 23;
public final static String MAGE_VERSION_MINOR_PATCH = "V6";
public final static int MAGE_VERSION_PATCH = 24;
public final static String MAGE_VERSION_MINOR_PATCH = "V0";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-counter-plugin</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-plugins</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-deck-constructed</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-deck-limited</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-canadianhighlanderduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-commanderduel</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-commanderfreeforall</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-freeforall</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-momirduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-tinyleadersduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-game-twoplayerduel</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-ai-draftbot</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-ai-ma</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-ai</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-ai-mcts</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-aiminimax</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-player-human</artifactId>

View file

@ -50,7 +50,7 @@ public class PlayerResponse implements Serializable {
}
public String toString() {
return new StringBuilder(responseString)
return new StringBuilder((responseString == null) ? "null" : responseString)
.append(',')
.append(responseUUID)
.append(',')

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-tournament-boosterdraft</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-tournament-constructed</artifactId>

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-server-plugins</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-tournament-sealed</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-server-plugins</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-server</artifactId>

View file

@ -129,9 +129,7 @@ public class ChatSession {
clientsToRemove.add(userId);
}
}
for (UUID userIdToRemove : clientsToRemove) {
clients.remove(userIdToRemove);
}
clients.keySet().removeAll(clientsToRemove);
}
}

View file

@ -46,6 +46,7 @@ import mage.game.Table;
import mage.game.events.Listener;
import mage.game.events.PlayerQueryEvent;
import mage.game.events.TableEvent;
import mage.game.match.MatchPlayer;
import mage.game.permanent.Permanent;
import mage.interfaces.Action;
import mage.players.Player;
@ -65,7 +66,6 @@ import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.*;
import java.util.zip.GZIPOutputStream;
import mage.game.match.MatchPlayer;
/**
* @author BetaSteward_at_googlemail.com
@ -108,12 +108,7 @@ public class GameController implements GameCallback {
this.tableId = tableId;
this.choosingPlayerId = choosingPlayerId;
this.gameOptions = gameOptions;
for (Player player : game.getPlayers().values()) {
if (!player.isHuman()) {
useTimeout = false; // no timeout for AI players because of beeing idle
break;
}
}
useTimeout = game.getPlayers().values().stream().allMatch(Player::isHuman);
init();
}
@ -832,13 +827,8 @@ public class GameController implements GameCallback {
}
final String message = new StringBuilder(game.getStep().getType().toString()).append(" - Waiting for ").append(controller.getName()).toString();
for (final Entry<UUID, GameSessionPlayer> entry : gameSessions.entrySet()) {
boolean skip = false;
for (UUID uuid : players) {
if (entry.getKey().equals(uuid)) {
skip = true;
break;
}
}
boolean skip = players.stream().anyMatch(playerId -> entry.getKey().equals(playerId));
if (!skip) {
entry.getValue().inform(message);
}

View file

@ -7,7 +7,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -46,7 +46,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.CrestedSunmareToken;
import mage.watchers.common.PlayerGainedLifeWatcher;
/**
@ -56,6 +56,7 @@ import mage.watchers.common.PlayerGainedLifeWatcher;
public class CrestedSunmare extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Horses you control");
static {
filter.add(new SubtypePredicate(SubType.HORSE));
}
@ -88,15 +89,3 @@ public class CrestedSunmare extends CardImpl {
return new CrestedSunmare(this);
}
}
class CrestedSunmareToken extends Token {
CrestedSunmareToken() {
super("Horse", "5/5 white Horse creature token");
power = new MageInt(5);
toughness = new MageInt(5);
color.setWhite(true);
subtype.add("Horse");
cardType.add(CardType.CREATURE);
}
}

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -41,7 +41,6 @@ import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetOpponent;
@ -58,9 +57,9 @@ public class Doomfall extends CardImpl {
this.getSpellAbility().getModes().setMinModes(1);
this.getSpellAbility().getModes().setMaxModes(1);
// Target player exiles a creature he or she controls.
// Target opponent exiles a creature he or she controls.
this.getSpellAbility().addEffect(new DoomfallEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new TargetOpponent());
// Target opponent reveals his or her hand. You choose a nonland card from it. Exile that card.
Mode mode = new Mode();
@ -103,7 +102,7 @@ class DoomfallEffect extends OneShotEffect {
Target target = new TargetControlledCreaturePermanent();
target.setNotTarget(true);
if (targetPlayer.choose(outcome, target, source.getSourceId(), game)) {
targetPlayer.moveCards(game.getCard(target.getFirstTarget()), Zone.EXILED, source, game);
targetPlayer.moveCards(game.getPermanent(target.getFirstTarget()), Zone.EXILED, source, game);
}
return true;
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -45,8 +46,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author Plopman
@ -54,18 +53,20 @@ import java.util.UUID;
public class Duplicant extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
public Duplicant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
this.subtype.add("Shapeshifter");
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Imprint - When Duplicant enters the battlefield, you may exile target nontoken creature.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(), true, "<i>Imprint - </i>");
Ability ability = new EntersBattlefieldTriggeredAbility(new DuplicantExileTargetEffect(), true, "<i>Imprint - </i>");
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
// As long as the exiled card is a creature card, Duplicant has that card's power, toughness, and creature types. It's still a Shapeshifter.
@ -81,20 +82,20 @@ public class Duplicant extends CardImpl {
return new Duplicant(this);
}
}
class ExileTargetEffect extends OneShotEffect {
class DuplicantExileTargetEffect extends OneShotEffect {
public ExileTargetEffect() {
public DuplicantExileTargetEffect() {
super(Outcome.Exile);
}
public ExileTargetEffect(final ExileTargetEffect effect) {
public DuplicantExileTargetEffect(final DuplicantExileTargetEffect effect) {
super(effect);
}
@Override
public ExileTargetEffect copy() {
return new ExileTargetEffect(this);
public DuplicantExileTargetEffect copy() {
return new DuplicantExileTargetEffect(this);
}
@Override
@ -102,7 +103,7 @@ class ExileTargetEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
Permanent sourcePermananent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if(sourcePermananent != null){
if (sourcePermananent != null) {
sourcePermananent.imprint(permanent.getId(), game);
sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append(']').toString(), game);
}
@ -118,7 +119,6 @@ class ExileTargetEffect extends OneShotEffect {
}
}
class DuplicantContinuousEffect extends ContinuousEffectImpl {
public DuplicantContinuousEffect() {
@ -128,7 +128,7 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
public DuplicantContinuousEffect(final DuplicantContinuousEffect effect) {
super(effect);
}
}
@Override
public DuplicantContinuousEffect copy() {
@ -139,10 +139,9 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if(!permanent.getImprinted().isEmpty()){
if (!permanent.getImprinted().isEmpty()) {
Card card = game.getCard(permanent.getImprinted().get(0));
if(card != null && card.isCreature())
{
if (card != null && card.isCreature()) {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
@ -152,14 +151,13 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
break;
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
permanent.getPower().setValue(card.getPower().getValue());
permanent.getToughness().setValue(card.getToughness().getValue());
permanent.getPower().setValue(card.getPower().getValue());
permanent.getToughness().setValue(card.getToughness().getValue());
}
}
return true;
}
}

View file

@ -43,6 +43,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
@ -55,6 +56,7 @@ public class HourOfGlory extends CardImpl {
// Exile target creature. If that creature was a God, its controller reveals his or her hand and exiles all cards with the same name as that creature.
this.getSpellAbility().addEffect(new HourOfGloryEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public HourOfGlory(final HourOfGlory card) {

View file

@ -142,7 +142,6 @@ class ImminentDoomEffect extends OneShotEffect {
Effect effect = new DamageTargetEffect((int) game.getState().getValue("ImminentDoomCount" + source.getSourceId().toString()));
effect.apply(game, source);
imminentDoom.addCounters(CounterType.DOOM.createInstance(), source, game);
game.getState().setValue("ImminentDoomCount" + source.getSourceId().toString(), 0); // reset to 0 to avoid any silliness
return true;
}
return false;

View file

@ -139,14 +139,21 @@ class SolemnityEffect2 extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ADD_COUNTER;
return event.getType() == EventType.ADD_COUNTER || event.getType() == EventType.ADD_COUNTERS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
MageObject object = game.getObject(event.getTargetId());
if (object instanceof Permanent && filter.match((Permanent) object, game)) {
return true;
Permanent permanent = game.getPermanentEntering(event.getSourceId());
if (object != null && object instanceof Permanent) {
if (filter.match((Permanent) object, game)) {
return true;
}
} else if (permanent != null) {
if (filter.match(permanent, game)) {
return true;
}
}
return false;
}

View file

@ -36,6 +36,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -61,7 +62,7 @@ public class SunsetPyramid extends CardImpl {
this.addAbility(ability);
// {2}, {T}: Scry 1.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(1), new GenericManaCost(2));
ability2.addCost(new TapSourceCost());
this.addAbility(ability2);

View file

@ -36,7 +36,12 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -94,7 +99,10 @@ class TormentOfVenomEffect extends OneShotEffect {
int permanents = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_NON_LAND, controllingPlayer.getId(), game);
if (permanents > 0 && controllingPlayer.chooseUse(outcome, "Sacrifices a nonland permanent?",
"Otherwise you have to discard a card or lose 3 life.", "Sacrifice", "Discard or life loss", source, game)) {
Target target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND);
FilterPermanent filter = new FilterControlledPermanent("another nonland permanent");
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
filter.add(Predicates.not(new PermanentIdPredicate(targetCreature.getId())));
Target target = new TargetPermanent(filter);
if (controllingPlayer.choose(outcome, target, source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<groupId>org.mage</groupId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-tests</artifactId>

View file

@ -0,0 +1,43 @@
package org.mage.test.multiplayer;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
playerD = createPlayer(game, playerD, "PlayerD");
return game;
}
@Test
public void testMultiplayerAttackStinkdrinkerBanditTrigger(){
String pestermite = "Pestermite";
String stinkdrinker = "Stinkdrinker Bandit";
addCard(Zone.BATTLEFIELD, playerA, stinkdrinker);
addCard(Zone.BATTLEFIELD, playerA, pestermite, 1);
attack(1, playerA, pestermite, playerB);
attack(1, playerA, stinkdrinker, playerC);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPowerToughness(playerA, pestermite, 4, 2);
}
}

View file

@ -5,7 +5,7 @@
<parent>
<artifactId>mage-root</artifactId>
<groupId>org.mage</groupId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage-verify</artifactId>

View file

@ -6,7 +6,7 @@
<parent>
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
</parent>
<artifactId>mage</artifactId>

View file

@ -45,13 +45,10 @@ public enum DashedCondition implements Condition {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
for (Ability ability : card.getAbilities()) {
if (ability instanceof DashAbility) {
if (((DashAbility) ability).isActivated(source, game)) {
return true;
}
}
}
return card.getAbilities().stream()
.filter(a -> a instanceof DashAbility)
.anyMatch(d -> ((DashAbility)d).isActivated(source, game));
}
return false;
}

View file

@ -48,13 +48,9 @@ public enum EvokedCondition implements Condition {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
for (Ability ability: card.getAbilities()) {
if (ability instanceof EvokeAbility) {
if(((EvokeAbility) ability).isActivated(source, game)) {
return true;
}
}
}
return card.getAbilities().stream()
.filter(ab -> ab instanceof EvokeAbility)
.anyMatch(evoke -> ((EvokeAbility) evoke).isActivated(source, game));
}
return false;
}

View file

@ -27,13 +27,15 @@
*/
package mage.abilities.costs.mana;
import java.util.List;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.VariableCost;
import mage.game.Game;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author BetaSteward_at_googlemail.com
@ -63,14 +65,10 @@ public interface ManaCosts<T extends ManaCost> extends List<T>, ManaCost {
static ManaCosts<ManaCost> removeVariableManaCost(ManaCosts<ManaCost> m) {
ManaCosts<ManaCost> manaCosts = new ManaCostsImpl<>();
for(ManaCost manaCost : m){
if(!(manaCost instanceof VariableManaCost)){
manaCosts.add(manaCost);
return m.stream()
.filter(mc -> !(mc instanceof VariableManaCost))
.collect(Collectors.toCollection(ManaCostsImpl<ManaCost>::new));
}
}
return manaCosts;
}
}

View file

@ -18,11 +18,7 @@ public class DiscardCostCardConvertedMana implements DynamicValue {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof DiscardTargetCost) {
DiscardTargetCost discardCost = (DiscardTargetCost) cost;
int cmc = 0;
for (Card card : discardCost.getCards()) {
cmc += card.getConvertedManaCost();
}
return cmc;
return discardCost.getCards().stream().mapToInt(Card::getConvertedManaCost).sum();
}
}
return 0;

View file

@ -6,7 +6,6 @@ import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author LevelX2
@ -18,11 +17,8 @@ public class SacrificeCostCreaturesPower implements DynamicValue {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
int powerSum = 0;
for (Permanent permanent : sacrificeCost.getPermanents()) {
powerSum += permanent.getPower().getValue();
}
return powerSum;
return sacrificeCost.getPermanents()
.stream().mapToInt(p -> p.getPower().getValue()).sum();
}
}
return 0;

View file

@ -6,7 +6,6 @@ import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author LevelX2
@ -18,11 +17,7 @@ public class SacrificeCostCreaturesToughness implements DynamicValue {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
int toughnessSum = 0;
for (Permanent permanent : sacrificeCost.getPermanents()) {
toughnessSum += permanent.getToughness().getValue();
}
return toughnessSum;
return sacrificeCost.getPermanents().stream().mapToInt(p -> p.getToughness().getValue()).sum();
}
}
return 0;

View file

@ -27,10 +27,6 @@
*/
package mage.abilities.keyword;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.StaticAbility;
@ -56,6 +52,11 @@ import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
/*
* 702.77. Conspire
* 702.77a Conspire is a keyword that represents two abilities.
@ -165,7 +166,7 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional
if (conspireCost.canPay(ability, getSourceId(), getControllerId(), game)
&& player.chooseUse(Outcome.Benefit, "Pay " + conspireCost.getText(false) + " ?", ability, game)) {
activateConspire(ability, game);
for (Iterator it = ((Costs) conspireCost).iterator(); it.hasNext();) {
for (Iterator it = conspireCost.iterator(); it.hasNext(); ) {
Cost cost = (Cost) it.next();
ability.getCosts().add(cost.copy());
}

View file

@ -58,7 +58,7 @@ public enum CardRepository {
// raise this if db structure was changed
private static final long CARD_DB_VERSION = 51;
// raise this if new cards were added to the server
private static final long CARD_CONTENT_VERSION = 81;
private static final long CARD_CONTENT_VERSION = 82;
private final TreeSet<String> landTypes = new TreeSet<>();
private Dao<CardInfo, Object> cardDao;
private Set<String> classNames;

View file

@ -28,7 +28,7 @@ public enum ExpansionRepository {
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2;AUTO_SERVER=TRUE";
private static final String VERSION_ENTITY_NAME = "expansion";
private static final long EXPANSION_DB_VERSION = 5;
private static final long EXPANSION_CONTENT_VERSION = 13;
private static final long EXPANSION_CONTENT_VERSION = 14;
private Dao<ExpansionInfo, Object> expansionDao;

View file

@ -28,20 +28,16 @@
package mage.game.draft;
import java.util.*;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.game.draft.DraftOptions.TimingOption;
import mage.game.events.Listener;
import mage.game.events.PlayerQueryEvent;
import mage.game.events.PlayerQueryEventSource;
import mage.game.events.TableEvent;
import mage.game.events.*;
import mage.game.events.TableEvent.EventType;
import mage.game.events.TableEventSource;
import mage.players.Player;
import mage.players.PlayerList;
import java.util.*;
/**
*
* @author BetaSteward_at_googlemail.com
@ -262,22 +258,16 @@ public abstract class DraftImpl implements Draft {
if(isAbort()) {
return true;
}
for (DraftPlayer player: players.values()) {
if (player.isPicking()) {
return false;
}
}
return true;
return players.values()
.stream()
.noneMatch(DraftPlayer::isPicking);
}
@Override
public boolean allJoined() {
for (DraftPlayer player: this.players.values()) {
if (!player.isJoined()) {
return false;
}
}
return true;
return players.values().stream()
.allMatch(DraftPlayer::isJoined);
}
@Override

View file

@ -0,0 +1,47 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com AS IS AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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.game.permanent.token;
import mage.constants.CardType;
import mage.MageInt;
/**
*
* @author spjspj
*/
public class CrestedSunmareToken extends Token {
public CrestedSunmareToken() {
super("Horse", "5/5 white Horse creature token");
power = new MageInt(5);
toughness = new MageInt(5);
color.setWhite(true);
subtype.add("Horse");
cardType.add(CardType.CREATURE);
}
}

View file

@ -6,7 +6,7 @@
<groupId>org.mage</groupId>
<artifactId>mage-root</artifactId>
<version>1.4.23</version>
<version>1.4.24</version>
<packaging>pom</packaging>
<name>Mage Root</name>
<description>Mage Root POM</description>
@ -84,7 +84,7 @@
</repositories>
<properties>
<mage-version>1.4.23</mage-version>
<mage-version>1.4.24</mage-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>