diff --git a/Mage.Sets/src/mage/cards/t/TimberPaladin.java b/Mage.Sets/src/mage/cards/t/TimberPaladin.java new file mode 100644 index 00000000000..7c239ba1071 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TimberPaladin.java @@ -0,0 +1,77 @@ +package mage.cards.t; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.EnchantedSourceCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Duration; +import mage.constants.SubLayer; + +/** + * + * @author Xanderhall + */ +public final class TimberPaladin extends CardImpl { + + private static Condition exactlyOne = new EnchantedSourceCondition(1, ComparisonType.EQUAL_TO, true); + private static Condition exactlyTwo = new EnchantedSourceCondition(2, ComparisonType.EQUAL_TO, true); + private static Condition threeOrMore = new EnchantedSourceCondition(3, ComparisonType.OR_GREATER, true); + + public TimberPaladin(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{G}"); + + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // As long as Timber Paladin is enchanted by exactly one Aura, it has base power and toughness 3/3. + Ability ability1 = new SimpleStaticAbility(new ConditionalContinuousEffect( + new SetBasePowerToughnessSourceEffect(3, 3, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), + exactlyOne, + "As long as {this} is enchanted by exactly one Aura, it has base power and toughness 3/3." + )); + + this.addAbility(ability1); + // As long as Timber Paladin is enchanted by exactly two Auras, it has base power and toughness 5/5 and vigilance. + + Ability ability2 = new SimpleStaticAbility(new ConditionalContinuousEffect( + new SetBasePowerToughnessSourceEffect(5, 5, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), + exactlyTwo, + "As long as {this} is enchanted by exactly two Auras, it has base power and toughness 5/5" + )); + ability2.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), exactlyTwo, "and vigilance.")); + + this.addAbility(ability2); + + // As long as Timber Paladin is enchanted by three or more Auras, it has base power and toughness 10/10, vigilance, and trample. + Ability ability3 = new SimpleStaticAbility(new ConditionalContinuousEffect( + new SetBasePowerToughnessSourceEffect(10, 10, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), + threeOrMore, + "As long as {this} is enchanted by three or more Auras, it has base power and toughness 10/10" + )); + ability3.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), threeOrMore, ", vigilance")); + ability3.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance()), threeOrMore, ", and trample.")); + this.addAbility(ability3); + } + + private TimberPaladin(final TimberPaladin card) { + super(card); + } + + @Override + public TimberPaladin copy() { + return new TimberPaladin(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java b/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java index 2aa48fb7585..a3df4bc2c3f 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java @@ -127,6 +127,7 @@ public final class WildsOfEldraineCommander extends ExpansionSet { cards.add(new SetCardInfo("Temple of the False God", 172, Rarity.UNCOMMON, mage.cards.t.TempleOfTheFalseGod.class)); cards.add(new SetCardInfo("Theoretical Duplication", 112, Rarity.RARE, mage.cards.t.TheoreticalDuplication.class)); cards.add(new SetCardInfo("Thrilling Encore", 118, Rarity.RARE, mage.cards.t.ThrillingEncore.class)); + cards.add(new SetCardInfo("Timber Paladin", 20, Rarity.RARE, mage.cards.t.TimberPaladin.class)); cards.add(new SetCardInfo("Timely Ward", 79, Rarity.RARE, mage.cards.t.TimelyWard.class)); cards.add(new SetCardInfo("Tithe Taker", 80, Rarity.RARE, mage.cards.t.TitheTaker.class)); cards.add(new SetCardInfo("Transcendent Envoy", 81, Rarity.COMMON, mage.cards.t.TranscendentEnvoy.class)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java index bef982778ce..06bf00bab25 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java @@ -2,8 +2,11 @@ package mage.abilities.condition.common; import java.util.UUID; + import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.constants.ComparisonType; +import mage.constants.SubType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -14,13 +17,21 @@ import mage.game.permanent.Permanent; public class EnchantedSourceCondition implements Condition { private int numberOfEnchantments; + private ComparisonType comparisonType; + private boolean aurasOnly; public EnchantedSourceCondition() { this(1); } public EnchantedSourceCondition(int numberOfEnchantments) { + this(numberOfEnchantments, ComparisonType.OR_GREATER, false); + } + + public EnchantedSourceCondition(int numberOfEnchantments, ComparisonType comparisonType, boolean aurasOnly) { this.numberOfEnchantments = numberOfEnchantments; + this.comparisonType = comparisonType; + this.aurasOnly = aurasOnly; } @Override @@ -30,14 +41,12 @@ public class EnchantedSourceCondition implements Condition { if (permanent != null) { for (UUID uuid : permanent.getAttachments()) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached != null && attached.isEnchantment(game)) { - if (++numberOfFoundEnchantments >= numberOfEnchantments) { - return true; - } + if (attached != null && attached.isEnchantment(game) && (!aurasOnly || attached.hasSubtype(SubType.AURA, game))) { + numberOfFoundEnchantments += 1; } } } - return (numberOfFoundEnchantments >= numberOfEnchantments); + return ComparisonType.compare(numberOfFoundEnchantments, comparisonType, numberOfEnchantments); } @Override