mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[KHM] Implemented Rune of Flight
This commit is contained in:
parent
69eed4cc2e
commit
5d7fc394fd
4 changed files with 130 additions and 0 deletions
75
Mage.Sets/src/mage/cards/r/RuneOfFlight.java
Normal file
75
Mage.Sets/src/mage/cards/r/RuneOfFlight.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.AttachedToMatchesFilterCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class RuneOfFlight extends CardImpl {
|
||||
|
||||
private static final Condition condition1 = new AttachedToMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_CREATURE);
|
||||
private static final Condition condition2 = new AttachedToMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_EQUIPMENT);
|
||||
|
||||
public RuneOfFlight(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
this.subtype.add(SubType.RUNE);
|
||||
|
||||
// Enchant permanent
|
||||
TargetPermanent auraTarget = new TargetPermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// When Rune of Flight enters the battlefield, draw a card.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
|
||||
// As long as enchanted permanent is a creature, it has flying.
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new GainAbilityAttachedEffect(
|
||||
FlyingAbility.getInstance(), AttachmentType.AURA
|
||||
), condition1, "as long as enchanted permanent is a creature, it has flying"
|
||||
)));
|
||||
|
||||
// As long as enchanted permanent is an Equipment, it has "Equipped creature has flying."
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new GainAbilityAttachedEffect(
|
||||
new SimpleStaticAbility(new GainAbilityAttachedEffect(
|
||||
FlyingAbility.getInstance(), AttachmentType.EQUIPMENT
|
||||
)), AttachmentType.AURA
|
||||
), condition2, "as long as enchanted permanent is an Equipment, " +
|
||||
"it has \"Equipped creature has flying.\""
|
||||
)));
|
||||
}
|
||||
|
||||
private RuneOfFlight(final RuneOfFlight card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuneOfFlight copy() {
|
||||
return new RuneOfFlight(this);
|
||||
}
|
||||
}
|
|
@ -163,6 +163,7 @@ public final class Kaldheim extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Roots of Wisdom", 190, Rarity.COMMON, mage.cards.r.RootsOfWisdom.class));
|
||||
cards.add(new SetCardInfo("Run Amok", 147, Rarity.COMMON, mage.cards.r.RunAmok.class));
|
||||
cards.add(new SetCardInfo("Run Ashore", 74, Rarity.COMMON, mage.cards.r.RunAshore.class));
|
||||
cards.add(new SetCardInfo("Rune of Flight", 75, Rarity.UNCOMMON, mage.cards.r.RuneOfFlight.class));
|
||||
cards.add(new SetCardInfo("Sarulf's Packmate", 192, Rarity.COMMON, mage.cards.s.SarulfsPackmate.class));
|
||||
cards.add(new SetCardInfo("Sarulf, Realm Eater", 228, Rarity.RARE, mage.cards.s.SarulfRealmEater.class));
|
||||
cards.add(new SetCardInfo("Saw It Coming", 76, Rarity.UNCOMMON, mage.cards.s.SawItComing.class));
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package org.mage.test.cards.single.khm;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class RuneOfFlightTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testGivesFlying() {
|
||||
removeAllCardsFromHand(playerA);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bonesplitter");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
|
||||
addCard(Zone.HAND, playerA, "Rune of Flight");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rune of Flight", "Bonesplitter");
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Equip", "Grizzly Bears");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertAbility(playerA, "Grizzly Bears", FlyingAbility.getInstance(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGivesFlying2() {
|
||||
removeAllCardsFromHand(playerA);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bonesplitter");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
|
||||
addCard(Zone.HAND, playerA, "Rune of Flight");
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Equip", "Grizzly Bears");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rune of Flight", "Bonesplitter");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertAbility(playerA, "Grizzly Bears", FlyingAbility.getInstance(), true);
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ public enum SubType {
|
|||
AURA("Aura", SubTypeSet.EnchantmentType),
|
||||
CARTOUCHE("Cartouche", SubTypeSet.EnchantmentType),
|
||||
CURSE("Curse", SubTypeSet.EnchantmentType),
|
||||
RUNE("Rune", SubTypeSet.EnchantmentType),
|
||||
SAGA("Saga", SubTypeSet.EnchantmentType),
|
||||
SHARD("Shard", SubTypeSet.EnchantmentType),
|
||||
SHRINE("Shrine", SubTypeSet.EnchantmentType),
|
||||
|
|
Loading…
Reference in a new issue