- small fixes to some "Curse" cards.

This commit is contained in:
Jeff 2019-05-03 10:18:29 -05:00
parent 878d602b58
commit e980240553
8 changed files with 33 additions and 38 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.UUID;
@ -29,10 +28,9 @@ import mage.target.targetpointer.FixedTarget;
public final class CurseOfPredation extends CardImpl {
public CurseOfPredation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
@ -75,17 +73,11 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.isAttachedTo(defender.getId())) {
for (Effect effect: this.getEffects()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.abilities.Ability;
@ -29,16 +28,16 @@ import java.util.UUID;
public final class CurseOfTheBloodyTome extends CardImpl {
public CurseOfTheBloodyTome(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer target = new TargetPlayer();
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(target.getTargetName());
this.addAbility(ability);
// At the beginning of enchanted player's upkeep, that player puts the top two cards of their library into their graveyard.
this.addAbility(new CurseOfTheBloodyTomeAbility());

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.abilities.Ability;
@ -42,10 +41,13 @@ public final class CurseOfTheCabal extends CardImpl {
// Target player sacrifices half the permanents he or she controls, rounded down.
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new CurseOfTheCabalSacrificeEffect());
// Suspend 2-{2}{B}{B}
this.addAbility(new SuspendAbility(2, new ManaCostsImpl("{2}{B}{B}"), this));
// At the beginning of each player's upkeep, if Curse of the Cabal is suspended, that player may sacrifice a permanent. If he or she does, put two time counters on Curse of the Cabal.
this.addAbility(new CurseOfTheCabalInterveningIfTriggeredAbility());
}
public CurseOfTheCabal(final CurseOfTheCabal card) {
@ -84,7 +86,8 @@ class CurseOfTheCabalSacrificeEffect extends OneShotEffect {
}
Target target = new TargetControlledPermanent(amount, amount, StaticFilters.FILTER_CONTROLLED_PERMANENT, true);
if (target.canChoose(targetPlayer.getId(), game)) {
while (!target.isChosen() && target.canChoose(targetPlayer.getId(), game) && targetPlayer.canRespond()) {
while (!target.isChosen()
&& target.canChoose(targetPlayer.getId(), game) && targetPlayer.canRespond()) {
targetPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
//sacrifice all chosen (non null) permanents
@ -107,7 +110,9 @@ class CurseOfTheCabalInterveningIfTriggeredAbility extends ConditionalIntervenin
TargetController.ANY, false, true
),
SuspendedCondition.instance,
"At the beginning of each player's upkeep, if {this} is suspended, that player may sacrifice a permanent. If he or she does, put two time counters on {this}."
"At the beginning of each player's upkeep, if {this} is suspended, "
+ "that player may sacrifice a permanent. If he or she does, "
+ "put two time counters on {this}."
);
// controller has to sac a permanent
// counters aren't placed

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.abilities.TriggeredAbilityImpl;
@ -29,7 +28,7 @@ import java.util.UUID;
public final class CurseOfTheForsaken extends CardImpl {
public CurseOfTheForsaken(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
@ -40,6 +39,7 @@ public final class CurseOfTheForsaken extends CardImpl {
// Whenever a creature attacks enchanted player, its controller gains 1 life.
this.addAbility(new CurseOfTheForsakenTriggeredAbility());
}
public CurseOfTheForsaken(final CurseOfTheForsaken card) {
@ -74,12 +74,6 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.abilities.Ability;
@ -29,8 +28,10 @@ public final class CurseOfTheSwine extends CardImpl {
// Exile X target creatures. For each creature exiled this way, its controller creates a 2/2 green Boar creature token.
this.getSpellAbility().addEffect(new CurseOfTheSwineEffect());
// Correct number of targets will be set in adjustTargets
this.getSpellAbility().setTargetAdjuster(CurseOfTheSwineAdjuster.instance);
}
public CurseOfTheSwine(final CurseOfTheSwine card) {
@ -57,7 +58,8 @@ class CurseOfTheSwineEffect extends OneShotEffect {
public CurseOfTheSwineEffect() {
super(Outcome.Exile);
this.staticText = "Exile X target creatures. For each creature exiled this way, its controller creates a 2/2 green Boar creature token";
this.staticText = "Exile X target creatures. For each creature exiled this way, "
+ "its controller creates a 2/2 green Boar creature token";
}
public CurseOfTheSwineEffect(final CurseOfTheSwineEffect effect) {
@ -78,13 +80,15 @@ class CurseOfTheSwineEffect extends OneShotEffect {
Permanent creature = game.getPermanent(targetId);
if (creature != null) {
if (controller.moveCards(creature, Zone.EXILED, source, game)) {
playersWithTargets.put(creature.getControllerId(), playersWithTargets.getOrDefault(creature.getControllerId(), 0) + 1);
playersWithTargets.put(creature.getControllerId(),
playersWithTargets.getOrDefault(creature.getControllerId(), 0) + 1);
}
}
}
CurseOfTheSwineBoarToken swineToken = new CurseOfTheSwineBoarToken();
for (Map.Entry<UUID, Integer> exiledByController : playersWithTargets.entrySet()) {
swineToken.putOntoBattlefield(exiledByController.getValue(), game, source.getSourceId(), exiledByController.getKey());
swineToken.putOntoBattlefield(exiledByController.getValue(),
game, source.getSourceId(), exiledByController.getKey());
}
return true;
}

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.abilities.Ability;
@ -31,10 +30,9 @@ import java.util.UUID;
public final class CurseOfThirst extends CardImpl {
public CurseOfThirst(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}");
this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
@ -91,7 +89,8 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "At the beginning of enchanted player's upkeep, Curse of Thirst deals damage to that player equal to the number of Curses attached to him or her.";
return "At the beginning of enchanted player's upkeep, Curse of Thirst "
+ "deals damage to that player equal to the number of Curses attached to him or her.";
}
}
@ -108,13 +107,14 @@ class CursesAttachedCount implements DynamicValue {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null) {
for (UUID attachmentId: player.getAttachments()) {
for (UUID attachmentId : player.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game))
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) {
count++;
}
}
}
}
return count;
}

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.UUID;
@ -130,7 +129,8 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "When enchanted player loses the game, you gain X life and draw X cards, where X is the number of spite counters on {this}";
return "When enchanted player loses the game, you gain X life and "
+ "draw X cards, where X is the number of spite counters on {this}";
}
}
@ -138,7 +138,8 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect {
public CurseOfVengeanceDrawLifeEffect() {
super(Outcome.Benefit);
staticText = "you gain X life and draw X cards, where X is the number of spite counters on {this}";
staticText = "you gain X life and draw X cards, where X is the "
+ "number of spite counters on {this}";
}
public CurseOfVengeanceDrawLifeEffect(final CurseOfVengeanceDrawLifeEffect effect) {

View file

@ -129,7 +129,7 @@ class UrzasHotTubPredicate implements Predicate<MageObject> {
}
private boolean sharesWordWithName(String str) {
if (referenceName == null || referenceName == "") {
if (referenceName == null || referenceName.equals("")) {
return false;
}
String[] arr = referenceName.split("\\s+");