[ONE] Implement Jor Kadeen, First Goldwarden

This commit is contained in:
theelk801 2023-01-16 14:51:45 -05:00
parent 880383004b
commit 0e4483dd7c
3 changed files with 79 additions and 9 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.j;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.constants.*;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.EquippedPredicate;
/**
* @author TheElk801
*/
public final class JorKadeenFirstGoldwarden extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
private static final FilterPermanent filter2 = new FilterPermanent();
static {
filter.add(EquippedPredicate.instance);
filter2.add(new PowerPredicate(ComparisonType.MORE_THAN, 3));
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter, null);
private static final Hint hint = new ValueHint("Equipped creatures you control", xValue);
private static final Condition condition = new SourceMatchesFilterCondition(filter2);
public JorKadeenFirstGoldwarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.REBEL);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever Jor Kadeen, First Goldwarden attacks, it gets +X/+X until end of turn, where X is the number of equipped creatures you control. Then if Jor Kadeen's power is 4 or greater, draw a card.
Ability ability = new AttacksTriggeredAbility(new BoostSourceEffect(
xValue, xValue, Duration.EndOfTurn, true, "it"
));
ability.addEffect(new ConditionalOneShotEffect(
new DrawCardSourceControllerEffect(1),
condition, "Then if {this}'s power is 4 or greater"
));
this.addAbility(ability.addHint(hint));
}
private JorKadeenFirstGoldwarden(final JorKadeenFirstGoldwarden card) {
super(card);
}
@Override
public JorKadeenFirstGoldwarden copy() {
return new JorKadeenFirstGoldwarden(this);
}
}

View file

@ -32,6 +32,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Ezuri, Stalker of Spheres", 201, Rarity.RARE, mage.cards.e.EzuriStalkerOfSpheres.class)); cards.add(new SetCardInfo("Ezuri, Stalker of Spheres", 201, Rarity.RARE, mage.cards.e.EzuriStalkerOfSpheres.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jor Kadeen, First Goldwarden", 203, Rarity.RARE, mage.cards.j.JorKadeenFirstGoldwarden.class));
cards.add(new SetCardInfo("Karumonix, the Rat King", 292, Rarity.RARE, mage.cards.k.KarumonixTheRatKing.class)); cards.add(new SetCardInfo("Karumonix, the Rat King", 292, Rarity.RARE, mage.cards.k.KarumonixTheRatKing.class));
cards.add(new SetCardInfo("Kaya, Intangible Slayer", 205, Rarity.RARE, mage.cards.k.KayaIntangibleSlayer.class)); cards.add(new SetCardInfo("Kaya, Intangible Slayer", 205, Rarity.RARE, mage.cards.k.KayaIntangibleSlayer.class));
cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class)); cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.condition.common; package mage.abilities.condition.common;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -14,8 +13,8 @@ import mage.game.permanent.Permanent;
*/ */
public class SourceMatchesFilterCondition implements Condition { public class SourceMatchesFilterCondition implements Condition {
private FilterPermanent FILTER; private final FilterPermanent FILTER;
private String text; private final String text;
public SourceMatchesFilterCondition(FilterPermanent filter) { public SourceMatchesFilterCondition(FilterPermanent filter) {
this(null, filter); this(null, filter);
@ -28,12 +27,8 @@ public class SourceMatchesFilterCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); Permanent permanent = source.getSourcePermanentOrLKI(game);
if (FILTER.match(permanent, permanent.getControllerId(), source, game)) { return FILTER.match(permanent, permanent.getControllerId(), source, game);
return true;
}
return false;
} }
@Override @Override