mirror of
https://github.com/correl/mage.git
synced 2024-11-22 19:18:39 +00:00
Merge branch 'master' of https://github.com/magefree/mage
This commit is contained in:
commit
958503cff2
7 changed files with 274 additions and 97 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -12,8 +11,6 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
@ -50,12 +47,6 @@ public final class DaruSpiritualist extends CardImpl {
|
||||||
|
|
||||||
class DaruSpiritualistTriggeredAbility extends TriggeredAbilityImpl {
|
class DaruSpiritualistTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Cleric creature you control");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(new SubtypePredicate(SubType.CLERIC));
|
|
||||||
}
|
|
||||||
|
|
||||||
public DaruSpiritualistTriggeredAbility(Effect effect) {
|
public DaruSpiritualistTriggeredAbility(Effect effect) {
|
||||||
super(Zone.BATTLEFIELD, effect);
|
super(Zone.BATTLEFIELD, effect);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +68,7 @@ class DaruSpiritualistTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
if (creature != null && filter.match(creature, getSourceId(), getControllerId(), game)) {
|
if (creature != null && creature.hasSubtype(SubType.CLERIC, game) && creature.getControllerId().equals(getControllerId()) && creature.isCreature()) {
|
||||||
this.getEffects().setTargetPointer(new FixedTarget(creature, game));
|
this.getEffects().setTargetPointer(new FixedTarget(creature, game));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ class GraveBetrayalReplacementEffect extends ReplacementEffectImpl {
|
||||||
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
|
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
|
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
discard();
|
//discard(); why?
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
|
||||||
package mage.cards.k;
|
package mage.cards.k;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.AsThoughEffectImpl;
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.keyword.FlashbackAbility;
|
import mage.abilities.keyword.FlashbackAbility;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
@ -18,22 +19,16 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubLayer;
|
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.SuperType;
|
import mage.constants.SuperType;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
|
||||||
import mage.filter.predicate.Predicates;
|
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +50,9 @@ public final class KessDissidentMage extends CardImpl {
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// During each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard this turn, exile it instead.
|
// During each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard this turn, exile it instead.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KessDissidentMageContinuousEffect()), new KessDissidentMageWatcher());
|
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new KessDissidentMageCastFromGraveyardEffect());
|
||||||
|
ability.addEffect(new KessDissidentMageReplacementEffect());
|
||||||
|
this.addAbility(ability, new KessDissidentMageWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
public KessDissidentMage(final KessDissidentMage card) {
|
public KessDissidentMage(final KessDissidentMage card) {
|
||||||
|
@ -68,56 +65,11 @@ public final class KessDissidentMage extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KessDissidentMageContinuousEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("Instant or sorcery spell");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(Predicates.or(
|
|
||||||
new CardTypePredicate(CardType.INSTANT),
|
|
||||||
new CardTypePredicate(CardType.SORCERY)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
KessDissidentMageContinuousEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
|
||||||
staticText = "During each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard, exile it instead";
|
|
||||||
}
|
|
||||||
|
|
||||||
KessDissidentMageContinuousEffect(final KessDissidentMageContinuousEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public KessDissidentMageContinuousEffect copy() {
|
|
||||||
return new KessDissidentMageContinuousEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player != null) {
|
|
||||||
if (!game.isActivePlayer(player.getId())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (Card card : player.getGraveyard().getCards(filter, game)) {
|
|
||||||
ContinuousEffect effect = new KessDissidentMageCastFromGraveyardEffect();
|
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
effect = new KessDissidentMageReplacementEffect(card.getId());
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
|
class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
KessDissidentMageCastFromGraveyardEffect() {
|
KessDissidentMageCastFromGraveyardEffect() {
|
||||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
|
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
staticText = "You may cast an instant or sorcery card from your graveyard";
|
staticText = "During each of your turns, you may cast an instant or sorcery card from your graveyard";
|
||||||
}
|
}
|
||||||
|
|
||||||
KessDissidentMageCastFromGraveyardEffect(final KessDissidentMageCastFromGraveyardEffect effect) {
|
KessDissidentMageCastFromGraveyardEffect(final KessDissidentMageCastFromGraveyardEffect effect) {
|
||||||
|
@ -136,14 +88,13 @@ class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
if (!(source instanceof FlashbackAbility) && affectedControllerId.equals(source.getControllerId()) && game.isActivePlayer(source.getControllerId())) {
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
Card card = game.getCard(objectId);
|
||||||
if (game.isActivePlayer(source.getControllerId())) {
|
if (card != null && (card.isInstant() || card.isSorcery())
|
||||||
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatchers().get(KessDissidentMageWatcher.class.getSimpleName(), source.getSourceId());
|
&& game.getState().getZone(objectId).equals(Zone.GRAVEYARD)) {
|
||||||
if (!(source instanceof FlashbackAbility)) {
|
// check if not already a card was cast this turn with this ability
|
||||||
return !watcher.isAbilityUsed();
|
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatchers().get(KessDissidentMageWatcher.class.getSimpleName());
|
||||||
}
|
return !watcher.isAbilityUsed(new MageObjectReference(source.getSourceId(), game));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -152,17 +103,13 @@ class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
class KessDissidentMageReplacementEffect extends ReplacementEffectImpl {
|
class KessDissidentMageReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
private final UUID cardId;
|
KessDissidentMageReplacementEffect() {
|
||||||
|
super(Duration.EndOfGame, Outcome.Exile);
|
||||||
KessDissidentMageReplacementEffect(UUID cardId) {
|
|
||||||
super(Duration.EndOfTurn, Outcome.Exile);
|
|
||||||
this.cardId = cardId;
|
|
||||||
staticText = "If a card cast this way would be put into your graveyard, exile it instead";
|
staticText = "If a card cast this way would be put into your graveyard, exile it instead";
|
||||||
}
|
}
|
||||||
|
|
||||||
KessDissidentMageReplacementEffect(final KessDissidentMageReplacementEffect effect) {
|
KessDissidentMageReplacementEffect(final KessDissidentMageReplacementEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.cardId = effect.cardId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -173,9 +120,9 @@ class KessDissidentMageReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Card card = game.getCard(this.cardId);
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (controller != null && card != null) {
|
if (controller != null && card != null) {
|
||||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true);
|
controller.moveCards(card, Zone.EXILED, source, game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,31 +136,39 @@ class KessDissidentMageReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
return zEvent.getToZone() == Zone.GRAVEYARD
|
if (zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||||
&& zEvent.getTargetId().equals(this.cardId);
|
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatchers().get(KessDissidentMageWatcher.class.getSimpleName());
|
||||||
|
if (source.getSourceId().equals(watcher.spellCastWasAllowedBy(new MageObjectReference(event.getTargetId(), game)))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KessDissidentMageWatcher extends Watcher {
|
class KessDissidentMageWatcher extends Watcher {
|
||||||
|
|
||||||
boolean abilityUsed = false;
|
// Which kess object did cast which spell from graveyard
|
||||||
|
private final Set<MageObjectReference> allowingObjects = new HashSet<>();
|
||||||
|
private final Map<MageObjectReference, UUID> castSpells = new HashMap<>();
|
||||||
|
|
||||||
KessDissidentMageWatcher() {
|
KessDissidentMageWatcher() {
|
||||||
super(KessDissidentMageWatcher.class.getSimpleName(), WatcherScope.CARD);
|
super(KessDissidentMageWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
KessDissidentMageWatcher(final KessDissidentMageWatcher watcher) {
|
KessDissidentMageWatcher(final KessDissidentMageWatcher watcher) {
|
||||||
super(watcher);
|
super(watcher);
|
||||||
this.abilityUsed = watcher.abilityUsed;
|
this.allowingObjects.addAll(watcher.allowingObjects);
|
||||||
|
this.castSpells.putAll(watcher.castSpells);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
|
||||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||||
if (spell.isInstant() || spell.isSorcery()) {
|
if (null != event.getAdditionalReference() && spell.isInstant() || spell.isSorcery()) {
|
||||||
Optional<Ability> source = game.getAbility(event.getSourceId(), event.getSourceId());
|
allowingObjects.add(event.getAdditionalReference());
|
||||||
abilityUsed = true;
|
castSpells.put(new MageObjectReference(spell.getSourceId(), game), event.getAdditionalReference().getSourceId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,10 +181,15 @@ class KessDissidentMageWatcher extends Watcher {
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
abilityUsed = false;
|
allowingObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAbilityUsed() {
|
public boolean isAbilityUsed(MageObjectReference mor) {
|
||||||
return abilityUsed;
|
return allowingObjects.contains(mor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID spellCastWasAllowedBy(MageObjectReference mor) {
|
||||||
|
return castSpells.getOrDefault(mor, null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
139
Mage.Sets/src/mage/cards/o/OathOfLimDul.java
Normal file
139
Mage.Sets/src/mage/cards/o/OathOfLimDul.java
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
package mage.cards.o;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.costs.common.DiscardTargetCost;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetCardInHand;
|
||||||
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class OathOfLimDul extends CardImpl {
|
||||||
|
|
||||||
|
public OathOfLimDul(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
|
||||||
|
|
||||||
|
// Whenever you lose life, for each 1 life you lost, sacrifice a permanent other than Oath of Lim-Dul unless you discard a card.
|
||||||
|
this.addAbility(new OathOfLimDulTriggeredAbility());
|
||||||
|
|
||||||
|
// {B}{B}: Draw a card.
|
||||||
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{B}{B}")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private OathOfLimDul(final OathOfLimDul card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OathOfLimDul copy() {
|
||||||
|
return new OathOfLimDul(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OathOfLimDulTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
public OathOfLimDulTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new OathOfLimDulEffect());
|
||||||
|
}
|
||||||
|
|
||||||
|
public OathOfLimDulTriggeredAbility(final OathOfLimDulTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OathOfLimDulTriggeredAbility copy() {
|
||||||
|
return new OathOfLimDulTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.LOST_LIFE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (event.getPlayerId().equals(controllerId)) {
|
||||||
|
game.getState().setValue(sourceId.toString() + "oathOfLimDul", event.getAmount());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever you lose life, for each 1 life you lost, sacrifice a permanent other than {this} unless you discard a card.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OathOfLimDulEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final static FilterControlledPermanent filter = new FilterControlledPermanent("controlled permanent other than Oath of Lim-Dul");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new AnotherPredicate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public OathOfLimDulEffect() {
|
||||||
|
super(Outcome.Neutral);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OathOfLimDulEffect(final OathOfLimDulEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
int amount = (int) game.getState().getValue(source.getSourceId().toString() + "oathOfLimDul");
|
||||||
|
if (amount > 0
|
||||||
|
&& controller != null) {
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
||||||
|
target.setNotTarget(true);
|
||||||
|
if (target.canChoose(controller.getId(), game)
|
||||||
|
&& controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
|
||||||
|
Cost cost = new DiscardTargetCost(new TargetCardInHand());
|
||||||
|
if (cost.canPay(source, source.getSourceId(), controller.getId(), game)
|
||||||
|
&& controller.chooseUse(Outcome.Benefit,
|
||||||
|
"Do you wish to discard a card rather than sacrifice the target permanent?", source, game)) {
|
||||||
|
cost.pay(source, game, source.getSourceId(), controller.getId(), true);
|
||||||
|
} else {
|
||||||
|
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
||||||
|
if (targetPermanent != null) {
|
||||||
|
targetPermanent.sacrifice(source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OathOfLimDulEffect copy() {
|
||||||
|
return new OathOfLimDulEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
81
Mage.Sets/src/mage/cards/s/StenchOfEvil.java
Normal file
81
Mage.Sets/src/mage/cards/s/StenchOfEvil.java
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.filter.common.FilterLandPermanent;
|
||||||
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class StenchOfEvil extends CardImpl {
|
||||||
|
|
||||||
|
public StenchOfEvil(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
|
||||||
|
|
||||||
|
// Destroy all Plains. For each land destroyed this way, Stench of Evil deals 1 damage to that land's controller unless he or she pays {2}.
|
||||||
|
this.getSpellAbility().addEffect(new StenchOfEvilEffect());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private StenchOfEvil(final StenchOfEvil card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StenchOfEvil copy() {
|
||||||
|
return new StenchOfEvil(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StenchOfEvilEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private static final FilterLandPermanent filter = new FilterLandPermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new SubtypePredicate(SubType.PLAINS));
|
||||||
|
}
|
||||||
|
|
||||||
|
public StenchOfEvilEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "Destroy all Plains. For each land destroyed this way, {this} deals 1 damage to that land's controller unless he or she pays {2}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public StenchOfEvilEffect(final StenchOfEvilEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StenchOfEvilEffect copy() {
|
||||||
|
return new StenchOfEvilEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
|
UUID landControllerId = land.getControllerId();
|
||||||
|
if (land.destroy(source.getSourceId(), game, false)) {
|
||||||
|
Cost cost = new ManaCostsImpl("{2}");
|
||||||
|
Player landController = game.getPlayer(landControllerId);
|
||||||
|
if (landController != null
|
||||||
|
&& cost.canPay(source, source.getSourceId(), landControllerId, game)
|
||||||
|
&& !cost.pay(source, game, source.getSourceId(), landControllerId, false)) {
|
||||||
|
landController.damage(1, source.getSourceId(), game, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -238,6 +238,7 @@ public final class IceAge extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Nature's Lore", 255, Rarity.UNCOMMON, mage.cards.n.NaturesLore.class));
|
cards.add(new SetCardInfo("Nature's Lore", 255, Rarity.UNCOMMON, mage.cards.n.NaturesLore.class));
|
||||||
cards.add(new SetCardInfo("Necropotence", 154, Rarity.RARE, mage.cards.n.Necropotence.class));
|
cards.add(new SetCardInfo("Necropotence", 154, Rarity.RARE, mage.cards.n.Necropotence.class));
|
||||||
cards.add(new SetCardInfo("Norritt", 155, Rarity.COMMON, mage.cards.n.Norritt.class));
|
cards.add(new SetCardInfo("Norritt", 155, Rarity.COMMON, mage.cards.n.Norritt.class));
|
||||||
|
cards.add(new SetCardInfo("Oath of Lim-Dul", 44, Rarity.RARE, mage.cards.o.OathOfLimDul.class));
|
||||||
cards.add(new SetCardInfo("Onyx Talisman", 331, Rarity.UNCOMMON, mage.cards.o.OnyxTalisman.class));
|
cards.add(new SetCardInfo("Onyx Talisman", 331, Rarity.UNCOMMON, mage.cards.o.OnyxTalisman.class));
|
||||||
cards.add(new SetCardInfo("Orcish Cannoneers", 205, Rarity.UNCOMMON, mage.cards.o.OrcishCannoneers.class));
|
cards.add(new SetCardInfo("Orcish Cannoneers", 205, Rarity.UNCOMMON, mage.cards.o.OrcishCannoneers.class));
|
||||||
cards.add(new SetCardInfo("Orcish Healer", 208, Rarity.UNCOMMON, mage.cards.o.OrcishHealer.class));
|
cards.add(new SetCardInfo("Orcish Healer", 208, Rarity.UNCOMMON, mage.cards.o.OrcishHealer.class));
|
||||||
|
@ -304,6 +305,7 @@ public final class IceAge extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Spoils of Evil", 163, Rarity.RARE, mage.cards.s.SpoilsOfEvil.class));
|
cards.add(new SetCardInfo("Spoils of Evil", 163, Rarity.RARE, mage.cards.s.SpoilsOfEvil.class));
|
||||||
cards.add(new SetCardInfo("Staff of the Ages", 340, Rarity.RARE, mage.cards.s.StaffOfTheAges.class));
|
cards.add(new SetCardInfo("Staff of the Ages", 340, Rarity.RARE, mage.cards.s.StaffOfTheAges.class));
|
||||||
cards.add(new SetCardInfo("Stampede", 265, Rarity.RARE, mage.cards.s.Stampede.class));
|
cards.add(new SetCardInfo("Stampede", 265, Rarity.RARE, mage.cards.s.Stampede.class));
|
||||||
|
cards.add(new SetCardInfo("Stench of Evil", 165, Rarity.UNCOMMON, mage.cards.s.StenchOfEvil.class));
|
||||||
cards.add(new SetCardInfo("Stone Rain", 217, Rarity.COMMON, mage.cards.s.StoneRain.class));
|
cards.add(new SetCardInfo("Stone Rain", 217, Rarity.COMMON, mage.cards.s.StoneRain.class));
|
||||||
cards.add(new SetCardInfo("Stone Spirit", 218, Rarity.UNCOMMON, mage.cards.s.StoneSpirit.class));
|
cards.add(new SetCardInfo("Stone Spirit", 218, Rarity.UNCOMMON, mage.cards.s.StoneSpirit.class));
|
||||||
cards.add(new SetCardInfo("Stonehands", 219, Rarity.COMMON, mage.cards.s.Stonehands.class));
|
cards.add(new SetCardInfo("Stonehands", 219, Rarity.COMMON, mage.cards.s.Stonehands.class));
|
||||||
|
|
|
@ -494,7 +494,11 @@ public class ContinuousEffects implements Serializable {
|
||||||
if (affectedAbility != null && affectedAbility.getSourceObject(game) instanceof SplitCardHalf) {
|
if (affectedAbility != null && affectedAbility.getSourceObject(game) instanceof SplitCardHalf) {
|
||||||
idToCheck = ((SplitCardHalf) affectedAbility.getSourceObject(game)).getParentCard().getId();
|
idToCheck = ((SplitCardHalf) affectedAbility.getSourceObject(game)).getParentCard().getId();
|
||||||
} else {
|
} else {
|
||||||
idToCheck = objectId;
|
if (game.getObject(objectId) instanceof SplitCardHalf) {
|
||||||
|
idToCheck = ((SplitCardHalf) game.getObject(objectId)).getParentCard().getId();
|
||||||
|
} else {
|
||||||
|
idToCheck = objectId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (AsThoughEffect effect : asThoughEffectsList) {
|
for (AsThoughEffect effect : asThoughEffectsList) {
|
||||||
Set<Ability> abilities = asThoughEffectsMap.get(type).getAbility(effect.getId());
|
Set<Ability> abilities = asThoughEffectsMap.get(type).getAbility(effect.getId());
|
||||||
|
|
Loading…
Reference in a new issue