[AVR] 5 cards

This commit is contained in:
magenoxx 2012-05-21 08:39:14 +04:00
parent 2312b38a75
commit 6f31c00811
8 changed files with 535 additions and 2 deletions

View file

@ -50,7 +50,7 @@ public class Cloudshift extends CardImpl<Cloudshift> {
// Exile target creature you control, then return that card to the battlefield under your control.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addEffect(new ExileTargetForSourceEffect("Cloudshift exile"));
this.getSpellAbility().addEffect(new ExileTargetForSourceEffect("Cloudshift"));
this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect());
}

View file

@ -0,0 +1,114 @@
/*
* 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.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
* @author noxx
*/
public class GhostlyFlicker extends CardImpl<GhostlyFlicker> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifacts, creatures, and/or lands you control");
static {
filter.getCardType().add(CardType.CREATURE);
filter.getCardType().add(CardType.LAND);
filter.getCardType().add(CardType.ARTIFACT);
filter.setScopeCardType(Filter.ComparisonScope.Any);
}
public GhostlyFlicker(UUID ownerId) {
super(ownerId, 57, "Ghostly Flicker", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}");
this.expansionSetCode = "AVR";
this.color.setBlue(true);
// Exile two target artifacts, creatures, and/or lands you control, then return those cards to the battlefield under your control.
this.getSpellAbility().addTarget(new TargetControlledPermanent(2, 2, filter, false));
this.getSpellAbility().addEffect(new GhostlyFlickerEffect());
}
public GhostlyFlicker(final GhostlyFlicker card) {
super(card);
}
@Override
public GhostlyFlicker copy() {
return new GhostlyFlicker(this);
}
}
class GhostlyFlickerEffect extends OneShotEffect<GhostlyFlickerEffect> {
public GhostlyFlickerEffect() {
super(Constants.Outcome.Benefit);
staticText = "Exile two target artifacts, creatures, and/or lands you control, then return those cards to the battlefield under your control";
}
public GhostlyFlickerEffect(final GhostlyFlickerEffect effect) {
super(effect);
}
@Override
public GhostlyFlickerEffect copy() {
return new GhostlyFlickerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UUID exileId = source.getSourceId();
for (UUID permanentId : targetPointer.getTargets(source)) {
Permanent target = game.getPermanent(permanentId);
if (target != null) {
target.moveToExile(exileId, "Ghostly Flicker", source.getId(), game);
Card card = game.getCard(target.getId());
if (card != null) {
Constants.Zone currentZone = game.getState().getZone(card.getId());
card.putOntoBattlefield(game, currentZone, source.getId(), source.getControllerId());
}
}
}
return true;
}
}

View file

@ -0,0 +1,67 @@
/*
* 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.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.PreventDamageTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author noxx
*/
public class LeapOfFaith extends CardImpl<LeapOfFaith> {
public LeapOfFaith(UUID ownerId) {
super(ownerId, 26, "Leap of Faith", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "AVR";
this.color.setWhite(true);
// Target creature gains flying until end of turn. Prevent all damage that would be dealt to that creature this turn.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Constants.Duration.EndOfTurn));
this.getSpellAbility().addEffect(new PreventDamageTargetEffect(Constants.Duration.EndOfTurn, Integer.MAX_VALUE));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public LeapOfFaith(final LeapOfFaith card) {
super(card);
}
@Override
public LeapOfFaith copy() {
return new LeapOfFaith(this);
}
}

View file

@ -0,0 +1,150 @@
/*
* 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.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
* @author noxx
*/
public class Malignus extends CardImpl<Malignus> {
public Malignus(UUID ownerId) {
super(ownerId, 148, "Malignus", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.expansionSetCode = "AVR";
this.subtype.add("Elemental");
this.subtype.add("Spirit");
this.color.setRed(true);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Malignus's power and toughness are each equal to half the highest life total among your opponents, rounded up.
this.addAbility(new SimpleStaticAbility(Constants.Zone.ALL, new SetPowerToughnessSourceEffect(new HighestLifeTotalAmongOpponentsCount(), Constants.Duration.EndOfGame)));
// Damage that would be dealt by Malignus can't be prevented.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new MalignusEffect()));
}
public Malignus(final Malignus card) {
super(card);
}
@Override
public Malignus copy() {
return new Malignus(this);
}
}
class HighestLifeTotalAmongOpponentsCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility) {
if (sourceAbility != null) {
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) {
int max = 0;
for (UUID uuid : game.getOpponents(controller.getId())) {
Player opponent = game.getPlayer(uuid);
if (opponent != null) {
if (opponent.getLife() > max) {
max = opponent.getLife();
}
}
}
return (int)Math.ceil(max / 2.0);
}
}
return 0;
}
@Override
public DynamicValue clone() {
return new CardsInControllerHandCount();
}
@Override
public String getMessage() {
return "half the highest life total among your opponents, rounded up";
}
@Override
public String toString() {
return "1";
}
}
class MalignusEffect extends ReplacementEffectImpl<MalignusEffect> {
public MalignusEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit);
staticText = "Damage that would be dealt by {this} can't be prevented";
}
public MalignusEffect(final MalignusEffect effect) {
super(effect);
}
@Override
public MalignusEffect copy() {
return new MalignusEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.PREVENT_DAMAGE && event.getSourceId().equals(source.getSourceId())) {
return true;
}
return false;
}
}

View file

@ -0,0 +1,86 @@
/*
* 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.avacynrestored;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author noxx
*/
public class RestorationAngel extends CardImpl<RestorationAngel> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel");
static {
filter.getSubtype().add("Angel");
filter.setNotSubtype(true);
}
public RestorationAngel(UUID ownerId) {
super(ownerId, 32, "Restoration Angel", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "AVR";
this.subtype.add("Angel");
this.color.setWhite(true);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
this.addAbility(FlashAbility.getInstance());
this.addAbility(FlyingAbility.getInstance());
// When Restoration Angel enters the battlefield, you may exile target non-Angel creature you control, then return that card to the battlefield under your control.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect("Restoration Angel"), true);
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect());
ability.addTarget(new TargetControlledCreaturePermanent(1, 1, filter, false));
this.addAbility(ability);
}
public RestorationAngel(final RestorationAngel card) {
super(card);
}
@Override
public RestorationAngel copy() {
return new RestorationAngel(this);
}
}

View file

@ -0,0 +1,68 @@
/*
* 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.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.ControlsBiggestOrTiedCreatureCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import java.util.UUID;
/**
* @author noxx
*/
public class TriumphOfFerocity extends CardImpl<TriumphOfFerocity> {
private static final String ruleText = "draw a card if you control the creature with the greatest power or tied for the greatest power";
public TriumphOfFerocity(UUID ownerId) {
super(ownerId, 198, "Triumph of Ferocity", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
this.expansionSetCode = "AVR";
this.color.setGreen(true);
// At the beginning of your upkeep, draw a card if you control the creature with the greatest power or tied for the greatest power.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardControllerEffect(1), Constants.TargetController.YOU, false);
this.addAbility(new ConditionalTriggeredAbility(ability, ControlsBiggestOrTiedCreatureCondition.getInstance(), ruleText));
}
public TriumphOfFerocity(final TriumphOfFerocity card) {
super(card);
}
@Override
public TriumphOfFerocity copy() {
return new TriumphOfFerocity(this);
}
}

View file

@ -0,0 +1,44 @@
package org.mage.test.cards.replacement.prevent;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Malignus:
* Malignus's power and toughness are each equal to half the highest life total among your opponents, rounded up
* Damage that would be dealt by Malignus can't be prevented.
*
* @author noxx
*/
public class MalignusNoPreventDamageTest extends CardTestPlayerBase {
/**
* Tests "If Malignus becomes blocked by a creature with protection from red, the damage Malignus deals to that creature won't be prevented."
*/
@Test
public void testBlockByCreatureWithProRed() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Vedalken Outlander");
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Malignus");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
attack(2, playerB, "Malignus");
block(2, playerA, "Vedalken Outlander", "Malignus");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 17);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Malignus", 1);
assertPowerToughness(playerB, "Malignus", 9, 9);
assertPermanentCount(playerA, "Vedalken Outlander", 0);
}
}

View file

@ -93,7 +93,11 @@ public class PreventDamageTargetEffect extends PreventionEffectImpl<PreventDamag
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder();
if (amount == Integer.MAX_VALUE) {
sb.append("Prevent all damage that would be dealt to target ");
} else {
sb.append("Prevent the next ").append(amount).append(" damage that would be dealt to target ");
}
sb.append(mode.getTargets().get(0).getTargetName()).append(" ").append(duration.toString());
return sb.toString();
}