- Added Seraph and Chaos Lord

This commit is contained in:
Jeff 2019-01-17 09:09:49 -06:00
parent 3b47dce117
commit 9b782ec16c
5 changed files with 529 additions and 221 deletions

View file

@ -0,0 +1,163 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.ControlsPermanentsComparedToOpponentsCondition;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.SubType;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author jeffwadsworth
*/
public final class ChaosLord extends CardImpl {
public ChaosLord(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}{R}");
this.subtype.add(SubType.HUMAN);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// At the beginning of your upkeep, target opponent gains control of Chaos Lord if the number of permanents is even.
Ability ability = new ChaosLordTriggeredAbility();
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
// Chaos Lord can attack as though it had haste unless it entered the battlefield this turn.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new ChaosLordEffect()));
}
private ChaosLord(final ChaosLord card) {
super(card);
}
@Override
public ChaosLord copy() {
return new ChaosLord(this);
}
}
class ChaosLordTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
public ChaosLordTriggeredAbility() {
super(Zone.BATTLEFIELD,
new GainControlSourceEffect(),
TargetController.YOU,
false);
}
public ChaosLordTriggeredAbility(ChaosLordTriggeredAbility ability) {
super(ability);
}
@Override
public BeginningOfUpkeepTriggeredAbility copy() {
return new ChaosLordTriggeredAbility(this);
}
@Override
public boolean checkInterveningIfClause(Game game) {
Condition condition = new ControlsPermanentsComparedToOpponentsCondition(
ComparisonType.EQUAL_TO,
new FilterPermanent());
Player controller = game.getPlayer(controllerId);
if (controller != null
&& condition.apply(game, this)) {
return super.checkInterveningIfClause(game);
}
return false;
}
@Override
public String getRule() {
return "At the beginning of your upkeep, target opponent gains control of {this} if the number of permanents is even.";
}
}
class GainControlSourceEffect extends ContinuousEffectImpl {
public GainControlSourceEffect() {
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
staticText = "target opponent gains control of {this}";
}
public GainControlSourceEffect(final GainControlSourceEffect effect) {
super(effect);
}
@Override
public GainControlSourceEffect copy() {
return new GainControlSourceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (permanent != null) {
return permanent.changeControllerId(source.getFirstTarget(), game);
} else {
discard();
}
return false;
}
}
class ChaosLordEffect extends AsThoughEffectImpl {
public ChaosLordEffect() {
super(AsThoughEffectType.ATTACK_AS_HASTE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "Chaos Lord can attack as though it had haste unless it entered the battlefield this turn";
}
public ChaosLordEffect(final ChaosLordEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public ChaosLordEffect copy() {
return new ChaosLordEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Permanent chaosLord = game.getPermanent(objectId);
return chaosLord != null
&& objectId == source.getSourceId()
&& chaosLord.getTurnsOnBattlefield() > 0;
}
}

View file

@ -0,0 +1,140 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.DealtDamageAndDiedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
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.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author jeffwadsworth
*/
public final class Seraph extends CardImpl {
public Seraph(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever a creature dealt damage by Seraph this turn dies, put that card onto the battlefield under your control at the beginning of the next end step. Sacrifice the creature when you lose control of Seraph.
Effect effect = new CreateDelayedTriggeredAbilityEffect(
new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new SeraphEffect()));
effect.setText("put that card onto the battlefield under your control at the beginning of the next end step. Sacrifice the creature when you lose control of {this}");
this.addAbility(new DealtDamageAndDiedTriggeredAbility(effect));
}
private Seraph(final Seraph card) {
super(card);
}
@Override
public Seraph copy() {
return new Seraph(this);
}
}
class SeraphEffect extends OneShotEffect {
SeraphEffect() {
super(Outcome.Neutral);
staticText = "put that card onto the battlefield under your control. Sacrifice it when you lose control of {this}";
}
SeraphEffect(SeraphEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card creatureCard = game.getCard(targetPointer.getFirst(game, source));
if (controller != null
&& creatureCard != null
&& game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { // must be still in the graveyard
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game, false, false, false, null);
OneShotEffect effect = new SacrificeTargetEffect();
effect.setText("Sacrifice this if Seraph leaves the battlefield or its current controller loses control of it.");
effect.setTargetPointer(new FixedTarget(creatureCard.getId()));
SeraphDelayedTriggeredAbility dTA = new SeraphDelayedTriggeredAbility(effect, source.getSourceId());
game.addDelayedTriggeredAbility(dTA, source);
return true;
}
return false;
}
@Override
public SeraphEffect copy() {
return new SeraphEffect(this);
}
}
class SeraphDelayedTriggeredAbility extends DelayedTriggeredAbility {
UUID seraph;
SeraphDelayedTriggeredAbility(Effect effect, UUID seraph) {
super(effect, Duration.EndOfGame, true);
this.seraph = seraph;
}
SeraphDelayedTriggeredAbility(SeraphDelayedTriggeredAbility ability) {
super(ability);
this.seraph = ability.seraph;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOST_CONTROL
|| event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.LOST_CONTROL
&& event.getSourceId().equals(seraph)) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE
&& event.getTargetId().equals(seraph)) {
return true;
}
return false;
}
@Override
public SeraphDelayedTriggeredAbility copy() {
return new SeraphDelayedTriggeredAbility(this);
}
@Override
public String getRule() {
return "Control of Seraph was lost, sacrifice this.";
}
}

