Merge remote-tracking branch 'upstream/master' into CMH-GuiltyConscienceAndBackfire

This commit is contained in:
Clint Herron 2017-04-19 21:49:10 -04:00
commit 98eea3c97b
38 changed files with 1420 additions and 677 deletions

View file

@ -0,0 +1,27 @@
3 [AER:173] Renegade Map
2 [KLD:144] Armorcraft Judge
9 [KLD:263] Forest
1 [KLD:181] Engineered Might
1 [AER:149] Daredevil Dragster
1 [AER:105] Aid from the Cowl
3 [AER:7] Audacious Infiltrator
1 [AER:5] Airdrop Aeronauts
4 [AER:189] Tranquil Expanse
1 [AER:22] Solemn Recruit
2 [AER:126] Unbridled Growth
2 [AER:125] Silkweaver Elite
1 [AER:120] Prey Upon
4 [AER:186] Inspiring Roar
1 [AER:185] Ajani, Valiant Protector
2 [AER:188] Ajani's Aid
3 [AER:187] Ajani's Comrade
1 [AER:121] Ridgescale Tusker
9 [KLD:250] Plains
1 [KLD:156] Ghirapur Guide
2 [AER:180] Verdant Automaton
1 [AER:15] Deadeye Harpooner
2 [AER:117] Narnam Renegade
1 [AER:118] Natural Obsolescence
2 [AER:113] Lifecraft Cavalry
LAYOUT MAIN:(1,7)(CMC,false,50)|([KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[AER:189],[AER:189],[AER:189],[AER:189])([AER:117],[AER:117],[AER:120],[AER:173],[AER:173],[AER:173],[AER:126],[AER:126])([AER:187],[AER:187],[AER:187],[AER:7],[AER:7],[AER:7],[AER:118],[AER:180],[AER:180])([AER:149],[AER:15],[KLD:156],[AER:125],[AER:125],[AER:22])([AER:188],[AER:188],[KLD:144],[KLD:144],[AER:186],[AER:186],[AER:186],[AER:186])([AER:105],[AER:5],[KLD:181],[AER:113],[AER:113],[AER:121])([AER:185])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -0,0 +1,27 @@
11 [KLD:261] Mountain
1 [KLD:265] Chandra, Pyrogenius
2 [KLD:188] Veteran Motorist
4 [KLD:266] Flame Lash
1 [KLD:28] Skyswirl Harrier
1 [KLD:225] Ovalchase Dragster
2 [KLD:267] Liberating Combustion
3 [KLD:268] Renegade Firebrand
4 [AKH:274] Stone Quarry
1 [KLD:109] Cathartic Reunion
1 [KLD:107] Brazen Scourge
10 [KLD:250] Plains
2 [KLD:133] Spireside Infiltrator
2 [KLD:233] Sky Skiff
2 [KLD:230] Renegade Freighter
1 [KLD:132] Speedway Fanatic
2 [KLD:33] Trusty Companion
1 [KLD:198] Bomat Bazaar Barge
1 [KLD:16] Gearshift Ace
2 [KLD:2] Aerial Responder
2 [KLD:7] Built to Last
1 [KLD:236] Snare Thopter
1 [KLD:214] Fleetwheel Cruiser
1 [KLD:114] Fateful Showdown
1 [KLD:238] Weldfast Monitor
LAYOUT MAIN:(1,7)(CMC,false,50)|([KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:261],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[KLD:250],[AKH:274],[AKH:274],[AKH:274],[AKH:274])([KLD:7],[KLD:7])([KLD:109],[KLD:16],[KLD:233],[KLD:233],[KLD:132],[KLD:33],[KLD:33],[KLD:188],[KLD:188])([KLD:2],[KLD:2],[KLD:107],[KLD:268],[KLD:268],[KLD:268],[KLD:230],[KLD:230],[KLD:133],[KLD:133],[KLD:238])([KLD:198],[KLD:114],[KLD:266],[KLD:266],[KLD:266],[KLD:266],[KLD:214],[KLD:225],[KLD:236])([KLD:267],[KLD:267],[KLD:28])([KLD:265])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -0,0 +1,24 @@
1 [AKH:270] Gideon, Martial Paragon
2 [AKH:272] Gideon's Resolve
10 [AKH:250] Plains
3 [AKH:271] Companion of the Trials
1 [AKH:10] Devoted Crop-Mate
1 [AKH:31] Tah-Crop Elite
2 [AKH:29] Sparring Mummy
1 [AKH:18] Impeccable Timing
3 [AKH:17] Gust Walker
1 [AKH:16] Glory-Bound Initiate
3 [AKH:117] Ahn-Crop Crasher
2 [AKH:139] Hyena Pack
2 [AKH:129] Electrify
1 [AKH:146] Pathmaker Initiate
2 [AKH:124] Cartouche of Zeal
2 [AKH:200] Honored Crop-Captain
1 [AKH:137] Hazoret's Favor
4 [AKH:274] Stone Quarry
4 [AKH:273] Graceful Cat
3 [AKH:152] Trial of Zeal
1 [AKH:144] Nef-Crop Entangler
10 [AKH:253] Mountain
LAYOUT MAIN:(1,6)(CMC,false,50)|([AKH:274],[AKH:274],[AKH:274],[AKH:274],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:250],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253],[AKH:253])([AKH:124],[AKH:124])([AKH:16],[AKH:17],[AKH:17],[AKH:17],[AKH:144],[AKH:146],[AKH:200],[AKH:200],[AKH:18])([AKH:271],[AKH:271],[AKH:271],[AKH:10],[AKH:273],[AKH:273],[AKH:273],[AKH:273],[AKH:117],[AKH:117],[AKH:117],[AKH:137],[AKH:152],[AKH:152],[AKH:152])([AKH:29],[AKH:29],[AKH:31],[AKH:139],[AKH:139],[AKH:129],[AKH:129])([AKH:270],[AKH:272],[AKH:272])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -0,0 +1,26 @@
1 [AKH:160] Channeler Initiate
1 [AKH:91] Festering Mummy
1 [AKH:162] Crocodile of the Crossing
2 [AKH:89] Dune Beetle
2 [AKH:83] Cartouche of Ambition
2 [AKH:93] Gravedigger
2 [AKH:109] Splendid Agony
1 [AKH:226] Edifice of Authority
2 [AKH:79] Baleful Ammit
4 [AKH:278] Tattered Mummy
1 [AKH:234] Oracle's Vault
2 [AKH:113] Trial of Ambition
2 [AKH:277] Liliana's Influence
1 [AKH:167] Gift of Paradise
1 [AKH:244] Grasping Dunes
2 [AKH:158] Cartouche of Strength
4 [AKH:279] Foul Orchard
2 [AKH:197] Decimator Beetle
11 [AKH:252] Swamp
3 [AKH:276] Desiccated Naga
2 [AKH:166] Giant Spider
1 [AKH:232] Luxa River Shrine
9 [AKH:254] Forest
1 [AKH:275] Liliana, Death Wielder
LAYOUT MAIN:(1,8)(CMC,false,50)|([AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:254],[AKH:279],[AKH:279],[AKH:279],[AKH:279],[AKH:244],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252],[AKH:252])([AKH:91])([AKH:160],[AKH:89],[AKH:89],[AKH:278],[AKH:278],[AKH:278],[AKH:278],[AKH:113],[AKH:113])([AKH:79],[AKH:79],[AKH:83],[AKH:83],[AKH:158],[AKH:158],[AKH:276],[AKH:276],[AKH:276],[AKH:226],[AKH:167],[AKH:232],[AKH:109],[AKH:109])([AKH:162],[AKH:166],[AKH:166],[AKH:93],[AKH:93],[AKH:234])([AKH:197],[AKH:197])([AKH:277],[AKH:277])([AKH:275])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -0,0 +1,24 @@
4 [KLD:272] Terrain Elemental
2 [KLD:273] Verdant Crescendo
2 [KLD:141] Appetite for the Unnatural
1 [KLD:270] Nissa, Nature's Artisan
2 [KLD:171] Thriving Rhino
2 [KLD:161] Longtusk Cub
3 [KLD:271] Guardian of the Great Conduit
2 [KLD:53] Janjeet Sentry
1 [KLD:167] Riparian Tiger
3 [KLD:145] Attune with Aether
2 [KLD:54] Long-Finned Skywhale
2 [KLD:142] Arborback Stomper
4 [KLD:274] Woodland Stream
11 [KLD:263] Forest
2 [KLD:66] Thriving Turtle
2 [KLD:55] Malfunction
8 [KLD:253] Island
2 [KLD:180] Empyreal Voyager
1 [KLD:39] Aethersquall Ancient
1 [KLD:168] Sage of Shaila's Claim
2 [KLD:169] Servant of the Conduit
1 [KLD:147] Bristling Hydra
LAYOUT MAIN:(1,8)(CMC,false,50)|([KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:263],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:274],[KLD:274],[KLD:274],[KLD:274])([KLD:145],[KLD:145],[KLD:145],[KLD:66],[KLD:66])([KLD:161],[KLD:161],[KLD:168],[KLD:169],[KLD:169],[KLD:272],[KLD:272],[KLD:272],[KLD:272])([KLD:141],[KLD:141],[KLD:180],[KLD:180],[KLD:53],[KLD:53],[KLD:171],[KLD:171])([KLD:147],[KLD:271],[KLD:271],[KLD:271],[KLD:54],[KLD:54],[KLD:55],[KLD:55],[KLD:273],[KLD:273])([KLD:142],[KLD:142],[KLD:167])([KLD:270])([KLD:39])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -0,0 +1,27 @@
3 [AER:193] Tezzeret's Simulacrum
4 [AER:192] Pendulum of Patterns
1 [AER:151] Foundry Assembler
4 [AER:194] Submerged Boneyard
2 [AER:191] Tezzeret's Betrayal
1 [AER:190] Tezzeret, Master of Metal
1 [AER:42] Reverse Engineer
1 [AER:167] Ornithopter
1 [AER:65] Ironclad Revolutionary
1 [KLD:207] Dukhara Peafowl
1 [AER:163] Merchant's Dockhand
1 [AER:144] Barricade Breaker
2 [AER:143] Augmenting Automaton
1 [AER:41] Quicksmith Spy
2 [KLD:74] Dhund Operative
1 [AER:58] Fen Hauler
11 [KLD:253] Island
2 [AER:138] Tezzeret's Touch
10 [KLD:258] Swamp
2 [AER:178] Universal Solvent
2 [AER:156] Implement of Examination
2 [AER:50] Wind-Kin Raiders
1 [AER:177] Treasure Keeper
2 [AER:30] Bastion Inventor
1 [KLD:80] Essence Extraction
LAYOUT MAIN:(1,8)(CMC,false,50)|([KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[KLD:253],[AER:167],[AER:194],[AER:194],[AER:194],[AER:194],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258],[KLD:258])([AER:143],[AER:143],[AER:163],[AER:178],[AER:178])([KLD:74],[KLD:74],[AER:192],[AER:192],[AER:192],[AER:192])([KLD:80],[AER:156],[AER:156],[AER:193],[AER:193],[AER:193],[AER:138],[AER:138])([KLD:207],[AER:41],[AER:177])([AER:151],[AER:42],[AER:191],[AER:191])([AER:30],[AER:30],[AER:65],[AER:190],[AER:50],[AER:50])([AER:144],[AER:58])
LAYOUT SIDEBOARD:(0,0)(NONE,false,50)|

View file

@ -322,9 +322,6 @@ public class NewTournamentDialog extends MageDialog {
btnOk.setText("OK");
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
btnOk.setText("OK");
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
btnCancel.setText("Cancel");
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));

View file

@ -27,15 +27,14 @@
*/
package mage.server;
import java.util.*;
import java.util.concurrent.*;
import mage.server.User.UserState;
import mage.server.record.UserStats;
import mage.server.record.UserStatsRepository;
import mage.server.util.ThreadExecutor;
import org.apache.log4j.Logger;
import java.util.*;
import java.util.concurrent.*;
/**
* manages users - if a user is disconnected and 10 minutes have passed with no
* activity the user is removed
@ -68,8 +67,7 @@ public enum UserManager {
public Optional<User> getUser(UUID userId) {
if (!users.containsKey(userId)) {
LOGGER.error(String.format("User with id %s could not be found", userId));
LOGGER.trace(String.format("User with id %s could not be found", userId));
return Optional.empty();
} else {
return Optional.of(users.get(userId));
@ -82,10 +80,7 @@ public enum UserManager {
if (u.isPresent()) {
return u;
} else {
LOGGER.error("User with name " + userName + " could not be found");
return Optional.empty();
}
}
@ -123,8 +118,8 @@ public enum UserManager {
public void removeUser(final UUID userId, final DisconnectReason reason) {
if (userId != null) {
getUser(userId).ifPresent(user ->
USER_EXECUTOR.execute(
getUser(userId).ifPresent(user
-> USER_EXECUTOR.execute(
() -> {
try {
LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId + " [" + user.getGameInfo() + ']');

View file

@ -27,6 +27,8 @@
*/
package mage.cards.a;
import java.util.Optional;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -41,9 +43,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.TargetPlayer;
import java.util.Optional;
import java.util.UUID;
/**
*
* @author fireshoes
@ -103,7 +102,7 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getPlayerId().equals(source.getFirstTarget())) {
if (source.getFirstTarget() != null && source.getFirstTarget().equals(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
if (object.isInstant() || object.isSorcery()) {

View file

@ -81,8 +81,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
}
// Is the library now empty, thus the rise is on the bottom (for the message to the players)?
boolean isOnBottom = !controller.getLibrary().hasCards();
boolean isOnBottom = controller.getLibrary().size() < 6;
// Put this card (if the ability came from an ApproachOfTheSecondSun spell card) on top
spellCard.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
@ -96,7 +95,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
if (isOnBottom) {
game.informPlayers(controller.getLogName() + " puts " + spell.getLogName() + " on the bottom of his or her library.");
} else {
game.informPlayers(controller.getLogName() + " puts " + spell.getLogName() + " into his or her library 6th from the top.");
game.informPlayers(controller.getLogName() + " puts " + spell.getLogName() + " into his or her library 7th from the top.");
}
}
}

View file

@ -147,13 +147,12 @@ class CruelRealityEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (cursedPlayer != null
&& controller != null) {
if (cursedPlayer.chooseUse(outcome, "Sacrifice a creature or planeswalker?", source, game)) {
FilterControlledPermanent filter = new FilterControlledPermanent();
FilterControlledPermanent filter = new FilterControlledPermanent("creature or planeswalker");
filter.add(Predicates.or(
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.PLANESWALKER)));
TargetPermanent target = new TargetPermanent(filter);
if (cursedPlayer.choose(outcome, target, source.getId(), game)) {
if (cursedPlayer.choose(Outcome.Sacrifice, target, source.getId(), game)) {
Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget());
if (objectToBeSacrificed != null) {
if (objectToBeSacrificed.sacrifice(source.getId(), game)) {
@ -161,7 +160,6 @@ class CruelRealityEffect extends OneShotEffect {
}
}
}
}
cursedPlayer.loseLife(5, game, false);
}
return false;

View file

@ -28,6 +28,7 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
@ -41,8 +42,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
/**
*
* @author Loki
@ -62,7 +61,10 @@ public class DungroveElder extends CardImpl {
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Hexproof (This creature can't be the target of spells or abilities your opponents control.)
this.addAbility(HexproofAbility.getInstance());
// Dungrove Elder's power and toughness are each equal to the number of Forests you control.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.EndOfGame)));
}

View file

@ -28,10 +28,8 @@
package mage.cards.l;
import java.util.UUID;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
@ -40,8 +38,6 @@ import mage.abilities.effects.common.continuous.BecomesBlackZombieAdditionEffect
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
@ -75,9 +71,11 @@ public class LilianaDeathsMajesty extends CardImpl {
this.addAbility(ability);
// -3: Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types.
ability = new LoyaltyAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), -3);
ability = new LoyaltyAbility(new BecomesBlackZombieAdditionEffect() // because the effect has to be active for triggered effects that e.g. check if the creature entering is a Zombie, the continuous effect needs to be added before the card moving effect is applied
.setText(""), -3);
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
ability.addEffect(new BecomesBlackZombieAdditionEffect());
ability.addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect()
.setText("Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types"));
this.addAbility(ability);
// -7: Destroy all non-Zombie creatures.

View file

@ -27,6 +27,8 @@
*/
package mage.cards.m;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -151,17 +153,20 @@ class MimicVatEffect extends OneShotEffect {
return false;
}
// return older cards to graveyard
for (UUID imprinted : permanent.getImprinted()) {
Card card = game.getCard(imprinted);
controller.moveCards(card, Zone.GRAVEYARD, source, game);
Set<Card> toGraveyard = new HashSet<>();
for (UUID imprintedId : permanent.getImprinted()) {
Card card = game.getCard(imprintedId);
if (card != null) {
toGraveyard.add(card);
}
}
controller.moveCards(toGraveyard, Zone.GRAVEYARD, source, game);
permanent.clearImprinted(game);
// Imprint a new one
UUID target = targetPointer.getFirst(game, source);
if (target != null) {
Card card = game.getCard(target);
card.moveToExile(getId(), "Mimic Vat (Imprint)", source.getSourceId(), game);
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), permanent.getName() + " (Imprint)");
permanent.imprint(card.getId(), game);
}

