1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-01 19:07:57 -09:00

[MIC] Implemented Curse of Clinging Webs

This commit is contained in:
Evan Kranzler 2021-09-20 19:53:02 -04:00
parent 77845bd1df
commit b43bb44b27
4 changed files with 102 additions and 43 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/filter/predicate/permanent

View file

@ -0,0 +1,65 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.EnchantPlayerControlsPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.permanent.token.SpiderToken;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CurseOfClingingWebs extends CardImpl {
private static final FilterPermanent filter
= new FilterCreaturePermanent("a nontoken creature enchanted player controls");
static {
filter.add(TokenPredicate.FALSE);
filter.add(EnchantPlayerControlsPredicate.instance);
}
public CurseOfClingingWebs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
this.subtype.add(SubType.AURA);
this.subtype.add(SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Whenever a nontoken creature enchanted player controls dies, exile it and you create a 1/2 green Spider creature token with reach.
Ability ability = new DiesCreatureTriggeredAbility(
new ExileTargetEffect().setText("exile it"),
false, filter, true
);
ability.addEffect(new CreateTokenEffect(new SpiderToken()).concatBy("and you"));
this.addAbility(ability);
}
private CurseOfClingingWebs(final CurseOfClingingWebs card) {
super(card);
}
@Override
public CurseOfClingingWebs copy() {
return new CurseOfClingingWebs(this);
}
}

View file

@ -1,28 +1,33 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.EnchantPlayerControlsPredicate;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author BetaSteward
*/
public final class CurseOfDeathsHold extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creatures enchanted player controls");
static {
filter.add(EnchantPlayerControlsPredicate.instance);
}
public CurseOfDeathsHold(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
this.subtype.add(SubType.AURA, SubType.CURSE);
@ -34,7 +39,9 @@ public final class CurseOfDeathsHold extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Creatures enchanted player controls get -1/-1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CurseOfDeathsHoldEffect()));
this.addAbility(new SimpleStaticAbility(new BoostAllEffect(
-1, -1, Duration.WhileOnBattlefield, filter, false
)));
}
private CurseOfDeathsHold(final CurseOfDeathsHold card) {
@ -46,36 +53,3 @@ public final class CurseOfDeathsHold extends CardImpl {
return new CurseOfDeathsHold(this);
}
}
class CurseOfDeathsHoldEffect extends ContinuousEffectImpl {
public CurseOfDeathsHoldEffect() {
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.UnboostCreature);
staticText = "Creatures enchanted player controls get -1/-1";
}
public CurseOfDeathsHoldEffect(final CurseOfDeathsHoldEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game)) {
perm.addPower(-1);
perm.addToughness(-1);
}
return true;
}
}
return false;
}
@Override
public CurseOfDeathsHoldEffect copy() {
return new CurseOfDeathsHoldEffect(this);
}
}

View file

@ -48,6 +48,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
cards.add(new SetCardInfo("Commander's Sphere", 159, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
cards.add(new SetCardInfo("Corpse Augur", 109, Rarity.UNCOMMON, mage.cards.c.CorpseAugur.class));
cards.add(new SetCardInfo("Crowded Crypt", 17, Rarity.RARE, mage.cards.c.CrowdedCrypt.class));
cards.add(new SetCardInfo("Curse of Clinging Webs", 25, Rarity.RARE, mage.cards.c.CurseOfClingingWebs.class));
cards.add(new SetCardInfo("Custodi Soulbinders", 83, Rarity.RARE, mage.cards.c.CustodiSoulbinders.class));
cards.add(new SetCardInfo("Dark Salvation", 110, Rarity.RARE, mage.cards.d.DarkSalvation.class));
cards.add(new SetCardInfo("Darkwater Catacombs", 171, Rarity.RARE, mage.cards.d.DarkwaterCatacombs.class));

View file

@ -0,0 +1,19 @@
package mage.filter.predicate.permanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author TheElk801
*/
public enum EnchantPlayerControlsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
Permanent permanent = game.getPermanent(input.getSourceId());
return permanent != null && input.getObject().isControlledBy(permanent.getAttachedTo());
}
}