mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[WHO] Implement Regenerations Restored (#11312)
This commit is contained in:
parent
06dc5be2d8
commit
dd1852352a
4 changed files with 133 additions and 4 deletions
122
Mage.Sets/src/mage/cards/r/RegenerationsRestored.java
Normal file
122
Mage.Sets/src/mage/cards/r/RegenerationsRestored.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.abilities.keyword.VanishingSacrificeAbility;
|
||||
import mage.abilities.keyword.VanishingUpkeepAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class RegenerationsRestored extends CardImpl {
|
||||
|
||||
public RegenerationsRestored(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}{U}");
|
||||
|
||||
// Vanishing 12
|
||||
Ability ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(12)));
|
||||
ability.setRuleVisible(false);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new VanishingUpkeepAbility(12));
|
||||
this.addAbility(new VanishingSacrificeAbility());
|
||||
|
||||
// Whenever one or more time counters are removed from Regenerations Restored, scry 1 and you gain 1 life. Then if Regenerations Restored has no time counters on it, exile it. When you do, take an extra turn after this one.
|
||||
this.addAbility(new RegenerationsRestoredTriggeredAbility());
|
||||
}
|
||||
|
||||
private RegenerationsRestored(final RegenerationsRestored card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegenerationsRestored copy() {
|
||||
return new RegenerationsRestored(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RegenerationsRestoredTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
RegenerationsRestoredTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ScryEffect(1, false));
|
||||
this.addEffect(new GainLifeEffect(1).concatBy("and"));
|
||||
|
||||
this.addEffect(new ConditionalOneShotEffect(
|
||||
new RegenerationsRestoredEffect(),
|
||||
new SourceHasCounterCondition(CounterType.TIME, 0, 0)
|
||||
).concatBy("Then"));
|
||||
|
||||
this.setTriggerPhrase("Whenever one or more time counters are removed from {this}, ");
|
||||
}
|
||||
|
||||
private RegenerationsRestoredTriggeredAbility(final RegenerationsRestoredTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.COUNTERS_REMOVED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getAmount() > 0
|
||||
&& event.getData().equals(CounterType.TIME.getName())
|
||||
&& event.getTargetId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegenerationsRestoredTriggeredAbility copy() {
|
||||
return new RegenerationsRestoredTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RegenerationsRestoredEffect extends OneShotEffect {
|
||||
|
||||
RegenerationsRestoredEffect() {
|
||||
super(Outcome.ExtraTurn);
|
||||
staticText = "exile it. When you do, take an extra turn after this one";
|
||||
}
|
||||
|
||||
private RegenerationsRestoredEffect(final RegenerationsRestoredEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegenerationsRestoredEffect copy() {
|
||||
return new RegenerationsRestoredEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (new ExileSourceEffect().apply(game, source)) {
|
||||
game.fireReflexiveTriggeredAbility(
|
||||
new ReflexiveTriggeredAbility(new AddExtraTurnControllerEffect(), false)
|
||||
.setTriggerPhrase("When you do, "),
|
||||
source
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -145,6 +145,7 @@ public final class DoctorWho extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Propaganda", 219, Rarity.UNCOMMON, mage.cards.p.Propaganda.class));
|
||||
cards.add(new SetCardInfo("Quantum Misalignment", 52, Rarity.RARE, mage.cards.q.QuantumMisalignment.class));
|
||||
cards.add(new SetCardInfo("RMS Titanic", 93, Rarity.RARE, mage.cards.r.RMSTitanic.class));
|
||||
cards.add(new SetCardInfo("Regenerations Restored", 151, Rarity.RARE, mage.cards.r.RegenerationsRestored.class));
|
||||
cards.add(new SetCardInfo("Reliquary Tower", 296, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class));
|
||||
cards.add(new SetCardInfo("Renegade Silent", 53, Rarity.UNCOMMON, mage.cards.r.RenegadeSilent.class));
|
||||
cards.add(new SetCardInfo("Return to Dust", 211, Rarity.UNCOMMON, mage.cards.r.ReturnToDust.class));
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility {
|
|||
return condition == null || condition.apply(game, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflexiveTriggeredAbility setTriggerPhrase(String triggerPhrase) {
|
||||
super.setTriggerPhrase(triggerPhrase);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflexiveTriggeredAbility copy() {
|
||||
return new ReflexiveTriggeredAbility(this);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -13,6 +11,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -53,7 +53,7 @@ public class ExileSourceEffect extends OneShotEffect {
|
|||
if (sourceObject instanceof Card) {
|
||||
if (sourceObject instanceof Permanent) {
|
||||
if (!((Permanent) sourceObject).isPhasedIn()) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
UUID exileZoneId = null;
|
||||
|
|
@ -65,7 +65,7 @@ public class ExileSourceEffect extends OneShotEffect {
|
|||
Card sourceCard = (Card) sourceObject;
|
||||
return controller.moveCardsToExile(sourceCard, source, game, true, exileZoneId, exileZoneName);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue