Implemented Manascape Refractor (#6467)

* Implemented Xyris, the Writhing Storm

* Name change for Xyris's draw ability.

* Implemented Kalamax, the Stormsire.

* Added Kalamax and Xyris to Commander2020Edition Set.

* Updated XyrisTheWrithingStorm drawCards implementation.

* Fixed bug where "First card drawn" was not enforced.

* Removed unnecessary Predicates.or, and replaced custom effect with CreateTokenEffect

* Implemented ManascapeRefractor.
This commit is contained in:
AsterAether 2020-04-25 02:28:55 +02:00 committed by GitHub
parent 1804b8df01
commit c5ab1828e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 144 additions and 0 deletions

View file

@ -0,0 +1,143 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.AsThoughManaEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.ManaPoolItem;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author AsterAether
*/
public final class ManascapeRefractor extends CardImpl {
public ManascapeRefractor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Manascape Refractor enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// Manascape Refractor has all activated abilities of all lands on the battlefield.
this.addAbility(new SimpleStaticAbility(new ManascapeRefractorGainAbilitiesEffect()));
// You may spend mana as though it were mana of any color to pay the activation costs of Manascape Refractor's abilities.
ManascapeRefractorSpendAnyManaEffect manaEffect = new ManascapeRefractorSpendAnyManaEffect();
manaEffect.setTargetPointer(new FixedTarget(this.getId()));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, manaEffect));
}
private ManascapeRefractor(final ManascapeRefractor card) {
super(card);
}
@Override
public ManascapeRefractor copy() {
return new ManascapeRefractor(this);
}
}
class ManascapeRefractorGainAbilitiesEffect extends ContinuousEffectImpl {
private static final FilterPermanent filter = new FilterLandPermanent();
static {
filter.add(AnotherPredicate.instance);
}
ManascapeRefractorGainAbilitiesEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "{this} all activated abilities of all lands on the battlefield.";
}
private ManascapeRefractorGainAbilitiesEffect(final ManascapeRefractorGainAbilitiesEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent perm = game.getPermanent(source.getSourceId());
if (perm == null) {
return true;
}
for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(
filter, source.getControllerId(), source.getSourceId(), game
)) {
for (Ability ability : permanent.getAbilities()) {
if (ability instanceof ActivatedAbility) {
boolean addAbility = true;
for (Ability existingAbility : perm.getAbilities()) {
if (existingAbility instanceof RedManaAbility && ability instanceof RedManaAbility) {
addAbility = false;
} else if (existingAbility instanceof BlueManaAbility && ability instanceof BlueManaAbility) {
addAbility = false;
} else if (existingAbility instanceof GreenManaAbility && ability instanceof GreenManaAbility) {
addAbility = false;
} else if (existingAbility instanceof WhiteManaAbility && ability instanceof WhiteManaAbility) {
addAbility = false;
} else if (existingAbility instanceof BlackManaAbility && ability instanceof BlackManaAbility) {
addAbility = false;
}
}
if (addAbility)
perm.addAbility(ability, source.getSourceId(), game);
}
}
}
return true;
}
@Override
public ManascapeRefractorGainAbilitiesEffect copy() {
return new ManascapeRefractorGainAbilitiesEffect(this);
}
}
class ManascapeRefractorSpendAnyManaEffect extends AsThoughEffectImpl implements AsThoughManaEffect {
public ManascapeRefractorSpendAnyManaEffect() {
super(AsThoughEffectType.SPEND_OTHER_MANA, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may spend mana as though it were mana of any color to pay the activation costs of {this}'s abilities.";
}
public ManascapeRefractorSpendAnyManaEffect(final ManascapeRefractorSpendAnyManaEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public ManascapeRefractorSpendAnyManaEffect copy() {
return new ManascapeRefractorSpendAnyManaEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
objectId = CardUtil.getMainCardId(game, objectId); // for split cards
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
return affectedControllerId.equals(source.getControllerId());
}
return false;
}
@Override
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
return mana.getFirstAvailable();
}
}

View file

@ -196,6 +196,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Magus of the Disk", 94, Rarity.RARE, mage.cards.m.MagusOfTheDisk.class));
cards.add(new SetCardInfo("Magus of the Wheel", 156, Rarity.RARE, mage.cards.m.MagusOfTheWheel.class));
cards.add(new SetCardInfo("Majestic Myriarch", 182, Rarity.MYTHIC, mage.cards.m.MajesticMyriarch.class));
cards.add(new SetCardInfo("Manascape Refractor", 68, Rarity.RARE, mage.cards.m.ManascapeRefractor.class));
cards.add(new SetCardInfo("Martial Impetus", 28, Rarity.UNCOMMON, mage.cards.m.MartialImpetus.class));
cards.add(new SetCardInfo("Masked Admirers", 183, Rarity.RARE, mage.cards.m.MaskedAdmirers.class));
cards.add(new SetCardInfo("Melek, Izzet Paragon", 220, Rarity.RARE, mage.cards.m.MelekIzzetParagon.class));