mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
[MIC] Implemented Curse of Obsession
This commit is contained in:
parent
541511692e
commit
bd22c4a3ae
4 changed files with 100 additions and 27 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/abilities/common
60
Mage.Sets/src/mage/cards/c/CurseOfObsession.java
Normal file
60
Mage.Sets/src/mage/cards/c/CurseOfObsession.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfDrawTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardHandTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CurseOfObsession extends CardImpl {
|
||||
|
||||
public CurseOfObsession(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
this.subtype.add(SubType.CURSE);
|
||||
|
||||
// Enchant player
|
||||
TargetPlayer auraTarget = new TargetPlayer();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of enchanted player's draw step, that player draws two additional cards.
|
||||
this.addAbility(new BeginningOfDrawTriggeredAbility(
|
||||
new DrawCardTargetEffect(2)
|
||||
.setText("that player draws two additional cards"),
|
||||
TargetController.ENCHANTED, false
|
||||
));
|
||||
|
||||
// At the beginning of enchanted player's end step, that player discards their hand.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new DiscardHandTargetEffect("that player"),
|
||||
TargetController.ENCHANTED, false
|
||||
));
|
||||
}
|
||||
|
||||
private CurseOfObsession(final CurseOfObsession card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfObsession copy() {
|
||||
return new CurseOfObsession(this);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Crowded Crypt", 17, Rarity.RARE, mage.cards.c.CrowdedCrypt.class));
|
||||
cards.add(new SetCardInfo("Curse of Clinging Webs", 25, Rarity.RARE, mage.cards.c.CurseOfClingingWebs.class));
|
||||
cards.add(new SetCardInfo("Curse of Conformity", 6, Rarity.RARE, mage.cards.c.CurseOfConformity.class));
|
||||
cards.add(new SetCardInfo("Curse of Obsession", 35, Rarity.RARE, mage.cards.c.CurseOfObsession.class));
|
||||
cards.add(new SetCardInfo("Curse of Unbinding", 12, Rarity.RARE, mage.cards.c.CurseOfUnbinding.class));
|
||||
cards.add(new SetCardInfo("Curse of the Restless Dead", 18, Rarity.RARE, mage.cards.c.CurseOfTheRestlessDead.class));
|
||||
cards.add(new SetCardInfo("Custodi Soulbinders", 83, Rarity.RARE, mage.cards.c.CustodiSoulbinders.class));
|
||||
|
|
|
@ -11,7 +11,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
|
||||
public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private TargetController targetController;
|
||||
private final TargetController targetController;
|
||||
|
||||
/**
|
||||
* The Ability sets if no target is defined the target pointer to the active
|
||||
|
@ -50,10 +50,8 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
switch (targetController) {
|
||||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours) {
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
if (yours && getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return yours;
|
||||
case OPPONENT:
|
||||
|
@ -84,6 +82,15 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ENCHANTED:
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null || !game.isActivePlayer(permanent.getAttachedTo())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case ANY:
|
||||
case ACTIVE:
|
||||
if (getTargets().isEmpty()) {
|
||||
|
@ -108,6 +115,8 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "At the beginning of each player's draw step, " + generateZoneString();
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
return "At the beginning of the draw step of enchanted creature's controller, " + generateZoneString();
|
||||
case ENCHANTED:
|
||||
return "At the beginning of enchanted player's draw step, " + generateZoneString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -46,20 +46,14 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
|
|||
switch (targetController) {
|
||||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
if (yours && getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return yours;
|
||||
case OPPONENT:
|
||||
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -68,24 +62,31 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
|
|||
case EACH_PLAYER:
|
||||
case NEXT:
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
Permanent attachment = game.getPermanent(sourceId);
|
||||
if (attachment != null && attachment.getAttachedTo() != null) {
|
||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||
if (attachedTo != null && attachedTo.isControlledBy(event.getPlayerId())) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (attachment == null || attachment.getAttachedTo() == null) {
|
||||
break;
|
||||
}
|
||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||
if (attachedTo == null || !attachedTo.isControlledBy(event.getPlayerId())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case ENCHANTED:
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null || !game.isActivePlayer(permanent.getAttachedTo())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -113,6 +114,8 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "At the beginning of each player's end step, " + generateConditionString();
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
return "At the beginning of the end step of enchanted permanent's controller, " + generateConditionString();
|
||||
case ENCHANTED:
|
||||
return "At the beginning of enchanted player's draw step, " + generateConditionString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue