mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
[MKM] Implement Treacherous Greed
This commit is contained in:
parent
f197715d20
commit
a39668512e
2 changed files with 105 additions and 0 deletions
104
Mage.Sets/src/mage/cards/t/TreacherousGreed.java
Normal file
104
Mage.Sets/src/mage/cards/t/TreacherousGreed.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TreacherousGreed extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("a creature that dealt damage this turn");
|
||||
|
||||
static {
|
||||
filter.add(TreacherousGreedPredicate.instance);
|
||||
}
|
||||
|
||||
public TreacherousGreed(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}{B}");
|
||||
|
||||
// As an additional cost to cast this spell, sacrifice a creature that dealt damage this turn.
|
||||
this.getSpellAbility().addCost(new SacrificeTargetCost(filter));
|
||||
this.getSpellAbility().addWatcher(new TreacherousGreedWatcher());
|
||||
|
||||
// Draw three cards. Each opponent loses 3 life and you gain 3 life.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
|
||||
this.getSpellAbility().addEffect(new LoseLifeOpponentsEffect(3));
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(3).concatBy("and"));
|
||||
}
|
||||
|
||||
private TreacherousGreed(final TreacherousGreed card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreacherousGreed copy() {
|
||||
return new TreacherousGreed(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum TreacherousGreedPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class TreacherousGreedWatcher extends Watcher {
|
||||
|
||||
private final Set<MageObjectReference> set = new HashSet<>();
|
||||
|
||||
TreacherousGreedWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case DAMAGED_PLAYER:
|
||||
case DAMAGED_PERMANENT:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null) {
|
||||
set.add(new MageObjectReference(permanent, game));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
set.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
static boolean checkCreature(Permanent permanent, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(TreacherousGreedWatcher.class)
|
||||
.set
|
||||
.contains(new MageObjectReference(permanent, game));
|
||||
}
|
||||
}
|
||||
|
|
@ -108,6 +108,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("They Went This Way", 178, Rarity.COMMON, mage.cards.t.TheyWentThisWay.class));
|
||||
cards.add(new SetCardInfo("Thundering Falls", 269, Rarity.RARE, mage.cards.t.ThunderingFalls.class));
|
||||
cards.add(new SetCardInfo("Topiary Panther", 179, Rarity.COMMON, mage.cards.t.TopiaryPanther.class));
|
||||
cards.add(new SetCardInfo("Treacherous Greed", 237, Rarity.RARE, mage.cards.t.TreacherousGreed.class));
|
||||
cards.add(new SetCardInfo("Trostani, Three Whispers", 238, Rarity.MYTHIC, mage.cards.t.TrostaniThreeWhispers.class));
|
||||
cards.add(new SetCardInfo("Undercity Eliminator", 108, Rarity.UNCOMMON, mage.cards.u.UndercityEliminator.class));
|
||||
cards.add(new SetCardInfo("Undercity Sewers", 270, Rarity.RARE, mage.cards.u.UndercitySewers.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue