This commit is contained in:
LevelX2 2013-06-05 22:41:00 +02:00
commit 6a8af5aef0
14 changed files with 696 additions and 15 deletions

1
.gitignore vendored
View file

@ -46,6 +46,7 @@ Utils/author.txt
.metadata
.project
.settings
.idea
syntax: regexp
\.class
\.jar

Binary file not shown.

View file

@ -0,0 +1,81 @@
/*
* 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.alliances;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.ObjectColor;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.ExileFromHandCost;
import mage.abilities.effects.common.DamageMultiEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterOwnedCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreatureOrPlayerAmount;
import mage.target.common.TargetCreaturePermanentAmount;
/**
*
* @author Plopman
*/
public class Pyrokinesis extends CardImpl<Pyrokinesis> {
public Pyrokinesis(UUID ownerId) {
super(ownerId, 115, "Pyrokinesis", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
this.expansionSetCode = "ALL";
this.color.setRed(true);
// You may exile a red card from your hand rather than pay Pyrokinesis's mana cost.
FilterOwnedCard filter = new FilterOwnedCard("red card from your hand");
filter.add(new ColorPredicate(ObjectColor.RED));
filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself
CostsImpl<Cost> costs = new CostsImpl<Cost>();
costs.add(new ExileFromHandCost(new TargetCardInHand(filter)));
this.getSpellAbility().addAlternativeCost(new AlternativeCostImpl("You may exile a red card from your hand rather than pay Pyrokinesis's mana cost", costs));
// Pyrokinesis deals 4 damage divided as you choose among any number of target creatures.
this.getSpellAbility().addEffect(new DamageMultiEffect(4));
this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(4));
}
public Pyrokinesis(final Pyrokinesis card) {
super(card);
}
@Override
public Pyrokinesis copy() {
return new Pyrokinesis(this);
}
}

View file

@ -0,0 +1,138 @@
/*
* 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.apocalypse;
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.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/**
*
* @author Plopman
*/
public class GoblinRingleader extends CardImpl<GoblinRingleader> {
public GoblinRingleader(UUID ownerId) {
super(ownerId, 62, "Goblin Ringleader", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.expansionSetCode = "APC";
this.subtype.add("Goblin");
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Haste
this.addAbility(HasteAbility.getInstance());
// When Goblin Ringleader enters the battlefield, reveal the top four cards of your library. Put all Goblin cards revealed this way into your hand and the rest on the bottom of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GoblinRingleaderEffect()));
}
public GoblinRingleader(final GoblinRingleader card) {
super(card);
}
@Override
public GoblinRingleader copy() {
return new GoblinRingleader(this);
}
}
class GoblinRingleaderEffect extends OneShotEffect<GoblinRingleaderEffect> {
private static final FilterCard filter = new FilterCard("Goblin");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GoblinRingleaderEffect() {
super(Constants.Outcome.DrawCard);
this.staticText = "reveal the top four cards of your library. Put all Goblin cards revealed this way into your hand and the rest on the bottom of your library in any order";
}
public GoblinRingleaderEffect(final GoblinRingleaderEffect effect) {
super(effect);
}
@Override
public GoblinRingleaderEffect copy() {
return new GoblinRingleaderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Cards cards = new CardsImpl(Constants.Zone.PICK);
Cards cards2 = new CardsImpl(Constants.Zone.PICK);
int count = Math.min(player.getLibrary().size(), 4);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
game.setZone(card.getId(), Constants.Zone.PICK);
if (filter.match(card, game)) {
card.moveToZone(Constants.Zone.HAND, source.getId(), game, true);
} else {
cards2.add(card);
}
}
}
Card sourceCard = game.getCard(source.getSourceId());
if (!cards.isEmpty() && sourceCard != null) {
player.revealCards(sourceCard.getName(), cards, game);
}
TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard("card to put on the bottom of your library"));
target.setRequired(true);
while (cards2.size() > 0 && player.choose(Constants.Outcome.Detriment, cards2, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards2.remove(card);
card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, false);
}
target.clearChosen();
}
}
return true;
}
}

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.fifthedition;
import java.util.UUID;
import mage.Constants.Rarity;
/**
*
* @author Plopman
*/
public class Pyroblast extends mage.sets.iceage.Pyroblast {
public Pyroblast(UUID ownerId) {
super(ownerId);
this.cardNumber = 262;
this.expansionSetCode = "5ED";
this.rarity = Rarity.UNCOMMON;
}
public Pyroblast(final Pyroblast card) {
super(card);
}
@Override
public Pyroblast copy() {
return new Pyroblast(this);
}
}

View file

@ -0,0 +1,141 @@
/*
* 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.iceage;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.TargetSpell;
/**
*
* @author Plopman
*/
public class Pyroblast extends CardImpl<Pyroblast> {
public Pyroblast(UUID ownerId) {
super(ownerId, 213, "Pyroblast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}");
this.expansionSetCode = "ICE";
this.color.setRed(true);
// Choose one - Counter target spell if it's blue; or destroy target permanent if it's blue.
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addTarget(new TargetSpell());
Mode mode = new Mode();
mode.getEffects().add(new DestroyTargetEffect());
mode.getTargets().add(new TargetPermanent());
this.getSpellAbility().addMode(mode);
}
public Pyroblast(final Pyroblast card) {
super(card);
}
@Override
public Pyroblast copy() {
return new Pyroblast(this);
}
}
class CounterTargetEffect extends OneShotEffect<CounterTargetEffect> {
public CounterTargetEffect() {
super(Constants.Outcome.Detriment);
}
public CounterTargetEffect(final CounterTargetEffect effect) {
super(effect);
}
@Override
public CounterTargetEffect copy() {
return new CounterTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if(game.getStack().getSpell(source.getFirstTarget()).getColor().isBlue()){
game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
}
return true;
}
@Override
public String getText(Mode mode) {
return "Counter target spell if it's blue";
}
}
class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
public DestroyTargetEffect() {
super(Constants.Outcome.DestroyPermanent);
}
public DestroyTargetEffect(final DestroyTargetEffect effect) {
super(effect);
}
@Override
public DestroyTargetEffect copy() {
return new DestroyTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
if (permanent != null && permanent.getColor().isBlue()) {
permanent.destroy(source.getId(), game, false);
}
return true;
}
@Override
public String getText(Mode mode) {
return "Destroy target permanent if it's blue";
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.legions;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CycleTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Plopman
*/
public class GempalmIncinerator extends CardImpl<GempalmIncinerator> {
private static final FilterPermanent filter = new FilterPermanent("Goblins on the battlefield");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GempalmIncinerator(UUID ownerId) {
super(ownerId, 94, "Gempalm Incinerator", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "LGN";
this.subtype.add("Goblin");
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Cycling {1}{R}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{1}{R}")));
// When you cycle Gempalm Incinerator, you may have it deal X damage to target creature, where X is the number of Goblins on the battlefield.
Ability ability = new CycleTriggeredAbility(new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)),true);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public GempalmIncinerator(final GempalmIncinerator card) {
super(card);
}
@Override
public GempalmIncinerator copy() {
return new GempalmIncinerator(this);
}
}

View file

@ -74,7 +74,7 @@ public class GoblinPiledriver extends CardImpl<GoblinPiledriver> {
this.addAbility(new ProtectionAbility(filter1));
// Whenever Goblin Piledriver attacks, it gets +2/+0 until end of turn for each other attacking Goblin.
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter2, 2);
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(value, new StaticValue(0), Duration.EndOfTurn), false));
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(value, new StaticValue(0), Duration.EndOfTurn, true), false));
}
public GoblinPiledriver(final GoblinPiledriver card) {

View file

@ -61,7 +61,7 @@ public class GoblinSharpshooter extends CardImpl<GoblinSharpshooter> {
// Goblin Sharpshooter doesn't untap during your untap step.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipUntapSourceEffect()));
// Whenever a creature dies, untap Goblin Sharpshooter.
this.addAbility(new DiesCreatureTriggeredAbility(new UntapSourceEffect(), true));
this.addAbility(new DiesCreatureTriggeredAbility(new UntapSourceEffect(), false));
// {tap}: Goblin Sharpshooter deals 1 damage to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());

View file

@ -0,0 +1,67 @@
/*
* 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.onslaught;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.Mana;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
/**
*
* @author Plopman
*/
public class SkirkProspector extends CardImpl<SkirkProspector> {
public SkirkProspector(UUID ownerId) {
super(ownerId, 230, "Skirk Prospector", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}");
this.expansionSetCode = "ONS";
this.subtype.add("Goblin");
this.color.setRed(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Sacrifice a Goblin: Add {R} to your mana pool.
this.addAbility(new SimpleManaAbility(Constants.Zone.BATTLEFIELD, Mana.RedMana, new SacrificeSourceCost()));
}
public SkirkProspector(final SkirkProspector card) {
super(card);
}
@Override
public SkirkProspector copy() {
return new SkirkProspector(this);
}
}

View file

@ -0,0 +1,82 @@
/*
* 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.onslaught;
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.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Plopman
*/
public class Sparksmith extends CardImpl<Sparksmith> {
private static final FilterPermanent filter = new FilterPermanent("Goblins on the battlefield");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public Sparksmith(UUID ownerId) {
super(ownerId, 235, "Sparksmith", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "ONS";
this.subtype.add("Goblin");
this.color.setRed(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}: Sparksmith deals X damage to target creature and X damage to you, where X is the number of Goblins on the battlefield.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
ability.addEffect(new DamageControllerEffect(new PermanentsOnBattlefieldCount(filter)));
this.addAbility(ability);
}
public Sparksmith(final Sparksmith card) {
super(card);
}
@Override
public Sparksmith copy() {
return new Sparksmith(this);
}
}

View file

@ -67,7 +67,9 @@ public class Stingscourger extends CardImpl<Stingscourger> {
this.addAbility(new EchoAbility("{3}{R}"));
// When Stingscourger enters the battlefield, return target creature an opponent controls to its owner's hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
ability.addTarget(new TargetCreaturePermanent(filter));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
target.setRequired(true);
ability.addTarget(target);
this.addAbility(ability);
}

View file

@ -49,7 +49,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
public class GoblinWarchief extends CardImpl<GoblinWarchief> {
private static final FilterCard filterSpells = new FilterCard("Goblin spells");
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblins");
static {
filter.add(new SubtypePredicate("Goblin"));
@ -68,7 +68,7 @@ public class GoblinWarchief extends CardImpl<GoblinWarchief> {
// Goblin spells you cast cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filterSpells, 1)));
// Goblin creatures you control have haste.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, filter, false)));
}
public GoblinWarchief(final GoblinWarchief card) {

View file

@ -30,6 +30,9 @@ package mage.abilities.effects.common;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.players.Player;
@ -40,7 +43,7 @@ import mage.players.Player;
*/
public class DamageControllerEffect extends OneShotEffect<DamageControllerEffect> {
protected int amount;
protected DynamicValue amount;
protected boolean preventable;
public DamageControllerEffect(int amount) {
@ -49,13 +52,22 @@ public class DamageControllerEffect extends OneShotEffect<DamageControllerEffect
public DamageControllerEffect(int amount, boolean preventable) {
super(Outcome.Damage);
this.amount = amount;
this.amount = new StaticValue(amount);
this.preventable = preventable;
setText();
}
public DamageControllerEffect(DynamicValue amount) {
super(Outcome.Damage);
this.amount = amount;
this.preventable = true;
}
public int getAmount() {
return amount;
if (amount instanceof StaticValue) {
return amount.calculate(null, null);
} else {
return 0;
}
}
public DamageControllerEffect(final DamageControllerEffect effect) {
@ -73,18 +85,40 @@ public class DamageControllerEffect extends OneShotEffect<DamageControllerEffect
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.damage(amount, source.getId(), game, false, preventable);
player.damage(amount.calculate(game, source), source.getId(), game, false, preventable);
return true;
}
return false;
}
private void setText() {
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
sb.append("{source} deals ").append(Integer.toString(amount)).append(" damage to you");
if (!preventable)
String message = amount.getMessage();
sb.append("{source} deals ");
if (message.isEmpty() || !message.equals("1")) {
sb.append(amount);
}
sb.append(" damage to you");
if (message.length() > 0) {
if (message.equals("1")) {
sb.append(" equal to the number of ");
} else {
if (message.startsWith("the") || message.startsWith("twice")) {
sb.append(" equal to ");
} else {
sb.append(" for each ");
}
}
sb.append(message);
}
if (!preventable) {
sb.append(". The damage can't be prevented");
staticText = sb.toString();
}
return sb.toString();
}
}