forked from External/mage
Some minor fixes and changes to framework and some cards.
This commit is contained in:
parent
923fdb5882
commit
0e229fd22a
8 changed files with 21 additions and 72 deletions
|
|
@ -27,22 +27,21 @@
|
|||
*/
|
||||
package mage.sets.avacynrestored;
|
||||
|
||||
import mage.constants.*;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageByAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
|
|
@ -63,7 +62,7 @@ public class Defang extends CardImpl<Defang> {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Prevent all damage that would be dealt by enchanted creature.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DefangEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllDamageByAttachedEffect(Duration.WhileOnBattlefield, "enchanted creature", false)));
|
||||
}
|
||||
|
||||
public Defang(final Defang card) {
|
||||
|
|
@ -75,50 +74,3 @@ public class Defang extends CardImpl<Defang> {
|
|||
return new Defang(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DefangEffect extends PreventionEffectImpl<DefangEffect> {
|
||||
|
||||
public DefangEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Prevent all damage that would be dealt by enchanted creature";
|
||||
}
|
||||
|
||||
public DefangEffect(final DefangEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefangEffect copy() {
|
||||
return new DefangEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false);
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game) && event instanceof DamageEvent) {
|
||||
Permanent aura = game.getPermanent(source.getSourceId());
|
||||
if (aura != null && aura.getAttachedTo() != null) {
|
||||
if (event.getSourceId().equals(aura.getAttachedTo())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect<UnexpectedlyAbsentEffect> {
|
|||
if (owner != null) {
|
||||
int xValue = Math.min(source.getManaCostsToPay().getX(), owner.getLibrary().size());
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
List<UUID> cardIds = new ArrayList<UUID>();
|
||||
List<UUID> cardIds = new ArrayList<>();
|
||||
for (int i = 0; i < xValue; i++) {
|
||||
Card card = owner.getLibrary().getFromTop(game);
|
||||
cards.add(card);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class ShieldedPassage extends CardImpl<ShieldedPassage> {
|
|||
|
||||
// Prevent all damage that would be dealt to target creature this turn.
|
||||
this.getSpellAbility().addEffect(new PreventDamageTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(true));
|
||||
}
|
||||
|
||||
public ShieldedPassage(final ShieldedPassage card) {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ import mage.abilities.ActivatedAbility;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.abilities.keyword.RetraceAbility;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.CostModificationType;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import mage.filter.Filter.ComparisonType;
|
|||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -70,7 +70,7 @@ public class OrderOfWhiteclay extends CardImpl<OrderOfWhiteclay> {
|
|||
// {1}{W}{W}, {untap}: Return target creature card with converted mana cost 3 or less from your graveyard to the battlefield.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{1}{W}{W}"));
|
||||
ability.addCost(new UntapSourceCost());
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
Target target = new TargetCardInYourGraveyard(filter);
|
||||
target.setRequired(true);
|
||||
ability.addTarget(target);
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl<PropagandaReplac
|
|||
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
|
||||
player.chooseUse(Outcome.Neutral, "Pay {2} to declare attacker?", game) )
|
||||
{
|
||||
if (propagandaTax.payOrRollback(source, game, this.getId(), event.getPlayerId()) ) {
|
||||
if (propagandaTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId()) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class EquippedMatchesFilterCondition implements Condition {
|
||||
|
||||
private FilterCreaturePermanent filter;
|
||||
private final FilterCreaturePermanent filter;
|
||||
|
||||
public EquippedMatchesFilterCondition(FilterCreaturePermanent filter) {
|
||||
this.filter = filter;
|
||||
|
|
|
|||
|
|
@ -39,27 +39,27 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PreventAllDamageAttachedEffect extends PreventionEffectImpl<PreventAllDamageAttachedEffect> {
|
||||
public class PreventAllDamageToAttachedEffect extends PreventionEffectImpl<PreventAllDamageToAttachedEffect> {
|
||||
|
||||
private String attachedDescription;
|
||||
private boolean combatOnly;
|
||||
private final String attachedDescription;
|
||||
private final boolean combatOnly;
|
||||
|
||||
public PreventAllDamageAttachedEffect(Duration duration, String attachedDescription, boolean combatOnly) {
|
||||
public PreventAllDamageToAttachedEffect(Duration duration, String attachedDescription, boolean combatOnly) {
|
||||
super(duration);
|
||||
this.attachedDescription = attachedDescription;
|
||||
this.combatOnly = combatOnly;
|
||||
staticText = setText();
|
||||
}
|
||||
|
||||
public PreventAllDamageAttachedEffect(final PreventAllDamageAttachedEffect effect) {
|
||||
public PreventAllDamageToAttachedEffect(final PreventAllDamageToAttachedEffect effect) {
|
||||
super(effect);
|
||||
this.attachedDescription = effect.attachedDescription;
|
||||
this.combatOnly = effect.combatOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreventAllDamageAttachedEffect copy() {
|
||||
return new PreventAllDamageAttachedEffect(this);
|
||||
public PreventAllDamageToAttachedEffect copy() {
|
||||
return new PreventAllDamageToAttachedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Loading…
Add table
Add a link
Reference in a new issue