mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Implemented Barrin, Tolarian Archmage
This commit is contained in:
parent
8356b3392d
commit
0af261aeb3
2 changed files with 112 additions and 0 deletions
111
Mage.Sets/src/mage/cards/b/BarrinTolarianArchmage.java
Normal file
111
Mage.Sets/src/mage/cards/b/BarrinTolarianArchmage.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BarrinTolarianArchmage extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterCreatureOrPlaneswalkerPermanent("other target creature or planeswalker");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public BarrinTolarianArchmage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// When Barrin, Tolarian Archmage enters the battlefield, return up to one other target creature or planeswalker to its owner's hand.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
|
||||
ability.addTarget(new TargetPermanent(0, 1, filter, false));
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of your end step, if a permanent was put into your hand from the battlefield this turn, draw a card.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfEndStepTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), TargetController.YOU, false
|
||||
), BarrinTolarianArchmageCondition.instance, "At the beginning of your end step, " +
|
||||
"if a permanent was put into your hand from the battlefield this turn, draw a card."
|
||||
), new BarrinTolarianArchmageWatcher());
|
||||
}
|
||||
|
||||
private BarrinTolarianArchmage(final BarrinTolarianArchmage card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BarrinTolarianArchmage copy() {
|
||||
return new BarrinTolarianArchmage(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BarrinTolarianArchmageCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
BarrinTolarianArchmageWatcher watcher = game.getState().getWatcher(BarrinTolarianArchmageWatcher.class);
|
||||
return watcher != null && watcher.checkPlayer(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
class BarrinTolarianArchmageWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> playerSet = new HashSet<>();
|
||||
|
||||
BarrinTolarianArchmageWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.ZONE_CHANGE) {
|
||||
return;
|
||||
}
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.HAND) {
|
||||
playerSet.add(zEvent.getTarget().getOwnerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
playerSet.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
boolean checkPlayer(UUID playerId) {
|
||||
return playerSet.contains(playerId);
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ public final class CoreSet2021 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Azusa, Lost but Seeking", 173, Rarity.RARE, mage.cards.a.AzusaLostButSeeking.class));
|
||||
cards.add(new SetCardInfo("Bad Deal", 89, Rarity.UNCOMMON, mage.cards.b.BadDeal.class));
|
||||
cards.add(new SetCardInfo("Baneslayer Angel", 6, Rarity.MYTHIC, mage.cards.b.BaneslayerAngel.class));
|
||||
cards.add(new SetCardInfo("Barrin, Tolarian Archmage", 45, Rarity.RARE, mage.cards.b.BarrinTolarianArchmage.class));
|
||||
cards.add(new SetCardInfo("Basri Ket", 7, Rarity.MYTHIC, mage.cards.b.BasriKet.class));
|
||||
cards.add(new SetCardInfo("Basri's Acolyte", 8, Rarity.COMMON, mage.cards.b.BasrisAcolyte.class));
|
||||
cards.add(new SetCardInfo("Basri's Aegis", 322, Rarity.RARE, mage.cards.b.BasrisAegis.class));
|
||||
|
|
Loading…
Reference in a new issue