mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[ECL] Implement Bark of Doran
This commit is contained in:
parent
1622058d4a
commit
b79d154445
6 changed files with 159 additions and 157 deletions
57
Mage.Sets/src/mage/cards/b/BarkOfDoran.java
Normal file
57
Mage.Sets/src/mage/cards/b/BarkOfDoran.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.AttachedToMatchesFilterCondition;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ToughnessGreaterThanPowerPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BarkOfDoran extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(ToughnessGreaterThanPowerPredicate.instance);
|
||||
}
|
||||
|
||||
private static final Condition condition = new AttachedToMatchesFilterCondition(filter);
|
||||
|
||||
public BarkOfDoran(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Equipped creature gets +0/+1.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(0, 1)));
|
||||
|
||||
// As long as equipped creature's toughness is greater than its power, it assigns combat damage equal to its toughness rather than its power.
|
||||
this.addAbility(new SimpleStaticAbility(new CombatDamageByToughnessAttachedEffect(
|
||||
condition, "as long as equipped creature's toughness is greater than its power, " +
|
||||
"it assigns combat damage equal to its toughness rather than its power"
|
||||
)));
|
||||
|
||||
// Equip {1}
|
||||
this.addAbility(new EquipAbility(1));
|
||||
}
|
||||
|
||||
private BarkOfDoran(final BarkOfDoran card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BarkOfDoran copy() {
|
||||
return new BarkOfDoran(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,19 +4,18 @@ 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.effects.common.ruleModifying.CombatDamageByToughnessAttachedEffect;
|
||||
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.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -36,20 +35,19 @@ public final class GauntletsOfLight extends CardImpl {
|
|||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// 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());
|
||||
Ability ability = new SimpleStaticAbility(new BoostEnchantedEffect(0, 2));
|
||||
ability.addEffect(new CombatDamageByToughnessAttachedEffect(
|
||||
null, "and assigns combat damage equal to its toughness rather than its power"
|
||||
));
|
||||
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)
|
||||
));
|
||||
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) {
|
||||
|
|
@ -61,43 +59,3 @@ public final class GauntletsOfLight extends CardImpl {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,21 @@ package mage.cards.s;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.AttachedToMatchesFilterCondition;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
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.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -25,6 +27,14 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class SolidFooting extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new AbilityPredicate(VigilanceAbility.class));
|
||||
}
|
||||
|
||||
private static final Condition condition = new AttachedToMatchesFilterCondition(filter);
|
||||
|
||||
public SolidFooting(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
|
||||
|
||||
|
|
@ -44,7 +54,10 @@ public final class SolidFooting extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(1, 1)));
|
||||
|
||||
// As long as enchanted creature has vigilance, it assigns combat damage equal to its toughness rather than its power.
|
||||
this.addAbility(new SimpleStaticAbility(new GauntletsOfLightEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new CombatDamageByToughnessAttachedEffect(
|
||||
condition, "as long as enchanted creature has vigilance, " +
|
||||
"it assigns combat damage equal to its toughness rather than its power"
|
||||
)));
|
||||
}
|
||||
|
||||
private SolidFooting(final SolidFooting card) {
|
||||
|
|
@ -56,48 +69,3 @@ public final class SolidFooting extends CardImpl {
|
|||
return new SolidFooting(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GauntletsOfLightEffect extends ContinuousEffectImpl {
|
||||
|
||||
GauntletsOfLightEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "As long as enchanted creature has vigilance, " +
|
||||
"it 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;
|
||||
}
|
||||
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
||||
if (attachedTo == null || !attachedTo.getAbilities().containsKey(VigilanceAbility.getInstance().getId())) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,18 +2,16 @@ package mage.cards.t;
|
|||
|
||||
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.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.UmbraArmorAbility;
|
||||
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.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -33,12 +31,13 @@ public final class TreefolkUmbra extends CardImpl {
|
|||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// 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 TreefolkUmbraEffect());
|
||||
Ability ability = new SimpleStaticAbility(new BoostEnchantedEffect(0, 2));
|
||||
ability.addEffect(new CombatDamageByToughnessAttachedEffect(
|
||||
null, "and assigns combat damage equal to its toughness rather than its power"
|
||||
));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Umbra armor
|
||||
|
|
@ -54,43 +53,3 @@ public final class TreefolkUmbra extends CardImpl {
|
|||
return new TreefolkUmbra(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TreefolkUmbraEffect extends ContinuousEffectImpl {
|
||||
|
||||
TreefolkUmbraEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "and assigns combat damage equal to its toughness rather than its power";
|
||||
}
|
||||
|
||||
private TreefolkUmbraEffect(final TreefolkUmbraEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreefolkUmbraEffect copy() {
|
||||
return new TreefolkUmbraEffect(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public final class LorwynEclipsed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Aurora Awakener", 165, Rarity.MYTHIC, mage.cards.a.AuroraAwakener.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Aurora Awakener", 323, Rarity.MYTHIC, mage.cards.a.AuroraAwakener.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Barbed Bloodletter", 86, Rarity.COMMON, mage.cards.b.BarbedBloodletter.class));
|
||||
cards.add(new SetCardInfo("Bark of Doran", 6, Rarity.UNCOMMON, mage.cards.b.BarkOfDoran.class));
|
||||
cards.add(new SetCardInfo("Bile-Vial Boggart", 87, Rarity.COMMON, mage.cards.b.BileVialBoggart.class));
|
||||
cards.add(new SetCardInfo("Bitterbloom Bearer", 310, Rarity.MYTHIC, mage.cards.b.BitterbloomBearer.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bitterbloom Bearer", 352, Rarity.MYTHIC, mage.cards.b.BitterbloomBearer.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package mage.abilities.effects.common.ruleModifying;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CombatDamageByToughnessAttachedEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final Condition condition;
|
||||
|
||||
public CombatDamageByToughnessAttachedEffect(Condition condition, String text) {
|
||||
super(Duration.WhileOnBattlefield, Layer.RulesEffects, SubLayer.NA, Outcome.Benefit);
|
||||
this.condition = condition;
|
||||
this.staticText = text;
|
||||
}
|
||||
|
||||
private CombatDamageByToughnessAttachedEffect(final CombatDamageByToughnessAttachedEffect effect) {
|
||||
super(effect);
|
||||
this.condition = effect.condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CombatDamageByToughnessAttachedEffect copy() {
|
||||
return new CombatDamageByToughnessAttachedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (condition != null && !condition.apply(game, source)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = Optional
|
||||
.ofNullable(source.getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getPermanent)
|
||||
.orElse(null);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new PermanentIdPredicate(permanent.getId()));
|
||||
game.getCombat().setUseToughnessForDamage(true);
|
||||
game.getCombat().addUseToughnessForDamageFilter(filter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue