mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
merge cleanup
This commit is contained in:
parent
248b78677c
commit
6e43a35ecd
5 changed files with 40 additions and 73 deletions
|
|
@ -27,7 +27,7 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
*/
|
||||
public final class AdmiralBrassUnsinkable extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("pirate creature card from your graveyard");
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("Pirate creature card from your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(SubType.PIRATE.getPredicate());
|
||||
|
|
@ -57,7 +57,7 @@ public final class AdmiralBrassUnsinkable extends CardImpl {
|
|||
true
|
||||
);
|
||||
ability.addEffect(new SetBasePowerToughnessTargetEffect(4, 4, Duration.WhileOnBattlefield).setText("It has base power and toughness 4/4."));
|
||||
ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setText("It gains haste until end of turn. (If a creature with a finality counter on it would die, exile it instead.)"));
|
||||
ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setText("It gains haste until end of turn. <i>(If a creature with a finality counter on it would die, exile it instead.)</i>"));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
|
|
@ -44,12 +43,12 @@ public final class BronzebeakForagers extends CardImpl {
|
|||
// When Bronzebeak Foragers enters the battlefield, for each opponent, exile up to one target nonland permanent
|
||||
// that player controls until Bronzebeak Foragers leaves the battlefield.
|
||||
// The next few lines are taken from Grasp of Fate
|
||||
Ability etbability = new EntersBattlefieldTriggeredAbility(new ExileUntilSourceLeavesEffect()
|
||||
Ability etbAbility = new EntersBattlefieldTriggeredAbility(new ExileUntilSourceLeavesEffect()
|
||||
.setTargetPointer(new EachTargetPointer())
|
||||
.setText("for each opponent, exile up to one target nonland permanent that player controls until {this} leaves the battlefield")
|
||||
);
|
||||
etbability.setTargetAdjuster(BronzebeakForagerExileAdjuster.instance);
|
||||
this.addAbility(etbability);
|
||||
etbAbility.setTargetAdjuster(BronzebeakForagerExileAdjuster.instance);
|
||||
this.addAbility(etbAbility);
|
||||
|
||||
// {X}{W}: Put target card with mana value X exiled with Bronzebeak Foragers into its owner's graveyard.
|
||||
// You gain X life.
|
||||
|
|
@ -84,7 +83,7 @@ enum BronzebeakForagerExileAdjuster implements TargetAdjuster {
|
|||
if (opponent == null) {
|
||||
continue;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent("nonland permanent from opponent " + opponent.getLogName());
|
||||
FilterPermanent filter = new FilterPermanent("nonland permanent controlled by " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
filter.add(Predicates.not(CardType.LAND.getPredicate()));
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
|
|
@ -101,7 +100,7 @@ enum BronzebeakForagerDissolveAdjuster implements TargetAdjuster {
|
|||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
FilterCard filter = new FilterCreatureCard("creature card with mana value " + xValue);
|
||||
FilterCard filter = new FilterCard("card with mana value " + xValue);
|
||||
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.addTarget(new TargetCardInExile(filter, CardUtil.getExileZoneId(game, ability)));
|
||||
}
|
||||
|
|
@ -112,7 +111,7 @@ class BronzebeakForagerDissolveEffect extends OneShotEffect {
|
|||
|
||||
BronzebeakForagerDissolveEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put target creature card with mana value X exiled with {this} into its owner's graveyard";
|
||||
staticText = "put target card with mana value X exiled with {this} into its owner's graveyard";
|
||||
}
|
||||
|
||||
private BronzebeakForagerDissolveEffect(final BronzebeakForagerDissolveEffect effect) {
|
||||
|
|
@ -124,13 +123,11 @@ class BronzebeakForagerDissolveEffect extends OneShotEffect {
|
|||
return new BronzebeakForagerDissolveEffect(this);
|
||||
}
|
||||
|
||||
// Lifegain based on Asmodeus the Archfiend
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && player != null && card != null){
|
||||
if (player != null && card != null){
|
||||
return player.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldWithCounterTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jimga150
|
||||
|
|
@ -28,7 +23,7 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
public final class FromTheRubble extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard(
|
||||
"a creature card of the chosen type from your graveyard"
|
||||
"creature card of the chosen type from your graveyard"
|
||||
);
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import mage.constants.*;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageIdentifier;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -19,16 +15,7 @@ import mage.abilities.mana.BlackManaAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -39,6 +26,10 @@ import mage.util.CardUtil;
|
|||
import mage.util.SubTypes;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
|
@ -78,7 +69,7 @@ class TheTombOfAclazotzEffect extends AsThoughEffectImpl {
|
|||
|
||||
TheTombOfAclazotzEffect() {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "You may cast a creature spell from your graveyard this turn. If you do, it enters the battlefield with a finality counter on it and is a Vampire in addition to its other types. (If a creature with a finality counter on it would die, exile it instead.)";
|
||||
staticText = "You may cast a creature spell from your graveyard this turn. If you do, it enters the battlefield with a finality counter on it and is a Vampire in addition to its other types. <i>(If a creature with a finality counter on it would die, exile it instead.)</i>";
|
||||
}
|
||||
|
||||
private TheTombOfAclazotzEffect(final TheTombOfAclazotzEffect effect) {
|
||||
|
|
@ -119,20 +110,16 @@ class TheTombOfAclazotzEffect extends AsThoughEffectImpl {
|
|||
return false;
|
||||
}
|
||||
Card card = game.getCard(objectId);
|
||||
if (card != null
|
||||
return card != null
|
||||
&& affectedAbility instanceof SpellAbility
|
||||
&& card.getOwnerId().equals(playerId)
|
||||
&& card.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
&& card.isCreature(game);
|
||||
}
|
||||
}
|
||||
|
||||
class TheTombOfAclazotzWatcher extends Watcher {
|
||||
|
||||
private final Map<MageObjectReference, Map<UUID, Integer>> morMap = new HashMap<>();
|
||||
private MageObjectReference mor;
|
||||
private UUID playFromAnywhereEffectId;
|
||||
|
||||
TheTombOfAclazotzWatcher() {
|
||||
|
|
@ -146,19 +133,16 @@ class TheTombOfAclazotzWatcher extends Watcher {
|
|||
Spell target = game.getSpell(event.getTargetId());
|
||||
Card card = target.getCard();
|
||||
if (card != null) {
|
||||
mor = new MageObjectReference(card.getId(), card.getZoneChangeCounter(game), game);
|
||||
if (mor != null) {
|
||||
game.getState().addEffect(new AddCounterEnteringCreatureEffect(new MageObjectReference(target.getCard(), game),
|
||||
CounterType.FINALITY.createInstance(), Outcome.Neutral),
|
||||
target.getSpellAbility());
|
||||
game.getState().addEffect(new AddSubtypeEnteringCreatureEffect(new MageObjectReference(target.getCard(), game), SubType.VAMPIRE, Outcome.Benefit), card.getSpellAbility());
|
||||
// Rule 728.2 we must insure the effect is used (creature is cast successfully) before discarding the play effect
|
||||
UUID playEffectId = this.getPlayFromAnywhereEffect();
|
||||
if (playEffectId != null
|
||||
&& game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, game).listIterator().next().getId().equals(playEffectId)) {
|
||||
// discard the play effect
|
||||
game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, game).listIterator().next().discard();
|
||||
}
|
||||
game.getState().addEffect(new AddCounterEnteringCreatureEffect(new MageObjectReference(target.getCard(), game),
|
||||
CounterType.FINALITY.createInstance(), Outcome.Neutral),
|
||||
target.getSpellAbility());
|
||||
game.getState().addEffect(new AddSubtypeEnteringCreatureEffect(new MageObjectReference(target.getCard(), game), SubType.VAMPIRE, Outcome.Benefit), card.getSpellAbility());
|
||||
// Rule 728.2 we must insure the effect is used (creature is cast successfully) before discarding the play effect
|
||||
UUID playEffectId = this.getPlayFromAnywhereEffect();
|
||||
if (playEffectId != null
|
||||
&& game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, game).listIterator().next().getId().equals(playEffectId)) {
|
||||
// discard the play effect
|
||||
game.getContinuousEffects().getApplicableAsThoughEffects(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, game).listIterator().next().discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -203,7 +187,7 @@ class AddSubtypeEnteringCreatureEffect extends ReplacementEffectImpl {
|
|||
private final MageObjectReference mor;
|
||||
private final SubType subType;
|
||||
|
||||
public AddSubtypeEnteringCreatureEffect(MageObjectReference mor, SubType subType, Outcome outcome) {
|
||||
AddSubtypeEnteringCreatureEffect(MageObjectReference mor, SubType subType, Outcome outcome) {
|
||||
super(Duration.WhileOnBattlefield, outcome);
|
||||
this.mor = mor;
|
||||
this.subType = subType;
|
||||
|
|
@ -223,11 +207,7 @@ class AddSubtypeEnteringCreatureEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
MageObject spell = game.getObject(event.getSourceId());
|
||||
if (spell != null
|
||||
&& mor.refersTo(spell, game)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return spell != null && mor.refersTo(spell, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -251,16 +231,15 @@ class AddSubtypeEnteringCreatureEffect extends ReplacementEffectImpl {
|
|||
class AddCardSubTypeEnteringTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final SubType addedSubType;
|
||||
private MageObjectReference mor;
|
||||
private Card card;
|
||||
private final MageObjectReference mor;
|
||||
|
||||
public AddCardSubTypeEnteringTargetEffect(MageObjectReference mor, SubType addedSubType, Duration duration) {
|
||||
AddCardSubTypeEnteringTargetEffect(MageObjectReference mor, SubType addedSubType, Duration duration) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.addedSubType = addedSubType;
|
||||
this.mor = mor;
|
||||
}
|
||||
|
||||
protected AddCardSubTypeEnteringTargetEffect(final AddCardSubTypeEnteringTargetEffect effect) {
|
||||
private AddCardSubTypeEnteringTargetEffect(final AddCardSubTypeEnteringTargetEffect effect) {
|
||||
super(effect);
|
||||
this.addedSubType = effect.addedSubType;
|
||||
this.mor = effect.mor;
|
||||
|
|
@ -270,15 +249,12 @@ class AddCardSubTypeEnteringTargetEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getSpell(targetPointer.getFixedTarget(game, source).getTarget());
|
||||
MageObject target = game.getObject(targetPointer.getFixedTarget(game, source).getTarget());
|
||||
if (spell != null) {
|
||||
card = spell.getCard();
|
||||
if (spell == null) {
|
||||
return false;
|
||||
}
|
||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext();) {
|
||||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& target != null
|
||||
&& target.equals(stackObject)
|
||||
&& mor.refersTo(target, game)) {
|
||||
Card card = spell.getCard();
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (stackObject instanceof Spell && stackObject.equals(target) && mor.refersTo(target, game)) {
|
||||
setCreatureSubtype(stackObject, addedSubType, game);
|
||||
setCreatureSubtype(((Spell) stackObject).getCard(), addedSubType, game);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue