mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
- Added Voidwalk, Spell Rupture, and Gruul Charm.
This commit is contained in:
parent
0c50786109
commit
053abd4c93
3 changed files with 396 additions and 0 deletions
130
Mage.Sets/src/mage/sets/gatecrash/GruulCharm.java
Normal file
130
Mage.Sets/src/mage/sets/gatecrash/GruulCharm.java
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* 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.gatecrash;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.Constants.TargetController;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.common.CantBlockAllEffect;
|
||||||
|
import mage.abilities.effects.common.DamageAllEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||||
|
import mage.filter.predicate.other.OwnerPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class GruulCharm extends CardImpl<GruulCharm> {
|
||||||
|
|
||||||
|
final static private FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures without flying");
|
||||||
|
final static private FilterPermanent filter2 = new FilterPermanent("all permanents you own");
|
||||||
|
final static private FilterCreaturePermanent filter3 = new FilterCreaturePermanent("creature with flying");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
|
||||||
|
filter2.add(new OwnerPredicate(TargetController.YOU));
|
||||||
|
filter3.add(new AbilityPredicate(FlyingAbility.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GruulCharm(UUID ownerId) {
|
||||||
|
super(ownerId, 169, "Gruul Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{G}");
|
||||||
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
|
this.color.setRed(true);
|
||||||
|
this.color.setGreen(true);
|
||||||
|
|
||||||
|
// Choose one - Creatures without flying can't block this turn;
|
||||||
|
this.getSpellAbility().addEffect(new CantBlockAllEffect(filter, Constants.Duration.EndOfTurn));
|
||||||
|
|
||||||
|
// or gain control of all permanents you own;
|
||||||
|
Mode mode = new Mode();
|
||||||
|
mode.getEffects().add(new GainControlAllEffect(Constants.Duration.EndOfGame, filter2));
|
||||||
|
this.getSpellAbility().addMode(mode);
|
||||||
|
|
||||||
|
// or Gruul Charm deals 3 damage to each creature with flying.
|
||||||
|
Mode mode2 = new Mode();
|
||||||
|
mode2.getEffects().add(new DamageAllEffect(3, filter3));
|
||||||
|
this.getSpellAbility().addMode(mode2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GruulCharm(final GruulCharm card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GruulCharm copy() {
|
||||||
|
return new GruulCharm(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GainControlAllEffect extends ContinuousEffectImpl<GainControlAllEffect> {
|
||||||
|
|
||||||
|
final FilterPermanent filter;
|
||||||
|
|
||||||
|
public GainControlAllEffect(Constants.Duration duration, FilterPermanent filter) {
|
||||||
|
super(duration, Constants.Layer.ControlChangingEffects_2, Constants.SubLayer.NA, Constants.Outcome.GainControl);
|
||||||
|
this.filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GainControlAllEffect(final GainControlAllEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.filter = effect.filter.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GainControlAllEffect copy() {
|
||||||
|
return new GainControlAllEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.changeControllerId(source.getControllerId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Mode mode) {
|
||||||
|
return "Gain control of all permanents you own";
|
||||||
|
}
|
||||||
|
}
|
154
Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java
Normal file
154
Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* 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.gatecrash;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class SpellRupture extends CardImpl<SpellRupture> {
|
||||||
|
|
||||||
|
public SpellRupture(UUID ownerId) {
|
||||||
|
super(ownerId, 52, "Spell Rupture", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||||
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
|
||||||
|
// Counter target spell unless its controller pays {X}, where X is the greatest power among creatures you control.
|
||||||
|
this.getSpellAbility().addEffect(new SpellRuptureCounterUnlessPaysEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpellRupture(final SpellRupture card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpellRupture copy() {
|
||||||
|
return new SpellRupture(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect<SpellRuptureCounterUnlessPaysEffect> {
|
||||||
|
|
||||||
|
public SpellRuptureCounterUnlessPaysEffect() {
|
||||||
|
super(Constants.Outcome.Detriment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpellRuptureCounterUnlessPaysEffect(final SpellRuptureCounterUnlessPaysEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpellRuptureCounterUnlessPaysEffect copy() {
|
||||||
|
return new SpellRuptureCounterUnlessPaysEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
||||||
|
if (spell != null) {
|
||||||
|
Player player = game.getPlayer(spell.getControllerId());
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
int amount = new greatestPowerCountCreatureYouControl().calculate(game, source);
|
||||||
|
if (player != null && controller != null) {
|
||||||
|
if (amount > 0) {
|
||||||
|
GenericManaCost cost = new GenericManaCost(amount);
|
||||||
|
if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) {
|
||||||
|
|
||||||
|
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
||||||
|
if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId()))) {
|
||||||
|
game.informPlayers("Spell Rupture: cost wasn't payed - countering " + stackObject.getName());
|
||||||
|
if (stackObject instanceof Spell) {
|
||||||
|
game.rememberLKI(source.getFirstTarget(), Constants.Zone.STACK, (Spell) stackObject);
|
||||||
|
}
|
||||||
|
game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
||||||
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Mode mode) {
|
||||||
|
return "Counter target spell unless its controller pays {X}, where X is the greatest power among creatures you control";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class greatestPowerCountCreatureYouControl implements DynamicValue {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility) {
|
||||||
|
int value = 0;
|
||||||
|
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)) {
|
||||||
|
if (creature != null && creature.getPower().getValue() > value) {
|
||||||
|
value = creature.getPower().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DynamicValue copy() {
|
||||||
|
return new greatestPowerCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "X";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "greatest power among creatures you control";
|
||||||
|
}
|
||||||
|
}
|
112
Mage.Sets/src/mage/sets/gatecrash/Voidwalk.java
Normal file
112
Mage.Sets/src/mage/sets/gatecrash/Voidwalk.java
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* 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.gatecrash;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CipherEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class Voidwalk extends CardImpl<Voidwalk> {
|
||||||
|
|
||||||
|
public Voidwalk(UUID ownerId) {
|
||||||
|
super(ownerId, 55, "Voidwalk", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||||
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
|
||||||
|
// Exile target creature. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
|
this.getSpellAbility().addEffect(new VoidwalkEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
|
|
||||||
|
// Cipher
|
||||||
|
this.getSpellAbility().addEffect(new CipherEffect());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Voidwalk(final Voidwalk card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Voidwalk copy() {
|
||||||
|
return new Voidwalk(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VoidwalkEffect extends OneShotEffect<VoidwalkEffect> {
|
||||||
|
|
||||||
|
private static final String effectText = "Exile target creature. Return it to the battlefield under its owner's control at the beginning of the next end step";
|
||||||
|
|
||||||
|
VoidwalkEffect() {
|
||||||
|
super(Constants.Outcome.Benefit);
|
||||||
|
staticText = effectText;
|
||||||
|
}
|
||||||
|
|
||||||
|
VoidwalkEffect(VoidwalkEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (getTargetPointer().getFirst(game, source) != null) {
|
||||||
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
|
if (permanent != null) {
|
||||||
|
if (permanent.moveToExile(source.getSourceId(), "Voidwalk", source.getSourceId(), game)) {
|
||||||
|
if (card != null) {
|
||||||
|
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Constants.Zone.BATTLEFIELD));
|
||||||
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(card.getOwnerId());
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoidwalkEffect copy() {
|
||||||
|
return new VoidwalkEffect(this);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue