Skip to content

Commit

Permalink
Updated wordings and refactored class name for effects which prompt t…
Browse files Browse the repository at this point in the history
…he player to choose a card name
  • Loading branch information
theelk801 committed Jun 6, 2018
1 parent d2e8016 commit 2662fa7
Show file tree
Hide file tree
Showing 33 changed files with 149 additions and 159 deletions.
6 changes: 3 additions & 3 deletions Mage.Sets/src/mage/cards/b/BrainPry.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
Expand All @@ -25,7 +25,7 @@ public BrainPry(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}");

//Name a nonland card. Target player reveals their hand. That player discards a card with that name. If he or she can't, you draw a card.
this.getSpellAbility().addEffect((new NameACardEffect(NameACardEffect.TypeOfName.NON_LAND_NAME)));
this.getSpellAbility().addEffect((new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_NAME)));
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new BrainPryEffect());
}
Expand Down Expand Up @@ -56,7 +56,7 @@ public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (targetPlayer != null && controller != null && sourceObject != null && cardName != null) {
boolean hasDiscarded = false;
for (Card card : targetPlayer.getHand().getCards(game)) {
Expand Down
18 changes: 8 additions & 10 deletions Mage.Sets/src/mage/cards/c/CabalTherapy.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

package mage.cards.c;

import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.*;
import mage.constants.CardType;
Expand All @@ -26,10 +25,10 @@
public final class CabalTherapy extends CardImpl {

public CabalTherapy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}");

// Name a nonland card. Target player reveals their hand and discards all cards with that name.
this.getSpellAbility().addEffect((new NameACardEffect(NameACardEffect.TypeOfName.NON_LAND_NAME)));
this.getSpellAbility().addEffect((new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_NAME)));
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new CabalTherapyEffect());

Expand All @@ -53,7 +52,7 @@ class CabalTherapyEffect extends OneShotEffect {

public CabalTherapyEffect() {
super(Outcome.Discard);
staticText = "Name a nonland card. Target player reveals their hand and discards all cards with that name";
staticText = "Target player reveals their hand and discards all cards with that name";
}

public CabalTherapyEffect(final CabalTherapyEffect effect) {
Expand All @@ -66,16 +65,15 @@ public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (targetPlayer != null && controller != null && sourceObject != null) {
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
Cards hand = targetPlayer.getHand();

for (Card card : hand.getCards(game)) {
if(card.isSplitCard()){
if (card.isSplitCard()) {
SplitCard splitCard = (SplitCard) card;
if(splitCard.getLeftHalfCard().getName().equals(cardName)){
if (splitCard.getLeftHalfCard().getName().equals(cardName)) {
targetPlayer.discard(card, source, game);
}
else if(splitCard.getRightHalfCard().getName().equals(cardName)){
} else if (splitCard.getRightHalfCard().getName().equals(cardName)) {
targetPlayer.discard(card, source, game);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Mage.Sets/src/mage/cards/c/CheeringFanatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.NameACardEffect.TypeOfName;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.ChooseACardNameEffect.TypeOfName;
import mage.abilities.effects.common.cost.SpellsCostReductionAllEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
Expand Down Expand Up @@ -65,8 +65,8 @@ public CheeringFanaticEffect copy() {

@Override
public boolean apply(Game game, Ability source) {
new NameACardEffect(TypeOfName.ALL).apply(game, source);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
new ChooseACardNameEffect(TypeOfName.ALL).apply(game, source);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
FilterCard filter = new FilterCard();
filter.add(new NamePredicate(cardName));
ContinuousEffect effect = new SpellsCostReductionAllEffect(filter, 1);
Expand Down
15 changes: 7 additions & 8 deletions Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package mage.cards.c;

import java.util.UUID;
Expand All @@ -9,7 +8,7 @@
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
Expand All @@ -35,7 +34,7 @@ public CouncilOfTheAbsolute(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(4);

// As Council of the Absolute enters the battlefield, name a card other than a creature or a land card.
this.addAbility(new AsEntersBattlefieldAbility(new NameACardEffect(NameACardEffect.TypeOfName.NON_LAND_AND_NON_CREATURE_NAME)));
this.addAbility(new AsEntersBattlefieldAbility(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_AND_NON_CREATURE_NAME)));
// Your opponents can't cast the chosen card.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CouncilOfTheAbsoluteReplacementEffect()));
// Spells with the chosen name cost 2 less for you to cast.
Expand All @@ -58,7 +57,7 @@ class CouncilOfTheAbsoluteReplacementEffect extends ContinuousRuleModifyingEffec

public CouncilOfTheAbsoluteReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "Your opponents can't cast the chosen card";
staticText = "Your opponents can't cast spells with the chosen name";
}

public CouncilOfTheAbsoluteReplacementEffect(final CouncilOfTheAbsoluteReplacementEffect effect) {
Expand All @@ -79,7 +78,7 @@ public CouncilOfTheAbsoluteReplacementEffect copy() {
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "You can't cast a card with that name (" + mageObject.getLogName() + " in play).";
return "You can't cast a spell with that name (" + mageObject.getLogName() + " in play).";
}
return null;
}
Expand All @@ -93,7 +92,7 @@ public boolean checksEventType(GameEvent event, Game game) {
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY))) {
return true;
}
}
Expand All @@ -105,7 +104,7 @@ class CouncilOfTheAbsoluteCostReductionEffect extends CostModificationEffectImpl

public CouncilOfTheAbsoluteCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.staticText = "Spells with the chosen name cost 2 less for you to cast";
this.staticText = "Spells with the chosen name you cast cost 2 less to cast";
}

protected CouncilOfTheAbsoluteCostReductionEffect(CouncilOfTheAbsoluteCostReductionEffect effect) {
Expand All @@ -123,7 +122,7 @@ public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility)
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
Card card = game.getCard(abilityToModify.getSourceId());
return card.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY));
return card.getName().equals(game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY));
}
return false;
}
Expand Down
9 changes: 4 additions & 5 deletions Mage.Sets/src/mage/cards/c/CursedScroll.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package mage.cards.c;

