mirror of
https://github.com/correl/mage.git
synced 2025-04-13 09:11:06 -09:00
[WWK] reworked Quest for Ula's Temple
This commit is contained in:
parent
cb6498e0d7
commit
5fec1148c8
1 changed files with 52 additions and 66 deletions
|
@ -1,47 +1,59 @@
|
||||||
|
|
||||||
package mage.cards.q;
|
package mage.cards.q;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public final class QuestForUlasTemple extends CardImpl {
|
public final class QuestForUlasTemple extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter
|
||||||
|
= new FilterCreatureCard("Kraken, Leviathan, Octopus, or Serpent creature card");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
SubType.KRAKEN.getPredicate(),
|
||||||
|
SubType.LEVIATHAN.getPredicate(),
|
||||||
|
SubType.OCTOPUS.getPredicate(),
|
||||||
|
SubType.SERPENT.getPredicate()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, 3);
|
||||||
|
|
||||||
public QuestForUlasTemple(UUID ownerId, CardSetInfo setInfo) {
|
public QuestForUlasTemple(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
|
||||||
|
|
||||||
// At the beginning of your upkeep, you may look at the top card of your library. If it's a creature card, you may reveal it and put a quest counter on Quest for Ula's Temple.
|
// At the beginning of your upkeep, you may look at the top card of your library. If it's a creature card, you may reveal it and put a quest counter on Quest for Ula's Temple.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuestForUlasTempleEffect(), TargetController.YOU, true));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||||
|
new QuestForUlasTempleEffect(), TargetController.YOU, true
|
||||||
|
));
|
||||||
|
|
||||||
// At the beginning of each end step, if there are three or more quest counters on Quest for Ula's Temple, you may put a Kraken, Leviathan, Octopus, or Serpent creature card from your hand onto the battlefield.
|
// At the beginning of each end step, if there are three or more quest counters on Quest for Ula's Temple, you may put a Kraken, Leviathan, Octopus, or Serpent creature card from your hand onto the battlefield.
|
||||||
FilterCreatureCard filter = new FilterCreatureCard("Kraken, Leviathan, Octopus, or Serpent creature card");
|
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||||
filter.add(Predicates.or(
|
Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(filter),
|
||||||
SubType.KRAKEN.getPredicate(),
|
TargetController.ANY, condition, false
|
||||||
SubType.LEVIATHAN.getPredicate(),
|
));
|
||||||
SubType.OCTOPUS.getPredicate(),
|
|
||||||
SubType.SERPENT.getPredicate()));
|
|
||||||
this.addAbility(new QuestForUlasTempleTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(filter)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private QuestForUlasTemple(final QuestForUlasTemple card) {
|
private QuestForUlasTemple(final QuestForUlasTemple card) {
|
||||||
|
@ -56,12 +68,13 @@ public final class QuestForUlasTemple extends CardImpl {
|
||||||
|
|
||||||
class QuestForUlasTempleEffect extends OneShotEffect {
|
class QuestForUlasTempleEffect extends OneShotEffect {
|
||||||
|
|
||||||
public QuestForUlasTempleEffect() {
|
QuestForUlasTempleEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.staticText = "you may look at the top card of your library. If it's a creature card, you may reveal it and put a quest counter on {this}";
|
this.staticText = "you may look at the top card of your library. " +
|
||||||
|
"If it's a creature card, you may reveal it and put a quest counter on {this}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestForUlasTempleEffect(final QuestForUlasTempleEffect effect) {
|
private QuestForUlasTempleEffect(final QuestForUlasTempleEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,54 +86,27 @@ class QuestForUlasTempleEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
if (controller == null) {
|
||||||
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
|
return false;
|
||||||
Card card = controller.getLibrary().getFromTop(game);
|
|
||||||
Cards cards = new CardsImpl(card);
|
|
||||||
controller.lookAtCards(sourcePermanent.getName(), cards, game);
|
|
||||||
if (card.isCreature(game)) {
|
|
||||||
if (controller.chooseUse(Outcome.DrawCard, "Reveal the top card of your library?", source, game)) {
|
|
||||||
controller.revealCards(sourcePermanent.getName(), cards, game);
|
|
||||||
Permanent questForUlasTemple = game.getPermanent(source.getSourceId());
|
|
||||||
if (questForUlasTemple != null) {
|
|
||||||
questForUlasTemple.addCounters(CounterType.QUEST.createInstance(), source.getControllerId(), source, game);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
}
|
if (card == null) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl {
|
controller.lookAtCards("Top of library", card, game);
|
||||||
|
if (!card.isCreature(game) || !controller.chooseUse(
|
||||||
public QuestForUlasTempleTriggeredAbility(Effect effect) {
|
Outcome.DrawCard, "Reveal the top card of your library?", source, game
|
||||||
super(Zone.BATTLEFIELD, effect, true);
|
)) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public QuestForUlasTempleTriggeredAbility(final QuestForUlasTempleTriggeredAbility ability) {
|
controller.revealCards(source, new CardsImpl(card), game);
|
||||||
super(ability);
|
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
}
|
if (permanent != null) {
|
||||||
|
permanent.addCounters(
|
||||||
@Override
|
CounterType.QUEST.createInstance(),
|
||||||
public QuestForUlasTempleTriggeredAbility copy() {
|
source.getControllerId(), source, game
|
||||||
return new QuestForUlasTempleTriggeredAbility(this);
|
);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
@Override
|
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
|
||||||
return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
|
||||||
Permanent quest = game.getPermanent(super.getSourceId());
|
|
||||||
return quest != null && quest.getCounters(game).getCount(CounterType.QUEST) >= 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTriggerPhrase() {
|
|
||||||
return "At the beginning of each end step, if there are three or more quest counters on {this}, " ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue