Merge remote-tracking branch 'origin/master'

This commit is contained in:
Oleg Agafonov 2019-04-19 18:57:54 +04:00
commit 841ae27e82
3 changed files with 148 additions and 0 deletions

View file

@ -0,0 +1,37 @@
package mage.cards.n;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class NarsetsReversal extends CardImpl {
public NarsetsReversal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{U}");
// Copy target instant or sorcery spell, then return it to its owner's hand. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new CopyTargetSpellEffect()
.setText("Copy target instant or sorcery spell,"));
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()
.setText("then return it to its owner's hand. You may choose new targets for the copy."));
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY));
}
private NarsetsReversal(final NarsetsReversal card) {
super(card);
}
@Override
public NarsetsReversal copy() {
return new NarsetsReversal(this);
}
}

View file

@ -0,0 +1,109 @@
package mage.cards.o;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetAnyTarget;
import mage.target.targetpointer.FixedTarget;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class OathOfKaya extends CardImpl {
public OathOfKaya(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{B}");
this.addSuperType(SuperType.LEGENDARY);
// When Oath of Kaya enters the battlefield, it deals 3 damage to any target and you gain 3 life.
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(3, "it"));
ability.addEffect(new GainLifeEffect(3).concatBy("and"));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// Whenever an opponent attacks a planeswalker you control with one or more creatures, Oath of Kaya deals 2 damage to that player and you gain 2 life.
this.addAbility(new OathOfKayaTriggeredAbility());
}
private OathOfKaya(final OathOfKaya card) {
super(card);
}
@Override
public OathOfKaya copy() {
return new OathOfKaya(this);
}
}
class OathOfKayaTriggeredAbility extends TriggeredAbilityImpl {
private final Set<UUID> attackedThisCombat = new HashSet();
OathOfKayaTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
}
private OathOfKayaTriggeredAbility(final OathOfKayaTriggeredAbility ability) {
super(ability);
this.attackedThisCombat.addAll(ability.attackedThisCombat);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED
|| event.getType() == GameEvent.EventType.DECLARE_ATTACKERS_STEP_POST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKERS_STEP_POST) {
this.attackedThisCombat.clear();
return false;
}
for (UUID attackerId : game.getCombat().getAttackers()) {
Permanent attacker = game.getPermanent(attackerId);
if (attacker == null) {
continue;
}
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(attackerId, game);
UUID defenderId = game.getCombat().getDefenderId(attackerId);
if (defendingPlayerId.equals(defenderId) || attackedThisCombat.contains(defenderId)) {
continue;
}
attackedThisCombat.add(defenderId);
this.getEffects().clear();
Effect effect = new DamageTargetEffect(2);
effect.setTargetPointer(new FixedTarget(defendingPlayerId, game));
this.addEffect(effect);
this.addEffect(new GainLifeEffect(2));
return true;
}
return false;
}
@Override
public OathOfKayaTriggeredAbility copy() {
return new OathOfKayaTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever an opponent attacks a planeswalker you control with one or more creatures, " +
"{this} deals 2 damage to that player and you gain 2 life.";
}
}

View file

@ -188,6 +188,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Naga Eternal", 60, Rarity.COMMON, mage.cards.n.NagaEternal.class));
cards.add(new SetCardInfo("Nahiri's Stoneblades", 139, Rarity.COMMON, mage.cards.n.NahirisStoneblades.class));
cards.add(new SetCardInfo("Nahiri, Storm of Stone", 233, Rarity.UNCOMMON, mage.cards.n.NahiriStormOfStone.class));
cards.add(new SetCardInfo("Narset's Reversal", 62, Rarity.RARE, mage.cards.n.NarsetsReversal.class));
cards.add(new SetCardInfo("Narset, Parter of Veils", 61, Rarity.UNCOMMON, mage.cards.n.NarsetParterOfVeils.class));
cards.add(new SetCardInfo("Neheb, Dreadhorde Champion", 140, Rarity.RARE, mage.cards.n.NehebDreadhordeChampion.class));
cards.add(new SetCardInfo("Neoform", 206, Rarity.UNCOMMON, mage.cards.n.Neoform.class));
@ -197,6 +198,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Nissa, Who Shakes the World", 169, Rarity.RARE, mage.cards.n.NissaWhoShakesTheWorld.class));
cards.add(new SetCardInfo("Niv-Mizzet Reborn", 208, Rarity.MYTHIC, mage.cards.n.NivMizzetReborn.class));
cards.add(new SetCardInfo("No Escape", 63, Rarity.COMMON, mage.cards.n.NoEscape.class));
cards.add(new SetCardInfo("Oath of Kaya", 209, Rarity.RARE, mage.cards.o.OathOfKaya.class));
cards.add(new SetCardInfo("Ob Nixilis's Cruelty", 101, Rarity.COMMON, mage.cards.o.ObNixilissCruelty.class));
cards.add(new SetCardInfo("Ob Nixilis, the Hate-Twisted", 100, Rarity.UNCOMMON, mage.cards.o.ObNixilisTheHateTwisted.class));
cards.add(new SetCardInfo("Orzhov Guildgate", 269, Rarity.COMMON, mage.cards.o.OrzhovGuildgate.class));