Merge remote-tracking branch 'refs/remotes/magefree/master'

This commit is contained in:
CountAndromalius 2016-07-12 19:24:54 -03:00
commit a863f65679
14 changed files with 154 additions and 44 deletions

View file

@ -28,13 +28,12 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.abilities.keyword.CascadeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
/**
@ -48,9 +47,6 @@ public class DemonicDread extends CardImpl {
super(ownerId, 38, "Demonic Dread", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}{R}");
this.expansionSetCode = "ARB";
// Cascade
this.addAbility(new CascadeAbility());

View file

@ -68,7 +68,7 @@ class CertainDeathEffect extends OneShotEffect {
public CertainDeathEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target creature. Its controler loses 2 life and you gain 2 life";
this.staticText = "Destroy target creature. Its controller loses 2 life and you gain 2 life";
}
public CertainDeathEffect(final CertainDeathEffect effect) {

View file

@ -77,8 +77,10 @@ public class Cryptbreaker extends CardImpl {
this.addAbility(ability);
// Tap three untapped Zombies you control: You draw a card and you lose 1 life.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true)));
Effect effect = new LoseLifeSourceControllerEffect(1);
Effect effect = new DrawCardSourceControllerEffect(1);
effect.setText("You draw a card");
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true)));
effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -41,8 +41,8 @@ import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieToken;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer;
@ -62,9 +62,9 @@ public class DarkSalvation extends CardImpl {
Effect effect = new CreateTokenTargetEffect(new ZombieToken(), new ManacostVariableValue());
effect.setText("Target player puts X 2/2 black Zombie creature tokens onto the battlefield");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent(), false));
DynamicValue value = new ZombiesControlledByTargetPlayerCount();
DynamicValue value = new ZombiesControlledByTargetCreaturesControllerCount();
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent(), false));
effect = new BoostTargetEffect(value, value, Duration.EndOfTurn, true);
effect.setTargetPointer(new SecondTargetPointer());
effect.setText(", then up to one target creature gets -1/-1 until end of turn for each Zombie that player controls");
@ -81,7 +81,7 @@ public class DarkSalvation extends CardImpl {
}
}
class ZombiesControlledByTargetCreaturesControllerCount implements DynamicValue {
class ZombiesControlledByTargetPlayerCount implements DynamicValue {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("Zombies");
@ -90,15 +90,15 @@ class ZombiesControlledByTargetCreaturesControllerCount implements DynamicValue
}
@Override
public ZombiesControlledByTargetCreaturesControllerCount copy() {
return new ZombiesControlledByTargetCreaturesControllerCount();
public ZombiesControlledByTargetPlayerCount copy() {
return new ZombiesControlledByTargetPlayerCount();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent targetCreature = game.getPermanent(effect.getTargetPointer().getFirst(game, sourceAbility));
if (targetCreature != null) {
int value = game.getBattlefield().countAll(filter, targetCreature.getControllerId(), game);
Player player = game.getPlayer(sourceAbility.getTargets().get(0).getFirstTarget());
if (player != null) {
int value = game.getBattlefield().countAll(filter, player.getId(), game);
return -1 * value;
} else {
return 0;

View file

@ -62,6 +62,7 @@ public class DuskFeaster extends CardImpl {
// <i>Delirium</i> &mdash; Dusk Feaster costs {2} less to cast if there are four or more card types among cards in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new DuskFeasterCostReductionEffect()));
// Flying
this.addAbility(FlyingAbility.getInstance());
}
@ -80,7 +81,7 @@ class DuskFeasterCostReductionEffect extends CostModificationEffectImpl {
DuskFeasterCostReductionEffect() {
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "{this} costs {2} less to cast if there are four or more card types among cards in your graveyard";
staticText = "<i>Delirium</i> &mdash; {this} costs {2} less to cast if there are four or more card types among cards in your graveyard";
}
DuskFeasterCostReductionEffect(final DuskFeasterCostReductionEffect effect) {
@ -105,7 +106,7 @@ class DuskFeasterCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
boolean hasDelirium = false;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
@ -116,9 +117,9 @@ class DuskFeasterCostReductionEffect extends CostModificationEffectImpl {
int number = foundCardTypes.size();
hasDelirium = number > 3;
}
return abilityToModify.getSourceId().equals(source.getSourceId())
&& (abilityToModify instanceof SpellAbility)
return abilityToModify.getSourceId().equals(source.getSourceId())
&& (abilityToModify instanceof SpellAbility)
&& hasDelirium;
}

View file

@ -33,6 +33,7 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.MenaceAbility;
@ -52,7 +53,7 @@ import mage.target.common.TargetCardInYourGraveyard;
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class GrafHarvest extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Zombies you control");
static {
@ -64,8 +65,10 @@ public class GrafHarvest extends CardImpl {
this.expansionSetCode = "EMN";
// Zombies you control have menace.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new MenaceAbility(), Duration.WhileOnBattlefield, filter)));
Effect effect = new GainAbilityAllEffect(new MenaceAbility(), Duration.WhileOnBattlefield, filter);
effect.setText("Zombies you control have menace. <i>(They can't be blocked except by two or more creatures.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// {3}{B}, Exile a creature card from your graveyard: Put a 2/2 black Zombie creature token onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken()), new ManaCostsImpl("{3}{B}"));
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(new FilterCreatureCard("a creature card from your graveyard"))));

View file

@ -60,8 +60,7 @@ public class NoosegrafMob extends CardImpl {
this.toughness = new MageInt(0);
// Noosegraf Mob enters the battlefield with five +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(5)),
"{this} enters the battlefield with five +1/+1 counters on it"));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(5)), "with five +1/+1 counters on it"));
// Whenever a player casts a spell, remove a +1/+1 counter from Noosegraf Mob. If you do, put a 2/2 black Zombie creature token onto the battlefield.
this.addAbility(new SpellCastAllTriggeredAbility(new NoosegrafMobEffect(), false));

View file

@ -28,8 +28,10 @@
package mage.sets.eldritchmoon;
import java.util.UUID;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -51,11 +53,16 @@ public class RuthlessDisposal extends CardImpl {
this.expansionSetCode = "EMN";
// As an additional cost to cast Ruthless Disposal, discard a card and sacrifice a creature.
this.getSpellAbility().addCost(new DiscardTargetCost(new TargetCardInHand(new FilterCard("card to discard"))));
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
this.getSpellAbility().addCost(new DiscardTargetCost(new TargetCardInHand(new FilterCard("a card"))));
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
cost.setText("As an additional cost to cast {this}, sacrifice a creature");
this.getSpellAbility().addCost(cost);
// Two target creatures each get -13/-13 until end of turn.
Effect effect = new BoostTargetEffect(-13, -13, Duration.EndOfTurn);
effect.setText("Two target creatures each get -13/-13 until end of turn");
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
this.getSpellAbility().addEffect(new BoostTargetEffect(-13, -13, Duration.EndOfTurn));
this.getSpellAbility().addEffect(effect);
}

View file

@ -66,7 +66,7 @@ public class StrangeAugmentation extends CardImpl {
// <i>Delirium</i> &mdash Enchanted creature gets an additional +2/+2 as long as there are four or more card types among cards in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEnchantedEffect(2, 2), DeliriumCondition.getInstance(),
"<i>Delirium</i> &mdash; Enchanted creature gets an additional +2/+2 as long as you have no cards in hand")));
"<i>Delirium</i> &mdash; Enchanted creature gets an additional +2/+2 as long as there are four or more card types among cards in your graveyard.")));
}
public StrangeAugmentation(final StrangeAugmentation card) {

View file

@ -53,7 +53,7 @@ public class StromkirkCondemned extends CardImpl {
}
public StromkirkCondemned(UUID ownerId) {
super(ownerId, 105, "Stromkirk Condemned", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{B}");
super(ownerId, 106, "Stromkirk Condemned", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{B}");
this.expansionSetCode = "EMN";
this.subtype.add("Vampire");
this.subtype.add("Horror");

View file

@ -51,7 +51,7 @@ public class WhispersOfEmrakul extends CardImpl {
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DiscardTargetEffect(1, true),
new InvertCondition(DeliriumCondition.getInstance()),
"Target player sacrifices a creature or planeswalker."));
"Target opponent discards a card at random."));
// <i>Delirium</i> &mdash; If there are four or more card types among cards in your graveyard, that player discards two cards at random instead.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(

View file

@ -28,14 +28,14 @@
package mage.sets.planechase;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
@ -59,16 +59,16 @@ public class NoxiousGhoul extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(3);
filter.add(Predicates.or(
new CardIdPredicate(this.getId()),
new SubtypePredicate("Zombie")));
filter2.add(new CardTypePredicate(CardType.CREATURE));
filter2.add(Predicates.not(
new SubtypePredicate("Zombie")));
final String rule = "Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.";
final String rule = "Whenever {this} or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.";
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter2, false), filter, false, rule));

View file

@ -29,6 +29,7 @@ package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -227,4 +228,101 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
}
// Test self trigger
@Test
public void testNoxiousGhoul1() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // {3}{B}{B}
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Noxious Ghoul", 1);
assertPowerToughness(playerB, "Silvercoat Lion", 1, 1);
assertPowerToughness(playerB, "Scathe Zombies", 2, 2);
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
}
// Test another zombie trigger
@Test
public void testNoxiousGhoul2() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // 3/3 Zombie {3}{B}{B}
addCard(Zone.HAND, playerA, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
// Changeling (This card is every creature type.)
// Creatures target player controls get -2/-0 and lose all creature types until end of turn.
addCard(Zone.HAND, playerB, "Ego Erasure", 1); // {2}{U}
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Ego Erasure", "targetPlayer=PlayerA", "Whenever");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scathe Zombies");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Noxious Ghoul", 1);
assertGraveyardCount(playerB, "Ego Erasure", 1);
assertPowerToughness(playerA, "Noxious Ghoul", -1, 1);// -2/0 from Ego Erasure / -2/0 from the 2 zombies coming into play
assertPermanentCount(playerA, "Scathe Zombies", 1);
assertPowerToughness(playerB, "Scathe Zombies", 2, 2);
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
}
// Test copy of Noxious Ghoul
@Test
public void testCopyNoxiousGhoul() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 9);
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // 3/3 Zombie {3}{B}{B}
// You may have Clone enter the battlefield as a copy of any creature on the battlefield.
addCard(Zone.HAND, playerA, "Clone", 1); // 0/0 Shapeshifter {3}{U}
addCard(Zone.BATTLEFIELD, playerA, "Carnivorous Plant", 1); // 4/5
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
// Changeling (This card is every creature type.)
// Creatures target player controls get -2/-0 and lose all creature types until end of turn.
addCard(Zone.HAND, playerB, "Ego Erasure", 1); // {2}{U}
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
addCard(Zone.BATTLEFIELD, playerB, "Carnivorous Plant", 1); // 4/5
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Clone");
setChoice(playerA, "Noxious Ghoul");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ego Erasure", "targetPlayer=PlayerA", "Whenever");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Noxious Ghoul", 2);
assertGraveyardCount(playerB, "Ego Erasure", 1);
assertPowerToughness(playerA, "Noxious Ghoul", -1, 1, Filter.ComparisonScope.All);// -1/-1 from the second Noxious Ghoul also if it's no zombie
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
assertPowerToughness(playerB, "Carnivorous Plant", 2, 3);
assertPowerToughness(playerA, "Carnivorous Plant", 0, 3);
}
}

View file

@ -987,9 +987,13 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
*/
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) {
if (StackClause.WHILE_ON_STACK.equals(clause)) {
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName + "$spellOnStack=" + spellOnStack);
player.addAction(turnNum, step, "activate:Cast " + cardName
+ "$" + (targetName.startsWith("target") ? targetName : "target=" + targetName)
+ "$spellOnStack=" + spellOnStack);
} else {
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName + "$!spellOnStack=" + spellOnStack);
player.addAction(turnNum, step, "activate:Cast " + cardName
+ "$" + (targetName.startsWith("target") ? targetName : "target=" + targetName)
+ "$!spellOnStack=" + spellOnStack);
}
}