* Enshrouding Mist - Fixed that the target creature was not untapped if renowned.

This commit is contained in:
LevelX2 2015-07-07 17:09:52 +02:00
parent 322d2dd0e5
commit 51c6a89753
11 changed files with 135 additions and 40 deletions

View file

@ -30,7 +30,7 @@ package mage.sets.magicorigins;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.common.RenownCondition;
import mage.abilities.condition.common.RenownedSourceCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -62,7 +62,7 @@ public class ConsulsLieutenant extends CardImpl {
// Whenever Consul's Lieutenant attacks, if it's renowned, other attacking creatures you control get +1/+1 until end of turn.
this.addAbility(new ConditionalTriggeredAbility(new AttacksTriggeredAbility(
new BoostControlledEffect(1, 1, Duration.EndOfTurn, new FilterAttackingCreature("other attacking creatures you control"), true), false),
RenownCondition.getInstance(),
RenownedSourceCondition.getInstance(),
"Whenever Consul's Lieutenant attacks, if it's renowned, other attacking creatures you control get +1/+1 until end of turn."));
}

View file

@ -28,12 +28,12 @@
package mage.sets.magicorigins;
import java.util.UUID;
import mage.abilities.condition.common.RenownCondition;
import mage.abilities.condition.common.RenownedTargetCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -56,12 +56,11 @@ public class EnshroudingMist extends CardImpl {
Effect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE);
effect.setText("Prevent all damage that would dealt to it this turn");
this.getSpellAbility().addEffect(effect);
OneShotEffect effect2 = new UntapSourceEffect();
OneShotEffect effect2 = new UntapTargetEffect();
effect2.setText("untap it");
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(effect2, RenownCondition.getInstance()));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(effect2, RenownedTargetCondition.getInstance()));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public EnshroudingMist(final EnshroudingMist card) {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.RenownCondition;
import mage.abilities.condition.common.RenownedSourceCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
@ -63,7 +63,7 @@ public class GoblinGloryChaser extends CardImpl {
// As long as Goblin Glory Chaser is renowned, it has menace.
Effect effect = new ConditionalContinuousEffect(
new GainAbilitySourceEffect(new MenaceAbility(), Duration.WhileOnBattlefield),
RenownCondition.getInstance(),
RenownedSourceCondition.getInstance(),
"As long as {this} is renowned, it has menace");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.RenownCondition;
import mage.abilities.condition.common.RenownedSourceCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
@ -64,12 +64,12 @@ public class HonoredHierarch extends CardImpl {
// As long as Honored Hierarch is renowned, it has vigilance and "{T}: Add one mana of any color to your mana pool."
Effect effect = new ConditionalContinuousEffect(
new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.WhileOnBattlefield),
RenownCondition.getInstance(),
RenownedSourceCondition.getInstance(),
"As long as {this} is renown, it has vigilance");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
effect = new ConditionalContinuousEffect(
new GainAbilitySourceEffect(new AnyColorManaAbility(), Duration.WhileOnBattlefield),
RenownCondition.getInstance(),
RenownedSourceCondition.getInstance(),
"and \"{T}: Add one mana of any color to your mana pool.\"");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -30,7 +30,7 @@ package mage.sets.magicorigins;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.common.RenownCondition;
import mage.abilities.condition.common.RenownedSourceCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
@ -68,7 +68,7 @@ public class ScabClanBerserker extends CardImpl {
// Whenever an opponent casts a noncreature spell, if Scab-Clan Berserker is renowned, Scab-Clan Berserker deals 2 damage to that player.
this.addAbility(new ConditionalTriggeredAbility(
new ScabClanBerserkerTriggeredAbility(),
RenownCondition.getInstance(),
RenownedSourceCondition.getInstance(),
"Whenever an opponent casts a noncreature spell, if Scab-Clan Berserker is renowned, Scab-Clan Berserker deals 2 damage to that player"));
}

View file

@ -174,7 +174,7 @@ public class RenownTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Rhox Maulers", 6, 6); // renown again in turn 7 after the attack
Permanent rhoxMaulers = getPermanent("Rhox Maulers", playerA);
Assert.assertEquals("may not be renown", true, rhoxMaulers.isRenown());
Assert.assertEquals("may not be renown", true, rhoxMaulers.isRenowned());
}
@ -202,7 +202,7 @@ public class RenownTest extends CardTestPlayerBase {
execute();
Permanent goblin = getPermanent("Goblin Glory Chaser", playerA);
Assert.assertEquals("has has renown", true, goblin.isRenown());
Assert.assertEquals("has has renown", true, goblin.isRenowned());
assertAbility(playerA, "Goblin Glory Chaser", new MenaceAbility(), true);
assertPowerToughness(playerA, "Goblin Glory Chaser", 2, 2);
@ -231,11 +231,40 @@ public class RenownTest extends CardTestPlayerBase {
execute();
Permanent berserker = getPermanent("Scab-Clan Berserker", playerA);
Assert.assertEquals("has has renown", true, berserker.isRenown());
Assert.assertEquals("has has renown", true, berserker.isRenowned());
assertPowerToughness(playerA, "Scab-Clan Berserker", 3, 3);
assertLife(playerA, 17); // Lightning Bolt
assertLife(playerB, 16); // 2 from attack 2 from triggered ability
}
/**
* Enshrouding Mist (new card from ORI) isn't untapping renowned creatures.
*/
@Test
public void testEnshroudingMist() {
// Renown 1
// Whenever an opponent casts a noncreature spell, if Scab-Clan Berserker is renowned, Scab-Clan Berserker deals 2 damage to that player.
addCard(Zone.BATTLEFIELD, playerB, "Scab-Clan Berserker"); // 2/2 {1}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Plains", 1);
// Target creature gets +1/+1 until end of turn. Prevent all damage that would dealt to it this turn. If it's renowned, untap it.
addCard(Zone.HAND, playerB, "Enshrouding Mist");
attack(2, playerB, "Scab-Clan Berserker"); // 1 damage
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Enshrouding Mist", "Scab-Clan Berserker");
setStopAt(2, PhaseStep.END_TURN);
execute();
Permanent berserker = getPermanent("Scab-Clan Berserker", playerB);
Assert.assertEquals("has has renown", true, berserker.isRenowned());
assertPowerToughness(playerB, "Scab-Clan Berserker", 4, 4); // +1 from renowned + 1 from Enshrouding Mist
assertTapped("Scab-Clan Berserker", false);
assertLife(playerA, 18); // Lightning Bolt
assertLife(playerB, 20);
}
}

View file

@ -16,15 +16,15 @@ import mage.game.permanent.Permanent;
* @author LevelX2
*/
public class RenownCondition implements Condition {
public class RenownedSourceCondition implements Condition {
private static RenownCondition fInstance = null;
private static RenownedSourceCondition fInstance = null;
private RenownCondition() {}
private RenownedSourceCondition() {}
public static RenownCondition getInstance() {
public static RenownedSourceCondition getInstance() {
if (fInstance == null) {
fInstance = new RenownCondition();
fInstance = new RenownedSourceCondition();
}
return fInstance;
}
@ -33,7 +33,7 @@ public class RenownCondition implements Condition {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
return permanent.isRenown();
return permanent.isRenowned();
}
return false;
}

View file

@ -0,0 +1,67 @@
/*
* 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.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class RenownedTargetCondition implements Condition {
private static RenownedTargetCondition fInstance = null;
private RenownedTargetCondition() {
}
public static RenownedTargetCondition getInstance() {
if (fInstance == null) {
fInstance = new RenownedTargetCondition();
}
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
if (permanent != null) {
return permanent.isRenowned();
}
return false;
}
@Override
public String toString() {
return "it's renowned";
}
}

View file

@ -27,7 +27,7 @@ public class RenownAbility extends TriggeredAbilityImpl {
private int renownValue;
public RenownAbility(int renownValue) {
super(Zone.BATTLEFIELD, new BecomeRenownSourceEffect(renownValue), false);
super(Zone.BATTLEFIELD, new BecomesRenownedSourceEffect(renownValue), false);
this.renownValue = renownValue;
}
@ -49,7 +49,7 @@ public class RenownAbility extends TriggeredAbilityImpl {
@Override
public boolean checkInterveningIfClause(Game game) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
return sourcePermanent != null && !sourcePermanent.isRenown();
return sourcePermanent != null && !sourcePermanent.isRenowned();
}
@Override
@ -63,20 +63,20 @@ public class RenownAbility extends TriggeredAbilityImpl {
}
}
class BecomeRenownSourceEffect extends OneShotEffect {
class BecomesRenownedSourceEffect extends OneShotEffect {
public BecomeRenownSourceEffect(int renownValue) {
public BecomesRenownedSourceEffect(int renownValue) {
super(Outcome.BoostCreature);
this.staticText = setText(renownValue);
}
public BecomeRenownSourceEffect(final BecomeRenownSourceEffect effect) {
public BecomesRenownedSourceEffect(final BecomesRenownedSourceEffect effect) {
super(effect);
}
@Override
public BecomeRenownSourceEffect copy() {
return new BecomeRenownSourceEffect(this);
public BecomesRenownedSourceEffect copy() {
return new BecomesRenownedSourceEffect(this);
}
@Override
@ -90,7 +90,7 @@ class BecomeRenownSourceEffect extends OneShotEffect {
renownValue = source.getManaCostsToPay().getX();
}
new AddCountersSourceEffect(CounterType.P1P1.createInstance(renownValue), true).apply(game, source);
permanent.setRenown(true);
permanent.setRenowned(true);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_RENOWNED, source.getSourceId(), source.getSourceId(), source.getControllerId(), renownValue));
return true;
}

View file

@ -75,8 +75,8 @@ public interface Permanent extends Card, Controllable {
boolean isMonstrous();
void setMonstrous(boolean value);
boolean isRenown();
void setRenown(boolean value);
boolean isRenowned();
void setRenowned(boolean value);
void setCardNumber(int cid);
void setExpansionSetCode(String expansionSetCode);

View file

@ -90,7 +90,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
protected boolean flipped;
protected boolean transformed;
protected boolean monstrous;
protected boolean renown;
protected boolean renowned;
protected boolean manifested = false;
protected boolean morphed = false;
protected UUID originalControllerId;
@ -176,7 +176,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.maxBlockedBy = permanent.maxBlockedBy;
this.transformed = permanent.transformed;
this.monstrous = permanent.monstrous;
this.renown = permanent.renown;
this.renowned = permanent.renowned;
this.pairedCard = permanent.pairedCard;
this.timesLoyaltyUsed = permanent.timesLoyaltyUsed;
@ -1268,13 +1268,13 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
@Override
public boolean isRenown() {
return this.renown;
public boolean isRenowned() {
return this.renowned;
}
@Override
public void setRenown(boolean value) {
this.renown = value;
public void setRenowned(boolean value) {
this.renowned = value;
}
@Override