[AVR] 5 cards

This commit is contained in:
Loki 2012-05-05 15:38:37 +03:00
parent 95e4ef4ff8
commit 2d0c1a5efa
5 changed files with 537 additions and 0 deletions

View file

@ -0,0 +1,109 @@
/*
* 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 java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class EssenceHarvest extends CardImpl<EssenceHarvest> {
public EssenceHarvest(UUID ownerId) {
super(ownerId, 100, "Essence Harvest", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{B}");
this.expansionSetCode = "AVR";
this.color.setBlack(true);
// Target player loses X life and you gain X life, where X is the greatest power among creatures you control.
this.getSpellAbility().addEffect(new EssenceHarvestEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public EssenceHarvest(final EssenceHarvest card) {
super(card);
}
@Override
public EssenceHarvest copy() {
return new EssenceHarvest(this);
}
}
class EssenceHarvestEffect extends OneShotEffect<EssenceHarvestEffect> {
public EssenceHarvestEffect() {
super(Outcome.Damage);
this.staticText = "Target player loses X life and you gain X life, where X is the greatest power among creatures you control";
}
public EssenceHarvestEffect(final EssenceHarvestEffect effect) {
super(effect);
}
@Override
public EssenceHarvestEffect copy() {
return new EssenceHarvestEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId());
int amount = 0;
for (Permanent creature : creatures) {
int power = creature.getPower().getValue();
if (amount < power) {
amount = power;
}
}
if (amount > 0) {
targetPlayer.loseLife(amount, game);
player.gainLife(amount, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,112 @@
/*
* 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 java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author North
*/
public class GraveExchange extends CardImpl<GraveExchange> {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from your graveyard");
public GraveExchange(UUID ownerId) {
super(ownerId, 105, "Grave Exchange", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
this.expansionSetCode = "AVR";
this.color.setBlack(true);
// Return target creature card from your graveyard to your hand.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(filter));
// Target player sacrifices a creature.
this.getSpellAbility().addEffect(new GraveExchangeEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public GraveExchange(final GraveExchange card) {
super(card);
}
@Override
public GraveExchange copy() {
return new GraveExchange(this);
}
}
class GraveExchangeEffect extends OneShotEffect<GraveExchangeEffect> {
public GraveExchangeEffect() {
super(Outcome.Sacrifice);
this.staticText = "Target player sacrifices a creature";
}
public GraveExchangeEffect(final GraveExchangeEffect effect) {
super(effect);
}
@Override
public GraveExchangeEffect copy() {
return new GraveExchangeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget());
if (player == null) {
return false;
}
Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
return permanent.sacrifice(source.getSourceId(), game);
}
}
return false;
}
}

View file

@ -0,0 +1,136 @@
/*
* 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 java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author North
*/
public class KillingWave extends CardImpl<KillingWave> {
public KillingWave(UUID ownerId) {
super(ownerId, 111, "Killing Wave", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{B}");
this.expansionSetCode = "AVR";
this.color.setBlack(true);
// For each creature, its controller sacrifices it unless he or she pays X life.
this.getSpellAbility().addEffect(new KillingWaveEffect());
}
public KillingWave(final KillingWave card) {
super(card);
}
@Override
public KillingWave copy() {
return new KillingWave(this);
}
}
class KillingWaveEffect extends OneShotEffect<KillingWaveEffect> {
public KillingWaveEffect() {
super(Outcome.Sacrifice);
this.staticText = "For each creature, its controller sacrifices it unless he or she pays X life";
}
public KillingWaveEffect(final KillingWaveEffect effect) {
super(effect);
}
@Override
public KillingWaveEffect copy() {
return new KillingWaveEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int amount = (new ManacostVariableValue()).calculate(game, source);
if (amount > 0) {
LinkedList<Permanent> sacrifices = new LinkedList<Permanent>();
HashMap<UUID, Integer> lifePaidAmounts = new HashMap<UUID, Integer>();
FilterCreaturePermanent filter = new FilterCreaturePermanent();
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(filter, playerId);
int lifePaid = 0;
int playerLife = player.getLife();
for (Permanent creature : creatures) {
String message = "Pay " + amount + " life? If you don't, " + creature.getName() + " will be sacrificed.";
if (playerLife - amount - lifePaid >= 0 && player != null && player.chooseUse(Outcome.Neutral, message, game)) {
game.informPlayers(player.getName() + " pays " + amount + " life. He will not sacrifice " + creature.getName());
lifePaid += amount;
} else {
game.informPlayers(player.getName() + " will sacrifice " + creature.getName());
sacrifices.add(creature);
}
}
lifePaidAmounts.put(playerId, lifePaid);
}
for (UUID playerId : controller.getInRange()) {
int lifePaid = lifePaidAmounts.get(playerId);
if (lifePaid > 0) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.loseLife(lifePaid, game);
}
}
}
for (Permanent creature : sacrifices) {
creature.sacrifice(source.getId(), game);
}
}
return true;
}
}

View file

@ -0,0 +1,64 @@
/*
* 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 java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DiscardTargetEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class MentalAgony extends CardImpl<MentalAgony> {
public MentalAgony(UUID ownerId) {
super(ownerId, 114, "Mental Agony", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{B}");
this.expansionSetCode = "AVR";
this.color.setBlack(true);
// Target player discards two cards and loses 2 life.
this.getSpellAbility().addEffect(new DiscardTargetEffect(2));
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(2));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public MentalAgony(final MentalAgony card) {
super(card);
}
@Override
public MentalAgony copy() {
return new MentalAgony(this);
}
}

View file

@ -0,0 +1,116 @@
/*
* 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 java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.MiracleAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class RevengeOfTheHunted extends CardImpl<RevengeOfTheHunted> {
public RevengeOfTheHunted(UUID ownerId) {
super(ownerId, 191, "Revenge of the Hunted", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
this.expansionSetCode = "AVR";
this.color.setGreen(true);
// Until end of turn, target creature gets +6/+6 and gains trample, and all creatures able to block it this turn do so.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(6, 6, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new RevengeOfTheHuntedEffect());
this.addAbility(new MiracleAbility(new ManaCostsImpl("{G}")));
}
public RevengeOfTheHunted(final RevengeOfTheHunted card) {
super(card);
}
@Override
public RevengeOfTheHunted copy() {
return new RevengeOfTheHunted(this);
}
}
class RevengeOfTheHuntedEffect extends RequirementEffect<RevengeOfTheHuntedEffect> {
public RevengeOfTheHuntedEffect() {
this(Duration.EndOfTurn);
}
public RevengeOfTheHuntedEffect(Duration duration) {
super(duration);
staticText = "All creatures able to block it this turn do so";
}
public RevengeOfTheHuntedEffect(final RevengeOfTheHuntedEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return true;
}
@Override
public boolean mustAttack(Game game) {
return false;
}
@Override
public boolean mustBlock(Game game) {
return true;
}
@Override
public UUID mustBlockAttacker(Ability source, Game game) {
return source.getFirstTarget();
}
@Override
public RevengeOfTheHuntedEffect copy() {
return new RevengeOfTheHuntedEffect(this);
}
}