Implemented [BFZ] Ulamog, the Ceaseless Hunger and [S99] Wicked Pact. Updated some cards to use SacrificeCostCreaturesPower.

This commit is contained in:
fireshoes 2015-08-30 12:32:00 -05:00
parent 3df8b4958f
commit f2bb7470cf
7 changed files with 456 additions and 221 deletions

View file

@ -31,22 +31,18 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.DevoidAbility; import mage.abilities.keyword.DevoidAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorlessPredicate; import mage.filter.predicate.mageobject.ColorlessPredicate;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreatureOrPlayer;
@ -55,7 +51,7 @@ import mage.target.common.TargetCreatureOrPlayer;
* @author fireshoes * @author fireshoes
*/ */
public class BarrageTyrant extends CardImpl { public class BarrageTyrant extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another colorless creature"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another colorless creature");
static { static {
@ -72,9 +68,9 @@ public class BarrageTyrant extends CardImpl {
// Devoid // Devoid
this.addAbility(new DevoidAbility(this.color)); this.addAbility(new DevoidAbility(this.color));
// {2}{R}, Sacrifice another colorless creature: Barrage Tyrant deals damage equal to the sacrificed creature's power to target creature or player. // {2}{R}, Sacrifice another colorless creature: Barrage Tyrant deals damage equal to the sacrificed creature's power to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BarrageTyrantEffect(), new ManaCostsImpl("{2}{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new SacrificeCostCreaturesPower()), new ManaCostsImpl("{2}{R}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter)));
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability); this.addAbility(ability);
@ -89,44 +85,3 @@ public class BarrageTyrant extends CardImpl {
return new BarrageTyrant(this); return new BarrageTyrant(this);
} }
} }
class BarrageTyrantEffect extends OneShotEffect {
public BarrageTyrantEffect() {
super(Outcome.Damage);
staticText = "{this} deals damage equal to the sacrificed creature's power to target creature or player";
}
public BarrageTyrantEffect(final BarrageTyrantEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
break;
}
}
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.damage(amount, source.getSourceId(), game, false, true);
return true;
}
}
return false;
}
@Override
public BarrageTyrantEffect copy() {
return new BarrageTyrantEffect(this);
}
}

View file

@ -0,0 +1,191 @@
/*
* 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.battleforzendikar;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author fireshoes
*/
public class UlamogTheCeaselessHunger extends CardImpl {
public UlamogTheCeaselessHunger(UUID ownerId) {
super(ownerId, 15, "Ulamog, the Ceaseless Hunger", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{10}");
this.expansionSetCode = "BFZ";
this.supertype.add("Legendary");
this.subtype.add("Eldrazi");
this.power = new MageInt(10);
this.toughness = new MageInt(10);
// When you cast Ulamog, the Ceaseless Hunger, exile two target permanents.
this.addAbility(new UlamogExilePermanentsOnCastAbility());
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.
Effect effect = new UlamogExileLibraryEffect();
effect.setText("defending player exiles the top twenty cards of his or her library");
this.addAbility(new UlamogAttackTriggeredAbility(effect));
}
public UlamogTheCeaselessHunger(final UlamogTheCeaselessHunger card) {
super(card);
}
@Override
public UlamogTheCeaselessHunger copy() {
return new UlamogTheCeaselessHunger(this);
}
}
class UlamogExilePermanentsOnCastAbility extends TriggeredAbilityImpl {
UlamogExilePermanentsOnCastAbility() {
super(Zone.STACK, new ExileTargetEffect("exile two target permanents"));
this.addTarget(new TargetPermanent(2, new FilterPermanent()));
}
UlamogExilePermanentsOnCastAbility(UlamogExilePermanentsOnCastAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = (Spell) game.getObject(event.getTargetId());
return this.getSourceId().equals(spell.getSourceId());
}
@Override
public UlamogExilePermanentsOnCastAbility copy() {
return new UlamogExilePermanentsOnCastAbility(this);
}
@Override
public String getRule() {
return "When you cast {this}, " + super.getRule();
}
}
class UlamogAttackTriggeredAbility extends TriggeredAbilityImpl {
public UlamogAttackTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
public UlamogAttackTriggeredAbility(final UlamogAttackTriggeredAbility ability) {
super(ability);
}
@Override
public UlamogAttackTriggeredAbility copy() {
return new UlamogAttackTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
if (sourcePermanent != null && event.getSourceId() == this.getSourceId()) {
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;
}
return false;
}
@Override
public String getRule() {
return new StringBuilder("Whenever {this} attacks, ").append(super.getRule()).toString();
}
}
class UlamogExileLibraryEffect extends OneShotEffect {
public UlamogExileLibraryEffect() {
super(Outcome.Exile);
this.staticText = "defending player exiles the top twenty cards of his or her library";
}
public UlamogExileLibraryEffect(final UlamogExileLibraryEffect effect) {
super(effect);
}
@Override
public UlamogExileLibraryEffect copy() {
return new UlamogExileLibraryEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player defender = game.getPlayer(targetPointer.getFirst(game, source));
if (defender != null) {
int count = Math.min(defender.getLibrary().size(), 20);
for (int i = 0; i < count; i++) {
Card card = defender.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToExile(null, null, source.getSourceId(), game);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,54 @@
/*
* 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.masterseditioniv;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author fireshoes
*/
public class WickedPact extends mage.sets.portal.WickedPact {
public WickedPact(UUID ownerId) {
super(ownerId);
this.cardNumber = 102;
this.expansionSetCode = "ME4";
this.rarity = Rarity.UNCOMMON;
}
public WickedPact(final WickedPact card) {
super(card);
}
@Override
public WickedPact copy() {
return new WickedPact(this);
}
}

View file

@ -31,21 +31,17 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreatureOrPlayer;
@ -54,7 +50,7 @@ import mage.target.common.TargetCreatureOrPlayer;
* @author fireshoes * @author fireshoes
*/ */
public class AirdropCondor extends CardImpl { public class AirdropCondor extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Goblin creature"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Goblin creature");
static { static {
@ -70,9 +66,9 @@ public class AirdropCondor extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// {1}{R}, Sacrifice a Goblin creature: Airdrop Condor deals damage equal to the sacrificed creature's power to target creature or player. // {1}{R}, Sacrifice a Goblin creature: Airdrop Condor deals damage equal to the sacrificed creature's power to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AirdropCondorEffect(), new ManaCostsImpl("{1}{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new SacrificeCostCreaturesPower()), new ManaCostsImpl("{1}{R}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter)));
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability); this.addAbility(ability);
@ -87,44 +83,3 @@ public class AirdropCondor extends CardImpl {
return new AirdropCondor(this); return new AirdropCondor(this);
} }
} }
class AirdropCondorEffect extends OneShotEffect {
public AirdropCondorEffect() {
super(Outcome.Damage);
staticText = "{this} deals damage equal to the sacrificed creature's power to target creature or player";
}
public AirdropCondorEffect(final AirdropCondorEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
break;
}
}
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.damage(amount, source.getSourceId(), game, false, true);
return true;
}
}
return false;
}
@Override
public AirdropCondorEffect copy() {
return new AirdropCondorEffect(this);
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.portal;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author fireshoes
*/
public class WickedPact extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature");
static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
}
public WickedPact(UUID ownerId) {
super(ownerId, 40, "Wicked Pact", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
this.expansionSetCode = "POR";
// Destroy two target nonblack creatures. You lose 5 life.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, filter, false));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(5));
}
public WickedPact(final WickedPact card) {
super(card);
}
@Override
public WickedPact copy() {
return new WickedPact(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.starter1999;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class WickedPact extends mage.sets.portal.WickedPact {
public WickedPact(UUID ownerId) {
super(ownerId);
this.cardNumber = 92;
this.expansionSetCode = "S99";
}
public WickedPact(final WickedPact card) {
super(card);
}
@Override
public WickedPact copy() {
return new WickedPact(this);
}
}

View file

@ -1,121 +1,77 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * 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.sets.urzasdestiny; package mage.sets.urzasdestiny;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.MageInt;
import mage.constants.Outcome; import mage.abilities.common.SimpleActivatedAbility;
import mage.constants.Rarity; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.constants.Zone; import mage.abilities.costs.common.TapSourceCost;
import mage.MageInt; import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower;
import mage.abilities.Ability; import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.common.SimpleActivatedAbility; import mage.cards.CardImpl;
import mage.abilities.costs.Cost; import mage.constants.CardType;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.constants.Rarity;
import mage.abilities.costs.common.TapSourceCost; import mage.constants.Zone;
import mage.abilities.effects.OneShotEffect; import mage.target.common.TargetControlledCreaturePermanent;
import mage.cards.CardImpl; import mage.target.common.TargetCreatureOrPlayer;
import mage.game.Game;
import mage.game.permanent.Permanent; /**
import mage.players.Player; *
import mage.target.common.TargetControlledCreaturePermanent; * @author Backfir3
import mage.target.common.TargetCreatureOrPlayer; */
public class BloodshotCyclops extends CardImpl {
/**
* public BloodshotCyclops(UUID ownerId) {
* @author Backfir3 super(ownerId, 77, "Bloodshot Cyclops", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}");
*/ this.expansionSetCode = "UDS";
public class BloodshotCyclops extends CardImpl { this.subtype.add("Cyclops");
this.subtype.add("Giant");
public BloodshotCyclops(UUID ownerId) {
super(ownerId, 77, "Bloodshot Cyclops", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}"); this.power = new MageInt(4);
this.expansionSetCode = "UDS"; this.toughness = new MageInt(4);
this.subtype.add("Cyclops");
this.subtype.add("Giant"); // {T}, Sacrifice a creature: Bloodshot Cyclops deals damage equal to the sacrificed
// creature's power to target creature or player.
this.power = new MageInt(4); SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
this.toughness = new MageInt(4); new DamageTargetEffect(new SacrificeCostCreaturesPower()),
new TapSourceCost());
// {T}, Sacrifice a creature: Bloodshot Cyclops deals damage equal to the sacrificed ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
// creature's power to target creature or player. ability.addTarget(new TargetCreatureOrPlayer());
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BloodshotCyclopsEffect(), new TapSourceCost()); this.addAbility(ability);
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); }
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability); public BloodshotCyclops(final BloodshotCyclops card) {
} super(card);
}
public BloodshotCyclops(final BloodshotCyclops card) {
super(card); @Override
} public BloodshotCyclops copy() {
return new BloodshotCyclops(this);
@Override }
public BloodshotCyclops copy() { }
return new BloodshotCyclops(this);
}
}
class BloodshotCyclopsEffect extends OneShotEffect {
public BloodshotCyclopsEffect() {
super(Outcome.Damage);
staticText = "{this} deals damage equal to the sacrificed creature's power to target creature or player";
}
public BloodshotCyclopsEffect(final BloodshotCyclopsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
break;
}
}
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, false, true);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.damage(amount, source.getSourceId(), game, false, true);
return true;
}
}
return false;
}
@Override
public BloodshotCyclopsEffect copy() {
return new BloodshotCyclopsEffect(this);
}
}