View file

@ -368,6 +368,7 @@ public final class FifthEdition extends ExpansionSet {
cards.add(new SetCardInfo("Seasinger", 121, Rarity.UNCOMMON, mage.cards.s.Seasinger.class));
cards.add(new SetCardInfo("Segovian Leviathan", 122, Rarity.UNCOMMON, mage.cards.s.SegovianLeviathan.class));
cards.add(new SetCardInfo("Sengir Autocrat", 193, Rarity.RARE, mage.cards.s.SengirAutocrat.class));
cards.add(new SetCardInfo("Seraph", 59, Rarity.RARE, mage.cards.s.Seraph.class));
cards.add(new SetCardInfo("Serpent Generator", 397, Rarity.RARE, mage.cards.s.SerpentGenerator.class));
cards.add(new SetCardInfo("Serra Bestiary", 60, Rarity.UNCOMMON, mage.cards.s.SerraBestiary.class));
cards.add(new SetCardInfo("Serra Paladin", 61, Rarity.UNCOMMON, mage.cards.s.SerraPaladin.class));

View file

@ -62,6 +62,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Caribou Range", 11, Rarity.RARE, mage.cards.c.CaribouRange.class));
cards.add(new SetCardInfo("Celestial Sword", 314, Rarity.RARE, mage.cards.c.CelestialSword.class));
cards.add(new SetCardInfo("Centaur Archer", 282, Rarity.UNCOMMON, mage.cards.c.CentaurArcher.class));
cards.add(new SetCardInfo("Chaos Lord", 178, Rarity.RARE, mage.cards.c.ChaosLord.class));
cards.add(new SetCardInfo("Chaos Moon", 179, Rarity.RARE, mage.cards.c.ChaosMoon.class));
cards.add(new SetCardInfo("Chub Toad", 229, Rarity.COMMON, mage.cards.c.ChubToad.class));
cards.add(new SetCardInfo("Circle of Protection: Black", 12, Rarity.COMMON, mage.cards.c.CircleOfProtectionBlack.class));
@ -287,6 +288,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Scaled Wurm", 262, Rarity.COMMON, mage.cards.s.ScaledWurm.class));
cards.add(new SetCardInfo("Sea Spirit", 95, Rarity.UNCOMMON, mage.cards.s.SeaSpirit.class));
cards.add(new SetCardInfo("Seizures", 159, Rarity.COMMON, mage.cards.s.Seizures.class));
cards.add(new SetCardInfo("Seraph", 51, Rarity.RARE, mage.cards.s.Seraph.class));
cards.add(new SetCardInfo("Shambling Strider", 263, Rarity.COMMON, mage.cards.s.ShamblingStrider.class));
cards.add(new SetCardInfo("Shatter", 216, Rarity.COMMON, mage.cards.s.Shatter.class));
cards.add(new SetCardInfo("Shield Bearer", 52, Rarity.COMMON, mage.cards.s.ShieldBearer.class));

View file

@ -77,6 +77,7 @@ public final class MastersEdition extends ExpansionSet {
cards.add(new SetCardInfo("Erg Raiders", 68, Rarity.COMMON, mage.cards.e.ErgRaiders.class));
cards.add(new SetCardInfo("Eureka", 117, Rarity.RARE, mage.cards.e.Eureka.class));
cards.add(new SetCardInfo("Exile", 12, Rarity.COMMON, mage.cards.e.Exile.class));
cards.add(new SetCardInfo("Seraph", 26, Rarity.RARE, mage.cards.s.Seraph.class));
cards.add(new SetCardInfo("The Fallen", 69, Rarity.UNCOMMON, mage.cards.t.TheFallen.class));
cards.add(new SetCardInfo("Feast or Famine", 70, Rarity.COMMON, mage.cards.f.FeastOrFamine.class));
cards.add(new SetCardInfo("Fire Covenant", 145, Rarity.UNCOMMON, mage.cards.f.FireCovenant.class));
@ -175,6 +176,7 @@ public final class MastersEdition extends ExpansionSet {
cards.add(new SetCardInfo("Scryb Sprites", 128, Rarity.COMMON, mage.cards.s.ScrybSprites.class));
cards.add(new SetCardInfo("Seasinger", 49, Rarity.UNCOMMON, mage.cards.s.Seasinger.class));
cards.add(new SetCardInfo("Sea Sprite", 48, Rarity.COMMON, mage.cards.s.SeaSprite.class));
cards.add(new SetCardInfo("Seraph", 26, Rarity.RARE, mage.cards.s.Seraph.class));
cards.add(new SetCardInfo("Serendib Efreet", 50, Rarity.RARE, mage.cards.s.SerendibEfreet.class));
cards.add(new SetCardInfo("Serpent Generator", 164, Rarity.RARE, mage.cards.s.SerpentGenerator.class));
cards.add(new SetCardInfo("Shambling Strider", 129, Rarity.COMMON, mage.cards.s.ShamblingStrider.class));