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;
@ -74,7 +70,7 @@ public class BarrageTyrant extends CardImpl {
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;
@ -72,7 +68,7 @@ public class AirdropCondor extends CardImpl {
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

@ -28,21 +28,16 @@
package mage.sets.urzasdestiny; package mage.sets.urzasdestiny;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
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.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.Game; import mage.constants.CardType;
import mage.game.permanent.Permanent; import mage.constants.Rarity;
import mage.players.Player; import mage.constants.Zone;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreatureOrPlayer;
@ -63,7 +58,9 @@ public class BloodshotCyclops extends CardImpl {
// {T}, Sacrifice a creature: Bloodshot Cyclops deals damage equal to the sacrificed // {T}, Sacrifice a creature: Bloodshot Cyclops deals damage equal to the sacrificed
// creature's power to target creature or player. // creature's power to target creature or player.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BloodshotCyclopsEffect(), new TapSourceCost()); SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new DamageTargetEffect(new SacrificeCostCreaturesPower()),
new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability); this.addAbility(ability);
@ -78,44 +75,3 @@ public class BloodshotCyclops extends CardImpl {
return new BloodshotCyclops(this); 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);
}
}