mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Fixed that in some cases the converted mana costs of spells were calculated without the value of X costs (e.g. Chalice of the Void).
This commit is contained in:
parent
e343304c45
commit
0dd96df9e3
14 changed files with 28 additions and 16 deletions
|
@ -102,7 +102,7 @@ class DisruptingShoalCounterTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
DynamicValue amount = new ExileFromHandCostCardConvertedMana();
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null && spell.getManaCost().convertedManaCost() == amount.calculate(game, source)) {
|
||||
if (spell != null && spell.getConvertedManaCost() == amount.calculate(game, source)) {
|
||||
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -144,7 +144,7 @@ class HisokaMinamoSenseiCounterEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
HisokaMinamoSenseiDiscardTargetCost cost = (HisokaMinamoSenseiDiscardTargetCost) source.getCosts().get(0);
|
||||
if (cost != null && cost.getConvertedCosts() == spell.getManaCost().convertedManaCost()) {
|
||||
if (cost != null && cost.getConvertedCosts() == spell.getConvertedManaCost()) {
|
||||
return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class EndrekSahrMasterBreederEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
int cmc = spell.getManaCost().convertedManaCost();
|
||||
int cmc = spell.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
return new CreateTokenEffect(new EndrekSahrMasterBreederThrullToken(), cmc).apply(game, source);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class PlasmCaptureCounterEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||
if (spell != null) {
|
||||
result = game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
|
||||
int mana = spell.getManaCost().convertedManaCost();
|
||||
int mana = spell.getConvertedManaCost();
|
||||
AtTheBeginOfPreCombatMainDelayedTriggeredAbility delayedAbility =
|
||||
new AtTheBeginOfPreCombatMainDelayedTriggeredAbility(new PlasmCaptureManaEffect(mana), TargetController.YOU);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
|
|
|
@ -93,7 +93,7 @@ class EidolonOfTheGreatRevelTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if(event.getType() == GameEvent.EventType.SPELL_CAST){
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if(spell != null && spell.getManaCost().convertedManaCost() <= 3){
|
||||
if(spell != null && spell.getConvertedManaCost() <= 3){
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.sets.mirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
import static javax.xml.bind.JAXBIntrospector.getValue;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -128,7 +127,7 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if(event.getType() == GameEvent.EventType.SPELL_CAST){
|
||||
Permanent chalice = game.getPermanent(this.sourceId);
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if(spell != null && chalice != null && spell.getManaCost().convertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)){
|
||||
if(spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)){
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ImpsMischiefLoseLifeEffect extends OneShotEffect {
|
|||
if (spell != null) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.loseLife(spell.getManaCost().convertedManaCost(), game);
|
||||
player.loseLife(spell.getConvertedManaCost(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class BounteousKirinEffect extends OneShotEffect {
|
|||
if (spell != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int life = spell.getManaCost().convertedManaCost();
|
||||
int life = spell.getConvertedManaCost();
|
||||
controller.gainLife(life, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class CelestialKirinEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||
if (spell != null) {
|
||||
int cmc = spell.getManaCost().convertedManaCost();
|
||||
int cmc = spell.getConvertedManaCost();
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
|
||||
return new DestroyAllEffect(filter).apply(game, source);
|
||||
|
|
|
@ -108,7 +108,7 @@ class CloudhoofKirinEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (targetPlayer != null) {
|
||||
int cardsCount = Math.min(spell.getManaCost().convertedManaCost(), targetPlayer.getLibrary().size());
|
||||
int cardsCount = Math.min(spell.getConvertedManaCost(), targetPlayer.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = targetPlayer.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -103,7 +103,7 @@ class InfernalKirinEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
int cmc = spell.getManaCost().convertedManaCost();
|
||||
int cmc = spell.getConvertedManaCost();
|
||||
Player targetPlayer = null;
|
||||
for(Target target: source.getTargets()) {
|
||||
if (target instanceof TargetPlayer) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class SkyfireKirin extends CardImpl {
|
|||
if (ability.getAbilityType().equals(AbilityType.TRIGGERED)) {
|
||||
Spell spell = game.getStack().getSpell(ability.getEffects().get(0).getTargetPointer().getFirst(game, ability));
|
||||
if (spell != null) {
|
||||
int cmc = spell.getManaCost().convertedManaCost();
|
||||
int cmc = spell.getConvertedManaCost();
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterCreaturePermanent(new StringBuilder("creature with converted mana costs of ").append(cmc).toString());
|
||||
Target target = new TargetPermanent(filter);
|
||||
|
|
|
@ -92,7 +92,8 @@ class ManaplasmAbility extends TriggeredAbilityImpl {
|
|||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.getControllerId().equals(controllerId)) {
|
||||
this.getEffects().remove(0);
|
||||
this.addEffect(new BoostSourceEffect(spell.getManaCost().convertedManaCost(), spell.getManaCost().convertedManaCost(), Duration.EndOfTurn));
|
||||
int x = spell.getConvertedManaCost();
|
||||
this.addEffect(new BoostSourceEffect(x,x, Duration.EndOfTurn));
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
|
@ -109,4 +110,4 @@ class ManaplasmAbility extends TriggeredAbilityImpl {
|
|||
public ManaplasmAbility copy() {
|
||||
return new ManaplasmAbility(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ import mage.constants.Zone;
|
|||
import mage.counters.Counter;
|
||||
import mage.counters.Counters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
@ -596,6 +595,19 @@ public class Spell implements StackObject, Card {
|
|||
return card.getManaCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* 202.3b When calculating the converted mana cost of an object with an {X} in its
|
||||
* mana cost, X is treated as 0 while the object is not on the stack, and X is
|
||||
* treated as the number chosen for it while the object is on the stack.
|
||||
*/
|
||||
public int getConvertedManaCost() {
|
||||
int cmc = 0;
|
||||
for (Ability spellAbility: spellAbilities) {
|
||||
cmc += spellAbility.getManaCostsToPay().convertedManaCost();
|
||||
}
|
||||
return cmc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getPower() {
|
||||
return card.getPower();
|
||||
|
|
Loading…
Reference in a new issue