mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[TDM] Implement Dragonfire Blade (#13522)
* [TDM] Implement Dragonfire Blade
This commit is contained in:
parent
30ffe9a159
commit
0848382dcd
3 changed files with 134 additions and 0 deletions
83
Mage.Sets/src/mage/cards/d/DragonfireBlade.java
Normal file
83
Mage.Sets/src/mage/cards/d/DragonfireBlade.java
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import mage.Mana;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.costs.CostAdjuster;
|
||||||
|
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||||
|
import mage.abilities.keyword.EquipAbility;
|
||||||
|
import mage.abilities.keyword.HexproofFromMonocoloredAbility;
|
||||||
|
import mage.abilities.mana.ManaOptions;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jmlundeen
|
||||||
|
*/
|
||||||
|
public final class DragonfireBlade extends CardImpl {
|
||||||
|
|
||||||
|
public DragonfireBlade(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.EQUIPMENT);
|
||||||
|
|
||||||
|
// Equipped creature gets +2/+2 and has hexproof from monocolored.
|
||||||
|
Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(2, 2));
|
||||||
|
ability.addEffect(new GainAbilityAttachedEffect(HexproofFromMonocoloredAbility.getInstance(), AttachmentType.EQUIPMENT)
|
||||||
|
.setText("and has hexproof from monocolored"));
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// Equip {4}. This ability costs {1} less to activate for each color of the creature it targets.
|
||||||
|
EquipAbility equipAbility = new EquipAbility(4);
|
||||||
|
equipAbility.setCostAdjuster(DragonfireBladeCostAdjuster.instance);
|
||||||
|
equipAbility.setCostReduceText("This ability costs {1} less to activate for each color of the creature it targets.");
|
||||||
|
this.addAbility(equipAbility);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DragonfireBlade(final DragonfireBlade card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DragonfireBlade copy() {
|
||||||
|
return new DragonfireBlade(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DragonfireBladeCostAdjuster implements CostAdjuster {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduceCost(Ability ability, Game game) {
|
||||||
|
int reduceCount = 0;
|
||||||
|
if (game.inCheckPlayableState()) {
|
||||||
|
reduceCount = game.getBattlefield().getAllActivePermanents(ability.getControllerId())
|
||||||
|
.stream()
|
||||||
|
.filter(Permanent::isCreature)
|
||||||
|
.mapToInt(permanent -> permanent.getColor(game).getColorCount())
|
||||||
|
.max()
|
||||||
|
.orElse(reduceCount);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Permanent target = game.getPermanent(ability.getFirstTarget());
|
||||||
|
if (target != null) {
|
||||||
|
reduceCount = target.getColor(game).getColorCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
CardUtil.reduceCost(ability, reduceCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -86,6 +86,8 @@ public final class TarkirDragonstorm extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Dragonback Lancer", 9, Rarity.COMMON, mage.cards.d.DragonbackLancer.class));
|
cards.add(new SetCardInfo("Dragonback Lancer", 9, Rarity.COMMON, mage.cards.d.DragonbackLancer.class));
|
||||||
cards.add(new SetCardInfo("Dragonbroods' Relic", 140, Rarity.UNCOMMON, mage.cards.d.DragonbroodsRelic.class));
|
cards.add(new SetCardInfo("Dragonbroods' Relic", 140, Rarity.UNCOMMON, mage.cards.d.DragonbroodsRelic.class));
|
||||||
cards.add(new SetCardInfo("Dragonclaw Strike", 180, Rarity.UNCOMMON, mage.cards.d.DragonclawStrike.class));
|
cards.add(new SetCardInfo("Dragonclaw Strike", 180, Rarity.UNCOMMON, mage.cards.d.DragonclawStrike.class));
|
||||||
|
cards.add(new SetCardInfo("Dragonfire Blade", 240, Rarity.RARE, mage.cards.d.DragonfireBlade.class, NON_FULL_USE_VARIOUS));
|
||||||
|
cards.add(new SetCardInfo("Dragonfire Blade", 324, Rarity.RARE, mage.cards.d.DragonfireBlade.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Dragonologist", 42, Rarity.RARE, mage.cards.d.Dragonologist.class));
|
cards.add(new SetCardInfo("Dragonologist", 42, Rarity.RARE, mage.cards.d.Dragonologist.class));
|
||||||
cards.add(new SetCardInfo("Dragonstorm Forecaster", 43, Rarity.UNCOMMON, mage.cards.d.DragonstormForecaster.class));
|
cards.add(new SetCardInfo("Dragonstorm Forecaster", 43, Rarity.UNCOMMON, mage.cards.d.DragonstormForecaster.class));
|
||||||
cards.add(new SetCardInfo("Dragonstorm Globe", 241, Rarity.COMMON, mage.cards.d.DragonstormGlobe.class));
|
cards.add(new SetCardInfo("Dragonstorm Globe", 241, Rarity.COMMON, mage.cards.d.DragonstormGlobe.class));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.mage.test.cards.single.tdm;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
public class DragonfireBladeTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
private static final String blade = "Dragonfire Blade";
|
||||||
|
private static final String equipText = "Equip {4}";
|
||||||
|
public static final String ornithopter = "Ornithopter"; // colorless 0/1 creature
|
||||||
|
private static final String turtle = "Aegis Turtle"; // U 0/5 creature
|
||||||
|
private static final String leotau = "Grizzled Leotau"; // GW 1/5 creature
|
||||||
|
private static final String mantis = "Mantis Rider"; // URW 3/3 creature
|
||||||
|
private static final String glint = "Glint-Eye Nephilim"; // UBRG 2/2 creature
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void colorsTest() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, blade);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4 + 3 + 2 + 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, ornithopter);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, turtle);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, leotau);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, mantis);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, glint);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, equipText, ornithopter);
|
||||||
|
waitStackResolved(1,PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, equipText, turtle);
|
||||||
|
waitStackResolved(1,PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, equipText, leotau);
|
||||||
|
waitStackResolved(1,PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, equipText, mantis);
|
||||||
|
waitStackResolved(1,PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, equipText, glint);
|
||||||
|
waitStackResolved(1,PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAttachedTo(playerA, blade, glint, true);
|
||||||
|
assertPowerToughness(playerA, glint, 4, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue