mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Gerrard, Weatherlight Hero
This commit is contained in:
parent
a298c82555
commit
5207db7893
2 changed files with 133 additions and 0 deletions
132
Mage.Sets/src/mage/cards/g/GerrardWeatherlightHero.java
Normal file
132
Mage.Sets/src/mage/cards/g/GerrardWeatherlightHero.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GerrardWeatherlightHero extends CardImpl {
|
||||
|
||||
public GerrardWeatherlightHero(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SOLDIER);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// First strike
|
||||
this.addAbility(FirstStrikeAbility.getInstance());
|
||||
|
||||
// When Gerrard, Weatherlight Hero dies, exile it and return to the battlefield all artifact and creature cards in your graveyard that were put there from the battlefield this turn.
|
||||
Ability ability = new DiesTriggeredAbility(new ExileSourceEffect().setText("exile it"));
|
||||
ability.addEffect(new GerrardWeatherlightHeroEffect());
|
||||
this.addAbility(ability, new GerrardWeatherlightHeroWatcher());
|
||||
}
|
||||
|
||||
private GerrardWeatherlightHero(final GerrardWeatherlightHero card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GerrardWeatherlightHero copy() {
|
||||
return new GerrardWeatherlightHero(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GerrardWeatherlightHeroEffect extends OneShotEffect {
|
||||
|
||||
GerrardWeatherlightHeroEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "and return to the battlefield all artifact and creature cards " +
|
||||
"in your graveyard that were put there from the battlefield this turn";
|
||||
}
|
||||
|
||||
private GerrardWeatherlightHeroEffect(final GerrardWeatherlightHeroEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GerrardWeatherlightHeroEffect copy() {
|
||||
return new GerrardWeatherlightHeroEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
GerrardWeatherlightHeroWatcher watcher = game.getState().getWatcher(GerrardWeatherlightHeroWatcher.class);
|
||||
if (player == null || watcher == null) {
|
||||
return false;
|
||||
}
|
||||
return player.moveCards(
|
||||
player.getGraveyard()
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(card -> watcher.checkCard(card, game))
|
||||
.collect(Collectors.toSet()),
|
||||
Zone.BATTLEFIELD, source, game
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GerrardWeatherlightHeroWatcher extends Watcher {
|
||||
|
||||
private final List<MageObjectReference> cards = new ArrayList<>();
|
||||
|
||||
GerrardWeatherlightHeroWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
private GerrardWeatherlightHeroWatcher(final GerrardWeatherlightHeroWatcher watcher) {
|
||||
super(watcher);
|
||||
this.cards.addAll(watcher.cards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).isDiesEvent()) {
|
||||
cards.add(new MageObjectReference(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
|
||||
boolean checkCard(Card card, Game game) {
|
||||
if (!card.isCreature() && !card.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
return cards.stream().anyMatch(mageObjectReference -> mageObjectReference.refersTo(card, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GerrardWeatherlightHeroWatcher copy() {
|
||||
return new GerrardWeatherlightHeroWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
cards.clear();
|
||||
}
|
||||
}
|
||||
// don’t mourn for me. this is my destiny.
|
|
@ -22,6 +22,7 @@ public final class Commander2019Edition extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Anje Falkenrath", 37, Rarity.MYTHIC, mage.cards.a.AnjeFalkenrath.class));
|
||||
cards.add(new SetCardInfo("Anje's Ravager", 22, Rarity.RARE, mage.cards.a.AnjesRavager.class));
|
||||
cards.add(new SetCardInfo("Gerrard, Weatherlight Hero", 41, Rarity.RARE, mage.cards.g.GerrardWeatherlightHero.class));
|
||||
cards.add(new SetCardInfo("Ghired's Belligerence", 25, Rarity.RARE, mage.cards.g.GhiredsBelligerence.class));
|
||||
cards.add(new SetCardInfo("Ghired, Conclave Exile", 42, Rarity.MYTHIC, mage.cards.g.GhiredConclaveExile.class));
|
||||
cards.add(new SetCardInfo("Kadena's Silencer", 8, Rarity.RARE, mage.cards.k.KadenasSilencer.class));
|
||||
|
|
Loading…
Reference in a new issue