[DGM] Blood Baron of Vizkopa, Boros Battleshaper, Council of the Absolute, Deadbridge Chant

This commit is contained in:
LevelX2 2013-04-26 00:07:30 +02:00
parent d6a88a442d
commit ddefd5bc7b
4 changed files with 631 additions and 0 deletions

View file

@ -0,0 +1,162 @@
/*
* 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.dragonsmaze;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.SubLayer;
import mage.Constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class BloodBaronOfVizkopa extends CardImpl<BloodBaronOfVizkopa> {
private static final FilterCard filter = new FilterCard("white and from black");
static {
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.WHITE),
new ColorPredicate(ObjectColor.BLACK)));
}
public BloodBaronOfVizkopa (UUID ownerId) {
super(ownerId, 57, "Blood Baron of Vizkopa", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{3}{W}{B}");
this.expansionSetCode = "DGM";
this.subtype.add("Vampire");
this.color.setWhite(true);
this.color.setBlack(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Lifelink, protection from white and from black.
this.addAbility(LifelinkAbility.getInstance());
this.addAbility(new ProtectionAbility(filter));
// As long as you have 30 or more life and an opponent has 10 or less life, Blood Baron of Vizkopa gets +6/+6 and has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BloodBaronOfVizkopaEffect()));
}
public BloodBaronOfVizkopa (final BloodBaronOfVizkopa card) {
super(card);
}
@Override
public BloodBaronOfVizkopa copy() {
return new BloodBaronOfVizkopa(this);
}
}
class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl<BloodBaronOfVizkopaEffect> {
public BloodBaronOfVizkopaEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "As long as you have 30 or more life and an opponent has 10 or less life, {this} gets +6/+6 and has flying";
}
public BloodBaronOfVizkopaEffect(final BloodBaronOfVizkopaEffect effect) {
super(effect);
}
@Override
public BloodBaronOfVizkopaEffect copy() {
return new BloodBaronOfVizkopaEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
if (conditionState(source, game)) {
Permanent creature = game.getPermanent(source.getSourceId());
if (creature != null) {
switch (layer) {
case PTChangingEffects_7:
if (sublayer == SubLayer.ModifyPT_7c) {
creature.addPower(6);
creature.addToughness(6);
}
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
creature.addAbility(FlyingAbility.getInstance(), game);
}
break;
}
return true;
}
}
return false;
}
protected boolean conditionState(Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLife() >= 30) {
for (UUID opponentId :player.getInRange()) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null && opponent.getLife() > 11) {
return true;
}
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return (layer.equals(Layer.AbilityAddingRemovingEffects_6) || layer.equals(layer.PTChangingEffects_7));
}
}

View file

@ -0,0 +1,154 @@
/*
* 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.dragonsmaze;
import java.util.UUID;
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.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttacksIfAbleTargetEffect;
import mage.abilities.effects.common.BlocksIfAbleTargetEffect;
import mage.abilities.effects.common.CantAttackTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.AttacksThisTurnMarkerAbility;
import mage.abilities.keyword.BlocksThisTurnMarkerAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class BorosBattleshaper extends CardImpl<BorosBattleshaper> {
public BorosBattleshaper (UUID ownerId) {
super(ownerId, 58, "Boros Battleshaper", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}{W}");
this.expansionSetCode = "DGM";
this.subtype.add("Minotaur");
this.subtype.add("Soldier");
this.color.setRed(true);
this.color.setWhite(true);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// At the beginning of each combat, up to one target creature attacks or blocks this combat if able and up to one target creature can't attack or block this combat.
Ability ability = new BeginningOfCombatTriggeredAbility(Zone.BATTLEFIELD, new BorosBattleshaperEffect(), Constants.TargetController.ANY, false, false);
ability.addTarget(new TargetCreaturePermanent(0,1,new FilterCreaturePermanent("creature that attacks or blocks if able"),false));
ability.addTarget(new TargetCreaturePermanent(0,1,new FilterCreaturePermanent("creature that can't attack or block"),false));
this.addAbility(ability);
}
public BorosBattleshaper (final BorosBattleshaper card) {
super(card);
}
@Override
public BorosBattleshaper copy() {
return new BorosBattleshaper(this);
}
}
class BorosBattleshaperEffect extends OneShotEffect<BorosBattleshaperEffect> {
public BorosBattleshaperEffect() {
super(Outcome.Benefit);
this.staticText = "up to one target creature attacks or blocks this combat if able and up to one target creature can't attack or block this combat";
}
public BorosBattleshaperEffect(final BorosBattleshaperEffect effect) {
super(effect);
}
@Override
public BorosBattleshaperEffect copy() {
return new BorosBattleshaperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature1 = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature1 != null) {
if (game.getOpponents(creature1.getControllerId()).contains(game.getActivePlayerId())) {
// Blocks
ContinuousEffectImpl effect = new BlocksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature1.getId()));
game.addEffect(effect, source);
effect = new GainAbilityTargetEffect(BlocksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, "");
effect.setTargetPointer(new FixedTarget(creature1.getId()));
game.addEffect(effect, source);
} else {
// Attacks
ContinuousEffectImpl effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature1.getId()));
game.addEffect(effect, source);
effect = new GainAbilityTargetEffect(AttacksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, "");
effect.setTargetPointer(new FixedTarget(creature1.getId()));
game.addEffect(effect, source);
}
}
Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (creature2 != null) {
if (game.getOpponents(creature2.getControllerId()).contains(game.getActivePlayerId())) {
// Blocks
ContinuousEffectImpl effect = new CantBlockTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature2.getId()));
game.addEffect(effect, source);
} else {
// Attacks
ContinuousEffectImpl effect = new CantAttackTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature2.getId()));
game.addEffect(effect, source);
}
}
return true;
}
}

View file

@ -0,0 +1,201 @@
/*
* 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.dragonsmaze;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.CostModificationEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class CouncilOfTheAbsolute extends CardImpl<CouncilOfTheAbsolute> {
public CouncilOfTheAbsolute (UUID ownerId) {
super(ownerId, 62, "Council of the Absolute", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}{W}{U}");
this.expansionSetCode = "DGM";
this.subtype.add("Human");
this.subtype.add("Advisor");
this.color.setWhite(true);
this.color.setBlue(true);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// As Council of the Absolute enters the battlefield, name a card other than a creature or a land card.
this.addAbility(new AsEntersBattlefieldAbility(new CouncilOfTheAbsoluteChooseCardEffect()));
// Your opponents can't cast the chosen card.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CouncilOfTheAbsoluteReplacementEffect()));
// Spells with the chosen name cost 2 less for you to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CouncilOfTheAbsoluteCostReductionEffect()));
}
public CouncilOfTheAbsolute (final CouncilOfTheAbsolute card) {
super(card);
}
@Override
public CouncilOfTheAbsolute copy() {
return new CouncilOfTheAbsolute(this);
}
}
class CouncilOfTheAbsoluteChooseCardEffect extends OneShotEffect<CouncilOfTheAbsoluteChooseCardEffect> {
public CouncilOfTheAbsoluteChooseCardEffect() {
super(Outcome.Detriment);
staticText = "name a card other than a creature or a land card";
}
public CouncilOfTheAbsoluteChooseCardEffect(final CouncilOfTheAbsoluteChooseCardEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(CardRepository.instance.getNonLandAndNonCreatureNames());
cardChoice.clearChoice();
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
String cardName = cardChoice.getChoice();
game.informPlayers("Council of the Absolute, named card: [" + cardName + "]");
game.getState().setValue(source.getSourceId().toString(), cardName);
}
return false;
}
@Override
public CouncilOfTheAbsoluteChooseCardEffect copy() {
return new CouncilOfTheAbsoluteChooseCardEffect(this);
}
}
class CouncilOfTheAbsoluteReplacementEffect extends ReplacementEffectImpl<CouncilOfTheAbsoluteReplacementEffect> {
public CouncilOfTheAbsoluteReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "Your opponents can't cast the chosen card";
}
public CouncilOfTheAbsoluteReplacementEffect(final CouncilOfTheAbsoluteReplacementEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public CouncilOfTheAbsoluteReplacementEffect copy() {
return new CouncilOfTheAbsoluteReplacementEffect(this);
}
@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() == EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString()))) {
return true;
}
}
return false;
}
}
class CouncilOfTheAbsoluteCostReductionEffect extends CostModificationEffectImpl<CouncilOfTheAbsoluteCostReductionEffect> {
public CouncilOfTheAbsoluteCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
this.staticText = "Spells with the chosen name cost 2 less for you to cast";
}
protected CouncilOfTheAbsoluteCostReductionEffect(CouncilOfTheAbsoluteCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, 2);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
Card card = game.getCard(abilityToModify.getSourceId());
return card.getName().equals(game.getState().getValue(source.getSourceId().toString()));
}
return false;
}
@Override
public CouncilOfTheAbsoluteCostReductionEffect copy() {
return new CouncilOfTheAbsoluteCostReductionEffect(this);
}
}

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.dragonsmaze;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutTopCardOfYourLibraryIntoGraveEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class DeadbridgeChant extends CardImpl<DeadbridgeChant> {
public DeadbridgeChant(UUID ownerId) {
super(ownerId, 63, "Deadbridge Chant", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}{G}");
this.expansionSetCode = "DGM";
this.color.setBlack(true);
this.color.setGreen(true);
// When Deadbridge Chant enters the battlefield, put the top ten cards of your library into your graveyard.
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutTopCardOfYourLibraryIntoGraveEffect(10)));
// At the beginning of your upkeep, choose a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, put it into your hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DeadbridgeChantEffect(), Constants.TargetController.YOU, false));
}
public DeadbridgeChant(final DeadbridgeChant card) {
super(card);
}
@Override
public DeadbridgeChant copy() {
return new DeadbridgeChant(this);
}
}
class DeadbridgeChantEffect extends OneShotEffect<DeadbridgeChantEffect> {
public DeadbridgeChantEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "choose a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, put it into your hand";
}
public DeadbridgeChantEffect(final DeadbridgeChantEffect effect) {
super(effect);
}
@Override
public DeadbridgeChantEffect copy() {
return new DeadbridgeChantEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && !player.getGraveyard().isEmpty()) {
Card card = player.getGraveyard().getRandom(game);
if (card != null) {
Card sourceCard = game.getCard(source.getId());
Zone targetZone = Zone.HAND;
String text = " put into hand of ";
if (card.getCardType().contains(CardType.CREATURE)) {
targetZone = Zone.BATTLEFIELD;
text = " put onto battlefield for ";
}
card.moveToZone(targetZone, source.getId(), game, false);
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(card.getName()).append(text).append(player.getName()).toString());
return true;
}
}
return false;
}
}