mirror of
https://github.com/correl/mage.git
synced 2025-04-07 17:00:08 -09:00
[M21] Fix Enthralling Hold (#6745)
This commit is contained in:
parent
c6e5f3a1c8
commit
4652ebd790
2 changed files with 42 additions and 15 deletions
Mage.Sets/src/mage/cards
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
@ -10,13 +9,15 @@ import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author maxlebedev
|
* @author maxlebedev
|
||||||
|
@ -52,10 +53,20 @@ public final class DreamLeash extends CardImpl {
|
||||||
|
|
||||||
class DreamLeashTarget extends TargetPermanent {
|
class DreamLeashTarget extends TargetPermanent {
|
||||||
|
|
||||||
|
DreamLeashTarget() {}
|
||||||
|
|
||||||
|
private DreamLeashTarget(DreamLeashTarget target) {
|
||||||
|
super(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DreamLeashTarget copy() {
|
||||||
|
return new DreamLeashTarget(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||||
|
if (super.canTarget(controllerId, id, source, game)) {
|
||||||
if(super.canTarget(controllerId, id, source, game)){
|
|
||||||
Permanent permanent = game.getPermanent(id);
|
Permanent permanent = game.getPermanent(id);
|
||||||
return permanent.isTapped();
|
return permanent.isTapped();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,8 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.game.Game;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.filter.predicate.permanent.TappedPredicate;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
@ -26,26 +25,19 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class EnthrallingHold extends CardImpl {
|
public final class EnthrallingHold extends CardImpl {
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterCreaturePermanent();
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(TappedPredicate.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnthrallingHold(UUID ownerId, CardSetInfo setInfo) {
|
public EnthrallingHold(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
|
||||||
|
|
||||||
this.subtype.add(SubType.AURA);
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
// Enchant creature
|
// Enchant creature
|
||||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
TargetPermanent auraTarget = new EnthrallingHoldTarget();
|
||||||
this.getSpellAbility().addTarget(auraTarget);
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.GainControl));
|
this.getSpellAbility().addEffect(new AttachEffect(Outcome.GainControl));
|
||||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// You can't choose an untapped creature as this spell's target as you cast it.
|
// You can't choose an untapped creature as this spell's target as you cast it.
|
||||||
auraTarget.replaceFilter(filter);
|
|
||||||
Effect controlEnchantedEffect = new ControlEnchantedEffect();
|
Effect controlEnchantedEffect = new ControlEnchantedEffect();
|
||||||
controlEnchantedEffect.setText("You can't choose an untapped creature as this spell's target as you cast it.<br>" + controlEnchantedEffect.getText(null));
|
controlEnchantedEffect.setText("You can't choose an untapped creature as this spell's target as you cast it.<br>" + controlEnchantedEffect.getText(null));
|
||||||
|
|
||||||
|
@ -62,3 +54,27 @@ public final class EnthrallingHold extends CardImpl {
|
||||||
return new EnthrallingHold(this);
|
return new EnthrallingHold(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EnthrallingHoldTarget extends TargetCreaturePermanent {
|
||||||
|
|
||||||
|
EnthrallingHoldTarget() {}
|
||||||
|
|
||||||
|
private EnthrallingHoldTarget(EnthrallingHoldTarget target) {
|
||||||
|
super(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnthrallingHoldTarget copy() {
|
||||||
|
return new EnthrallingHoldTarget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||||
|
if (super.canTarget(controllerId, id, source, game)) {
|
||||||
|
Permanent permanent = game.getPermanent(id);
|
||||||
|
return permanent.isTapped();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue