forked from External/mage
[WHO] Implement Bill Potts (#13338)
This commit is contained in:
parent
fe8f54a64c
commit
33b3f53643
2 changed files with 128 additions and 4 deletions
124
Mage.Sets/src/mage/cards/b/BillPotts.java
Normal file
124
Mage.Sets/src/mage/cards/b/BillPotts.java
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageItem;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.ActivateAbilityTriggeredAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.CopyStackObjectEffect;
|
||||
import mage.abilities.meta.OrTriggeredAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.abilities.keyword.DoctorsCompanionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterInstantOrSorcerySpell;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.Target;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author padfoot
|
||||
*/
|
||||
public final class BillPotts extends CardImpl {
|
||||
|
||||
private static final FilterSpell filterInstantOrSorcery = new FilterInstantOrSorcerySpell("an instant or sorcery that targets only {this}");
|
||||
private static final FilterStackObject filterAbility = new FilterStackObject("an ability that targets only {this}");
|
||||
|
||||
static {
|
||||
filterInstantOrSorcery.add(BillPottsPredicate.instance);
|
||||
filterAbility.add(BillPottsPredicate.instance);
|
||||
}
|
||||
|
||||
public BillPotts(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever you cast an instant or sorcery spell that targets only Bill Potts or activate an ability that targets only Bill Potts, copy that spell or ability. You may choose new targets for the copy. This ability triggers only once each turn.
|
||||
this.addAbility(new OrTriggeredAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new CopyStackObjectEffect("that spell or ability"),
|
||||
false,
|
||||
"",
|
||||
new SpellCastControllerTriggeredAbility(
|
||||
null,
|
||||
filterInstantOrSorcery,
|
||||
false,
|
||||
SetTargetPointer.SPELL
|
||||
),
|
||||
new ActivateAbilityTriggeredAbility(
|
||||
null,
|
||||
filterAbility,
|
||||
SetTargetPointer.SPELL
|
||||
)
|
||||
).setTriggersLimitEachTurn(1));
|
||||
|
||||
// Doctor's companion
|
||||
this.addAbility(DoctorsCompanionAbility.getInstance());
|
||||
|
||||
}
|
||||
|
||||
private BillPotts(final BillPotts card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BillPotts copy() {
|
||||
return new BillPotts(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BillPottsPredicate implements ObjectSourcePlayerPredicate<StackObject> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
List<UUID> oneTargetList = Arrays.asList(input.getSourceId());
|
||||
return (makeStream(input, game).collect(Collectors.toList()).equals(oneTargetList));
|
||||
}
|
||||
|
||||
private static final Stream<UUID> makeStream(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
Abilities<Ability> objectAbilities = new AbilitiesImpl<>();
|
||||
if (input.getObject() instanceof Spell) {
|
||||
objectAbilities.addAll(((Spell) input.getObject()).getSpellAbilities());
|
||||
} else {
|
||||
objectAbilities.add(input.getObject().getStackAbility());
|
||||
}
|
||||
return objectAbilities
|
||||
.stream()
|
||||
.map(Ability::getModes)
|
||||
.flatMap(m -> m.getSelectedModes().stream().map(m::get))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Mode::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(t -> !t.isNotTarget())
|
||||
.map(Target::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct();
|
||||
}
|
||||
}
|
||||
|
|
@ -95,10 +95,10 @@ public final class DoctorWho extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bessie, the Doctor's Roadster", 776, Rarity.RARE, mage.cards.b.BessieTheDoctorsRoadster.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bigger on the Inside", 115, Rarity.UNCOMMON, mage.cards.b.BiggerOnTheInside.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bigger on the Inside", 720, Rarity.UNCOMMON, mage.cards.b.BiggerOnTheInside.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Bill Potts", 379, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Bill Potts", 681, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Bill Potts", 76, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Bill Potts", 970, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bill Potts", 379, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bill Potts", 681, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bill Potts", 76, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Bill Potts", 970, Rarity.RARE, mage.cards.b.BillPotts.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Blasphemous Act", 1063, Rarity.RARE, mage.cards.b.BlasphemousAct.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Blasphemous Act", 224, Rarity.RARE, mage.cards.b.BlasphemousAct.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Blasphemous Act", 472, Rarity.RARE, mage.cards.b.BlasphemousAct.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue