Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSK] Implement Omnivorous Flytrap #13083

Merged
merged 4 commits into from
Nov 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[DSK] Implement Omnivorous Flytrap
  • Loading branch information
Cguy7777 committed Nov 27, 2024
commit a6e95c4f4b37ae8d83f4de59f02b99999cab59b6
114 changes: 114 additions & 0 deletions Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
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.
Cguy7777 marked this conversation as resolved.
Show resolved Hide resolved
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";
}
}
2 changes: 2 additions & 0 deletions Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java
Original file line number Diff line number Diff line change
@@ -156,6 +156,8 @@ private DuskmournHouseOfHorror() {
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));