Implemented Divine Visitation (somewhat incorrectly)

This commit is contained in:
Evan Kranzler 2018-09-18 16:21:34 -04:00
parent dffd0e7fc3
commit 847ed97848
4 changed files with 93 additions and 7 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CopyEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.AngelVigilanceToken;
/**
*
* @author TheElk801
*/
public final class DivineVisitation extends CardImpl {
public DivineVisitation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
// TODO: This implementation is not entirely correct, see https://twitter.com/EliShffrn/status/1042145606582591490
// If one or more creature tokens would be created under your control, that many 4/4 white Angel creature tokens with flying and vigilance are created instead.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new DivineVisitationEffect()
));
}
public DivineVisitation(final DivineVisitation card) {
super(card);
}
@Override
public DivineVisitation copy() {
return new DivineVisitation(this);
}
}
class DivineVisitationEffect extends ReplacementEffectImpl {
public DivineVisitationEffect() {
super(Duration.WhileOnBattlefield, Outcome.Copy, false);
staticText = "If one or more creature tokens would be created "
+ "under your control, that many 4/4 white Angel creature "
+ "tokens with flying and vigilance are created instead.";
}
public DivineVisitationEffect(DivineVisitationEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent perm = ((EntersTheBattlefieldEvent) event).getTarget();
return perm != null
&& perm.isCreature()
&& perm instanceof PermanentToken
&& perm.isControlledBy(source.getControllerId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
game.addEffect(new CopyEffect(Duration.Custom, new AngelVigilanceToken(), event.getTargetId()), source);
return false;
}
@Override
public DivineVisitationEffect copy() {
return new DivineVisitationEffect(this);
}
}

View file

@ -20,7 +20,7 @@ import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.permanent.token.AngelToken2;
import mage.game.permanent.token.AngelVigilanceToken;
import mage.watchers.common.PlayerGainedLifeWatcher;
/**
@ -42,7 +42,7 @@ public final class ResplendentAngel extends CardImpl {
// At the beginning of each end step, if you gained 5 or more life this turn, create a 4/4 white Angel creature token with flying and vigilance.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
Zone.BATTLEFIELD,
new CreateTokenEffect(new AngelToken2()),
new CreateTokenEffect(new AngelVigilanceToken()),
TargetController.ANY,
new YouGainedLifeCondition(ComparisonType.MORE_THAN, 4),
false

View file

@ -68,6 +68,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
cards.add(new SetCardInfo("Disdainful Stroke", 37, Rarity.COMMON, mage.cards.d.DisdainfulStroke.class));
cards.add(new SetCardInfo("Disinformation Campaign", 167, Rarity.UNCOMMON, mage.cards.d.DisinformationCampaign.class));
cards.add(new SetCardInfo("District Guide", 128, Rarity.UNCOMMON, mage.cards.d.DistrictGuide.class));
cards.add(new SetCardInfo("Divine Visitation", 10, Rarity.MYTHIC, mage.cards.d.DivineVisitation.class));
cards.add(new SetCardInfo("Doom Whisperer", 69, Rarity.MYTHIC, mage.cards.d.DoomWhisperer.class));
cards.add(new SetCardInfo("Dream Eater", 38, Rarity.MYTHIC, mage.cards.d.DreamEater.class));
cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class));