View file

@ -114,8 +114,14 @@ class SoulScarMageDamageReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
boolean weControlSource = game.getControllerId(event.getSourceId()).equals(source.getControllerId());
UUID sourceControllerId = game.getControllerId(event.getSourceId());
UUID targetControllerId = game.getControllerId(event.getTargetId());
UUID controllerId = source.getControllerId();
boolean weControlSource = controllerId.equals(sourceControllerId);
boolean opponentControlsTarget = game.getOpponents(sourceControllerId).contains(targetControllerId);
boolean isNoncombatDamage = !((DamageCreatureEvent) event).isCombatDamage();
return weControlSource && isNoncombatDamage;
return weControlSource
&& isNoncombatDamage
&& opponentControlsTarget;
}
}

View file

@ -45,6 +45,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.Watcher;
@ -73,7 +74,10 @@ public class TimeToReflect extends CardImpl {
BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get("BlockedOrWasBlockedByAZombieWatcher");
if (watcher != null) {
for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) {
creaturesThatBlockedOrWereBlockedByAZombie.add(new PermanentIdPredicate(mor.getPermanent(game).getId()));
Permanent permanent = mor.getPermanent(game);
if (permanent != null) {
creaturesThatBlockedOrWereBlockedByAZombie.add(new PermanentIdPredicate(permanent.getId()));
}
}
}
filter.add(Predicates.or(creaturesThatBlockedOrWereBlockedByAZombie));

View file

@ -27,7 +27,6 @@
*/
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -44,6 +43,8 @@ import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
*
* @author fireshoes
@ -84,7 +85,7 @@ class WanderingFumaroleToken extends Token {
cardType.add(CardType.CREATURE);
subtype.add("Elemental");
color.setRed(true);
color.setWhite(true);
color.setBlue(true);
power = new MageInt(1);
toughness = new MageInt(4);
addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SwitchPowerToughnessSourceEffect(Duration.EndOfTurn), new ManaCostsImpl("{0}")));

View file

@ -104,6 +104,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Censor", 46, Rarity.UNCOMMON, mage.cards.c.Censor.class));
cards.add(new SetCardInfo("Champion of Rhonas", 159, Rarity.RARE, mage.cards.c.ChampionOfRhonas.class));
cards.add(new SetCardInfo("Channeler Initiate", 160, Rarity.RARE, mage.cards.c.ChannelerInitiate.class));
cards.add(new SetCardInfo("Cinder Barrens", 280, Rarity.COMMON, mage.cards.c.CinderBarrens.class));
cards.add(new SetCardInfo("Colossapede", 161, Rarity.COMMON, mage.cards.c.Colossapede.class));
cards.add(new SetCardInfo("Combat Celebrant", 125, Rarity.MYTHIC, mage.cards.c.CombatCelebrant.class));
cards.add(new SetCardInfo("Commit // Memory", 211, Rarity.RARE, mage.cards.c.CommitMemory.class));
@ -156,6 +157,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Forest", 268, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(null, true)));
cards.add(new SetCardInfo("Forest", 269, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(null, true)));
cards.add(new SetCardInfo("Forsake the Worldly", 13, Rarity.COMMON, mage.cards.f.ForsakeTheWorldly.class));
cards.add(new SetCardInfo("Forsaken Sanctuary", 281, Rarity.COMMON, mage.cards.f.ForsakenSanctuary.class));
cards.add(new SetCardInfo("Foul Orchard", 279, Rarity.COMMON, mage.cards.f.FoulOrchard.class));
cards.add(new SetCardInfo("Galestrike", 54, Rarity.UNCOMMON, mage.cards.g.Galestrike.class));
cards.add(new SetCardInfo("Gate to the Afterlife", 228, Rarity.UNCOMMON, mage.cards.g.GateToTheAfterlife.class));
@ -187,6 +189,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Heaven // Earth", 224, Rarity.RARE, mage.cards.h.HeavenEarth.class));
cards.add(new SetCardInfo("Hekma Sentinels", 56, Rarity.COMMON, mage.cards.h.HekmaSentinels.class));
cards.add(new SetCardInfo("Hieroglyphic Illumination", 57, Rarity.COMMON, mage.cards.h.HieroglyphicIllumination.class));
cards.add(new SetCardInfo("Highland Lake", 282, Rarity.COMMON, mage.cards.h.HighlandLake.class));
cards.add(new SetCardInfo("Honed Khopesh", 230, Rarity.COMMON, mage.cards.h.HonedKhopesh.class));
cards.add(new SetCardInfo("Honored Crop-Captain", 200, Rarity.UNCOMMON, mage.cards.h.HonoredCropCaptain.class));
cards.add(new SetCardInfo("Honored Hydra", 172, Rarity.RARE, mage.cards.h.HonoredHydra.class));
@ -219,6 +222,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Magma Spray", 141, Rarity.COMMON, mage.cards.m.MagmaSpray.class));
cards.add(new SetCardInfo("Manglehorn", 175, Rarity.UNCOMMON, mage.cards.m.Manglehorn.class));
cards.add(new SetCardInfo("Manticore of the Gauntlet", 142, Rarity.COMMON, mage.cards.m.ManticoreOfTheGauntlet.class));
cards.add(new SetCardInfo("Meandering River", 283, Rarity.COMMON, mage.cards.m.MeanderingRiver.class));
cards.add(new SetCardInfo("Merciless Javelineer", 202, Rarity.UNCOMMON, mage.cards.m.MercilessJavelineer.class));
cards.add(new SetCardInfo("Miasmic Mummy", 100, Rarity.COMMON, mage.cards.m.MiasmicMummy.class));
cards.add(new SetCardInfo("Mighty Leap", 20, Rarity.COMMON, mage.cards.m.MightyLeap.class));
@ -299,6 +303,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Stinging Shot", 189, Rarity.COMMON, mage.cards.s.StingingShot.class));
cards.add(new SetCardInfo("Stir the Sands", 110, Rarity.UNCOMMON, mage.cards.s.StirTheSands.class));
cards.add(new SetCardInfo("Stone Quarry", 274, Rarity.COMMON, mage.cards.s.StoneQuarry.class));
cards.add(new SetCardInfo("Submerged Boneyard", 284, Rarity.COMMON, mage.cards.s.SubmergedBoneyard.class));
cards.add(new SetCardInfo("Sunscorched Desert", 249, Rarity.COMMON, mage.cards.s.SunscorchedDesert.class));
cards.add(new SetCardInfo("Supernatural Stamina", 111, Rarity.COMMON, mage.cards.s.SupernaturalStamina.class));
cards.add(new SetCardInfo("Supply Caravan", 30, Rarity.COMMON, mage.cards.s.SupplyCaravan.class));
@ -315,8 +320,10 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Those Who Serve", 32, Rarity.COMMON, mage.cards.t.ThoseWhoServe.class));
cards.add(new SetCardInfo("Thresher Lizard", 150, Rarity.COMMON, mage.cards.t.ThresherLizard.class));
cards.add(new SetCardInfo("Throne of the God-Pharaoh", 237, Rarity.RARE, mage.cards.t.ThroneOfTheGodPharaoh.class));
cards.add(new SetCardInfo("Timber Gorge", 285, Rarity.COMMON, mage.cards.t.TimberGorge.class));
cards.add(new SetCardInfo("Time to Reflect", 33, Rarity.UNCOMMON, mage.cards.t.TimeToReflect.class));
cards.add(new SetCardInfo("Tormenting Voice", 151, Rarity.COMMON, mage.cards.t.TormentingVoice.class));
cards.add(new SetCardInfo("Tranquil Expanse", 286, Rarity.COMMON, mage.cards.t.TranquilExpanse.class));
cards.add(new SetCardInfo("Trespasser's Curse", 112, Rarity.COMMON, mage.cards.t.TrespassersCurse.class));
cards.add(new SetCardInfo("Trial of Ambition", 113, Rarity.UNCOMMON, mage.cards.t.TrialOfAmbition.class));
cards.add(new SetCardInfo("Trial of Knowledge", 73, Rarity.UNCOMMON, mage.cards.t.TrialOfKnowledge.class));
@ -342,6 +349,7 @@ public class Amonkhet extends ExpansionSet {
cards.add(new SetCardInfo("Weaver of Currents", 209, Rarity.UNCOMMON, mage.cards.w.WeaverOfCurrents.class));
cards.add(new SetCardInfo("Winds of Rebuke", 76, Rarity.COMMON, mage.cards.w.WindsOfRebuke.class));
cards.add(new SetCardInfo("Winged Shepherd", 39, Rarity.COMMON, mage.cards.w.WingedShepherd.class));
cards.add(new SetCardInfo("Woodland Stream", 287, Rarity.COMMON, mage.cards.w.WoodlandStream.class));
cards.add(new SetCardInfo("Zenith Seeker", 77, Rarity.UNCOMMON, mage.cards.z.ZenithSeeker.class));
}

