[DSK] Implement Omnivorous Flytrap (#13083)

* [DSK] Implement Omnivorous Flytrap

* Require at least one target

* Use single line for rules text

* Don't set minimum targets here
This commit is contained in:
Cameron Merkel 2024-11-30 11:46:22 -06:00 committed by GitHub
parent aaa611679f
commit 1efa094564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,110 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.DistributeCountersEffect;
import mage.abilities.hint.common.CardTypesInGraveyardHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanentAmount;
import java.util.UUID;
/**
* @author Cguy7777
*/
public final class OmnivorousFlytrap extends CardImpl {
public OmnivorousFlytrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.PLANT);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Delirium -- Whenever Omnivorous Flytrap enters or attacks, if there are four or more card types among cards in your graveyard, distribute two +1/+1 counters among one or two target creatures. Then if there are six or more card types among cards in your graveyard, double the number of +1/+1 counters on those creatures.
Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(
new DistributeCountersEffect(CounterType.P1P1, 2, "one or two target creatures"))
.withInterveningIf(DeliriumCondition.instance);
ability.addEffect(new ConditionalOneShotEffect(
new OmnivorousFlytrapEffect(),
new OmnivorousFlytrapCondition())
.concatBy("Then"));
ability.addTarget(new TargetCreaturePermanentAmount(2));
ability.addHint(CardTypesInGraveyardHint.YOU);
this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM));
}
private OmnivorousFlytrap(final OmnivorousFlytrap card) {
super(card);
}
@Override
public OmnivorousFlytrap copy() {
return new OmnivorousFlytrap(this);
}
}
class OmnivorousFlytrapEffect extends OneShotEffect {
OmnivorousFlytrapEffect() {
super(Outcome.Benefit);
staticText = "double the number of +1/+1 counters on those creatures";
}
private OmnivorousFlytrapEffect(final OmnivorousFlytrapEffect effect) {
super(effect);
}
@Override
public OmnivorousFlytrapEffect copy() {
return new OmnivorousFlytrapEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
if (existingCounters > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), source, game);
}
}
}
return true;
}
}
class OmnivorousFlytrapCondition extends IntCompareCondition {
OmnivorousFlytrapCondition() {
super(ComparisonType.OR_GREATER, 6);
}
@Override
protected int getInputValue(Game game, Ability source) {
return CardTypesInGraveyardCount.YOU.calculate(game, source, null);
}
@Override
public String toString() {
return "if there are six or more card types among cards in your graveyard";
}
}

View file

@ -159,6 +159,8 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
cards.add(new SetCardInfo("Niko, Light of Hope", 224, Rarity.MYTHIC, mage.cards.n.NikoLightOfHope.class));
cards.add(new SetCardInfo("Norin, Swift Survivalist", 145, Rarity.UNCOMMON, mage.cards.n.NorinSwiftSurvivalist.class));
cards.add(new SetCardInfo("Oblivious Bookworm", 225, Rarity.UNCOMMON, mage.cards.o.ObliviousBookworm.class));
cards.add(new SetCardInfo("Omnivorous Flytrap", 192, Rarity.RARE, mage.cards.o.OmnivorousFlytrap.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Omnivorous Flytrap", 322, Rarity.RARE, mage.cards.o.OmnivorousFlytrap.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Optimistic Scavenger", 21, Rarity.UNCOMMON, mage.cards.o.OptimisticScavenger.class));
cards.add(new SetCardInfo("Orphans of the Wheat", 22, Rarity.UNCOMMON, mage.cards.o.OrphansOfTheWheat.class));
cards.add(new SetCardInfo("Overlord of the Balemurk", 113, Rarity.MYTHIC, mage.cards.o.OverlordOfTheBalemurk.class));