From c65f0b4904a9c60ca3ea9149e6fa8cc040a6b869 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 22 Jul 2013 17:19:43 +0200 Subject: [PATCH] Added Bladewing the Risen and Vish Kal, Blood Arbiter. --- .../sets/commander/BladewingTheRisen.java | 95 +++++++++ .../sets/commander/VishKalBloodArbiter.java | 185 ++++++++++++++++++ .../mage/sets/scourge/BladewingTheRisen.java | 52 +++++ .../counter/AddCountersTargetEffect.java | 48 +++-- 4 files changed, 368 insertions(+), 12 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander/BladewingTheRisen.java create mode 100644 Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java create mode 100644 Mage.Sets/src/mage/sets/scourge/BladewingTheRisen.java diff --git a/Mage.Sets/src/mage/sets/commander/BladewingTheRisen.java b/Mage.Sets/src/mage/sets/commander/BladewingTheRisen.java new file mode 100644 index 0000000000..550d7eb673 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/BladewingTheRisen.java @@ -0,0 +1,95 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterPermanentCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.Target; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class BladewingTheRisen extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon creatures"); + private static final FilterPermanentCard filterCard = new FilterPermanentCard("Dragon permanent card from your graveyard"); + static { + filter.add(new SubtypePredicate("Dragon")); + filterCard.add(new SubtypePredicate("Dragon")); + } + + public BladewingTheRisen(UUID ownerId) { + super(ownerId, 185, "Bladewing the Risen", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{R}{R}"); + this.expansionSetCode = "CMD"; + this.supertype.add("Legendary"); + this.subtype.add("Zombie"); + this.subtype.add("Dragon"); + + this.color.setRed(true); + this.color.setBlack(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // When Bladewing the Risen enters the battlefield, you may return target Dragon permanent card from your graveyard to the battlefield. + Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), true); + Target target = new TargetCardInYourGraveyard(filterCard); + target.setRequired(true); + ability.addTarget(target); + this.addAbility(ability); + // {B}{R}: Dragon creatures get +1/+1 until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.EndOfTurn, filter, false), new ManaCostsImpl("{B}{R}"))); + } + + public BladewingTheRisen(final BladewingTheRisen card) { + super(card); + } + + @Override + public BladewingTheRisen copy() { + return new BladewingTheRisen(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java new file mode 100644 index 0000000000..6bbed5766c --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java @@ -0,0 +1,185 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.CostImpl; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower; +import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class VishKalBloodArbiter extends CardImpl { + + public VishKalBloodArbiter(UUID ownerId) { + super(ownerId, 234, "Vish Kal, Blood Arbiter", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{W}{B}{B}"); + this.expansionSetCode = "CMD"; + this.supertype.add("Legendary"); + this.subtype.add("Vampire"); + + this.color.setBlack(true); + this.color.setWhite(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + // Sacrifice a creature: Put X +1/+1 counters on Vish Kal, Blood Arbiter, where X is the sacrificed creature's power. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new SacrificeCostCreaturesPower(), true), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), false)))); + // Remove all +1/+1 counters from Vish Kal: Target creature gets -1/-1 until end of turn for each +1/+1 counter removed this way. + DynamicValue removedCounters = new SignInversionDynamicValue(new VishKalBloodArbiterDynamicValue()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(removedCounters, removedCounters, Duration.EndOfTurn), new VishKalBloodArbiterCost(CounterType.P1P1.createInstance())); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + } + + public VishKalBloodArbiter(final VishKalBloodArbiter card) { + super(card); + } + + @Override + public VishKalBloodArbiter copy() { + return new VishKalBloodArbiter(this); + } +} + +class VishKalBloodArbiterCost extends CostImpl { + + private int amount; + private String name; + + public VishKalBloodArbiterCost(Counter counter) { + this.name = counter.getName(); + this.amount = counter.getCount(); + this.text = "Remove all " + name + " counters from {this}"; + } + + public VishKalBloodArbiterCost(VishKalBloodArbiterCost cost) { + super(cost); + this.amount = cost.amount; + this.name = cost.name; + } + + @Override + public boolean canPay(UUID sourceId, UUID controllerId, Game game) { + return true; + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + Permanent permanent = game.getPermanent(sourceId); + if (permanent != null) { + this.amount = permanent.getCounters().getCount(name); + permanent.removeCounters(name, amount, game); + this.paid = true; + } + else + { + this.amount = 0; + } + return paid; + } + + @Override + public VishKalBloodArbiterCost copy() { + return new VishKalBloodArbiterCost(this); + } + + public int getAmount() { + return amount; + } + + +} + +class VishKalBloodArbiterDynamicValue implements DynamicValue { + + + public VishKalBloodArbiterDynamicValue() { + + } + + public VishKalBloodArbiterDynamicValue(final VishKalBloodArbiterDynamicValue dynamicValue) { + } + + @Override + public int calculate(Game game, Ability source) { + int count = 0; + for(Cost cost : source.getCosts()){ + if(cost instanceof VishKalBloodArbiterCost){ + count += ((VishKalBloodArbiterCost)cost).getAmount(); + } + } + return count; + } + + @Override + public VishKalBloodArbiterDynamicValue copy() { + return new VishKalBloodArbiterDynamicValue(this); + } + + @Override + public String toString() { + return "1"; + } + + @Override + public String getMessage() { + return "the number of +1/+1 counters removed this way"; + } +} diff --git a/Mage.Sets/src/mage/sets/scourge/BladewingTheRisen.java b/Mage.Sets/src/mage/sets/scourge/BladewingTheRisen.java new file mode 100644 index 0000000000..242d953fb1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/scourge/BladewingTheRisen.java @@ -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.scourge; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class BladewingTheRisen extends mage.sets.commander.BladewingTheRisen { + + public BladewingTheRisen(UUID ownerId) { + super(ownerId); + this.cardNumber = 136; + this.expansionSetCode = "SCG"; + } + + public BladewingTheRisen(final BladewingTheRisen card) { + super(card); + } + + @Override + public BladewingTheRisen copy() { + return new BladewingTheRisen(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 4ab2707855..84394c9bf5 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -38,6 +38,9 @@ import mage.players.Player; import java.util.UUID; import mage.abilities.Mode; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.util.CardUtil; /** * @@ -46,19 +49,32 @@ import mage.abilities.Mode; public class AddCountersTargetEffect extends OneShotEffect { private Counter counter; + private DynamicValue amount; public AddCountersTargetEffect(Counter counter) { this(counter, Outcome.Benefit); - } + } - public AddCountersTargetEffect(Counter counter, Outcome outcome) { + public AddCountersTargetEffect(Counter counter, DynamicValue amount) { + this(counter, amount, Outcome.Benefit); + } + + public AddCountersTargetEffect(Counter counter, Outcome outcome) { + this(counter, new StaticValue(0), outcome); + } + + public AddCountersTargetEffect(Counter counter, DynamicValue amount, Outcome outcome) { super(outcome); this.counter = counter; - } + this.amount = amount; + } public AddCountersTargetEffect(final AddCountersTargetEffect effect) { super(effect); - this.counter = effect.counter.copy(); + if (effect.counter != null) { + this.counter = effect.counter.copy(); + } + this.amount = effect.amount; } @Override @@ -68,13 +84,17 @@ public class AddCountersTargetEffect extends OneShotEffect 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters on target "); + sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + } else { + sb.append("a "); } - else { - sb.append("a ").append(counter.getName()).append(" counter on target "); - } - // TODO add normal text infrastructure for target pointers - if (mode.getTargets().size() > 0) + sb.append(counter.getName().toLowerCase()).append(" counter on target "); + // TODO: add normal text infrastructure for target pointers + if (mode.getTargets().size() > 0) { sb.append(mode.getTargets().get(0).getTargetName()); + } + if (amount.getMessage().length() > 0) { + sb.append(" for each ").append(amount.getMessage()); + } return sb.toString(); }