Implement more m21 cards (#6612)

* init commit

* AdherentOfHope init commit

* BasrisAegis init commit

* don't change test

* FungalRebirth init commit

* GarruksWarsteed init commit

* KeralKeepDisciples init commit

* ChromaticOrrery init commit

* add back filter names

* fix GolgariFindbroker text

* address comments

Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
htrajan 2020-06-07 13:02:07 -07:00 committed by GitHub
parent 3b125def9c
commit 8369184cac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 464 additions and 114 deletions

View file

@ -0,0 +1,61 @@
package mage.abilities.common;
import mage.abilities.LoyaltyAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackAbility;
public class ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility extends TriggeredAbilityImpl {
private final SubType planeswalkerSubType;
public ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility(Effect effect, SubType planeswalkerSubType) {
super(Zone.BATTLEFIELD, effect, false);
this.planeswalkerSubType = planeswalkerSubType;
}
private ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility(final ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility ability) {
super(ability);
this.planeswalkerSubType = ability.planeswalkerSubType;
}
@Override
public ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility copy() {
return new ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(getControllerId())) {
return false;
}
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (stackAbility == null || !(stackAbility.getStackAbility() instanceof LoyaltyAbility)) {
return false;
}
Permanent permanent = stackAbility.getSourcePermanentOrLKI(game);
if (permanent == null || !permanent.isPlaneswalker()
|| !permanent.hasSubtype(planeswalkerSubType, game)) {
return false;
}
Effect effect = this.getEffects().get(0);
effect.setValue("stackAbility", stackAbility);
return true;
}
@Override
public String getRule() {
return "Whenever you activate a loyalty ability of a " + planeswalkerSubType.getDescription() + " planeswalker, " +
this.getEffects().get(0).getText(getModes().getMode()) + ".";
}
}

View file

@ -0,0 +1,57 @@
package mage.abilities.effects.common;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.HashSet;
import java.util.Set;
public class DrawCardForEachColorAmongControlledPermanentsEffect extends OneShotEffect {
public DrawCardForEachColorAmongControlledPermanentsEffect() {
super(Outcome.DrawCard);
this.staticText = "Draw a card for each color among permanents you control";
}
public DrawCardForEachColorAmongControlledPermanentsEffect(final DrawCardForEachColorAmongControlledPermanentsEffect effect) {
super(effect);
}
@Override
public DrawCardForEachColorAmongControlledPermanentsEffect copy() {
return new DrawCardForEachColorAmongControlledPermanentsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<ObjectColor> colors = new HashSet<>();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (permanent.getColor(game).isBlack()) {
colors.add(ObjectColor.BLACK);
}
if (permanent.getColor(game).isBlue()) {
colors.add(ObjectColor.BLUE);
}
if (permanent.getColor(game).isRed()) {
colors.add(ObjectColor.RED);
}
if (permanent.getColor(game).isGreen()) {
colors.add(ObjectColor.GREEN);
}
if (permanent.getColor(game).isWhite()) {
colors.add(ObjectColor.WHITE);
}
}
controller.drawCards(colors.size(), source.getSourceId(), game);
return true;
}
return false;
}
}

View file

@ -191,6 +191,12 @@ public final class StaticFilters {
FILTER_CARD_INSTANT_AND_SORCERY.setLockedFilter(true);
}
public static final FilterPermanentCard FILTER_CARD_PERMANENT = new FilterPermanentCard("permanent card");
static {
FILTER_CARD_PERMANENT.setLockedFilter(true);
}
public static final FilterPermanent FILTER_PERMANENT = new FilterPermanent();
static {