- Requested. Added Infernal Genesis, Marshal's Anthem, and Kresh the Bloodbraided.

This commit is contained in:
jeffwadsworth 2012-08-07 14:36:36 -05:00
parent 861bb03731
commit 7cbdf4f8de
4 changed files with 365 additions and 0 deletions

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.prophecy;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class InfernalGenesis extends CardImpl<InfernalGenesis> {
public InfernalGenesis(UUID ownerId) {
super(ownerId, 68, "Infernal Genesis", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}{B}");
this.expansionSetCode = "PCY";
this.color.setBlack(true);
// At the beginning of each player's upkeep, that player puts the top card of his or her library into his or her graveyard. Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new InfernalGenesisEffect(), Constants.TargetController.ANY, false));
}
public InfernalGenesis(final InfernalGenesis card) {
super(card);
}
@Override
public InfernalGenesis copy() {
return new InfernalGenesis(this);
}
}
class InfernalGenesisEffect extends OneShotEffect<InfernalGenesisEffect> {
InfernalGenesisEffect() {
super(Constants.Outcome.BoostCreature);
staticText = "that player puts the top card of his or her library into his or her graveyard. Then he or she puts X 1/1 black Minion creature tokens onto the battlefield, where X is that card's converted mana cost";
}
InfernalGenesisEffect(final InfernalGenesisEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
if (card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false)) {
int cmc = card.getManaCost().convertedManaCost();
MinionToken token = new MinionToken();
token.putOntoBattlefield(cmc, game, id, player.getId());
}
}
}
return true;
}
@Override
public InfernalGenesisEffect copy() {
return new InfernalGenesisEffect(this);
}
}
class MinionToken extends Token {
public MinionToken() {
super("Minion", "1/1 black Minion creature token");
color = ObjectColor.BLACK;
cardType.add(CardType.CREATURE);
this.subtype.add("Minion");
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -0,0 +1,104 @@
/*
* 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.shardsofalara;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author jeffwadsworth
*/
public class KreshTheBloodbraided extends CardImpl<KreshTheBloodbraided> {
public KreshTheBloodbraided(UUID ownerId) {
super(ownerId, 178, "Kresh the Bloodbraided", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}");
this.expansionSetCode = "ALA";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Warrior");
this.color.setRed(true);
this.color.setGreen(true);
this.color.setBlack(true);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
// Whenever another creature dies, you may put X +1/+1 counters on Kresh the Bloodbraided, where X is that creature's power.
this.addAbility(new DiesCreatureTriggeredAbility(new KreshTheBloodbraidedEffect(), true, true));
}
public KreshTheBloodbraided(final KreshTheBloodbraided card) {
super(card);
}
@Override
public KreshTheBloodbraided copy() {
return new KreshTheBloodbraided(this);
}
}
class KreshTheBloodbraidedEffect extends OneShotEffect<KreshTheBloodbraidedEffect> {
KreshTheBloodbraidedEffect() {
super(Constants.Outcome.BoostCreature);
staticText = "you may put X +1/+1 counters on Kresh the Bloodbraided, where X is that creature's power";
}
KreshTheBloodbraidedEffect(final KreshTheBloodbraidedEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Card creature = game.getCard(targetPointer.getFirst(game, source));
Permanent KreshTheBloodbraided = game.getPermanent(source.getSourceId());
if (creature != null && KreshTheBloodbraided != null) {
KreshTheBloodbraided.addCounters(CounterType.P1P1.createInstance(creature.getPower().getValue()), game);
return true;
}
return false;
}
@Override
public KreshTheBloodbraidedEffect copy() {
return new KreshTheBloodbraidedEffect(this);
}
}

View file

@ -0,0 +1,142 @@
/*
* 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.worldwake;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.abilities.keyword.MultikickerAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author jeffwadsworth
*
*/
public class MarshalsAnthem extends CardImpl<MarshalsAnthem> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
protected static final String rule = "return up to X target creature cards from your graveyard to the battlefield, where X is the number of times Marshal's Anthem was kicked";
public MarshalsAnthem(UUID ownerId) {
super(ownerId, 15, "Marshal's Anthem", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
this.expansionSetCode = "WWK";
this.color.setWhite(true);
// Multikicker {1}{W}
MultikickerAbility ability = new MultikickerAbility(new EmptyEffect(rule), false);
ability.addManaCost(new ManaCostsImpl("{1}{W}"));
this.addAbility(ability);
// Creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Constants.Duration.WhileOnBattlefield, filter, false)));
// When Marshal's Anthem enters the battlefield, return up to X target creature cards from your graveyard to the battlefield, where X is the number of times Marshal's Anthem was kicked.
this.addAbility(new EntersBattlefieldTriggeredAbility(new MarshalsAnthemEffect()));
}
public MarshalsAnthem(final MarshalsAnthem card) {
super(card);
}
@Override
public MarshalsAnthem copy() {
return new MarshalsAnthem(this);
}
}
class MarshalsAnthemEffect extends OneShotEffect<MarshalsAnthemEffect> {
public MarshalsAnthemEffect() {
super(Constants.Outcome.PutCreatureInPlay);
this.staticText = "return up to X target creature cards from your graveyard to the battlefield, where X is the number of times {this} was kicked";
}
public MarshalsAnthemEffect(final MarshalsAnthemEffect effect) {
super(effect);
}
@Override
public MarshalsAnthemEffect copy() {
return new MarshalsAnthemEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
FilterCard filter = new FilterCard("creature card in your graveyard");
filter.add(new CardTypePredicate(CardType.CREATURE));
Player you = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
for (Ability ability : permanent.getAbilities()) {
if (ability instanceof MultikickerAbility) {
int count = Math.min(you.getGraveyard().size(), ((MultikickerAbility) ability).getActivateCount());
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, count, filter);
if (you != null) {
if (target.canChoose(source.getControllerId(), game) && target.choose(Constants.Outcome.Neutral, source.getControllerId(), source.getId(), game)) {
if (!target.getTargets().isEmpty()) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getId(), you.getId());
}
}
return true;
}
}
}
}
}
}
return false;
}
}

View file

@ -9,6 +9,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
* @author North
@ -54,7 +55,11 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl<DiesCreat
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
System.out.println("The permanent in the trigger is " + permanent.getName());
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
}