diff --git a/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java b/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java new file mode 100644 index 0000000000..29798ea21a --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeliodsPunishment.java @@ -0,0 +1,143 @@ +package mage.cards.h; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public final class HeliodsPunishment extends CardImpl { + + public HeliodsPunishment(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Heliod's Punishment enters the battlefield with four task counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TASK.createInstance(4)), "with four task counters on it")); + + // Enchanted creature can't attack or block. It loses all abilities and has "{T}: Remove a task counter from Heliod's Punishment. Then if it has no task counters on it, destroy Heliod's Punishment." + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackBlockAttachedEffect(AttachmentType.AURA)); + ability.addEffect(new HeliodsPunishmentLoseAllAbilitiesEnchantedEffect()); + this.addAbility(ability); + } + + private HeliodsPunishment(final HeliodsPunishment card) { + super(card); + } + + @Override + public HeliodsPunishment copy() { + return new HeliodsPunishment(this); + } +} + +class HeliodsPunishmentLoseAllAbilitiesEnchantedEffect extends ContinuousEffectImpl { + + public HeliodsPunishmentLoseAllAbilitiesEnchantedEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility); + staticText = "It loses all abilities and has \"{T}: Remove a task counter from {this}. Then if it has no task counters on it, destroy {this}.\" "; + } + + public HeliodsPunishmentLoseAllAbilitiesEnchantedEffect(final HeliodsPunishmentLoseAllAbilitiesEnchantedEffect effect) { + super(effect); + } + + @Override + public HeliodsPunishmentLoseAllAbilitiesEnchantedEffect copy() { + return new HeliodsPunishmentLoseAllAbilitiesEnchantedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourceEnchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourceEnchantment != null && sourceEnchantment.getAttachedTo() != null) { + Permanent attachedTo = game.getPermanent(sourceEnchantment.getAttachedTo()); + if (attachedTo != null) { + attachedTo.removeAllAbilities(source.getSourceId(), game); + HeliodsPunishmentEffect effect = new HeliodsPunishmentEffect(sourceEnchantment.getName()); + Ability ability = new SimpleActivatedAbility(effect, new TapSourceCost()); + effect.setSourceEnchantment(sourceEnchantment); + attachedTo.addAbility(ability, source.getSourceId(), game); + } + } + return true; + } + +} + +class HeliodsPunishmentEffect extends OneShotEffect { + + Permanent sourceEnchantment; + + public HeliodsPunishmentEffect(String sourceName) { + super(Outcome.Benefit); + this.staticText = "Remove a task counter from " + sourceName + ". Then if it has no task counters on it, destroy " + sourceName + "."; + sourceEnchantment = null; + } + + public HeliodsPunishmentEffect(final HeliodsPunishmentEffect effect) { + super(effect); + this.sourceEnchantment = effect.sourceEnchantment.copy(); + } + + @Override + public HeliodsPunishmentEffect copy() { + return new HeliodsPunishmentEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (sourceEnchantment != null) { + if (sourceEnchantment.getCounters(game).getCount(CounterType.TASK) > 0) { + sourceEnchantment.removeCounters(CounterType.TASK.createInstance(1), game); + if (!game.isSimulation()) { + game.informPlayers("Removed a task counter from " + sourceEnchantment.getLogName()); + } + } + if (sourceEnchantment.getCounters(game).getCount(CounterType.TASK) == 0) { + sourceEnchantment.destroy(source.getSourceId(), game, false); + } + return true; + } + return false; + } + + public void setSourceEnchantment(Permanent sourceEnchantment) { + this.sourceEnchantment = sourceEnchantment; + } + +} diff --git a/Mage.Sets/src/mage/cards/h/HydrasGrowth.java b/Mage.Sets/src/mage/cards/h/HydrasGrowth.java new file mode 100644 index 0000000000..2e74de7f95 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HydrasGrowth.java @@ -0,0 +1,91 @@ +package mage.cards.h; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.counter.AddCountersAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public final class HydrasGrowth extends CardImpl { + + public HydrasGrowth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When Hydra's Growth enters the battlefield, put a +1/+1 counter on enchanted creature. + this.addAbility(new EntersBattlefieldTriggeredAbility( + new AddCountersAttachedEffect(CounterType.P1P1.createInstance(), "enchanted creature"), false)); + // At the beginning of your upkeep, double the number of +1/+1 counters on enchanted creature. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new HydrasGrowthDoubleEffect(), + TargetController.YOU, false)); + } + + private HydrasGrowth(final HydrasGrowth card) { + super(card); + } + + @Override + public HydrasGrowth copy() { + return new HydrasGrowth(this); + } +} + +class HydrasGrowthDoubleEffect extends OneShotEffect { + + HydrasGrowthDoubleEffect() { + super(Outcome.BoostCreature); + staticText = "double the number of +1/+1 counters on enchanted creature"; + } + + HydrasGrowthDoubleEffect(final HydrasGrowthDoubleEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (permanent != null && permanent.getAttachedTo() != null) { + Permanent attachedTo = game.getPermanent(permanent.getAttachedTo()); + if (attachedTo != null) { + int amount = attachedTo.getCounters(game).getCount(CounterType.P1P1); + if (amount > 0) { + attachedTo.addCounters(CounterType.P1P1.createInstance(amount), source, game); + } + return true; + } + } + return false; + } + + @Override + public HydrasGrowthDoubleEffect copy() { + return new HydrasGrowthDoubleEffect(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/IlysianCaryatid.java b/Mage.Sets/src/mage/cards/i/IlysianCaryatid.java new file mode 100644 index 0000000000..5965a107af --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IlysianCaryatid.java @@ -0,0 +1,47 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.condition.common.FerociousCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.decorator.ConditionalManaEffect; +import mage.abilities.effects.mana.AddManaOfAnyColorEffect; +import mage.abilities.mana.SimpleManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public final class IlysianCaryatid extends CardImpl { + + public IlysianCaryatid(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); + + this.subtype.add(SubType.PLANT); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {T}: Add one mana of any color. If you control a creature with power 4 or greater, add two mana of any one color instead. + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, + new ConditionalManaEffect( + new AddManaOfAnyColorEffect(2), + new AddManaOfAnyColorEffect(1), + FerociousCondition.instance, + "Add one mana of any color. If you control a creature with power 4 or greater, add two mana of any one color instead" + ), new TapSourceCost())); + } + + private IlysianCaryatid(final IlysianCaryatid card) { + super(card); + } + + @Override + public IlysianCaryatid copy() { + return new IlysianCaryatid(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/ImpendingDoom.java b/Mage.Sets/src/mage/cards/i/ImpendingDoom.java new file mode 100644 index 0000000000..208dc46983 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/ImpendingDoom.java @@ -0,0 +1,64 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DamageAttachedControllerEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public final class ImpendingDoom extends CardImpl { + + public ImpendingDoom(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +3/+3 and attacks each combat if able. + Effect effect = new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield); + effect.setText("Enchanted creature gets +3/+3"); + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); + effect = new AttacksIfAbleAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.AURA); + effect.setText("and attacks each combat if able"); + ability.addEffect(effect); + this.addAbility(ability); + + // When enchanted creature dies, Impending Doom deals 3 damage to that creature's controller. + this.addAbility(new DiesAttachedTriggeredAbility( + new DamageAttachedControllerEffect(3), "enchanted creature")); + } + + private ImpendingDoom(final ImpendingDoom card) { + super(card); + } + + @Override + public ImpendingDoom copy() { + return new ImpendingDoom(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/IncendiaryOracle.java b/Mage.Sets/src/mage/cards/i/IncendiaryOracle.java new file mode 100644 index 0000000000..2ad0be2093 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IncendiaryOracle.java @@ -0,0 +1,49 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +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.constants.SubType; +import mage.constants.Zone; +import mage.watchers.common.DamagedByWatcher; + +/** + * + * @author LevelX2 + */ +public final class IncendiaryOracle extends CardImpl { + + public IncendiaryOracle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {1}{R}: Incendiary Oracle gets +1/+0 until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}"))); + + // If a creature dealt damage by Incendiary Oracle this turn would die, exile it instead. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new DealtDamageToCreatureBySourceDies(this, Duration.WhileOnBattlefield)), new DamagedByWatcher(false)); + } + + private IncendiaryOracle(final IncendiaryOracle card) { + super(card); + } + + @Override + public IncendiaryOracle copy() { + return new IncendiaryOracle(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/IrreverentRevelers.java b/Mage.Sets/src/mage/cards/i/IrreverentRevelers.java index c29a0a50d5..899480d365 100644 --- a/Mage.Sets/src/mage/cards/i/IrreverentRevelers.java +++ b/Mage.Sets/src/mage/cards/i/IrreverentRevelers.java @@ -1,5 +1,6 @@ package mage.cards.i; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.Mode; @@ -14,8 +15,6 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.target.common.TargetArtifactPermanent; -import java.util.UUID; - /** * @author TheElk801 */ @@ -37,6 +36,7 @@ public final class IrreverentRevelers extends CardImpl { ability.addMode(new Mode(new GainAbilitySourceEffect( HasteAbility.getInstance(), Duration.EndOfTurn ))); + this.addAbility(ability); } private IrreverentRevelers(final IrreverentRevelers card) { diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index e3de1f0fac..422a517477 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -110,15 +110,20 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Hateful Eidolon", 101, Rarity.UNCOMMON, mage.cards.h.HatefulEidolon.class)); cards.add(new SetCardInfo("Heliod's Intervention", 19, Rarity.RARE, mage.cards.h.HeliodsIntervention.class)); cards.add(new SetCardInfo("Heliod's Pilgrim", 20, Rarity.COMMON, mage.cards.h.HeliodsPilgrim.class)); + cards.add(new SetCardInfo("Heliod's Punishment", 21, Rarity.UNCOMMON, mage.cards.h.HeliodsPunishment.class)); cards.add(new SetCardInfo("Heliod, Sun-Crowned", 18, Rarity.MYTHIC, mage.cards.h.HeliodSunCrowned.class)); cards.add(new SetCardInfo("Hero of the Games", 137, Rarity.COMMON, mage.cards.h.HeroOfTheGames.class)); cards.add(new SetCardInfo("Hero of the Nyxborn", 219, Rarity.UNCOMMON, mage.cards.h.HeroOfTheNyxborn.class)); cards.add(new SetCardInfo("Hero of the Pride", 22, Rarity.COMMON, mage.cards.h.HeroOfThePride.class)); cards.add(new SetCardInfo("Hero of the Winds", 23, Rarity.UNCOMMON, mage.cards.h.HeroOfTheWinds.class)); cards.add(new SetCardInfo("Heroes of the Revel", 138, Rarity.UNCOMMON, mage.cards.h.HeroesOfTheRevel.class)); + cards.add(new SetCardInfo("Hydra's Growth", 172, Rarity.UNCOMMON, mage.cards.h.HydrasGrowth.class)); cards.add(new SetCardInfo("Hyrax Tower Scout", 173, Rarity.COMMON, mage.cards.h.HyraxTowerScout.class)); cards.add(new SetCardInfo("Ichthyomorphosis", 51, Rarity.COMMON, mage.cards.i.Ichthyomorphosis.class)); cards.add(new SetCardInfo("Idyllic Tutor", 24, Rarity.RARE, mage.cards.i.IdyllicTutor.class)); + cards.add(new SetCardInfo("Ilysian Caryatid", 174, Rarity.COMMON, mage.cards.i.IlysianCaryatid.class)); + cards.add(new SetCardInfo("Impending Doom", 139, Rarity.UNCOMMON, mage.cards.i.ImpendingDoom.class)); + cards.add(new SetCardInfo("Incendiary Oracle", 140, Rarity.COMMON, mage.cards.i.IncendiaryOracle.class)); cards.add(new SetCardInfo("Indomitable Will", 25, Rarity.COMMON, mage.cards.i.IndomitableWill.class)); cards.add(new SetCardInfo("Inevitable End", 102, Rarity.UNCOMMON, mage.cards.i.InevitableEnd.class)); cards.add(new SetCardInfo("Infuriate", 141, Rarity.COMMON, mage.cards.i.Infuriate.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java index f825e6da9f..dbc5aa6ad1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java @@ -1,5 +1,3 @@ - - package mage.abilities.effects.common; import java.util.UUID; @@ -15,7 +13,7 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; /** - * + * * @author BetaSteward_at_googlemail.com */ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleModifyingEffectImpl { @@ -43,7 +41,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; + return permanentToUntap.getIdName() + " doesn't untap (" + mageObject.getIdName() + ')'; } return null; } @@ -52,7 +50,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) { @@ -70,11 +68,11 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM @Override public String getText(Mode mode) { - if (staticText != null) { - return staticText; - } - return "Target " + mode.getTargets().get(0).getTargetName() - + " doesn't untap during its controller's untap step" + (getDuration().toString().isEmpty() ? "":" " + getDuration()); + if (staticText != null) { + return staticText; + } + return "Target " + mode.getTargets().get(0).getTargetName() + + " doesn't untap during its controller's untap step" + (getDuration().toString().isEmpty() ? "" : " " + getDuration()); } } diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 9f31003800..26e85ce9a4 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -125,6 +125,7 @@ public enum CounterType { STORAGE("storage"), STRIFE("strife"), STUDY("study"), + TASK("task"), THEFT("theft"), TIDE("tide"), TIME("time"),