Added a test, some minor changes.

This commit is contained in:
LevelX2 2015-07-31 15:46:14 +02:00
parent 3c026c7d19
commit 5fae4878c0
7 changed files with 165 additions and 114 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.sets.alarareborn;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -35,13 +36,15 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.NameACardEffect;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/**
*
* @author Plopman
@ -54,8 +57,6 @@ public class MeddlingMage extends CardImpl {
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(2);

View file

@ -109,6 +109,6 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
@Override
public String getRule() {
return "Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn";
return "Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn.";
}
}

View file

@ -25,19 +25,17 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.worldwake;
import java.util.UUID;
import mage.abilities.condition.common.LandfallCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.LandfallCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.LandfallWatcher;
@ -54,8 +52,10 @@ public class Groundswell extends CardImpl {
// Target creature gets +2/+2 until end of turn.
//Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead.
this.getSpellAbility().addWatcher(new LandfallWatcher());
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn), new BoostTargetEffect(2, 2, Duration.EndOfTurn),
new LockedInCondition(LandfallCondition.getInstance()),
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new AddContinuousEffectToGame(new BoostTargetEffect(4, 4, Duration.EndOfTurn)),
new AddContinuousEffectToGame(new BoostTargetEffect(2, 2, Duration.EndOfTurn)),
LandfallCondition.getInstance(),
"Target creature gets +2/+2 until end of turn. <br><i>Landfall</i> &mdash; If you had a land enter the battlefield under your control this turn, that creature gets +4/44 until end of turn instead"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -25,9 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.zendikar;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -36,7 +36,11 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
@ -46,8 +50,6 @@ import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author Loki
@ -59,13 +61,17 @@ public class CelestialMantle extends CardImpl {
this.expansionSetCode = "ZEN";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
// Whenever enchanted creature deals combat damage to a player, double its controller's life total.
this.addAbility(new CelestialMantleAbility());
}
@ -114,6 +120,7 @@ class CelestialMantleAbility extends TriggeredAbilityImpl {
}
class CelestialMantleEffect extends OneShotEffect {
CelestialMantleEffect() {
super(Outcome.GainLife);
}

View file

@ -83,4 +83,26 @@ public class PreventRepeatedActionsTest extends CardTestPlayerBaseAI {
assertTapped("Basalt Monolith", false);
}
/**
* AI gets stuck with two Kiora's Followers #1167
*/
@Test
public void testKiorasFollower() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2, true);
// {T}: Untap another target permanent.
addCard(Zone.BATTLEFIELD, playerA, "Kiora's Follower", 1, true);
addCard(Zone.BATTLEFIELD, playerA, "Kiora's Follower", 1);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2);
attack(2, playerB, "Silvercoat Lion");
attack(2, playerB, "Silvercoat Lion");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertLife(playerA, 16);
assertTapped("Kiora's Follower", false);
}
}

View file

@ -30,6 +30,7 @@ package org.mage.test.cards.abilities.keywords;
import mage.abilities.keyword.IntimidateAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -37,7 +38,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class LandfallTest extends CardTestPlayerBase {
@Test
@ -64,9 +64,11 @@ public class LandfallTest extends CardTestPlayerBase {
assertLife(playerB, 20);
}
/**
* If you Hive Mind an opponent's Rest for the Weary and redirect its target to yourself when it's not your turn,
* the game spits out this message and rolls back to before Rest for the Weary was cast.
* If you Hive Mind an opponent's Rest for the Weary and redirect its target
* to yourself when it's not your turn, the game spits out this message and
* rolls back to before Rest for the Weary was cast.
*
*/
@Test
@ -128,12 +130,10 @@ public class LandfallTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mountain");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Searing Blaze");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -159,7 +159,6 @@ public class LandfallTest extends CardTestPlayerBase {
attack(2, playerB, "Silvercoat Lion");
castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion");
setStopAt(2, PhaseStep.END_COMBAT);
execute();
@ -173,31 +172,50 @@ public class LandfallTest extends CardTestPlayerBase {
assertLife(playerB, 20);
}
/*
21:09: Turn 8 arucki (25 - 16)
21:09: arucki draws a card
21:09: Ability triggers: Sylvan Library [868] - At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library.
21:09: arucki draws two cards
21:09: arucki loses 4 life
21:09: arucki pays 4 life to keep a card on hand
21:09: arucki puts 1 card(s) back to library
21:09: arucki plays Twilight Mire [f4d]
21:10: arucki activates: Inkmoth Nexus [1b5] becomes a 1/1 Blinkmoth artifact creature with flying and infect until end of turn. It's still a land. (It deals damage to creatures in the form of -1/-1 counters and to players in the form of poison counters.). from Inkmoth Nexus [1b5]
21:10: arucki casts Groundswell [b28] targeting Inkmoth Nexus [1b5]
21:10: Ability triggers: Wild Defiance [990] - Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn
21:10: arucki puts Groundswell [b28] from stack into his or her graveyard
21:10: arucki attacks with 1 creature
21:10: Attacker: Inkmoth Nexus 1b5 unblocked
*/
@Test
@Ignore
public void testGroundswellWithLandfall() {
// Target creature gets +2/+2 until end of turn.
//Landfall - If you had a land enter the battlefield under your control this turn, that creature gets +4/+4 until end of turn instead.
addCard(Zone.HAND, playerB, "Groundswell",1);
addCard(Zone.HAND, playerB, "Forest");
addCard(Zone.HAND, playerB, "Groundswell", 1); // Instant
addCard(Zone.BATTLEFIELD, playerB, "Forest");
addCard(Zone.HAND, playerB, "Twilight Mire");
// Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn.
addCard(Zone.BATTLEFIELD, playerB, "Wild Defiance", 1);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Forest");
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Twilight Mire");
attack(2, playerB, "Silvercoat Lion");
castSpell(2, PhaseStep.DECLARE_ATTACKERS, playerB, "Groundswell", "Silvercoat Lion");
setStopAt(2, PhaseStep.END_COMBAT);
execute();
assertPermanentCount(playerB, "Forest", 1);
assertPermanentCount(playerB, "Twilight Mire", 1);
assertGraveyardCount(playerB, "Groundswell", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
assertPowerToughness(playerB, "Silvercoat Lion", 6, 6);
assertPowerToughness(playerB, "Silvercoat Lion", 9, 9);
assertLife(playerA, 14); // 2 + 4
assertLife(playerA, 11); // 2 + 4 + 3
assertLife(playerB, 20);
}
}

View file

@ -115,8 +115,11 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode == null || mode.getTargets().size() == 0) {
return "no target";
}
Target target = mode.getTargets().get(0);
StringBuilder sb = new StringBuilder();
if (target.getMaxNumberOfTargets() > 1) {
if (target.getNumberOfTargets() < target.getNumberOfTargets()) {
sb.append("up to ");