Implemented Underworld Fires and Wings of Hubris

This commit is contained in:
LevelX2 2020-01-11 18:22:30 +01:00
parent dd0844b09f
commit 86f2d22baa
4 changed files with 137 additions and 1 deletions

View file

@ -0,0 +1,38 @@
package mage.cards.u;
import java.util.UUID;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.watchers.common.DamagedByWatcher;
/**
*
* @author LevelX2
*/
public final class UnderworldFires extends CardImpl {
public UnderworldFires(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}");
// Underworld Fires deals 1 damage to each creature and each planeswalker.
this.getSpellAbility().addEffect(new DamageAllEffect(1,
new FilterCreatureOrPlaneswalkerPermanent("creature and each planeswalker")));
// If a permanent dealt damage this way would die this turn, exile it instead.
this.getSpellAbility().addEffect(new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn));
this.getSpellAbility().addWatcher(new DamagedByWatcher(false));
}
private UnderworldFires(final UnderworldFires card) {
super(card);
}
@Override
public UnderworldFires copy() {
return new UnderworldFires(this);
}
}

View file

@ -0,0 +1,96 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public final class WingsOfHubris extends CardImpl {
public WingsOfHubris(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.EQUIPMENT)));
// Sacrifice Wings of Hubris: Equipped creature can't be blocked this turn. Sacrifice it at the beginning of the next end step.
this.addAbility(new SimpleActivatedAbility(new WingsOfHubrisEffect(), new SacrificeSourceCost()));
// Equip {1}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
private WingsOfHubris(final WingsOfHubris card) {
super(card);
}
@Override
public WingsOfHubris copy() {
return new WingsOfHubris(this);
}
}
class WingsOfHubrisEffect extends OneShotEffect {
public WingsOfHubrisEffect() {
super(Outcome.Detriment);
this.staticText = "Equipped creature can't be blocked this turn. Sacrifice it at the beginning of the next end step";
}
public WingsOfHubrisEffect(final WingsOfHubrisEffect effect) {
super(effect);
}
@Override
public WingsOfHubrisEffect copy() {
return new WingsOfHubrisEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
MageObject equipment = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (equipment instanceof Permanent && ((Permanent) equipment).getAttachedTo() != null) {
Permanent attachedToCreature = game.getPermanent(((Permanent) equipment).getAttachedTo());
if (attachedToCreature != null) {
ContinuousEffect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(attachedToCreature, game));
game.addEffect(effect, source);
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(attachedToCreature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
return false;
}
}

View file

@ -259,6 +259,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Underworld Breach", 161, Rarity.RARE, mage.cards.u.UnderworldBreach.class)); cards.add(new SetCardInfo("Underworld Breach", 161, Rarity.RARE, mage.cards.u.UnderworldBreach.class));
cards.add(new SetCardInfo("Underworld Charger", 120, Rarity.COMMON, mage.cards.u.UnderworldCharger.class)); cards.add(new SetCardInfo("Underworld Charger", 120, Rarity.COMMON, mage.cards.u.UnderworldCharger.class));
cards.add(new SetCardInfo("Underworld Dreams", 121, Rarity.UNCOMMON, mage.cards.u.UnderworldDreams.class)); cards.add(new SetCardInfo("Underworld Dreams", 121, Rarity.UNCOMMON, mage.cards.u.UnderworldDreams.class));
cards.add(new SetCardInfo("Underworld Fires", 162, Rarity.UNCOMMON, mage.cards.u.UnderworldFires.class));
cards.add(new SetCardInfo("Underworld Rage-Hound", 163, Rarity.COMMON, mage.cards.u.UnderworldRageHound.class)); cards.add(new SetCardInfo("Underworld Rage-Hound", 163, Rarity.COMMON, mage.cards.u.UnderworldRageHound.class));
cards.add(new SetCardInfo("Underworld Sentinel", 293, Rarity.RARE, mage.cards.u.UnderworldSentinel.class)); cards.add(new SetCardInfo("Underworld Sentinel", 293, Rarity.RARE, mage.cards.u.UnderworldSentinel.class));
cards.add(new SetCardInfo("Unknown Shores", 249, Rarity.COMMON, mage.cards.u.UnknownShores.class)); cards.add(new SetCardInfo("Unknown Shores", 249, Rarity.COMMON, mage.cards.u.UnknownShores.class));
@ -269,6 +270,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Warden of the Chained", 230, Rarity.UNCOMMON, mage.cards.w.WardenOfTheChained.class)); cards.add(new SetCardInfo("Warden of the Chained", 230, Rarity.UNCOMMON, mage.cards.w.WardenOfTheChained.class));
cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class)); cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class));
cards.add(new SetCardInfo("Whirlwind Denial", 81, Rarity.UNCOMMON, mage.cards.w.WhirlwindDenial.class)); cards.add(new SetCardInfo("Whirlwind Denial", 81, Rarity.UNCOMMON, mage.cards.w.WhirlwindDenial.class));
cards.add(new SetCardInfo("Wings of Hubris", 241, Rarity.COMMON, mage.cards.w.WingsOfHubris.class));
cards.add(new SetCardInfo("Witness of Tomorrows", 82, Rarity.COMMON, mage.cards.w.WitnessOfTomorrows.class)); cards.add(new SetCardInfo("Witness of Tomorrows", 82, Rarity.COMMON, mage.cards.w.WitnessOfTomorrows.class));
cards.add(new SetCardInfo("Woe Strider", 123, Rarity.RARE, mage.cards.w.WoeStrider.class)); cards.add(new SetCardInfo("Woe Strider", 123, Rarity.RARE, mage.cards.w.WoeStrider.class));
cards.add(new SetCardInfo("Wolfwillow Haven", 205, Rarity.UNCOMMON, mage.cards.w.WolfwillowHaven.class)); cards.add(new SetCardInfo("Wolfwillow Haven", 205, Rarity.UNCOMMON, mage.cards.w.WolfwillowHaven.class));

View file

@ -102,7 +102,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
} else { } else {
sb.append("gains "); sb.append("gains ");
} }
sb.append('"' + ability.getRule("this creature") + '"'); sb.append('"').append(ability.getRule("this creature")).append('"');
if (!duration.toString().isEmpty()) { if (!duration.toString().isEmpty()) {
sb.append(' ').append(duration.toString()); sb.append(' ').append(duration.toString());
} }