1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-13 09:11:06 -09:00

* Rakdos, Lord of Riots - Fixed that game was locked if Rakdos was on hand caused by the new show playable cards feature ().

This commit is contained in:
LevelX2 2014-07-22 13:08:23 +02:00
parent a527e5108c
commit cf3a50d572

View file

@ -27,13 +27,14 @@
*/ */
package mage.sets.returntoravnica; package mage.sets.returntoravnica;
import mage.constants.*; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.CostImpl;
import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount; import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
@ -41,12 +42,18 @@ import mage.abilities.keyword.RetraceAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -64,7 +71,7 @@ public class RakdosLordOfRiots extends CardImpl {
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
// You can't cast Rakdos, Lord of Riots unless an opponent lost life this turn. // You can't cast Rakdos, Lord of Riots unless an opponent lost life this turn.
this.getSpellAbility().addCost(new RakdosLordOfRiotsCost()); this.addAbility(new SimpleStaticAbility(Zone.ALL, new RakdosLordOfRiotsCantCastEffect()));
// Flying, trample // Flying, trample
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
@ -84,45 +91,44 @@ public class RakdosLordOfRiots extends CardImpl {
} }
} }
class RakdosLordOfRiotsCost extends CostImpl { class RakdosLordOfRiotsCantCastEffect extends ReplacementEffectImpl {
public RakdosLordOfRiotsCost() { public RakdosLordOfRiotsCantCastEffect() {
text = "You can't cast Rakdos, Lord of Riots unless an opponent lost life this turn"; super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "You can't cast {this} unless an opponent lost life this turn";
} }
public RakdosLordOfRiotsCost(final RakdosLordOfRiotsCost cost) { public RakdosLordOfRiotsCantCastEffect(final RakdosLordOfRiotsCantCastEffect effect) {
super(cost); super(effect);
} }
@Override @Override
public RakdosLordOfRiotsCost copy() { public boolean apply(Game game, Ability source) {
return new RakdosLordOfRiotsCost(this); return true;
} }
@Override @Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) { public RakdosLordOfRiotsCantCastEffect copy() {
Player controller = game.getPlayer(controllerId); return new RakdosLordOfRiotsCantCastEffect(this);
if (game.getActivePlayerId().equals(controllerId)) { }
OpponentsLostLifeCount dynamicValue = new OpponentsLostLifeCount();
if (dynamicValue != null && dynamicValue.calculate(game, controllerId) > 0) { @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
game.informPlayer(controller, "You can't cast Rakdos, Lord of Riots because your opponents lost no life this turn yet");
}
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
if (new OpponentsLostLifeCount().calculate(game, source) == 0) {
return true; return true;
} else {
game.informPlayer(controller, "You can't cast Rakdos, Lord of Riots because your opponents lost no life this turn yet");
return false;
} }
} }
// Always return true for not controller's turn: return false;
// http://www.wizards.com/magic/magazine/article.aspx?x=mtg/faq/rtr
// Rakdos can be put onto the battlefield by another spell or ability even if no opponent has lost life that turn.
return true;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
} }
} }
@ -167,4 +173,4 @@ class RakdosLordOfRiotsCostReductionEffect extends CostModificationEffectImpl {
return new RakdosLordOfRiotsCostReductionEffect(this); return new RakdosLordOfRiotsCostReductionEffect(this);
} }
} }