[ORI] Added Tainted Remedy and Liliana Planeswalker. Fix for build bug of Sigled Starfish.

This commit is contained in:
LevelX2 2015-07-03 12:26:14 +02:00
parent 212f1e89b5
commit 25ca463520
7 changed files with 417 additions and 26 deletions

View file

@ -792,7 +792,7 @@ public class HumanPlayer extends PlayerImpl {
game.fireSelectEvent(playerId, "Select attackers", options); game.fireSelectEvent(playerId, "Select attackers", options);
waitForResponse(game); waitForResponse(game);
if (response.getString() != null && response.getString().equals("special")) { if (response.getString() != null && response.getString().equals("special")) { // All attack
setStoredBookmark(game.bookmarkState()); setStoredBookmark(game.bookmarkState());
UUID attackedDefender = null; UUID attackedDefender = null;
if (game.getCombat().getDefenders().size() > 1) { if (game.getCombat().getDefenders().size() > 1) {

View file

@ -0,0 +1,178 @@
/*
* 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 mage.sets.magicorigins;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayVariableLoyaltyCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class LilianaDefiantNecromancer extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("nonlegendary creature with converted mana cost X from your graveyard");
static {
filter.add(Predicates.not(new SupertypePredicate("Legendary")));
}
UUID ability2Id;
public LilianaDefiantNecromancer(UUID ownerId) {
super(ownerId, 106, "Liliana, Defiant Necromancer", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "");
this.expansionSetCode = "ORI";
this.subtype.add("Liliana");
this.color.setBlack(true);
this.nightCard = true;
// this.canTransform = true;
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
// +2: Each player discards a card.
this.addAbility(new LoyaltyAbility(new DiscardEachPlayerEffect(1, false), 2));
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
Ability ability = new LoyaltyAbility(new ReturnFromGraveyardToBattlefieldTargetEffect());
ability2Id = ability.getOriginalId();
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability);
//-8: You get an emblem with "Whenever a creature you control dies, return it to the battlefield under your control at the beginning of the next end step.";
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new LilianaDefiantNecromancerEmblem()), -8));
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(ability2Id)) {
int cmc = 0;
for (Cost cost : ability.getCosts()) {
if (cost instanceof PayVariableLoyaltyCost) {
cmc = ((PayVariableLoyaltyCost) cost).getAmount();
}
}
FilterCard newFilter = filter.copy();
newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
ability.getTargets().clear();
ability.addTarget(new TargetCardInYourGraveyard(filter));
}
}
public LilianaDefiantNecromancer(final LilianaDefiantNecromancer card) {
super(card);
this.ability2Id = card.ability2Id;
}
@Override
public LilianaDefiantNecromancer copy() {
return new LilianaDefiantNecromancer(this);
}
}
class LilianaDefiantNecromancerEmblem extends Emblem {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
// You get an emblem with "Whenever a creature you control dies, return it to the battlefield under your control at the beginning of the next end step."
public LilianaDefiantNecromancerEmblem() {
this.setName("Emblem - Liliana");
this.getAbilities().add(new DiesCreatureTriggeredAbility(new LilianaDefiantNecromancerEmblemEffect(), false, filter, true));
}
}
class LilianaDefiantNecromancerEmblemEffect extends OneShotEffect {
LilianaDefiantNecromancerEmblemEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "return it to the battlefield under your control at the beginning of the next end step";
}
LilianaDefiantNecromancerEmblemEffect(final LilianaDefiantNecromancerEmblemEffect effect) {
super(effect);
}
@Override
public LilianaDefiantNecromancerEmblemEffect copy() {
return new LilianaDefiantNecromancerEmblemEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setText("return that card to the battlefield at the beginning of the next end step");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
return true;
}
return false;
}
}

View file

@ -0,0 +1,88 @@
/*
* 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 mage.sets.magicorigins;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
/**
*
* @author LevelX2
*/
public class LilianaHereticalHealer extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another nontoken creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new AnotherPredicate());
filter.add(Predicates.not(new TokenPredicate()));
}
public LilianaHereticalHealer(UUID ownerId) {
super(ownerId, 106, "Liliana, Heretical Healer", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
this.expansionSetCode = "ORI";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Cleric");
this.power = new MageInt(2);
this.toughness = new MageInt(3);
this.canTransform = true;
this.secondSideCard = new LilianaDefiantNecromancer(ownerId);
this.addAbility(new TransformAbility());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield.
this.addAbility(new DiesCreatureTriggeredAbility(new ExileAndReturnTransformedSourceEffect(ExileAndReturnTransformedSourceEffect.Gender.FEMAL), false, filter));
}
public LilianaHereticalHealer(final LilianaHereticalHealer card) {
super(card);
}
@Override
public LilianaHereticalHealer copy() {
return new LilianaHereticalHealer(this);
}
}

View file

@ -38,7 +38,7 @@ public class SigiledStarfish extends mage.sets.journeyintonyx.SigiledStarfish {
public SigiledStarfish(UUID ownerId) { public SigiledStarfish(UUID ownerId) {
super(ownerId); super(ownerId);
this.cardNumber = ?; this.cardNumber = 999;
this.expansionSetCode = "ORI"; this.expansionSetCode = "ORI";
this.rarity = Rarity.UNCOMMON; this.rarity = Rarity.UNCOMMON;
} }

View file

@ -0,0 +1,108 @@
/*
* 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 mage.sets.magicorigins;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
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.players.Player;
/**
*
* @author LevelX2
*/
public class TaintedRemedy extends CardImpl {
public TaintedRemedy(UUID ownerId) {
super(ownerId, 120, "Tainted Remedy", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
this.expansionSetCode = "ORI";
// If an opponent would gain life, that player loses that much life instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TaintedRemedyReplacementEffect()));
}
public TaintedRemedy(final TaintedRemedy card) {
super(card);
}
@Override
public TaintedRemedy copy() {
return new TaintedRemedy(this);
}
}
class TaintedRemedyReplacementEffect extends ReplacementEffectImpl {
public TaintedRemedyReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If an opponent would gain life, that player loses that much life instead";
}
public TaintedRemedyReplacementEffect(final TaintedRemedyReplacementEffect effect) {
super(effect);
}
@Override
public TaintedRemedyReplacementEffect copy() {
return new TaintedRemedyReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.GAIN_LIFE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
return controller.hasOpponent(event.getPlayerId(), game);
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
opponent.loseLife(event.getAmount(), game);
}
return true;
}
}

View file

@ -37,8 +37,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class TransformTest extends CardTestPlayerBase {
public class TransformTest extends CardTestPlayerBase{
@Test @Test
public void NissaVastwoodSeerTest() { public void NissaVastwoodSeerTest() {
@ -51,7 +50,6 @@ public class TransformTest extends CardTestPlayerBase{
addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer"); addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
@ -65,4 +63,30 @@ public class TransformTest extends CardTestPlayerBase{
assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 3); assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 3);
} }
@Test
public void LilianaHereticalHealer() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
// Lifelink
// Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield.
addCard(Zone.HAND, playerA, "Liliana, Heretical Healer");
addCard(Zone.HAND, playerB, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt", "Silvercoat Lion");
setStopAt(1, PhaseStep.DECLARE_ATTACKERS);
execute();
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
}
} }

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.UUID; import java.util.UUID;
@ -69,18 +68,12 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (player != null) { if (controller != null) {
for (UUID targetId : getTargetPointer().getTargets(game, source)) { for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
if (card != null) { if (card != null) {
if (player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), tapped)) { controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), tapped);
// why is this neccessary - it contradicts Gather Specimens in play
// Permanent permanent = game.getPermanent(targetId);
// if (permanent != null) {
// permanent.changeControllerId(source.getControllerId(), game);
// }
}
} }
} }
return true; return true;