View file

@ -48,18 +48,17 @@ public class DiscardTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.HAND, playerA, "Tranquil Thicket");
addCard(Zone.BATTLEFIELD, playerB, "Rest in Peace", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling {G} <i>({G},Discard {this}: Draw a card.)</i>");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling {G}"); //cycling ability
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertHandCount(playerA, "Tranquil Thicket", 0);
assertExileCount("Tranquil Thicket", 1);
assertExileCount("Tranquil Thicket", 1); //exiled by Rest in Peace
assertHandCount(playerA, "Tranquil Thicket", 0); //should be exiled
assertHandCount(playerA, 1); // the card drawn by Cycling
}

View file

@ -73,18 +73,48 @@ public class TransmuteTest extends CardTestPlayerBase {
@Test
public void searchSplittedCardOneManaCmcSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Dizzy Spell");
// Target creature gets -3/-0 until end of turn.
// Transmute {1}{U}{U} ({1}{U}{U}, Discard this card: Search your library for a card with the same converted mana cost as this card, reveal it, and put it into your hand. Then shuffle your library. Transmute only as a sorcery.)
addCard(Zone.HAND, playerA, "Dizzy Spell"); // Instant {U}
// Wear {1}{R}
// Destroy target artifact.
// Tear {W}
// Destroy target enchantment.
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}");
setChoice(playerA, "Wear // Tear");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Dizzy Spell", 1);
assertHandCount(playerA, "Wear", 1); // Filter search can only search for one side of a split card
assertHandCount(playerA, "Tear", 1); // Filter search can only search for one side of a split card
assertHandCount(playerA, "Wear // Tear", 0);
}
@Test
public void searchSplittedCardThreeManaCmcSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
// Counter target spell unless its controller discards his or her hand.
// Transmute {1}{U}{B}
addCard(Zone.HAND, playerA, "Perplex"); // Instant {1}{U}{B}
// Wear {1}{R}
// Destroy target artifact.
// Tear {W}
// Destroy target enchantment.
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{B}");
setChoice(playerA, "Wear // Tear");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Perplex", 1);
assertHandCount(playerA, "Wear // Tear", 1);
}
}

View file

@ -77,24 +77,24 @@ public class CounterbalanceTest extends CardTestPlayerBase {
}
/**
* Test that if the top card is a split card, both casting costs of the split cards
* Test that if the top card is a split card, the total of both halves of the split card
* count to counter the spell. If one of the split cards halves has the equal casting
* cost, the spell is countered.
* cost, the spell is not countered.
*
*/
@Test
public void testSplitCard() {
addCard(Zone.HAND, playerA, "Typhoid Rats");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.HAND, playerA, "Nessian Courser");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerB, "Counterbalance");
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
addCard(Zone.LIBRARY, playerB, "Wear // Tear"); // CMC 2 and 1
addCard(Zone.LIBRARY, playerB, "Wear // Tear"); // CMC 3
skipInitShuffling(); // so the set to top card stays at top
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Typhoid Rats");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nessian Courser");
setChoice(playerB, "Yes");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
@ -103,8 +103,8 @@ public class CounterbalanceTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Typhoid Rats", 0);
assertGraveyardCount(playerA, "Typhoid Rats", 1);
assertPermanentCount(playerA, "Nessian Courser", 0);
assertGraveyardCount(playerA, "Nessian Courser", 1);
assertGraveyardCount(playerA, 1);
assertGraveyardCount(playerB, 0);

View file

@ -5,6 +5,8 @@ import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static junit.framework.TestCase.assertEquals;
/**
* @author LevelX2
*/
@ -26,9 +28,12 @@ public class TwoHeadedSliverTest extends CardTestPlayerBase {
block(3, playerB, "Silvercoat Lion", "Two-Headed Sliver");
setStopAt(3, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Two-Headed Sliver", 1);
assertLife(playerB, 19);
try {
execute();
} catch (UnsupportedOperationException e) {
assertEquals("Two-Headed Sliver is blocked by 1 creature(s). It has to be blocked by 2 or more.", e.getMessage());
}
}
}

View file

@ -0,0 +1,112 @@
/*
* 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 org.mage.test.cards.cost.modification;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author noxx
*/
public class FluctuatorTest extends CardTestPlayerBase {
/**
* Fluctuator makes 'Akroma's Vengeance' cyclic cost reduced to {1}
* Test it with one Plains on battlefield.
*/
@Test
public void testFluctuatorReducedBy2() {
// Destroy all artifacts, creatures, and enchantments.
// Cycling ({3}, Discard this card: Draw a card.)
addCard(Zone.HAND, playerA, "Akroma's Vengeance");
// Cycling abilities you activate cost you up to {2} less to activate.
addCard(Zone.BATTLEFIELD, playerA, "Fluctuator");
// One mana should be enough
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Akroma's Vengeance", 1);
assertHandCount(playerA, 1);
}
/**
* Fluctuator makes 'Akroma's Vengeance' cyclic cost reduced to {1}
*
* Make sure it wasn't reduced more than by two.
*/
@Test
public void testFluctuatorReducedNotBy3() {
// Destroy all artifacts, creatures, and enchantments.
// Cycling ({3}, Discard this card: Draw a card.)
addCard(Zone.HAND, playerA, "Akroma's Vengeance");
// Cycling abilities you activate cost you up to {2} less to activate.
addCard(Zone.BATTLEFIELD, playerA, "Fluctuator");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Akroma's Vengeance", 0);
assertHandCount(playerA, 1);
}
/**
* Test 2 Fluctuators reduce cycling cost up to 4.
*
*/
@Test
public void testTwoFluctuatorsReduceBy4() {
// Destroy all artifacts, creatures, and enchantments.
// Cycling ({3}, Discard this card: Draw a card.)
addCard(Zone.HAND, playerA, "Akroma's Vengeance");
// Cycling abilities you activate cost you up to {2} less to activate.
addCard(Zone.BATTLEFIELD, playerA, "Fluctuator", 2); // 2 copies
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Akroma's Vengeance", 1);
assertHandCount(playerA, 1);
}
}

View file

@ -0,0 +1,76 @@
package org.mage.test.cards.cost.splitcards;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author fireshoes
*/
public class SplitCardCmcTest extends CardTestPlayerBase {
/**
* The core of the change is that we're no longer assuming split cards have two sets of characteristics
* when they're not on the stack. Some characteristics have multiple pieces of information very naturally
* Destined to Lead is an instant sorcery, the same as Ornithopter is an artifact creature. It's black and green
* just like Winding Constrictor because its mana cost has B and G in it. Continuing that, the mana cost combines
* the components, and a card asking for Destined to Lead's mana cost sees 4BG.
*
* So now, the converted mana cost question is simple: if Destined to Lead isn't on the stack, it has a converted mana cost
* of 6. Destined on the stack is still a black instant with a converted mana cost of 2, and Lead on the stack is still a
* green sorcery with a converted mana cost of 4, but Destined to Lead, any time it's not one or the other, is a black and green
* instant sorcery with a converted mana cost of 6.
*/
@Test
public void testSplitCardCmcInHand() {
// Total CMC of Failure // Comply is 3, so should be exiled by Transgress the Mind.
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
// Devoid
// Target player reveals his or her hand. You may choose a card from it with converted mana cost 3 or greater and exile that card.
addCard(Zone.HAND, playerA, "Transgress the Mind");
addCard(Zone.HAND, playerB, "Failure // Comply");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transgress the Mind", playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertExileCount("Failure // Comply", 1);
}
@Test
public void testSplitCardCmcOnStack() {
// Counterbalance revealing Wear // Tear counters a spell with converted mana cost 3, but not 1 or 2.
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.HAND, playerA, "Typhoid Rats"); // Creature 1/1 {B}
// Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell
// if it has the same converted mana cost as the revealed card.
addCard(Zone.BATTLEFIELD, playerB, "Counterbalance");
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
// Wear {1}{R}
// Destroy target artifact.
// Tear {W}
// Destroy target enchantment.
addCard(Zone.LIBRARY, playerB, "Wear // Tear"); // CMC now 3
skipInitShuffling(); // so the set to top card stays at top
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Typhoid Rats");
setChoice(playerB, "Yes"); // Reveal to Counterbalance to attempt to counter Typhoid Rats
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Typhoid Rats", 1);
assertGraveyardCount(playerA, "Typhoid Rats", 0);
assertGraveyardCount(playerA, 0);
assertGraveyardCount(playerB, 0);
}
}

View file

@ -0,0 +1,68 @@
package org.mage.test.cards.planeswalker;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9
*/
public class LilianaTest extends CardTestPlayerBase {
@Test
public void testMe() {
/*
Binding Mummy {1}{W}
Creature - Zombie 2/2
Whenever another Zombie enters the battlefield under your control, you may tap target artifact or creature.
*/
String bMummy = "Binding Mummy";
/*
Liliana, Death's Majesty {3}{B}{B}
Planeswalker Liliana 5 loyalty
[+1] : Create a 2/2 black Zombie creature token. Put the top two cards of your library into your graveyard.
[-3] : Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types.
[-7] : Destroy all non-Zombie creatures.
*/
String liliannaDM = "Liliana, Death's Majesty";
/*
Winged Shepherd {5}{W}
Creature - Angel 3/3
Flying, vigilance
Cycling {W}
*/
String wShepherd = "Winged Shepherd";
String yOx = "Yoked Ox"; // {W} 0/4
addCard(Zone.BATTLEFIELD, playerA, bMummy);
addCard(Zone.HAND, playerA, liliannaDM);
addCard(Zone.GRAVEYARD, playerA, wShepherd);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.BATTLEFIELD, playerB, yOx);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, liliannaDM);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-3:"); // Liliana -3
addTarget(playerA, wShepherd); // returns to battlefield and become zombie on top of other types
setChoice(playerA, "Yes"); // use Binding Mummy ability
addTarget(playerA, yOx); // tap the ox
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, bMummy, 1);
assertPermanentCount(playerA, liliannaDM, 1);
assertPermanentCount(playerA, wShepherd, 1);
assertPermanentCount(playerB, yOx, 1);
assertCounterCount(playerA, liliannaDM, CounterType.LOYALTY, 2);
assertType(wShepherd, CardType.CREATURE, "Zombie"); // should have subtype zombie on top of angel type
assertType(wShepherd, CardType.CREATURE, "Angel");
assertTapped(yOx, true);
}
}

View file

@ -32,6 +32,8 @@ import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static junit.framework.TestCase.assertEquals;
/**
*
* @author LevelX2, icetc
@ -212,12 +214,12 @@ public class BlockRequirementTest extends CardTestPlayerBase {
block(1, playerB, "Hill Giant", "Breaker of Armies");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
// Hill giant is still alive
assertPermanentCount(playerB, "Hill Giant", 1);
// Player B was unable to block, so goes down to 10 life
assertLife(playerB, 8);
try {
execute();
} catch (UnsupportedOperationException e) {
assertEquals("Breaker of Armies is blocked by 1 creature(s). It has to be blocked by 2 or more.", e.getMessage());
}
}
/*

View file

@ -65,12 +65,16 @@ public class DuskDawnTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Dusk // Dawn", 0);
}
// Fail to cast Dawn (Aftermath part) from hand
@Test
public void testCastDawnFail() {
// Fail to cast dawn from hand
// Dusk {2}{W}{W}
// Destroy all creatures with power 3 or greater.
// Dawn {3}{W}{W}
// Return all creature cards with power less than or equal to 2 from your graveyard to your hand.
addCard(Zone.HAND, playerA, "Dusk // Dawn");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
addCard(Zone.GRAVEYARD, playerA, "Devoted Hero");
addCard(Zone.GRAVEYARD, playerA, "Devoted Hero"); // Creature 1/2 {W}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dawn");
setStopAt(1, PhaseStep.END_TURN);

View file

@ -12,7 +12,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
* @author escplan9
*/
public class PermeatingMassTest extends CardTestPlayerBase {
@ -35,4 +35,38 @@ public class PermeatingMassTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Permeating Mass", 1);
assertPowerToughness(playerA, "Permeating Mass", 1, 3);
}
@Test
public void damagedCreatureWithVaryingPTbecomesCopyOfPermeatingMass() {
/*
Permeating Mass {G}
Creature Spirit - 1/3
Whenever Permeating Mass deals combat damage to a creature, that creature becomes a copy of Permeating Mass.
*/
String pMass = "Permeating Mass";
/*
Dungrove Elder {2}{G}
Creature Treefolk
Hexproof * / *
Dungrove Elder's power and toughness are each equal to the number of Forests you control.
*/
String dElder = "Dungrove Elder";
addCard(Zone.BATTLEFIELD, playerA, pMass);
addCard(Zone.BATTLEFIELD, playerB, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerB, dElder); // 4/4 with the 4 forests
attack(2, playerB, dElder);
block(2, playerA, pMass, dElder);
setStopAt(2, PhaseStep.END_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, pMass, 1);
assertPermanentCount(playerB, pMass, 1); // dungrove elder becomes copy of permeating mass
assertPowerToughness(playerB, "Permeating Mass", 1, 3); // and should have P/T 1/3
}
}

