* Some formatting and a additional Cloudshift test.

This commit is contained in:
LevelX2 2014-04-05 02:52:24 +02:00
parent d031b93fd4
commit 2d4b1a4619
6 changed files with 61 additions and 18 deletions

View file

@ -27,19 +27,18 @@
*/
package mage.sets.avacynrestored;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author noxx
*/
@ -55,6 +54,7 @@ public class FerventCathar extends CardImpl<FerventCathar> {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Haste
this.addAbility(HasteAbility.getInstance());
// When Fervent Cathar enters the battlefield, target creature can't block this turn.

View file

@ -41,8 +41,11 @@ import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DiscardControllerEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.HasteAbility;
@ -72,10 +75,15 @@ public class TibaltTheFiendBlooded extends CardImpl<TibaltTheFiendBlooded> {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), false));
// +1: Draw a card, then discard a card at random.
this.addAbility(new LoyaltyAbility(new TibaltTheFiendBloodedFirstEffect(), 1));
LoyaltyAbility ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 1);
Effect effect = new DiscardControllerEffect(1, true);
effect.setText(", then discard a card at random");
ability.addEffect(effect);
this.addAbility(ability);
// -4: Tibalt, the Fiend-Blooded deals damage equal to the number of cards in target player's hand to that player.
LoyaltyAbility ability = new LoyaltyAbility(new DamageTargetEffect(new CardsInTargetHandCount()), -4);
ability.addTarget(new TargetPlayer());
//effect =
ability = new LoyaltyAbility(new DamageTargetEffect(new CardsInTargetHandCount(), true, "that player"), -4);
ability.addTarget(new TargetPlayer(true));
this.addAbility(ability);
// -6: Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn.
this.addAbility(new LoyaltyAbility(new TibaltTheFiendBloodedThirdEffect(), -6));
@ -158,7 +166,7 @@ class TibaltTheFiendBloodedThirdEffect extends OneShotEffect<TibaltTheFiendBlood
class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl<TibaltTheFiendBloodedControlEffect> {
private UUID controllerId;
private final UUID controllerId;
public TibaltTheFiendBloodedControlEffect(UUID controllerId) {
super(Duration.EndOfTurn, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);

View file

@ -29,15 +29,15 @@
package mage.sets.innistrad;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;

View file

@ -29,14 +29,14 @@
package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ShuffleSpellEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.Token;
/**
@ -48,6 +48,7 @@ public class WhiteSunsZenith extends CardImpl<WhiteSunsZenith> {
super(ownerId, 19, "White Sun's Zenith", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{W}{W}{W}");
this.expansionSetCode = "MBS";
this.color.setWhite(true);
// Put X 2/2 white Cat creature tokens onto the battlefield. Shuffle White Sun's Zenith into its owner's library.
this.getSpellAbility().addEffect(new CreateTokenEffect(new CatToken(), new ManacostVariableValue()));
this.getSpellAbility().addEffect(ShuffleSpellEffect.getInstance());
}
@ -65,6 +66,7 @@ public class WhiteSunsZenith extends CardImpl<WhiteSunsZenith> {
class CatToken extends Token {
public CatToken() {
super("Cat", "2/2 white Cat creature token");
setOriginalExpansionSetCode("SOM");
cardType.add(CardType.CREATURE);
color = ObjectColor.WHITE;
subtype.add("Cat");

View file

@ -67,6 +67,7 @@ public class CloudshiftTest extends CardTestPlayerBase {
Assert.assertFalse(clone.getAbilities().contains(LifelinkAbility.getInstance()));
Assert.assertFalse(clone.getAbilities().contains(FirstStrikeAbility.getInstance()));
}
@Test
public void testEquipmentDetached() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
@ -91,4 +92,37 @@ public class CloudshiftTest extends CardTestPlayerBase {
Assert.assertEquals("Silvercoat Lion's toughness has to be 2",2, silvercoatLion.getToughness().getValue());
}
/**
* Tests that casting Cloudshift makes creature able to block again
* if it before was targeted with can't block effect
*
*/
@Test
public void testCreatureCanBlockAgainAfterCloudshift() {
addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerA, "Timberland Guide");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
addCard(Zone.HAND, playerA, "Cloudshift");
addCard(Zone.HAND, playerB, "Fervent Cathar");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Fervent Cathar");
addTarget(playerB, "Timberland Guide");
attack(2, playerB, "Fervent Cathar");
castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerA, "Cloudshift", "Timberland Guide");
block(2, playerA, "Timberland Guide", "Fervent Cathar");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
// blocked and therefore no more on the battlefield
assertPermanentCount(playerB, "Fervent Cathar", 0);
assertPermanentCount(playerA, "Timberland Guide", 0);
}
}

View file

@ -8,11 +8,10 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.game.Game;
import mage.target.Target;
public class FirstTargetPointer implements TargetPointer {
private Map<UUID, Integer> zoneChangeCounter = new HashMap<UUID, Integer>();
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
public static FirstTargetPointer getInstance() {
return new FirstTargetPointer();
@ -22,7 +21,7 @@ public class FirstTargetPointer implements TargetPointer {
}
public FirstTargetPointer(FirstTargetPointer firstTargetPointer) {
this.zoneChangeCounter = new HashMap<UUID, Integer>();
this.zoneChangeCounter = new HashMap<>();
for (Map.Entry<UUID, Integer> entry : firstTargetPointer.zoneChangeCounter.entrySet()) {
this.zoneChangeCounter.put(entry.getKey(), entry.getValue());
}
@ -42,7 +41,7 @@ public class FirstTargetPointer implements TargetPointer {
@Override
public List<UUID> getTargets(Game game, Ability source) {
ArrayList<UUID> target = new ArrayList<UUID>();
ArrayList<UUID> target = new ArrayList<>();
if (source.getTargets().size() > 0) {
for (UUID targetId : source.getTargets().get(0).getTargets()) {
Card card = game.getCard(targetId);