Merge pull request #6432 from htrajan/c20-sanctuary-blade-and-verge-rangers

C20 sanctuary blade and verge rangers
This commit is contained in:
Oleg Agafonov 2020-04-18 23:31:10 +02:00 committed by GitHub
commit 4b940fb2fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 187 additions and 0 deletions

View file

@ -0,0 +1,55 @@
package mage.cards.s;
import mage.abilities.common.AttachedToCreatureSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ChooseColorEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.keyword.ProtectionChosenColorAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author htrajan
*/
public final class SanctuaryBlade extends CardImpl {
public SanctuaryBlade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
// As Sanctuary Blade becomes attached to a creature, choose a color.
this.addAbility(new AttachedToCreatureSourceTriggeredAbility(new ChooseColorEffect(Outcome.Benefit), false));
// Equipped creature gets +2/+0 and has protection from the last chosen color.
Effect boostEffect = new BoostEquippedEffect(2, 0);
boostEffect.concatBy(".");
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, boostEffect);
ProtectionChosenColorAttachedEffect protectionEfect = new ProtectionChosenColorAttachedEffect(false);
protectionEfect.setText("and has protection from the last chosen color.");
ability.addEffect(protectionEfect);
this.addAbility(ability);
// Equip {3}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3)));
}
private SanctuaryBlade(final SanctuaryBlade card) {
super(card);
}
@Override
public SanctuaryBlade copy() {
return new SanctuaryBlade(this);
}
}

View file

@ -0,0 +1,82 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
import mage.abilities.effects.common.continuous.PlayTheTopCardEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.Comparator;
import java.util.UUID;
/**
*
* @author htrajan
*/
public final class VergeRangers extends CardImpl {
public VergeRangers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SCOUT);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// You may look at the top card of your library any time.
this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect()));
// As long as an opponent controls more lands than you, you may play lands from the top of your library.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VergeRangersEffect()));
}
private VergeRangers(final VergeRangers card) {
super(card);
}
@Override
public VergeRangers copy() {
return new VergeRangers(this);
}
}
class VergeRangersEffect extends PlayTheTopCardEffect {
public VergeRangersEffect() {
super(StaticFilters.FILTER_CARD_LAND);
staticText = "As long as an opponent controls more lands than you, you may play lands from the top of your library.";
}
public VergeRangersEffect(final VergeRangersEffect effect) {
super(effect);
}
@Override
public VergeRangersEffect copy() {
return new VergeRangersEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (super.applies(objectId, affectedAbility, source, game, playerId)) {
int myLandCount = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, playerId, game);
int maxOpponentLandCount = game.getOpponents(playerId).stream()
.map(opponentId -> game.getBattlefield().countAll(StaticFilters.FILTER_LAND, opponentId, game))
.max(Comparator.naturalOrder())
.orElse(0);
return maxOpponentLandCount > myLandCount;
}
return false;
}
}

View file

@ -248,6 +248,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Rogue's Passage", 303, Rarity.UNCOMMON, mage.cards.r.RoguesPassage.class));
cards.add(new SetCardInfo("Rupture Spire", 304, Rarity.COMMON, mage.cards.r.RuptureSpire.class));
cards.add(new SetCardInfo("Sakura-Tribe Elder", 187, Rarity.COMMON, mage.cards.s.SakuraTribeElder.class));
cards.add(new SetCardInfo("Sanctuary Blade", 69, Rarity.RARE, mage.cards.s.SanctuaryBlade.class));
cards.add(new SetCardInfo("Sandsteppe Citadel", 305, Rarity.UNCOMMON, mage.cards.s.SandsteppeCitadel.class));
cards.add(new SetCardInfo("Satyr Wayfinder", 188, Rarity.COMMON, mage.cards.s.SatyrWayfinder.class));
cards.add(new SetCardInfo("Sawtusk Demolisher", 64, Rarity.RARE, mage.cards.s.SawtuskDemolisher.class));
@ -313,6 +314,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Unexpectedly Absent", 106, Rarity.RARE, mage.cards.u.UnexpectedlyAbsent.class));
cards.add(new SetCardInfo("Vampire Nighthawk", 140, Rarity.UNCOMMON, mage.cards.v.VampireNighthawk.class));
cards.add(new SetCardInfo("Vastwood Hydra", 194, Rarity.RARE, mage.cards.v.VastwoodHydra.class));
cards.add(new SetCardInfo("Verge Rangers", 29, Rarity.RARE, mage.cards.v.VergeRangers.class));
cards.add(new SetCardInfo("Vigilante Justice", 164, Rarity.UNCOMMON, mage.cards.v.VigilanteJustice.class));
cards.add(new SetCardInfo("Villainous Wealth", 233, Rarity.RARE, mage.cards.v.VillainousWealth.class));
cards.add(new SetCardInfo("Vitality Hunter", 30, Rarity.RARE, mage.cards.v.VitalityHunter.class));

View file

@ -0,0 +1,48 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import static mage.constants.CardType.CREATURE;
/**
*
* @author htrajan
*/
public class AttachedToCreatureSourceTriggeredAbility extends TriggeredAbilityImpl {
public AttachedToCreatureSourceTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
}
public AttachedToCreatureSourceTriggeredAbility(final AttachedToCreatureSourceTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACHED
&& event.getSourceId() != null
&& event.getSourceId().equals(this.getSourceId());
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent attachedPermanent = game.getPermanent(event.getTargetId());
return attachedPermanent != null && attachedPermanent.getCardType().contains(CREATURE);
}
@Override
public String getRule() {
return "As {this} becomes attached to a creature, " + super.getRule();
}
@Override
public AttachedToCreatureSourceTriggeredAbility copy() {
return new AttachedToCreatureSourceTriggeredAbility(this);
}
}