Fixed spellAbility fizzle on illegal targets. Fixed #Issue43: Huntmaster of the Fells triggered ability shouldn't be optional

This commit is contained in:
magenoxx 2012-08-16 02:19:43 +04:00
parent 44f2b3fd1e
commit 335462c8c8
8 changed files with 97 additions and 36 deletions

View file

@ -107,7 +107,7 @@ public class HuntmasterOfTheFells extends CardImpl<HuntmasterOfTheFells> {
class HuntmasterOfTheFellsAbility extends TriggeredAbilityImpl<HuntmasterOfTheFellsAbility> {
public HuntmasterOfTheFellsAbility() {
super(Constants.Zone.BATTLEFIELD, new CreateTokenEffect(new WolfToken(Token.Type.SECOND)), true);
super(Constants.Zone.BATTLEFIELD, new CreateTokenEffect(new WolfToken(Token.Type.SECOND)), false);
this.addEffect(new GainLifeEffect(2));
}
@ -146,7 +146,7 @@ class HuntmasterOfTheFellsAbility extends TriggeredAbilityImpl<HuntmasterOfTheFe
class RavagerOfTheFellsAbility extends TriggeredAbilityImpl<RavagerOfTheFellsAbility> {
public RavagerOfTheFellsAbility() {
super(Constants.Zone.BATTLEFIELD, new RavagerOfTheFellsEffect(), true);
super(Constants.Zone.BATTLEFIELD, new RavagerOfTheFellsEffect(), false);
Target target1 = new TargetOpponent();
target1.setRequired(true);
this.addTarget(target1);
@ -183,7 +183,7 @@ class RavagerOfTheFellsEffect extends OneShotEffect<RavagerOfTheFellsEffect> {
public RavagerOfTheFellsEffect() {
super(Constants.Outcome.Damage);
staticText = "{this} deals 2 damage to target opponent and 2 damage to up to one target creature that player controls";
//staticText = "{this} deals 2 damage to target opponent and 2 damage to up to one target creature that player controls";
}
public RavagerOfTheFellsEffect(final RavagerOfTheFellsEffect effect) {
@ -235,6 +235,16 @@ class RavagerOfTheFellsTarget extends TargetPermanent<RavagerOfTheFellsTarget> {
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
Set<UUID> possibleTargets = new HashSet<UUID>();
MageObject object = game.getObject(sourceId);
for (StackObject item: game.getState().getStack()) {
if (item.getId().equals(sourceId)) {
object = item;
}
if (item.getSourceId().equals(sourceId)) {
object = item;
}
}
if (object instanceof StackObject) {
UUID playerId = ((StackObject)object).getStackAbility().getFirstTarget();
for (UUID targetId : availablePossibleTargets) {

View file

@ -27,13 +27,14 @@
*/
package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EmptyEffect;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.TwoOrMoreSpellsWereCastLastTurnCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.TransformSourceEffect;
@ -41,12 +42,16 @@ import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import java.util.UUID;
/**
*
* @author BetaSteward
*/
public class RavagerOfTheFells extends CardImpl<RavagerOfTheFells> {
private static final String rule = "Whenever this creature transforms into Ravager of the Fells, it deals 2 damage to target opponent and 2 damage to up to one target creature that player controls";
public RavagerOfTheFells(UUID ownerId) {
super(ownerId, 140, "Ravager of the Fells", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "");
this.expansionSetCode = "DKA";
@ -62,6 +67,7 @@ public class RavagerOfTheFells extends CardImpl<RavagerOfTheFells> {
this.addAbility(TrampleAbility.getInstance());
// Whenever this creature transforms into Ravager of the Fells, it deals 2 damage to target opponent and 2 damage to up to one target creature that player controls.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new EmptyEffect(rule)));
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Ravager of the Fells.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new TransformSourceEffect(false), Constants.TargetController.ANY, false);

View file

@ -33,6 +33,7 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.EmptyEffect;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.CountersCount;
@ -81,30 +82,6 @@ public class EverflowingChalice extends CardImpl<EverflowingChalice> {
}
class EmptyEffect extends OneShotEffect<EmptyEffect> {
public EmptyEffect(String rule) {
super(Constants.Outcome.DrawCard);
staticText = rule;
}
public EmptyEffect(final EmptyEffect effect) {
super(effect);
}
@Override
public EmptyEffect copy() {
return new EmptyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// empty effect
return true;
}
}
class EverflowingChaliceAddCountersEffect extends OneShotEffect<EverflowingChaliceAddCountersEffect> {
public EverflowingChaliceAddCountersEffect() {

View file

@ -27,13 +27,12 @@
*/
package mage.sets.worldwake;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.Ability;
import mage.abilities.common.EmptyEffect;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -51,6 +50,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.List;
import java.util.UUID;
/**
*
* @author jeffwadsworth

View file

@ -31,6 +31,7 @@ import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.EmptyEffect;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;