small change to Partner with ability

This commit is contained in:
Evan Kranzler 2018-05-21 15:53:06 -04:00
parent 1a3a0d88c0
commit 636b35ae39
6 changed files with 29 additions and 21 deletions

View file

@ -33,7 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.keyword.PartnerAbility;
import mage.abilities.keyword.PartnersWithAbility;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
@ -151,8 +151,8 @@ public class Commander extends Constructed {
if (deck.getSideboard().size() == 2 && !commander.getAbilities().contains(PartnerAbility.getInstance())) {
boolean partnersWith = false;
for (Ability ability : commander.getAbilities()) {
if (ability instanceof PartnersWithAbility
&& commanderNames.contains(((PartnersWithAbility) ability).getPartnerName())) {
if (ability instanceof PartnerWithAbility
&& commanderNames.contains(((PartnerWithAbility) ability).getPartnerName())) {
partnersWith = true;
break;
}

View file

@ -30,7 +30,7 @@ package mage.deck;
import java.util.*;
import mage.abilities.Ability;
import mage.abilities.keyword.PartnerAbility;
import mage.abilities.keyword.PartnersWithAbility;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
@ -102,8 +102,8 @@ public class FreeformCommander extends Constructed {
if (deck.getSideboard().size() == 2 && !commander.getAbilities().contains(PartnerAbility.getInstance())) {
boolean partnersWith = false;
for (Ability ability : commander.getAbilities()) {
if (ability instanceof PartnersWithAbility
&& commanderNames.contains(((PartnersWithAbility) ability).getPartnerName())) {
if (ability instanceof PartnerWithAbility
&& commanderNames.contains(((PartnerWithAbility) ability).getPartnerName())) {
partnersWith = true;
break;
}

View file

@ -32,7 +32,7 @@ import java.util.Map.Entry;
import mage.abilities.Ability;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.keyword.PartnerAbility;
import mage.abilities.keyword.PartnersWithAbility;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
@ -113,8 +113,8 @@ public class PennyDreadfulCommander extends Constructed {
if (deck.getSideboard().size() == 2 && !commander.getAbilities().contains(PartnerAbility.getInstance())) {
boolean partnersWith = false;
for (Ability ability : commander.getAbilities()) {
if (ability instanceof PartnersWithAbility
&& commanderNames.contains(((PartnersWithAbility) ability).getPartnerName())) {
if (ability instanceof PartnerWithAbility
&& commanderNames.contains(((PartnerWithAbility) ability).getPartnerName())) {
partnersWith = true;
break;
}

View file

@ -32,7 +32,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.PartnersWithAbility;
import mage.abilities.keyword.PartnerWithAbility;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
@ -61,7 +61,7 @@ public class PirImaginativeRascal extends CardImpl {
this.toughness = new MageInt(1);
// Partner with Toothy, Imaginary Friend (When this creature enters the battlefield, target player may put Toothy into their hand from their library, then shuffle.)
this.addAbility(new PartnersWithAbility("Toothy, Imaginary Friend"));
this.addAbility(new PartnerWithAbility("Toothy, Imaginary Friend", true));
// If one or more counters would be put on a permanent your team controls, that many plus one of each of those kinds of counters are put on that permanent instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PirImaginativeRascalEffect()));

View file

@ -34,7 +34,7 @@ import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.PartnersWithAbility;
import mage.abilities.keyword.PartnerWithAbility;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
@ -57,7 +57,7 @@ public class ToothyImaginaryFriend extends CardImpl {
this.toughness = new MageInt(1);
// Partner with Pir, Imaginative Rascal (When this creature enters the battlefield, target player may put Pir into their hand from their library, then shuffle.)
this.addAbility(new PartnersWithAbility("Pir, Imaginative Rascal"));
this.addAbility(new PartnerWithAbility("Pir, Imaginative Rascal", true));
// Whenever you draw a card, put a +1/+1 counter on Toothy, Imaginary Friend.
this.addAbility(new DrawCardControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true));

View file

@ -46,32 +46,40 @@ import mage.target.common.TargetCardInLibrary;
*
* @author TheElk801
*/
public class PartnersWithAbility extends EntersBattlefieldTriggeredAbility {
public class PartnerWithAbility extends EntersBattlefieldTriggeredAbility {
private final String partnerName;
private final String shortName;
public PartnersWithAbility(String partnerName) {
public PartnerWithAbility(String partnerName) {
this(partnerName, false);
}
public PartnerWithAbility(String partnerName, boolean isLegendary) {
super(new PartnersWithSearchEffect(partnerName), false);
this.addTarget(new TargetPlayer());
this.partnerName = partnerName;
this.shortName = shortenName(partnerName);
if (isLegendary) {
this.shortName = shortenName(partnerName);
} else {
this.shortName = partnerName;
}
}
public PartnersWithAbility(final PartnersWithAbility ability) {
public PartnerWithAbility(final PartnerWithAbility ability) {
super(ability);
this.partnerName = ability.partnerName;
this.shortName = ability.shortName;
}
@Override
public PartnersWithAbility copy() {
return new PartnersWithAbility(this);
public PartnerWithAbility copy() {
return new PartnerWithAbility(this);
}
@Override
public String getRule() {
return "Partners with" + partnerName
return "Partner with " + partnerName
+ " <i>(When this creature enters the battlefield, target player may put " + shortName
+ " into their hand from their library, then shuffle.)</i>";
}
@ -122,7 +130,7 @@ class PartnersWithSearchEffect extends OneShotEffect {
FilterCard filter = new FilterCard("card named " + partnerName);
filter.add(new NamePredicate(partnerName));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.chooseUse(Outcome.Benefit, "Search your library for a card named" + partnerName + " and put it into your hand?", source, game)) {
if (player.chooseUse(Outcome.Benefit, "Search your library for a card named " + partnerName + " and put it into your hand?", source, game)) {
player.searchLibrary(target, game);
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);