Updated some power-setting and toughness-setting effects to the correct layers

This commit is contained in:
Evan Kranzler 2017-10-02 16:58:03 -04:00
parent 549103a2f0
commit 67bc2fb6bb
7 changed files with 93 additions and 23 deletions

View file

@ -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() {

View file

@ -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);
// <i>Formidable</i> - {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);
}

View file

@ -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) {

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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();
}

View file

@ -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();
}