mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Some formatting and a additional Cloudshift test.
This commit is contained in:
parent
d031b93fd4
commit
2d4b1a4619
6 changed files with 61 additions and 18 deletions
|
|
@ -27,19 +27,18 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,6 +54,7 @@ public class FerventCathar extends CardImpl<FerventCathar> {
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Haste
|
||||||
this.addAbility(HasteAbility.getInstance());
|
this.addAbility(HasteAbility.getInstance());
|
||||||
|
|
||||||
// When Fervent Cathar enters the battlefield, target creature can't block this turn.
|
// When Fervent Cathar enters the battlefield, target creature can't block this turn.
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,11 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
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.continious.GainAbilityTargetEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
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));
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), false));
|
||||||
|
|
||||||
// +1: Draw a card, then discard a card at random.
|
// +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.
|
// -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);
|
//effect =
|
||||||
ability.addTarget(new TargetPlayer());
|
ability = new LoyaltyAbility(new DamageTargetEffect(new CardsInTargetHandCount(), true, "that player"), -4);
|
||||||
|
ability.addTarget(new TargetPlayer(true));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
// -6: Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn.
|
// -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));
|
this.addAbility(new LoyaltyAbility(new TibaltTheFiendBloodedThirdEffect(), -6));
|
||||||
|
|
@ -158,7 +166,7 @@ class TibaltTheFiendBloodedThirdEffect extends OneShotEffect<TibaltTheFiendBlood
|
||||||
|
|
||||||
class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl<TibaltTheFiendBloodedControlEffect> {
|
class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl<TibaltTheFiendBloodedControlEffect> {
|
||||||
|
|
||||||
private UUID controllerId;
|
private final UUID controllerId;
|
||||||
|
|
||||||
public TibaltTheFiendBloodedControlEffect(UUID controllerId) {
|
public TibaltTheFiendBloodedControlEffect(UUID controllerId) {
|
||||||
super(Duration.EndOfTurn, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
super(Duration.EndOfTurn, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,15 @@
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.common.DoIfCostPaid;
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@
|
||||||
package mage.sets.mirrodinbesieged;
|
package mage.sets.mirrodinbesieged;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.ShuffleSpellEffect;
|
import mage.abilities.effects.common.ShuffleSpellEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.game.permanent.token.Token;
|
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}");
|
super(ownerId, 19, "White Sun's Zenith", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{W}{W}{W}");
|
||||||
this.expansionSetCode = "MBS";
|
this.expansionSetCode = "MBS";
|
||||||
this.color.setWhite(true);
|
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(new CreateTokenEffect(new CatToken(), new ManacostVariableValue()));
|
||||||
this.getSpellAbility().addEffect(ShuffleSpellEffect.getInstance());
|
this.getSpellAbility().addEffect(ShuffleSpellEffect.getInstance());
|
||||||
}
|
}
|
||||||
|
|
@ -65,6 +66,7 @@ public class WhiteSunsZenith extends CardImpl<WhiteSunsZenith> {
|
||||||
class CatToken extends Token {
|
class CatToken extends Token {
|
||||||
public CatToken() {
|
public CatToken() {
|
||||||
super("Cat", "2/2 white Cat creature token");
|
super("Cat", "2/2 white Cat creature token");
|
||||||
|
setOriginalExpansionSetCode("SOM");
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
color = ObjectColor.WHITE;
|
color = ObjectColor.WHITE;
|
||||||
subtype.add("Cat");
|
subtype.add("Cat");
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public class CloudshiftTest extends CardTestPlayerBase {
|
||||||
Assert.assertFalse(clone.getAbilities().contains(LifelinkAbility.getInstance()));
|
Assert.assertFalse(clone.getAbilities().contains(LifelinkAbility.getInstance()));
|
||||||
Assert.assertFalse(clone.getAbilities().contains(FirstStrikeAbility.getInstance()));
|
Assert.assertFalse(clone.getAbilities().contains(FirstStrikeAbility.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEquipmentDetached() {
|
public void testEquipmentDetached() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
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());
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,10 @@ import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.Target;
|
|
||||||
|
|
||||||
public class FirstTargetPointer implements TargetPointer {
|
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() {
|
public static FirstTargetPointer getInstance() {
|
||||||
return new FirstTargetPointer();
|
return new FirstTargetPointer();
|
||||||
|
|
@ -22,7 +21,7 @@ public class FirstTargetPointer implements TargetPointer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FirstTargetPointer(FirstTargetPointer firstTargetPointer) {
|
public FirstTargetPointer(FirstTargetPointer firstTargetPointer) {
|
||||||
this.zoneChangeCounter = new HashMap<UUID, Integer>();
|
this.zoneChangeCounter = new HashMap<>();
|
||||||
for (Map.Entry<UUID, Integer> entry : firstTargetPointer.zoneChangeCounter.entrySet()) {
|
for (Map.Entry<UUID, Integer> entry : firstTargetPointer.zoneChangeCounter.entrySet()) {
|
||||||
this.zoneChangeCounter.put(entry.getKey(), entry.getValue());
|
this.zoneChangeCounter.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +41,7 @@ public class FirstTargetPointer implements TargetPointer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UUID> getTargets(Game game, Ability source) {
|
public List<UUID> getTargets(Game game, Ability source) {
|
||||||
ArrayList<UUID> target = new ArrayList<UUID>();
|
ArrayList<UUID> target = new ArrayList<>();
|
||||||
if (source.getTargets().size() > 0) {
|
if (source.getTargets().size() > 0) {
|
||||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||||
Card card = game.getCard(targetId);
|
Card card = game.getCard(targetId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue