mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Fix Contempt. Closes #10087
This commit is contained in:
parent
7481cc9631
commit
5673a59f0e
1 changed files with 7 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.constants.AttachmentType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -40,7 +42,7 @@ public final class Contempt extends CardImpl {
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// Whenever enchanted creature attacks, return it and Contempt to their owners' hands at end of combat.
|
// Whenever enchanted creature attacks, return it and Contempt to their owners' hands at end of combat.
|
||||||
this.addAbility(new AttacksAttachedTriggeredAbility(new ContemptEffect()));
|
this.addAbility(new AttacksAttachedTriggeredAbility(new ContemptEffect(), AttachmentType.AURA, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,17 +76,16 @@ class ContemptEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent contempt = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent contempt = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (contempt != null) {
|
if (contempt != null) {
|
||||||
|
Effect effect = new ReturnToHandSourceEffect();
|
||||||
|
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
|
||||||
Permanent attachedToPermanent = game.getPermanent(contempt.getAttachedTo());
|
Permanent attachedToPermanent = game.getPermanent(contempt.getAttachedTo());
|
||||||
if (attachedToPermanent != null) {
|
if (attachedToPermanent != null) {
|
||||||
Effect effect = new ReturnToHandTargetEffect();
|
effect = new ReturnToHandTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(
|
effect.setTargetPointer(new FixedTarget(
|
||||||
attachedToPermanent.getId(), game)).setText("return "
|
attachedToPermanent.getId(), game)).setText("return "
|
||||||
+ attachedToPermanent.getName() + " to owner's hand.");
|
+ attachedToPermanent.getName() + " to owner's hand.");
|
||||||
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
|
ability.addEffect(effect);
|
||||||
game.addDelayedTriggeredAbility(ability, source);
|
|
||||||
}
|
}
|
||||||
Effect effect = new ReturnToHandSourceEffect();
|
|
||||||
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
|
|
||||||
game.addDelayedTriggeredAbility(ability, source);
|
game.addDelayedTriggeredAbility(ability, source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue