[TPR] Added Volrath's Curse and Crovax the Cursed.

This commit is contained in:
LevelX2 2015-04-11 12:09:46 +02:00
parent 4d7f1a05bf
commit b79d6e64cf
6 changed files with 523 additions and 3 deletions

View file

@ -0,0 +1,131 @@
/*
* 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.stronghold;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class CrovaxTheCursed extends CardImpl {
public CrovaxTheCursed(UUID ownerId) {
super(ownerId, 5, "Crovax the Cursed", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
this.expansionSetCode = "STH";
this.supertype.add("Legendary");
this.subtype.add("Vampire");
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Crovax the Cursed enters the battlefield with four +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(4)), "with four +1/+1 counters on it"));
// At the beginning of your upkeep, you may sacrifice a creature. If you do, put a +1/+1 counter on Crovax. If you don't, remove a +1/+1 counter from Crovax.
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new CrovaxTheCursedEffect(), TargetController.YOU, false);
this.addAbility(ability);
// {B}: Crovax gains flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{B}")));
}
public CrovaxTheCursed(final CrovaxTheCursed card) {
super(card);
}
@Override
public CrovaxTheCursed copy() {
return new CrovaxTheCursed(this);
}
}
class CrovaxTheCursedEffect extends OneShotEffect {
public CrovaxTheCursedEffect() {
super(Outcome.Detriment);
this.staticText = "you may sacrifice a creature. If you do, put a +1/+1 counter on {this}. If you don't, remove a +1/+1 counter from {this}";
}
public CrovaxTheCursedEffect(final CrovaxTheCursedEffect effect) {
super(effect);
}
@Override
public CrovaxTheCursedEffect copy() {
return new CrovaxTheCursedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game);
int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game);
if (creatures > 0 && controller.chooseUse(outcome, "Sacrifice a creature?", game)) {
if (new SacrificeControllerEffect(new FilterCreaturePermanent(), 1, "").apply(game, source)) {
if (sourceObject != null) {
sourceObject.getCounters().addCounter(CounterType.P1P1.createInstance());
game.informPlayers(controller.getName() + " puts a +1/+1 counter on " + sourceObject.getName());
}
}
} else {
if (sourceObject != null && sourceObject.getCounters().containsKey(CounterType.P1P1)) {
sourceObject.getCounters().removeCounter(CounterType.P1P1, 1);
game.informPlayers(controller.getName() + " removes a +1/+1 counter from " + sourceObject.getName());
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,221 @@
/*
* 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.tempest;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.SpecialAction;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import static mage.sets.tempest.VolrathsCurse.keyString;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class VolrathsCurse extends CardImpl {
public static final String keyString = "_ignoreEffectForTurn";
public VolrathsCurse(UUID ownerId) {
super(ownerId, 101, "Volrath's Curse", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "TMP";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature can't attack or block, and its activated abilities can't be activated. That creature's controller may sacrifice a permanent for that player to ignore this effect until end of turn.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new VolrathsCurseRestrictionEffect());
ability.addEffect(new VolrathsCurseCantActivateAbilitiesEffect());
this.addAbility(ability);
this.addAbility(new VolrathsCurseSpecialAction());
// {1}{U}: Return Volrath's Curse to its owner's hand.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{1}{U}")));
}
public VolrathsCurse(final VolrathsCurse card) {
super(card);
}
@Override
public VolrathsCurse copy() {
return new VolrathsCurse(this);
}
}
class VolrathsCurseRestrictionEffect extends RestrictionEffect {
public VolrathsCurseRestrictionEffect() {
super(Duration.WhileOnBattlefield);
this.staticText = "Enchanted creature can't attack or block";
}
public VolrathsCurseRestrictionEffect(final VolrathsCurseRestrictionEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent attachment = game.getPermanent(source.getSourceId());
if (attachment != null && attachment.getAttachedTo() != null
&& permanent.getId().equals(attachment.getAttachedTo())) {
String key = source.getSourceId().toString() + attachment.getZoneChangeCounter(game) + keyString + game.getTurnNum() + permanent.getControllerId();
return game.getState().getValue(key) == null;
}
return false;
}
@Override
public boolean canAttack(Game game) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
}
@Override
public VolrathsCurseRestrictionEffect copy() {
return new VolrathsCurseRestrictionEffect(this);
}
}
class VolrathsCurseCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffectImpl {
public VolrathsCurseCantActivateAbilitiesEffect() {
super(Duration.WhileOnBattlefield, Outcome.UnboostCreature);
staticText = ", and its activated abilities can't be activated";
}
public VolrathsCurseCantActivateAbilitiesEffect(final VolrathsCurseCantActivateAbilitiesEffect effect) {
super(effect);
}
@Override
public VolrathsCurseCantActivateAbilitiesEffect copy() {
return new VolrathsCurseCantActivateAbilitiesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
if (enchanted != null) {
String key = source.getSourceId().toString() + enchantment.getZoneChangeCounter(game) + keyString + game.getTurnNum() + enchanted.getControllerId();
return game.getState().getValue(key) == null;
}
}
}
return false;
}
}
class VolrathsCurseSpecialAction extends SpecialAction {
public VolrathsCurseSpecialAction() {
super(Zone.BATTLEFIELD);
this.addCost(new SacrificeTargetCost(new TargetControlledPermanent(), true));
this.addEffect(new VolrathsCurseIgnoreEffect(keyString));
this.setMayActivate(TargetController.CONTROLLER_ATTACHED_TO);
}
public VolrathsCurseSpecialAction(final VolrathsCurseSpecialAction ability) {
super(ability);
}
@Override
public VolrathsCurseSpecialAction copy() {
return new VolrathsCurseSpecialAction(this);
}
}
class VolrathsCurseIgnoreEffect extends OneShotEffect {
public VolrathsCurseIgnoreEffect(final String keyString) {
super(Outcome.Benefit);
this.staticText = "That creature's controller may sacrifice a permanent for that player to ignore this effect until end of turn";
}
public VolrathsCurseIgnoreEffect(final VolrathsCurseIgnoreEffect effect) {
super(effect);
}
@Override
public VolrathsCurseIgnoreEffect copy() {
return new VolrathsCurseIgnoreEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + keyString + game.getTurnNum() + ((ActivatedAbilityImpl)source).getActivatorId();
game.getState().setValue(key,true);
return true;
}
}

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.tempestremastered;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class CrovaxTheCursed extends mage.sets.stronghold.CrovaxTheCursed {
public CrovaxTheCursed(UUID ownerId) {
super(ownerId);
this.cardNumber = 90;
this.expansionSetCode = "TPR";
}
public CrovaxTheCursed(final CrovaxTheCursed card) {
super(card);
}
@Override
public CrovaxTheCursed copy() {
return new CrovaxTheCursed(this);
}
}

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.tempestremastered;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class VolrathsCurse extends mage.sets.tempest.VolrathsCurse {
public VolrathsCurse(UUID ownerId) {
super(ownerId);
this.cardNumber = 77;
this.expansionSetCode = "TPR";
this.rarity = Rarity.UNCOMMON;
}
public VolrathsCurse(final VolrathsCurse card) {
super(card);
}
@Override
public VolrathsCurse copy() {
return new VolrathsCurse(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.vintagemasters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class CrovaxTheCursed extends mage.sets.stronghold.CrovaxTheCursed {
public CrovaxTheCursed(UUID ownerId) {
super(ownerId);
this.cardNumber = 110;
this.expansionSetCode = "VMA";
}
public CrovaxTheCursed(final CrovaxTheCursed card) {
super(card);
}
@Override
public CrovaxTheCursed copy() {
return new CrovaxTheCursed(this);
}
}

View file

@ -32,7 +32,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.CostImpl;
import mage.constants.AbilityType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -65,7 +67,11 @@ public class SacrificeTargetCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
if (targets.choose(Outcome.Sacrifice, controllerId, sourceId, game)) {
UUID activator = controllerId;
if (ability.getAbilityType().equals(AbilityType.ACTIVATED) || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
activator = ((ActivatedAbilityImpl)ability).getActivatorId();
}
if (targets.choose(Outcome.Sacrifice, activator, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
@ -83,10 +89,14 @@ public class SacrificeTargetCost extends CostImpl {
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
if (!game.getPlayer(controllerId).canPaySacrificeCost()) {
UUID activator = controllerId;
if (ability.getAbilityType().equals(AbilityType.ACTIVATED)) {
activator = ((ActivatedAbilityImpl)ability).getActivatorId();
}
if (!game.getPlayer(activator).canPaySacrificeCost()) {
return false;
}
return targets.canChoose(controllerId, game);
return targets.canChoose(activator, game);
}
@Override