Implemented Kaheera, the Orphanguard

This commit is contained in:
Evan Kranzler 2020-04-12 11:23:07 -04:00
parent 7e0b755953
commit 87b316aa65
2 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,104 @@
package mage.cards.k;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.CompanionAbility;
import mage.abilities.keyword.CompanionCondition;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.util.SubTypeList;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KaheeraTheOrphanguard extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(AnotherPredicate.instance);
filter.add(Predicates.or(
SubType.CAT.getPredicate(),
SubType.ELEMENTAL.getPredicate(),
SubType.NIGHTMARE.getPredicate(),
SubType.DINOSAUR.getPredicate(),
SubType.BEAST.getPredicate()
));
}
public KaheeraTheOrphanguard(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G/W}{G/W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.CAT);
this.subtype.add(SubType.BEAST);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Companion Each creature card in your starting deck is a Cat, Elemental, Nightmare, Dinosaur, or Beast card.
this.addAbility(new CompanionAbility(KaheeraTheOrphanguardCompanionCondition.instance));
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// Each other creature you control that's a Cat, Elemental, Nightmare, Dinosaur, or Beast gets +1/+1 and has vigilance.
Ability ability = new SimpleStaticAbility(new BoostAllEffect(
1, 1, Duration.WhileOnBattlefield, filter, true
).setText("Each other creature you control that's a Cat, Elemental, Nightmare, Dinosaur, or Beast gets +1/+1"));
ability.addEffect(new GainAbilityAllEffect(
VigilanceAbility.getInstance(), Duration.WhileOnBattlefield, filter, "and has vigilance"
));
this.addAbility(ability);
}
private KaheeraTheOrphanguard(final KaheeraTheOrphanguard card) {
super(card);
}
@Override
public KaheeraTheOrphanguard copy() {
return new KaheeraTheOrphanguard(this);
}
}
enum KaheeraTheOrphanguardCompanionCondition implements CompanionCondition {
instance;
@Override
public String getRule() {
return "Each creature card in your starting deck is a Cat, Elemental, Nightmare, Dinosaur, or Beast card";
}
private static final SubTypeList subtypes = new SubTypeList(
SubType.CAT,
SubType.ELEMENTAL,
SubType.NIGHTMARE,
SubType.DINOSAUR,
SubType.BEAST
);
private static final boolean checkTypes(Card card) {
return subtypes.stream().anyMatch(card.getSubtype(null)::contains);
}
@Override
public boolean isLegal(Set<Card> deck) {
return deck.stream()
.filter(MageObject::isCreature)
.allMatch(KaheeraTheOrphanguardCompanionCondition::checkTypes);
}
}

View file

@ -180,6 +180,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Ivy Elemental", 161, Rarity.UNCOMMON, mage.cards.i.IvyElemental.class));
cards.add(new SetCardInfo("Jubilant Skybonder", 223, Rarity.UNCOMMON, mage.cards.j.JubilantSkybonder.class));
cards.add(new SetCardInfo("Jungle Hollow", 249, Rarity.COMMON, mage.cards.j.JungleHollow.class));
cards.add(new SetCardInfo("Kaheera, the Orphanguard", 224, Rarity.RARE, mage.cards.k.KaheeraTheOrphanguard.class));
cards.add(new SetCardInfo("Keensight Mentor", 18, Rarity.UNCOMMON, mage.cards.k.KeensightMentor.class));
cards.add(new SetCardInfo("Keep Safe", 56, Rarity.COMMON, mage.cards.k.KeepSafe.class));
cards.add(new SetCardInfo("Keruga, the Macrosage", 354, Rarity.RARE, mage.cards.k.KerugaTheMacrosage.class));