import java.util.UUID;
Expand All @@ -8,7 +7,7 @@
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
Expand All @@ -29,7 +28,7 @@ public CursedScroll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");

// {3}, {T}: Name a card. Reveal a card at random from your hand. If it's the named card, Cursed Scroll deals 2 damage to any target.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NameACardEffect(NameACardEffect.TypeOfName.ALL), new ManaCostsImpl("{3}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL), new ManaCostsImpl("{3}"));
ability.addEffect(new CursedScrollEffect());
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetAnyTarget());
Expand All @@ -50,7 +49,7 @@ class CursedScrollEffect extends OneShotEffect {

public CursedScrollEffect() {
super(Outcome.Neutral);
staticText = "Reveal a card at random from your hand. If it's the named card, {this} deals 2 damage to any target";
staticText = ", then reveal a card at random from your hand. If that card has the chosen name, {this} deals 2 damage to any target";
}

public CursedScrollEffect(final CursedScrollEffect effect) {
Expand All @@ -61,7 +60,7 @@ public CursedScrollEffect(final CursedScrollEffect effect) {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (sourceObject != null && controller != null && cardName != null && !cardName.isEmpty()) {
if (!controller.getHand().isEmpty()) {
Cards revealed = new CardsImpl();
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/d/DeclarationOfNaught.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
Expand All @@ -27,7 +27,7 @@ public DeclarationOfNaught(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");

// As Declaration of Naught enters the battlefield, name a card.
this.addAbility(new AsEntersBattlefieldAbility(new NameACardEffect(NameACardEffect.TypeOfName.ALL)));
this.addAbility(new AsEntersBattlefieldAbility(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL)));

// {U}: Counter target spell with the chosen name.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{U}"));
Expand Down
9 changes: 4 additions & 5 deletions Mage.Sets/src/mage/cards/d/DementiaSliver.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package mage.cards.d;

import java.util.UUID;
Expand All @@ -10,7 +9,7 @@
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.*;
import mage.constants.*;
Expand Down Expand Up @@ -39,7 +38,7 @@ public DementiaSliver(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(3);

// All Slivers have "{T}: Name a card. Target opponent reveals a card at random from their hand. If it's the named card, that player discards it. Activate this ability only during your turn."
Ability gainedAbility = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new NameACardEffect(NameACardEffect.TypeOfName.ALL), new TapSourceCost(), MyTurnCondition.instance);
Ability gainedAbility = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL), new TapSourceCost(), MyTurnCondition.instance);
gainedAbility.addEffect(new DementiaSliverEffect());
gainedAbility.addTarget(new TargetOpponent());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
Expand All @@ -66,7 +65,7 @@ class DementiaSliverEffect extends OneShotEffect {

public DementiaSliverEffect() {
super(Outcome.Damage);
staticText = "Target opponent reveals a card at random from their hand. If it's the named card, that player discards it";
staticText = "Target opponent reveals a card at random from their hand. If that card has the chose name, that player discards it";
}

public DementiaSliverEffect(final DementiaSliverEffect effect) {
Expand All @@ -77,7 +76,7 @@ public DementiaSliverEffect(final DementiaSliverEffect effect) {
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (opponent != null && sourceObject != null && !cardName.isEmpty()) {
if (!opponent.getHand().isEmpty()) {
Cards revealed = new CardsImpl();
Expand Down
6 changes: 3 additions & 3 deletions Mage.Sets/src/mage/cards/d/DesperateResearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
Expand All @@ -26,7 +26,7 @@ public DesperateResearch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");

// Choose a card name other than a basic land card name. Reveal the top seven cards of your library and put all of them with that name into your hand. Exile the rest.
this.getSpellAbility().addEffect(new NameACardEffect(NameACardEffect.TypeOfName.NOT_BASIC_LAND_NAME));
this.getSpellAbility().addEffect(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NOT_BASIC_LAND_NAME));
this.getSpellAbility().addEffect(new DesperateResearchEffect());
}

Expand Down Expand Up @@ -58,7 +58,7 @@ public DesperateResearchEffect copy() {

@Override
public boolean apply(Game game, Ability source) {
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
Player player = game.getPlayer(source.getControllerId());
if (player == null || cardName == null) {
return false;
Expand Down
6 changes: 3 additions & 3 deletions Mage.Sets/src/mage/cards/d/Dispossess.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
Expand All @@ -21,7 +21,7 @@ public Dispossess(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");

// Name an artifact card. Search target player's graveyard, hand, and library for any number of cards with that name and exile them. Then that player shuffles their library.
this.getSpellAbility().addEffect((new NameACardEffect(NameACardEffect.TypeOfName.ARTIFACT_NAME)));
this.getSpellAbility().addEffect((new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ARTIFACT_NAME)));
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new DispossessEffect());
}
Expand All @@ -48,7 +48,7 @@ public DispossessEffect(final DispossessEffect effect) {

@Override
public boolean apply(Game game, Ability source) {
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
return super.applySearchAndExile(game, source, cardName, targetPointer.getFirst(game, source));
}

Expand Down
Loading

0 comments on commit 2662fa7

Please sign in to comment.