* Fixed Rage Extractor and Counterbalance not taking X value into account for calculating converted mana costs.

This commit is contained in:
LevelX2 2014-07-19 15:16:08 +02:00
parent 22697295a8
commit acd5db9e62
2 changed files with 8 additions and 7 deletions

View file

@ -42,7 +42,7 @@ import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.game.stack.Spell;
import mage.players.Player;
/**
@ -92,14 +92,14 @@ class CounterbalanceEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
if (spell != null) {
Card topcard = controller.getLibrary().getFromTop(game);
if (topcard != null) {
CardsImpl cards = new CardsImpl();
cards.add(topcard);
controller.revealCards(sourcePermanent.getName(), cards, game);
if (topcard.getManaCost().convertedManaCost() == spell.getManaCost().convertedManaCost()) {
if (topcard.getManaCost().convertedManaCost() == spell.getConvertedManaCost()) {
return game.getStack().counter(spell.getId(), source.getSourceId(), game);
}
}

View file

@ -41,6 +41,7 @@ import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.common.TargetCreatureOrPlayer;
/**
@ -85,11 +86,11 @@ class RageExtractorTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.controllerId)) {
Card card = game.getCard(event.getSourceId());
if (card != null) {
for (ManaCost cost : card.getManaCost()) {
Spell spell = (Spell) game.getStack().getStackObject(event.getTargetId());
if (spell != null) {
for (ManaCost cost : spell.getCard().getManaCost()) {
if (cost instanceof PhyrexianManaCost) {
((DamageTargetEffect)getEffects().get(0)).setAmount(new StaticValue(card.getManaCost().convertedManaCost()));
((DamageTargetEffect)getEffects().get(0)).setAmount(new StaticValue(spell.getConvertedManaCost()));
return true;
}
}