mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
- Fixed #8144. Text is the bane of my existence. I hope some kind soul can fix it on this card so I don't throw myself out a window. Pic will be attached. Card works fine, though.
This commit is contained in:
parent
bdeb0dde66
commit
fdc24c20da
1 changed files with 57 additions and 87 deletions
|
|
@ -1,14 +1,8 @@
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
|
||||||
import mage.abilities.condition.Condition;
|
|
||||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.costs.Costs;
|
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
@ -21,9 +15,18 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.Mana;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.decorator.ConditionalAsThoughEffect;
|
||||||
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
|
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
|
||||||
public class GlimpseTheCosmos extends CardImpl {
|
public class GlimpseTheCosmos extends CardImpl {
|
||||||
|
|
||||||
|
|
@ -35,11 +38,17 @@ public class GlimpseTheCosmos extends CardImpl {
|
||||||
StaticValue.get(3), false, StaticValue.get(1),
|
StaticValue.get(3), false, StaticValue.get(1),
|
||||||
StaticFilters.FILTER_CARD, Zone.LIBRARY, false,
|
StaticFilters.FILTER_CARD, Zone.LIBRARY, false,
|
||||||
false, false, Zone.HAND, false
|
false, false, Zone.HAND, false
|
||||||
).setText("look at the top three cards of your library. " +
|
).setText("look at the top three cards of your library. "
|
||||||
"Put one of them into your hand and the rest on the bottom of your library in any order"));
|
+ "Put one of them into your hand and the rest on the bottom of your library in any order"));
|
||||||
|
|
||||||
//As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead.
|
//As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead.
|
||||||
this.addAbility(new GlimpseTheCosmosAbility(new ManaCostsImpl("{U}")));
|
this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD,
|
||||||
|
new ConditionalAsThoughEffect(
|
||||||
|
new GlimpseTheCosmosPlayEffect(),
|
||||||
|
new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(SubType.GIANT)))));
|
||||||
|
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.ALL, new GlimpseTheCosmosReplacementEffect()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GlimpseTheCosmos(final GlimpseTheCosmos card) {
|
private GlimpseTheCosmos(final GlimpseTheCosmos card) {
|
||||||
|
|
@ -53,88 +62,40 @@ public class GlimpseTheCosmos extends CardImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GlimpseTheCosmosAbility extends SpellAbility {
|
class GlimpseTheCosmosPlayEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
private String abilityName;
|
public GlimpseTheCosmosPlayEffect() {
|
||||||
private SpellAbility spellAbilityToResolve;
|
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
|
||||||
|
staticText = "As long as you control a Giant, you may cast {this} from your graveyard by paying {U} rather than paying its mana cost";
|
||||||
public GlimpseTheCosmosAbility(Cost cost) {
|
|
||||||
super(null, "", Zone.GRAVEYARD, SpellAbilityType.BASE_ALTERNATE, SpellAbilityCastMode.NORMAL);
|
|
||||||
this.setAdditionalCostsRuleVisible(false);
|
|
||||||
this.addCost(cost);
|
|
||||||
this.timing = TimingRule.SORCERY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlimpseTheCosmosAbility(final GlimpseTheCosmosAbility ability) {
|
public GlimpseTheCosmosPlayEffect(final GlimpseTheCosmosPlayEffect effect) {
|
||||||
super(ability);
|
super(effect);
|
||||||
this.spellAbilityType = ability.spellAbilityType;
|
|
||||||
this.abilityName = ability.abilityName;
|
|
||||||
this.spellAbilityToResolve = ability.spellAbilityToResolve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(getSourceId());
|
return true;
|
||||||
if (card != null) {
|
|
||||||
// Card must be in the graveyard zone
|
|
||||||
if (game.getState().getZone(card.getId()) != Zone.GRAVEYARD) {
|
|
||||||
return ActivationStatus.getFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Must control a giant
|
|
||||||
Condition controlGiantCondition = new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(SubType.GIANT, "you control a Giant"));
|
|
||||||
if (!controlGiantCondition.apply(game, this)) {
|
|
||||||
return ActivationStatus.getFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
return card.getSpellAbility().canActivate(playerId, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ActivationStatus.getFalse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpellAbility getSpellAbilityToResolve(Game game) {
|
public GlimpseTheCosmosPlayEffect copy() {
|
||||||
Card card = game.getCard(getSourceId());
|
return new GlimpseTheCosmosPlayEffect(this);
|
||||||
if (card != null) {
|
|
||||||
if (spellAbilityToResolve == null) {
|
|
||||||
SpellAbility spellAbilityCopy = card.getSpellAbility().copy();
|
|
||||||
spellAbilityCopy.setId(this.getId());
|
|
||||||
spellAbilityCopy.getManaCosts().clear();
|
|
||||||
spellAbilityCopy.getManaCostsToPay().clear();
|
|
||||||
spellAbilityCopy.getCosts().addAll(this.getCosts().copy());
|
|
||||||
spellAbilityCopy.addCost(this.getManaCosts().copy());
|
|
||||||
spellAbilityCopy.setSpellAbilityCastMode(this.getSpellAbilityCastMode());
|
|
||||||
spellAbilityToResolve = spellAbilityCopy;
|
|
||||||
ContinuousEffect effect = new GlimpseTheCosmosReplacementEffect();
|
|
||||||
effect.setTargetPointer(new FixedTarget(getSourceId(), game.getState().getZoneChangeCounter(getSourceId())));
|
|
||||||
game.addEffect(effect, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return spellAbilityToResolve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Costs<Cost> getCosts() {
|
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (spellAbilityToResolve == null) {
|
if (sourceId.equals(source.getSourceId())
|
||||||
return super.getCosts();
|
&& source.isControlledBy(affectedControllerId)) {
|
||||||
|
if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
|
||||||
|
Player controller = game.getPlayer(affectedControllerId);
|
||||||
|
if (controller != null) {
|
||||||
|
controller.setCastSourceIdWithAlternateMana(sourceId, new ManaCostsImpl<>("{U}"), null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return spellAbilityToResolve.getCosts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public GlimpseTheCosmosAbility copy() {
|
|
||||||
return new GlimpseTheCosmosAbility(this);
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
@Override
|
|
||||||
public String getRule(boolean all) {
|
|
||||||
return this.getRule();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "As long as you control a Giant, you may cast Glimpse the Cosmos from your graveyard by paying {U} rather than paying its mana cost. If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +104,7 @@ class GlimpseTheCosmosReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
public GlimpseTheCosmosReplacementEffect() {
|
public GlimpseTheCosmosReplacementEffect() {
|
||||||
super(Duration.OneUse, Outcome.Exile);
|
super(Duration.OneUse, Outcome.Exile);
|
||||||
staticText = "If you cast Glimpse the Cosmos this way and it would be put into your graveyard, exile it instead";
|
staticText = "If you cast {this} this way and it would be put into your graveyard, exile it instead";
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlimpseTheCosmosReplacementEffect(final GlimpseTheCosmosReplacementEffect effect) {
|
public GlimpseTheCosmosReplacementEffect(final GlimpseTheCosmosReplacementEffect effect) {
|
||||||
|
|
@ -181,10 +142,19 @@ class GlimpseTheCosmosReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class);
|
||||||
|
if (watcher == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Mana payment = watcher.getAndResetLastPayment(source.getSourceId());
|
||||||
|
if (payment != null
|
||||||
|
&& payment.getBlue() == 1 // most be blue mana
|
||||||
|
&& payment.count() == 1) { // must be just one
|
||||||
if (event.getTargetId().equals(source.getSourceId())
|
if (event.getTargetId().equals(source.getSourceId())
|
||||||
&& ((ZoneChangeEvent) event).getFromZone() == Zone.STACK
|
&& ((ZoneChangeEvent) event).getFromZone() == Zone.STACK
|
||||||
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
|
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
|
||||||
return game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter() + 1;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue