Implemented Sphinx of the Guildpact

This commit is contained in:
Evan Kranzler 2019-01-10 18:29:43 -05:00
parent d5003a6f8f
commit 7a89d22880
4 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,51 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HexproofFromMonocoloredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SphinxOfTheGuildpact extends CardImpl {
public SphinxOfTheGuildpact(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}");
this.subtype.add(SubType.SPHINX);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Sphinx of the Guildpact is all colors.
this.color.setWhite(true);
this.color.setBlue(true);
this.color.setBlack(true);
this.color.setRed(true);
this.color.setGreen(true);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("{this} is all colors")));
// Flying
this.addAbility(FlyingAbility.getInstance());
// Hexproof from mono colored
this.addAbility(HexproofFromMonocoloredAbility.getInstance());
}
private SphinxOfTheGuildpact(final SphinxOfTheGuildpact card) {
super(card);
}
@Override
public SphinxOfTheGuildpact copy() {
return new SphinxOfTheGuildpact(this);
}
}

View file

@ -176,6 +176,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Spawn of Mayhem", 85, Rarity.MYTHIC, mage.cards.s.SpawnOfMayhem.class));
cards.add(new SetCardInfo("Sphinx of Foresight", 55, Rarity.RARE, mage.cards.s.SphinxOfForesight.class));
cards.add(new SetCardInfo("Sphinx of New Prahv", 208, Rarity.UNCOMMON, mage.cards.s.SphinxOfNewPrahv.class));
cards.add(new SetCardInfo("Sphinx of the Guildpact", 241, Rarity.UNCOMMON, mage.cards.s.SphinxOfTheGuildpact.class));
cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class));
cards.add(new SetCardInfo("Spirit of the Spires", 23, Rarity.UNCOMMON, mage.cards.s.SpiritOfTheSpires.class));
cards.add(new SetCardInfo("Stomping Ground", 259, Rarity.RARE, mage.cards.s.StompingGround.class));

View file

@ -0,0 +1,44 @@
package mage.abilities.keyword;
import mage.abilities.MageSingleton;
import mage.abilities.common.SimpleStaticAbility;
import mage.constants.Zone;
import java.io.ObjectStreamException;
/**
* Hexproof from Monocolored (This creature or player can't be the target of monocolored
* spells or abilities your opponents control.)
*
* @author TheElk801
*/
public class HexproofFromMonocoloredAbility extends SimpleStaticAbility implements MageSingleton {
private static final HexproofFromMonocoloredAbility instance;
static {
instance = new HexproofFromMonocoloredAbility();
}
private Object readResolve() throws ObjectStreamException {
return instance;
}
public static HexproofFromMonocoloredAbility getInstance() {
return instance;
}
private HexproofFromMonocoloredAbility() {
super(Zone.BATTLEFIELD, null);
}
@Override
public HexproofFromMonocoloredAbility copy() {
return instance;
}
@Override
public String getRule() {
return "hexproof from monocolored <i>(This creature can't be the target of monocolored spells or abilities your opponents control.)</i>";
}
}

View file

@ -956,6 +956,14 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
}
if (abilities.containsKey(HexproofFromMonocoloredAbility.getInstance().getId())) {
if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game)
&& null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)
&& !source.getColor(game).isColorless() && !source.getColor(game).isMulticolored()) {
return false;
}
}
if (hasProtectionFrom(source, game)) {
return false;
}