From 67bc2fb6bb81a146810a9cc2e127e79e43f26d15 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 2 Oct 2017 16:58:03 -0400 Subject: [PATCH] Updated some power-setting and toughness-setting effects to the correct layers --- .../src/mage/cards/a/ApocalypseDemon.java | 37 ++++++++++++++-- .../src/mage/cards/c/CraterElemental.java | 11 ++--- .../src/mage/cards/i/IslandOfWakWak.java | 4 +- Mage.Sets/src/mage/cards/s/Sentinel.java | 5 ++- Mage.Sets/src/mage/cards/s/SingingTree.java | 44 ++++++++++++++++--- .../continuous/SetPowerSourceEffect.java | 8 ++-- .../continuous/SetToughnessSourceEffect.java | 7 ++- 7 files changed, 93 insertions(+), 23 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ApocalypseDemon.java b/Mage.Sets/src/mage/cards/a/ApocalypseDemon.java index 085df8bada..889d8d735c 100644 --- a/Mage.Sets/src/mage/cards/a/ApocalypseDemon.java +++ b/Mage.Sets/src/mage/cards/a/ApocalypseDemon.java @@ -1,3 +1,30 @@ +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. + */ package mage.cards.a; import java.util.UUID; @@ -16,9 +43,13 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledPermanent; +/** + * + * @author MajorLazar + */ public class ApocalypseDemon extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("nother creature"); + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); static { filter.add(new CardTypePredicate(CardType.CREATURE)); @@ -41,8 +72,8 @@ public class ApocalypseDemon extends CardImpl { this.addAbility(new BeginningOfUpkeepTriggeredAbility(tapEffect, TargetController.YOU, false)); } - public ApocalypseDemon(final ApocalypseDemon apocalypseDemon) { - super(apocalypseDemon); + public ApocalypseDemon(final ApocalypseDemon card) { + super(card); } public ApocalypseDemon copy() { diff --git a/Mage.Sets/src/mage/cards/c/CraterElemental.java b/Mage.Sets/src/mage/cards/c/CraterElemental.java index a3df9319dd..935ac7afaa 100644 --- a/Mage.Sets/src/mage/cards/c/CraterElemental.java +++ b/Mage.Sets/src/mage/cards/c/CraterElemental.java @@ -45,6 +45,7 @@ import mage.constants.AbilityWord; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubLayer; import mage.constants.Zone; import mage.target.common.TargetCreaturePermanent; @@ -55,7 +56,7 @@ import mage.target.common.TargetCreaturePermanent; public class CraterElemental extends CardImpl { public CraterElemental(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(0); this.toughness = new MageInt(6); @@ -66,14 +67,14 @@ public class CraterElemental extends CardImpl { ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); - + // Formidable - {2}{R}: Crater Elemental has base power 8 until end of turn. Activate this ability only if creatures you control have total power 8 or greater. ability = new ActivateIfConditionActivatedAbility( - Zone.BATTLEFIELD, - new SetPowerSourceEffect(new StaticValue(8), Duration.EndOfTurn), + Zone.BATTLEFIELD, + new SetPowerSourceEffect(new StaticValue(8), Duration.EndOfTurn, SubLayer.SetPT_7b), new ManaCostsImpl("{2}{R}"), FormidableCondition.instance); - ability.setAbilityWord(AbilityWord.FORMIDABLE); + ability.setAbilityWord(AbilityWord.FORMIDABLE); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/i/IslandOfWakWak.java b/Mage.Sets/src/mage/cards/i/IslandOfWakWak.java index fea3f88ec4..e027cfcc87 100644 --- a/Mage.Sets/src/mage/cards/i/IslandOfWakWak.java +++ b/Mage.Sets/src/mage/cards/i/IslandOfWakWak.java @@ -62,7 +62,7 @@ public class IslandOfWakWak extends CardImpl { public IslandOfWakWak(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); - // {tap}: The power of target creature with flying becomes 0 until end of turn. + // {tap}: Target creature with flying has base power 0 until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new IslandOfWakWakEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filterWithFlying)); this.addAbility(ability); @@ -82,7 +82,7 @@ class IslandOfWakWakEffect extends OneShotEffect { public IslandOfWakWakEffect() { super(Outcome.Detriment); - staticText = "The power of target creature with flying becomes 0 until end of turn"; + staticText = "Target creature with flying has base power 0 until end of turn."; } public IslandOfWakWakEffect(final IslandOfWakWakEffect effect) { diff --git a/Mage.Sets/src/mage/cards/s/Sentinel.java b/Mage.Sets/src/mage/cards/s/Sentinel.java index a8024fb19f..1c67461fe4 100644 --- a/Mage.Sets/src/mage/cards/s/Sentinel.java +++ b/Mage.Sets/src/mage/cards/s/Sentinel.java @@ -41,6 +41,7 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.SubLayer; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; @@ -58,7 +59,7 @@ import mage.target.common.TargetCreaturePermanent; public class Sentinel extends CardImpl { public Sentinel(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); this.subtype.add(SubType.SHAPESHIFTER); this.power = new MageInt(1); this.toughness = new MageInt(1); @@ -105,7 +106,7 @@ class SentinelEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); if (controller != null && targetPermanent != null) { int newToughness = targetPermanent.getPower().getValue() + 1; - game.addEffect(new SetToughnessSourceEffect(new StaticValue(newToughness), Duration.Custom), source); + game.addEffect(new SetToughnessSourceEffect(new StaticValue(newToughness), Duration.Custom, SubLayer.SetPT_7b), source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SingingTree.java b/Mage.Sets/src/mage/cards/s/SingingTree.java index e73405886a..c17e3ffa9a 100644 --- a/Mage.Sets/src/mage/cards/s/SingingTree.java +++ b/Mage.Sets/src/mage/cards/s/SingingTree.java @@ -32,14 +32,18 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.common.continuous.SetPowerSourceEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; import mage.target.common.TargetAttackingCreature; /** @@ -47,16 +51,16 @@ import mage.target.common.TargetAttackingCreature; * @author MarcoMarin */ public class SingingTree extends CardImpl { - + public SingingTree(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.PLANT); this.power = new MageInt(0); this.toughness = new MageInt(3); // {tap}: Target attacking creature's power becomes 0 until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SetPowerSourceEffect(new StaticValue(0), Duration.EndOfTurn), new TapSourceCost()); - ability.addTarget(new TargetAttackingCreature(1)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SingingTreeEffect(), new TapSourceCost()); + ability.addTarget(new TargetAttackingCreature()); this.addAbility(ability); } @@ -69,3 +73,31 @@ public class SingingTree extends CardImpl { return new SingingTree(this); } } + +class SingingTreeEffect extends OneShotEffect { + + public SingingTreeEffect() { + super(Outcome.Detriment); + staticText = "Target attacking creature has base power 0 until end of turn."; + } + + public SingingTreeEffect(final SingingTreeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent targetCreature = game.getPermanent(source.getFirstTarget()); + if (targetCreature != null) { + int toughness = targetCreature.getToughness().getBaseValueModified(); + game.addEffect(new SetPowerToughnessTargetEffect(0, toughness, Duration.EndOfTurn), source); + return true; + } + return false; + } + + @Override + public Effect copy() { + return new SingingTreeEffect(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerSourceEffect.java index dbafe0c94b..c344149b8d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerSourceEffect.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.continuous; import mage.MageObject; @@ -42,13 +41,16 @@ import mage.game.Game; * * @author LevelX2 */ - public class SetPowerSourceEffect extends ContinuousEffectImpl { private final DynamicValue amount; public SetPowerSourceEffect(DynamicValue amount, Duration duration) { - super(duration, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); + this(amount, duration, SubLayer.CharacteristicDefining_7a); + } + + public SetPowerSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) { + super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); this.amount = amount; staticText = "{this}'s power is equal to the number of " + amount.getMessage(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetToughnessSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetToughnessSourceEffect.java index af48b2b92c..b539625c80 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetToughnessSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetToughnessSourceEffect.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.continuous; import mage.MageObject; @@ -46,7 +45,11 @@ public class SetToughnessSourceEffect extends ContinuousEffectImpl { private final DynamicValue amount; public SetToughnessSourceEffect(DynamicValue amount, Duration duration) { - super(duration, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); + this(amount, duration, SubLayer.CharacteristicDefining_7a); + } + + public SetToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) { + super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); this.amount = amount; staticText = "{this}'s toughness is equal to the number of " + amount.getMessage(); }