mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
[MH2] Implemented Serra's Emissary
This commit is contained in:
parent
917b63cc00
commit
69235e4721
2 changed files with 91 additions and 0 deletions
90
Mage.Sets/src/mage/cards/s/SerrasEmissary.java
Normal file
90
Mage.Sets/src/mage/cards/s/SerrasEmissary.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseCardTypeEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SerrasEmissary extends CardImpl {
|
||||
|
||||
public SerrasEmissary(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}{W}");
|
||||
|
||||
this.subtype.add(SubType.ANGEL);
|
||||
this.power = new MageInt(7);
|
||||
this.toughness = new MageInt(7);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// As Serra's Emissary enters the battlefield, choose a card type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCardTypeEffect(Outcome.Benefit)));
|
||||
|
||||
// You and creatures you control have protection from the chosen card type.
|
||||
this.addAbility(new SimpleStaticAbility(new SerrasEmissaryEffect()));
|
||||
}
|
||||
|
||||
private SerrasEmissary(final SerrasEmissary card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerrasEmissary copy() {
|
||||
return new SerrasEmissary(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SerrasEmissaryEffect extends ContinuousEffectImpl {
|
||||
|
||||
SerrasEmissaryEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
staticText = "you and creatures you control have protection from the chosen card type";
|
||||
}
|
||||
|
||||
private SerrasEmissaryEffect(final SerrasEmissaryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Object savedType = game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (controller == null || !(savedType instanceof CardType)) {
|
||||
return false;
|
||||
}
|
||||
CardType cardType = ((CardType) savedType);
|
||||
FilterCard filter = new FilterCard(cardType + "s");
|
||||
filter.add(cardType.getPredicate());
|
||||
Ability ability = new ProtectionAbility(filter);
|
||||
controller.addAbility(ability);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||
source.getControllerId(), source.getSourceId(), game
|
||||
)) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerrasEmissaryEffect copy() {
|
||||
return new SerrasEmissaryEffect(this);
|
||||
}
|
||||
}
|
|
@ -239,6 +239,7 @@ public final class ModernHorizons2 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Seal of Cleansing", 264, Rarity.UNCOMMON, mage.cards.s.SealOfCleansing.class));
|
||||
cards.add(new SetCardInfo("Seal of Removal", 269, Rarity.UNCOMMON, mage.cards.s.SealOfRemoval.class));
|
||||
cards.add(new SetCardInfo("Search the Premises", 29, Rarity.RARE, mage.cards.s.SearchThePremises.class));
|
||||
cards.add(new SetCardInfo("Serra's Emissary", 30, Rarity.MYTHIC, mage.cards.s.SerrasEmissary.class));
|
||||
cards.add(new SetCardInfo("Shardless Agent", 292, Rarity.RARE, mage.cards.s.ShardlessAgent.class));
|
||||
cards.add(new SetCardInfo("Shattered Ego", 62, Rarity.COMMON, mage.cards.s.ShatteredEgo.class));
|
||||
cards.add(new SetCardInfo("Silverbluff Bridge", 255, Rarity.COMMON, mage.cards.s.SilverbluffBridge.class));
|
||||
|
|
Loading…
Reference in a new issue