Skip to content

Commit

Permalink
[FDN] Implement Quilled Greatwurm
Browse files Browse the repository at this point in the history
  • Loading branch information
PurpleCrowbar committed Dec 13, 2024
1 parent dc38ac0 commit b559ed6
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 6 deletions.
114 changes: 114 additions & 0 deletions Mage.Sets/src/mage/cards/q/QuilledGreatwurm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package mage.cards.q;

import mage.MageIdentifier;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAnyTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.RemoveCounterCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.CounterAnyPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;

import java.util.UUID;

/**
* @author PurpleCrowbar
*/
public final class QuilledGreatwurm extends CardImpl {

public QuilledGreatwurm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.WURM);
this.power = new MageInt(7);
this.toughness = new MageInt(7);

// Trample
this.addAbility(TrampleAbility.getInstance());

// Whenever a creature you control deals combat damage during your turn, put that many +1/+1 counters on it.
this.addAbility(new ConditionalTriggeredAbility(new DealsDamageToAnyTriggeredAbility(
Zone.BATTLEFIELD, new AddCountersTargetEffect(
CounterType.P1P1.createInstance(), SavedDamageValue.MANY
), StaticFilters.FILTER_CONTROLLED_A_CREATURE, SetTargetPointer.PERMANENT, true, false
), MyTurnCondition.instance, "Whenever a creature you control deals combat damage during your turn, put that many +1/+1 counters on it"));

// You may cast this card from your graveyard by removing six counters from among creatures you control in addition to paying its other costs.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new QuilledGreatwurmEffect()).setIdentifier(MageIdentifier.QuilledGreatwurmAlternateCast));
}

private QuilledGreatwurm(final QuilledGreatwurm card) {
super(card);
}

@Override
public QuilledGreatwurm copy() {
return new QuilledGreatwurm(this);
}
}

class QuilledGreatwurmEffect extends AsThoughEffectImpl {

private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();

static {
filter.add(CounterAnyPredicate.instance);
}

QuilledGreatwurmEffect() {
super(AsThoughEffectType.CAST_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
this.staticText = "you may cast {this} from your graveyard by removing six counters " +
"from among creatures you control in addition to paying its other costs";
}

private QuilledGreatwurmEffect(final QuilledGreatwurmEffect effect) {
super(effect);
}

@Override
public QuilledGreatwurmEffect copy() {
return new QuilledGreatwurmEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
return true;
}

@Override
public boolean applies(UUID objectId, Ability source, UUID affectControllerId, Game game) {
if (!source.getSourceId().equals(objectId)
|| !source.isControlledBy(affectControllerId)
|| game.getState().getZone(objectId) != Zone.GRAVEYARD) {
return false;
}
Player controller = game.getPlayer(affectControllerId);
if (controller == null) {
return false;
}
Costs<Cost> costs = new CostsImpl<>();
costs.add(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 6, filter, true), null, 6));
controller.setCastSourceIdWithAlternateMana(
objectId, new ManaCostsImpl<>("{4}{G}{G}"), costs,
MageIdentifier.QuilledGreatwurmAlternateCast
);
return true;
}
}
3 changes: 3 additions & 0 deletions Mage.Sets/src/mage/sets/Foundations.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ private Foundations() {
cards.add(new SetCardInfo("Pyromancer's Goggles", 677, Rarity.MYTHIC, mage.cards.p.PyromancersGoggles.class));
cards.add(new SetCardInfo("Quakestrider Ceratops", 110, Rarity.UNCOMMON, mage.cards.q.QuakestriderCeratops.class));
cards.add(new SetCardInfo("Quick Study", 513, Rarity.COMMON, mage.cards.q.QuickStudy.class));
cards.add(new SetCardInfo("Quilled Greatwurm", 111, Rarity.MYTHIC, mage.cards.q.QuilledGreatwurm.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Quilled Greatwurm", 339, Rarity.MYTHIC, mage.cards.q.QuilledGreatwurm.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Quilled Greatwurm", 473, Rarity.MYTHIC, mage.cards.q.QuilledGreatwurm.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Quick-Draw Katana", 130, Rarity.COMMON, mage.cards.q.QuickDrawKatana.class));
cards.add(new SetCardInfo("Raging Redcap", 543, Rarity.COMMON, mage.cards.r.RagingRedcap.class));
cards.add(new SetCardInfo("Raise the Past", 22, Rarity.RARE, mage.cards.r.RaiseThePast.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


package org.mage.test.cards.abilities.keywords;

import mage.constants.PhaseStep;
Expand Down Expand Up @@ -59,7 +57,6 @@ public void testGraft() {
assertPermanentCount(playerA, "Sporeback Troll", 1);
assertPowerToughness(playerA, "Sporeback Troll", 2, 2);
assertCounterCount("Sporeback Troll", CounterType.P1P1, 2);

}

@Test
Expand Down Expand Up @@ -102,6 +99,5 @@ public void testDontMoveCounters() {
assertPowerToughness(playerA, "Cytoplast Root-Kin", 4, 4);
assertCounterCount("Sporeback Troll", CounterType.P1P1, 2);
assertCounterCount("Cytoplast Root-Kin", CounterType.P1P1, 4);
}

}
}
3 changes: 2 additions & 1 deletion Mage/src/main/java/mage/MageIdentifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public enum MageIdentifier {
OfferingAlternateCast,
TheRuinousPowersAlternateCast,
FiresOfMountDoomAlternateCast,
PrimalPrayersAlternateCast;
PrimalPrayersAlternateCast,
QuilledGreatwurmAlternateCast;

/**
* Additional text if there is need to differentiate two very similar effects
Expand Down

0 comments on commit b559ed6

Please sign in to comment.