View file

@ -1,119 +0,0 @@
/*
* 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 org.mage.test.combat;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author jeffwadsworth
*/
public class CanBlockMultipleCreatures extends CardTestPlayerBase {
// test must be ignored until creature blocking multiple supported by test framework
@Ignore
@Test
public void testCombat() {
addCard(Zone.BATTLEFIELD, playerA, "Watcher in the Web", 1);
addCard(Zone.BATTLEFIELD, playerB, "Ulrich, Uncontested Alpha", 1); // 6/6
addCard(Zone.BATTLEFIELD, playerB, "Kessig Dire Swine", 1); // 6/6 (trample if delirium)
addCard(Zone.BATTLEFIELD, playerB, "Howlpack Wolf", 1); // 3/3
addCard(Zone.BATTLEFIELD, playerB, "Incorrigible Youths", 1); // 4/3
// Trample requirement for Kessig Dire Swine
addCard(Zone.GRAVEYARD, playerB, "Forest", 1);
addCard(Zone.GRAVEYARD, playerB, "Memnite", 1);
addCard(Zone.GRAVEYARD, playerB, "Flight", 1);
addCard(Zone.GRAVEYARD, playerB, "Drain Life", 1);
// Attack with all 4 creatures and block all with the Watcher in the Web
attack(2, playerB, "Ulrich, Uncontested Alpha");
attack(2, playerB, "Kessig Dire Swine");
attack(2, playerB, "Howlpack Wolf");
attack(2, playerB, "Incorrigible Youths");
block(2, playerA, "Watcher in the Web", "Ulrich, Uncontested Alpha");
block(2, playerA, "Watcher in the Web", "Kessig Dire Swine");
block(2, playerA, "Watcher in the Web", "Howlpack Wolf");
block(2, playerA, "Watcher in the Web", "Incorrigible Youths");
setStopAt(2, PhaseStep.COMBAT_DAMAGE);
execute();
assertLife(playerA, 19);
}
/*
* Reported bug: Night Market Guard was able to block a creature with Menace
*/
@Test
public void testNightMarketGuardShouldNotBlockCreatureWithMenace()
{
/*
Night Market Guard {3} 3/1
Artifact Creature Construct
Night Market Guard can block an additional creature each combat.
*/
String nMarketGuard = "Night Market Guard";
/*
Embraal Bruiser {1}{B}
Creature - Human Warrior
Embraal Bruiser enters the battlefield tapped.
Embraal Bruiser has menace as long as you control an artifact.
*/
String eBruiser = "Embraal Bruiser";
/*
{0} 1/1
* Artifact Creature Construct
*/
String memnite = "Memnite";
addCard(Zone.BATTLEFIELD, playerA, nMarketGuard);
addCard(Zone.BATTLEFIELD, playerB, eBruiser);
addCard(Zone.BATTLEFIELD, playerB, memnite); // only here to grant Embraal Menace
attack(4, playerB, eBruiser);
block(4, playerA, nMarketGuard, eBruiser);
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertTapped(eBruiser, true);
assertLife(playerA, 17); // could not block, so 3 damage goes through
assertPermanentCount(playerA, nMarketGuard, 1);
assertPermanentCount(playerB, eBruiser, 1);
}
}

View file

@ -0,0 +1,223 @@
/*
* 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 org.mage.test.combat;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static org.junit.Assert.assertEquals;
/**
*
* @author jeffwadsworth
* @author Simown
*/
public class CanBlockMultipleCreaturesTest extends CardTestPlayerBase {
@Test
public void testMultipleBlockWithTrample() {
addCard(Zone.BATTLEFIELD, playerA, "Watcher in the Web", 1);
addCard(Zone.BATTLEFIELD, playerB, "Ulrich, Uncontested Alpha", 1); // 6/6
addCard(Zone.BATTLEFIELD, playerB, "Kessig Dire Swine", 1); // 6/6 (trample if delirium)
addCard(Zone.BATTLEFIELD, playerB, "Howlpack Wolf", 1); // 3/3
addCard(Zone.BATTLEFIELD, playerB, "Incorrigible Youths", 1); // 4/3
// Trample requirement for Kessig Dire Swine
addCard(Zone.GRAVEYARD, playerB, "Forest", 1);
addCard(Zone.GRAVEYARD, playerB, "Memnite", 1);
addCard(Zone.GRAVEYARD, playerB, "Flight", 1);
addCard(Zone.GRAVEYARD, playerB, "Drain Life", 1);
// Attack with all 4 creatures and block all with the Watcher in the Web
attack(2, playerB, "Kessig Dire Swine");
attack(2, playerB, "Ulrich, Uncontested Alpha");
attack(2, playerB, "Howlpack Wolf");
attack(2, playerB, "Incorrigible Youths");
// BLOCKING ORDER MATTERS - the trampling creature must be selected to block first
// You can manually change the blocking order but it's easier to assign them in order
block(2, playerA, "Watcher in the Web", "Kessig Dire Swine");
block(2, playerA, "Watcher in the Web", "Ulrich, Uncontested Alpha");
block(2, playerA, "Watcher in the Web", "Howlpack Wolf");
block(2, playerA, "Watcher in the Web", "Incorrigible Youths");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 19);
}
@Test
public void testMultipleBlockWithTrample2() {
addCard(Zone.BATTLEFIELD, playerA, "Watcher in the Web", 1);
addCard(Zone.BATTLEFIELD, playerB, "Ulrich, Uncontested Alpha", 1); // 6/6
addCard(Zone.BATTLEFIELD, playerB, "Kessig Dire Swine", 1); // 6/6 (trample if delirium)
addCard(Zone.BATTLEFIELD, playerB, "Howlpack Wolf", 1); // 3/3
addCard(Zone.BATTLEFIELD, playerB, "Incorrigible Youths", 1); // 4/3
// Trample requirement for Kessig Dire Swine
addCard(Zone.GRAVEYARD, playerB, "Forest", 1);
addCard(Zone.GRAVEYARD, playerB, "Memnite", 1);
addCard(Zone.GRAVEYARD, playerB, "Flight", 1);
addCard(Zone.GRAVEYARD, playerB, "Drain Life", 1);
// Attack with all 4 creatures and block all with the Watcher in the Web
attack(2, playerB, "Kessig Dire Swine");
attack(2, playerB, "Ulrich, Uncontested Alpha");
attack(2, playerB, "Howlpack Wolf");
attack(2, playerB, "Incorrigible Youths");
// BLOCKING ORDER MATTERS - the trampling creature must be selected to block first
block(2, playerA, "Watcher in the Web", "Kessig Dire Swine");
block(2, playerA, "Watcher in the Web", "Ulrich, Uncontested Alpha");
block(2, playerA, "Watcher in the Web", "Howlpack Wolf");
// Don't block Incorrigible Youths
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
// Damage 1 from Kessig Dire Swine + 4 from Incorrigible Youths
assertLife(playerA, 15);
}
@Test
public void testCanOnlyBlockSingle() {
// Hundred-Handed One {2}{W}{W}
// Monstrosity 3. {3}{W}{W}{W} (If this creature isnt monstrous, put three +1/+1 counters on it and it becomes monstrous.)
//As long as Hundred-Handed One is monstrous, it has reach and can block an additional ninety-nine creatures each combat.
addCard(Zone.BATTLEFIELD, playerA, "Hundred-Handed One", 1);
addCard(Zone.BATTLEFIELD, playerB, "Bronze Sable", 1); // 2/1
addCard(Zone.BATTLEFIELD, playerB, "Fabled Hero", 1); // 2/2 double strike
// Attack with all 4 creatures and try and block both with hundred-handed one
attack(2, playerB, "Bronze Sable");
attack(2, playerB, "Fabled Hero");
block(2, playerA, "Hundred-Handed One", "Bronze Sable");
block(2, playerA, "Hundred-Handed One", "Fabled Hero");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
// Will fail on purpose - we are trying to block too many creatures!
try {
execute();
} catch(UnsupportedOperationException e) {
assertEquals("Hundred-Handed One cannot block Fabled Hero", e.getMessage());
}
}
@Test
public void testCanBlockMultiple() {
// Hundred-Handed One {2}{W}{W}
// Monstrosity 3. {3}{W}{W}{W} (If this creature isnt monstrous, put three +1/+1 counters on it and it becomes monstrous.)
// As long as Hundred-Handed One is monstrous, it has reach and can block an additional ninety-nine creatures each combat.
addCard(Zone.BATTLEFIELD, playerA, "Hundred-Handed One", 1);
// For monstrosity
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);
addCard(Zone.BATTLEFIELD, playerB, "Bronze Sable", 1); // 2/1
addCard(Zone.BATTLEFIELD, playerB, "Fabled Hero", 1); // 2/2 double strike
// Make hundred-handed one monstrous
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}{W}{W}{W}: Monstrosity 3.");
// Attack with all 4 creatures and try and block both with hundred-handed one
attack(2, playerB, "Bronze Sable");
attack(2, playerB, "Fabled Hero");
block(2, playerA, "Hundred-Handed One", "Bronze Sable");
block(2, playerA, "Hundred-Handed One", "Fabled Hero");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
// Will not fail this time as hundred-handed one is monstrous and can block up to 100 creatures
execute();
// Was a 3/5 but monstrosity 3
assertPowerToughness(playerA, "Hundred-Handed One", 6, 8);
// No one has been hit
assertLife(playerA, 20);
assertLife(playerB, 20);
}
/*
* Reported bug: Night Market Guard was able to block a creature with Menace
*/
@Test
public void testNightMarketGuardShouldNotBlockCreatureWithMenace()
{
/*
Night Market Guard {3} 3/1
Artifact Creature Construct
Night Market Guard can block an additional creature each combat.
*/
String nMarketGuard = "Night Market Guard";
/*
Embraal Bruiser {1}{B}
Creature - Human Warrior
Embraal Bruiser enters the battlefield tapped.
Embraal Bruiser has menace as long as you control an artifact.
*/
String eBruiser = "Embraal Bruiser";
/*
{0} 1/1
* Artifact Creature Construct
*/
String memnite = "Memnite";
addCard(Zone.BATTLEFIELD, playerA, nMarketGuard);
addCard(Zone.BATTLEFIELD, playerB, eBruiser);
addCard(Zone.BATTLEFIELD, playerB, memnite); // only here to grant Embraal Menace
attack(4, playerB, eBruiser);
block(4, playerA, nMarketGuard, eBruiser);
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
// Catch the illegal block
try {
execute();
} catch(UnsupportedOperationException e) {
assertEquals("Embraal Bruiser is blocked by 1 creature(s). It has to be blocked by 2 or more.", e.getMessage());
}
}
}

View file

@ -28,13 +28,10 @@
package org.mage.test.player;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
@ -65,15 +62,10 @@ import mage.counters.Counter;
import mage.counters.Counters;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterCreatureForCombat;
import mage.filter.common.FilterCreatureForCombatBlock;
import mage.filter.common.FilterCreatureOrPlayer;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.filter.common.*;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.BlockingPredicate;
import mage.filter.predicate.permanent.SummoningSicknessPredicate;
import mage.game.Game;
import mage.game.Graveyard;
@ -181,6 +173,11 @@ public class TestPlayer implements Player {
return null;
}
// Gets all permanents that match the filter
protected List<Permanent> findPermanents(FilterPermanent filter, UUID controllerId, Game game) {
return game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
}
private boolean checkExecuteCondition(String[] groups, Game game) {
if (groups[2].startsWith("spellOnStack=")) {
String spellOnStack = groups[2].substring(13);
@ -289,7 +286,7 @@ public class TestPlayer implements Player {
int index = 0;
int targetsSet = 0;
for (String targetName : targetList) {
Mode selectedMode = null;
Mode selectedMode;
if (targetName.startsWith("mode=")) {
int modeNr = Integer.parseInt(targetName.substring(5, 6));
if (modeNr == 0 || modeNr > (ability.getModes().isEachModeMoreThanOnce() ? ability.getModes().getSelectedModes().size() : ability.getModes().size())) {
@ -561,27 +558,88 @@ public class TestPlayer implements Player {
@Override
public void selectBlockers(Game game, UUID defendingPlayerId) {
UUID opponentId = game.getOpponents(computerPlayer.getId()).iterator().next();
// Map of Blocker reference -> list of creatures blocked
Map<MageObjectReference, List<MageObjectReference>> blockedCreaturesByCreature = new HashMap<>();
for (PlayerAction action : actions) {
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("block:")) {
String command = action.getAction();
command = command.substring(command.indexOf("block:") + 6);
String[] groups = command.split("\\$");
FilterCreatureForCombatBlock filterBlocker = new FilterCreatureForCombatBlock();
filterBlocker.add(new NamePredicate(groups[0]));
filterBlocker.add(Predicates.not(new BlockingPredicate()));
Permanent blocker = findPermanent(filterBlocker, computerPlayer.getId(), game);
if (blocker != null) {
FilterAttackingCreature filterAttacker = new FilterAttackingCreature();
filterAttacker.add(new NamePredicate(groups[1]));
Permanent attacker = findPermanent(filterAttacker, opponentId, game);
if (attacker != null) {
FilterControlledPermanent filterPermanent = new FilterControlledPermanent();
filterPermanent.add(new NamePredicate(groups[0]));
// Get all possible blockers - those with the same name on the battlefield
List<Permanent> possibleBlockers = findPermanents(filterPermanent, computerPlayer.getId(), game);
if (!possibleBlockers.isEmpty() && attacker != null) {
boolean blockerFound = false;
for(Permanent blocker: possibleBlockers) {
// See if it can block this creature
if(canBlockAnother(game, blocker, attacker, blockedCreaturesByCreature)) {
computerPlayer.declareBlocker(defendingPlayerId, blocker.getId(), attacker.getId(), game);
blockerFound = true;
break;
}
}
// If we haven't found a blocker then an illegal block has been made in the test
if(!blockerFound) {
throw new UnsupportedOperationException(groups[0] + " cannot block " + groups[1]);
}
}
}
checkMultipleBlockers(game, blockedCreaturesByCreature);
}
}
// Checks if a creature can block at least one more creature
private boolean canBlockAnother(Game game, Permanent blocker, Permanent attacker, Map<MageObjectReference, List<MageObjectReference>> blockedCreaturesByCreature) {
MageObjectReference blockerRef = new MageObjectReference(blocker, game);
// See if we already reference this blocker
for(MageObjectReference r: blockedCreaturesByCreature.keySet()) {
if(r.equals(blockerRef)) {
// Use the existing reference if we do
blockerRef = r;
}
}
List<MageObjectReference> blocked = blockedCreaturesByCreature.getOrDefault(blockerRef, new ArrayList<>());
int numBlocked = blocked.size();
// Can't block any more creatures
if(++numBlocked > blocker.getMaxBlocks()) {
return false;
}
// Add the attacker reference to the list of creatures this creature is blocking
blocked.add(new MageObjectReference(attacker, game));
blockedCreaturesByCreature.put(blockerRef, blocked);
return true;
}
// Check for Menace type abilities - if creatures can be blocked by >X or <Y only
private void checkMultipleBlockers(Game game, Map<MageObjectReference, List<MageObjectReference>> blockedCreaturesByCreature) {
// Stores the total number of blockers for each attacker
Map<MageObjectReference, Integer> blockersForAttacker = new HashMap<>();
// Calculate the number of blockers each attacker has
for(List<MageObjectReference> attackers : blockedCreaturesByCreature.values()) {
for(MageObjectReference mr: attackers) {
Integer blockers = blockersForAttacker.getOrDefault(mr, 0);
blockersForAttacker.put(mr, blockers+1);
}
}
// Check each attacker is blocked by an allowed amount of creatures
for(Map.Entry<MageObjectReference, Integer> entry: blockersForAttacker.entrySet()) {
Permanent attacker = entry.getKey().getPermanent(game);
Integer blockers = entry.getValue();
// If getMaxBlockedBy() == 0 it means any number of creatures can block this creature
if(attacker.getMaxBlockedBy() != 0 && blockers > attacker.getMaxBlockedBy()) {
throw new UnsupportedOperationException(attacker.getName() + " is blocked by " + blockers + " creature(s). It can only be blocked by " + attacker.getMaxBlockedBy() + " or less.");
}
else if(blockers < attacker.getMinBlockedBy()) {
throw new UnsupportedOperationException(attacker.getName() + " is blocked by " + blockers + " creature(s). It has to be blocked by " + attacker.getMinBlockedBy() + " or more.");
}
}
// No errors raised - all the blockers pass the test!
}
@Override
public Mode chooseMode(Modes modes, Ability source, Game game) {
if (!modesSet.isEmpty() && modes.getMaxModes() > modes.getSelectedModes().size()) {

View file

@ -805,9 +805,19 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* @param count Expected count.
*/
public void assertHandCount(Player player, String cardName, int count) throws AssertionError {
int actual;
if (cardName.contains("//")) { // special logic for cheched split cards, because in game logic of card name filtering is different than for test
actual = 0;
for (Card card : currentGame.getPlayer(player.getId()).getHand().getCards(currentGame)) {
if (card.getName().equals(cardName)) {
actual++;
}
}
} else {
FilterCard filter = new FilterCard();
filter.add(new NamePredicate(cardName));
int actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
}
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2017 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.abilities.costs;
import java.io.Serializable;
/**
* Some Cost act like wrappers hiding real costs inside
*
* @author noxx
*/
public interface WrapperCost extends Serializable {
Cost getOriginalCost();
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2017 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.abilities.costs.common;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.WrapperCost;
import mage.game.Game;
import mage.game.events.CostEvent;
import mage.game.events.GameEvent;
import mage.target.Targets;
import java.util.UUID;
/**
* Cycling Cost to interact with cards like 'New Perspectives'
*/
public class CyclingCost implements Cost, WrapperCost {
protected Cost cost;
public CyclingCost(Cost cost) {
this.cost = cost;
}
public CyclingCost(final CyclingCost cost) {
this.cost = cost.cost.copy();
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
return pay(ability, game, sourceId, controllerId, noMana, cost);
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
CostEvent costEvent = new CostEvent(GameEvent.EventType.CAN_PAY_CYCLE_COST, sourceId, sourceId, controllerId, cost);
game.replaceEvent(costEvent);
return cost.canPay(ability, sourceId, controllerId, game) || costEvent.getCost().canPay(ability, sourceId, controllerId, game);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
CostEvent costEvent = new CostEvent(GameEvent.EventType.PAY_CYCLE_COST, sourceId, sourceId, controllerId, cost);
game.replaceEvent(costEvent);
cost = costEvent.getCost();
return cost.pay(ability, game, sourceId, controllerId, noMana, cost);
}
@Override
public String getText() {
return cost.getText();
}
@Override
public void setText(String text) {
cost.setText(text);
}
@Override
public Targets getTargets() {
return cost.getTargets();
}
@Override
public boolean isPaid() {
return cost.isPaid();
}
@Override
public void clearPaid() {
cost.clearPaid();
}
@Override
public void setPaid() {
cost.setPaid();
}
@Override
public UUID getId() {
return cost.getId();
}
@Override
public Cost copy() {
return new CyclingCost(this);
}
@Override
public Cost getOriginalCost() {
return this.cost;
}
}

View file

@ -58,7 +58,10 @@ public class BecomesBlackZombieAdditionEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
Permanent creature = game.getPermanent(source.getTargets().getFirstTarget());
if (creature == null) {
creature = game.getPermanentEntering(source.getTargets().getFirstTarget());
}
if (creature != null) {
switch (layer) {
case TypeChangingEffects_4:

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.CyclingCost;
import mage.abilities.costs.common.DiscardSourceCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -90,77 +91,3 @@ public class CyclingAbility extends ActivatedAbilityImpl {
}
}
class CyclingCost implements Cost {
protected Cost cost;
public CyclingCost(Cost cost) {
this.cost = cost;
}
public CyclingCost(final CyclingCost cost) {
this.cost = cost.cost.copy();
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
return pay(ability, game, sourceId, controllerId, noMana, cost);
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
CostEvent costEvent = new CostEvent(GameEvent.EventType.CAN_PAY_CYCLE_COST, sourceId, sourceId, controllerId, cost);
game.replaceEvent(costEvent);
return cost.canPay(ability, sourceId, controllerId, game) || costEvent.getCost().canPay(ability, sourceId, controllerId, game);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
CostEvent costEvent = new CostEvent(GameEvent.EventType.PAY_CYCLE_COST, sourceId, sourceId, controllerId, cost);
game.replaceEvent(costEvent);
cost = costEvent.getCost();
return cost.pay(ability, game, sourceId, controllerId, noMana, cost);
}
@Override
public String getText() {
return cost.getText();
}
@Override
public void setText(String text) {
cost.setText(text);
}
@Override
public Targets getTargets() {
return cost.getTargets();
}
@Override
public boolean isPaid() {
return cost.isPaid();
}
@Override
public void clearPaid() {
cost.clearPaid();
}
@Override
public void setPaid() {
cost.setPaid();
}
@Override
public UUID getId() {
return cost.getId();
}
@Override
public Cost copy() {
return new CyclingCost(this);
}
}

View file

@ -28,14 +28,11 @@
package mage.filter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.cards.Card;
import mage.cards.SplitCard;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.filter.predicate.ObjectSourcePlayer;
@ -78,13 +75,8 @@ public class FilterCard extends FilterObject<Card> {
if (card == null) {
return false;
}
if (card.isSplitCard()) {
return super.match(((SplitCard) card).getLeftHalfCard(), game)
|| super.match(((SplitCard) card).getRightHalfCard(), game);
} else {
return super.match(card, game);
}
}
public boolean match(Card card, UUID playerId, Game game) {
if (!this.match(card, game)) {

View file

@ -27,6 +27,10 @@
*/
package mage.util;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.ObjectColor;
@ -36,7 +40,6 @@ import mage.abilities.SpellAbility;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.mana.*;
import mage.cards.Card;
import mage.cards.SplitCard;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -44,11 +47,6 @@ import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.util.functions.CopyTokenFunction;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author nantuko
*/
@ -540,14 +538,8 @@ public final class CardUtil {
cmcObject.add(object.getConvertedManaCost());
} else if (object instanceof Card) {
Card card = (Card) object;
if (card instanceof SplitCard) {
SplitCard splitCard = (SplitCard) card;
cmcObject.add(splitCard.getLeftHalfCard().getConvertedManaCost());
cmcObject.add(splitCard.getRightHalfCard().getConvertedManaCost());
} else {
cmcObject.add(card.getConvertedManaCost());
}
}
return cmcObject;
}