Implemented Verity Circle

This commit is contained in:
Evan Kranzler 2019-01-04 20:58:02 -05:00
parent a0a77a4b65
commit fd709bcd28
5 changed files with 84 additions and 2 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.v;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VerityCircle extends CardImpl {
public VerityCircle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// Whenever a creature an opponent controls becomes tapped, if it isn't being declared as an attacker, you may draw a card.
this.addAbility(new VerityCircleTriggeredAbility());
}
private VerityCircle(final VerityCircle card) {
super(card);
}
@Override
public VerityCircle copy() {
return new VerityCircle(this);
}
}
class VerityCircleTriggeredAbility extends TriggeredAbilityImpl {
VerityCircleTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true);
}
private VerityCircleTriggeredAbility(final VerityCircleTriggeredAbility ability) {
super(ability);
}
@Override
public VerityCircleTriggeredAbility copy() {
return new VerityCircleTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getFlag()) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
Player player = game.getPlayer(controllerId);
return permanent != null && player != null && permanent.isCreature()
&& player.hasOpponent(permanent.getControllerId(), game);
}
@Override
public String getRule() {
return "Whenever a creature an opponent controls becomes tapped, " +
"if it isn't being declared as an attacker, you may draw a card.";
}
}

View file

@ -114,6 +114,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("The Haunt of Hightower", 273, Rarity.MYTHIC, mage.cards.t.TheHauntOfHightower.class));
cards.add(new SetCardInfo("Titanic Brawl", 146, Rarity.COMMON, mage.cards.t.TitanicBrawl.class));
cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class));
cards.add(new SetCardInfo("Verity Circle", 58, Rarity.RARE, mage.cards.v.VerityCircle.class));
cards.add(new SetCardInfo("Wilderness Reclamation", 149, Rarity.UNCOMMON, mage.cards.w.WildernessReclamation.class));
cards.add(new SetCardInfo("Zegana, Utopian Speaker", 214, Rarity.RARE, mage.cards.z.ZeganaUtopianSpeaker.class));
cards.add(new SetCardInfo("Zhur-Taa Goblin", 215, Rarity.UNCOMMON, mage.cards.z.ZhurTaaGoblin.class));

View file

@ -275,7 +275,7 @@ public class Combat implements Serializable, Copyable<Combat> {
Permanent attackingPermanent = game.getPermanent(attacker);
if (attackingPermanent != null) {
attackingPermanent.setTapped(false);
attackingPermanent.tap(game); // to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards
attackingPermanent.tap(true,game); // to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards
}
}
handleBanding(attacker, game);

View file

@ -25,6 +25,8 @@ public interface Permanent extends Card, Controllable {
boolean tap(Game game);
boolean tap(boolean forCombat, Game game);
/**
* use tap(game)
* <p>

View file

@ -390,11 +390,16 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean tap(Game game) {
return tap(false, game);
}
@Override
public boolean tap(boolean forCombat, Game game) {
//20091005 - 701.15a
if (!tapped) {
if (!replaceEvent(EventType.TAP, game)) {
this.tapped = true;
fireEvent(EventType.TAPPED, game);
game.fireEvent(new GameEvent(EventType.TAPPED, objectId, ownerId, controllerId, 0, forCombat));
return true;
}
}