Merge pull request #2415 from Styxo/master

[CN2] Added two cards
This commit is contained in:
LevelX2 2016-10-02 17:30:37 +02:00 committed by GitHub
commit 1e2f0dba0a
3 changed files with 177 additions and 1 deletions

View file

@ -0,0 +1,74 @@
/*
* 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.conspiracytakethecrown;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.MeleeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
*
* @author Styxo
*/
public class AdrianaCaptainOfTheGuard extends CardImpl {
public AdrianaCaptainOfTheGuard(UUID ownerId) {
super(ownerId, 73, "Adriana, Captain of the Guard", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{W}");
this.expansionSetCode = "CN2";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Knight");
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Melee
this.addAbility(new MeleeAbility());
// Other creatures you control have melee.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new MeleeAbility(), Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("creatures"), true)));
}
public AdrianaCaptainOfTheGuard(final AdrianaCaptainOfTheGuard card) {
super(card);
}
@Override
public AdrianaCaptainOfTheGuard copy() {
return new AdrianaCaptainOfTheGuard(this);
}
}

View file

@ -0,0 +1,90 @@
/*
* 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.conspiracytakethecrown;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantAttackControllerAttachedEffect;
import mage.abilities.effects.common.combat.CantBlockAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
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.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class SpectralGrasp extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public SpectralGrasp(UUID ownerId) {
super(ownerId, 24, "Spectral Grasp", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "CN2";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature can't attack you or a planeswalker you control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackControllerAttachedEffect(AttachmentType.AURA)));
// Enchanted creature can't block creatures you control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAttachedEffect(AttachmentType.AURA, Duration.WhileOnBattlefield, filter)));
}
public SpectralGrasp(final SpectralGrasp card) {
super(card);
}
@Override
public SpectralGrasp copy() {
return new SpectralGrasp(this);
}
}

View file

@ -31,6 +31,7 @@ import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -41,18 +42,28 @@ import mage.target.targetpointer.FixedTarget;
*/
public class CantBlockAttachedEffect extends RestrictionEffect {
private final FilterCreaturePermanent filter;
public CantBlockAttachedEffect(AttachmentType attachmentType) {
this(attachmentType, Duration.WhileOnBattlefield);
}
public CantBlockAttachedEffect(AttachmentType attachmentType, Duration duration) {
this(attachmentType, duration, new FilterCreaturePermanent());
}
public CantBlockAttachedEffect(AttachmentType attachmentType, Duration duration, FilterCreaturePermanent filter) {
super(duration);
this.filter = filter;
StringBuilder sb = new StringBuilder();
if (attachmentType.equals(AttachmentType.AURA)) {
sb.append("Enchanted creature can't block");
} else {
sb.append("Equipped creature can't block");
}
if (!filter.getMessage().equals("creature")) {
sb.append(" ").append(filter.getMessage());
}
if (!duration.toString().isEmpty()) {
sb.append(" ").append(duration.toString());
}
@ -61,6 +72,7 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
public CantBlockAttachedEffect(final CantBlockAttachedEffect effect) {
super(effect);
this.filter = effect.filter;
}
@Override
@ -84,7 +96,7 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
}
@Override