Implemented Gauntlets of Light

This commit is contained in:
Evan Kranzler 2019-06-26 08:17:25 -04:00
parent 9f66ebbe54
commit b0489c3a61
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GauntletsOfLight extends CardImpl {
public GauntletsOfLight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.subtype.add(SubType.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 gets +0/+2 and assigns combat damage equal to its toughness rather than its power.
ability = new SimpleStaticAbility(new BoostEnchantedEffect(0, 2));
ability.addEffect(new GauntletsOfLightEffect());
this.addAbility(ability);
// Enchanted creature has "{2}{W}: Untap this creature."
this.addAbility(new SimpleStaticAbility(
new GainAbilityAttachedEffect(new SimpleActivatedAbility(
new UntapSourceEffect().setText("Untap this creature"), new ManaCostsImpl("{2}{W}")
), AttachmentType.AURA)
));
}
private GauntletsOfLight(final GauntletsOfLight card) {
super(card);
}
@Override
public GauntletsOfLight copy() {
return new GauntletsOfLight(this);
}
}
class GauntletsOfLightEffect extends ContinuousEffectImpl {
GauntletsOfLightEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "and assigns combat damage equal to its toughness rather than its power";
}
private GauntletsOfLightEffect(final GauntletsOfLightEffect effect) {
super(effect);
}
@Override
public GauntletsOfLightEffect copy() {
return new GauntletsOfLightEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null || permanent.getAttachedTo() == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new PermanentIdPredicate(permanent.getAttachedTo()));
game.getCombat().setUseToughnessForDamage(true);
game.getCombat().addUseToughnessForDamageFilter(filter);
return true;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.RulesEffects;
}
}

View file

@ -144,6 +144,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Frilled Sea Serpent", 61, Rarity.COMMON, mage.cards.f.FrilledSeaSerpent.class));
cards.add(new SetCardInfo("Frost Lynx", 62, Rarity.COMMON, mage.cards.f.FrostLynx.class));
cards.add(new SetCardInfo("Fry", 140, Rarity.UNCOMMON, mage.cards.f.Fry.class));
cards.add(new SetCardInfo("Gauntlets of Light", 17, Rarity.UNCOMMON, mage.cards.g.GauntletsOfLight.class));
cards.add(new SetCardInfo("Gift of Paradise", 173, Rarity.COMMON, mage.cards.g.GiftOfParadise.class));
cards.add(new SetCardInfo("Glaring Aegis", 18, Rarity.COMMON, mage.cards.g.GlaringAegis.class));
cards.add(new SetCardInfo("Glint-Horn Buccaneer", 141, Rarity.RARE, mage.cards.g.GlintHornBuccaneer.class));