mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
* Void Winnower - Fixed that the check for even casting costs did not work correctly.
This commit is contained in:
parent
50b5602459
commit
d3000da3a3
11 changed files with 163 additions and 25 deletions
|
|
@ -317,7 +317,10 @@ public abstract class AbilityImpl implements Ability {
|
|||
// its mana cost; see rule 107.3), the player announces the value of that variable.
|
||||
VariableManaCost variableManaCost = handleManaXCosts(game, noMana, controller);
|
||||
String announceString = handleOtherXCosts(game, controller);
|
||||
|
||||
// For effects from cards like Void Winnower x costs have to be set
|
||||
if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
return false;
|
||||
}
|
||||
for (Mode mode : this.getModes().getSelectedModes()) {
|
||||
this.getModes().setActiveMode(mode);
|
||||
//20121001 - 601.2c
|
||||
|
|
|
|||
|
|
@ -178,4 +178,23 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
|||
return cardName;
|
||||
}
|
||||
|
||||
public int getConvertedManaCost() {
|
||||
int cmc = 0;
|
||||
int xMultiplier = 0;
|
||||
for (String symbolString : getManaCosts().getSymbols()) {
|
||||
int index = symbolString.indexOf("{X}");
|
||||
while (index != -1) {
|
||||
xMultiplier++;
|
||||
symbolString = symbolString.substring(index + 3);
|
||||
index = symbolString.indexOf("{X}");
|
||||
}
|
||||
}
|
||||
if (getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||
cmc += getManaCostsToPay().getX() * xMultiplier;
|
||||
} else {
|
||||
cmc += getManaCosts().convertedManaCost() + getManaCostsToPay().getX() * xMultiplier;
|
||||
}
|
||||
return cmc;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,6 +290,8 @@ public interface Game extends MageItem, Serializable {
|
|||
|
||||
boolean replaceEvent(GameEvent event);
|
||||
|
||||
boolean replaceEvent(GameEvent event, Ability targetAbility);
|
||||
|
||||
/**
|
||||
* Creates and fires an damage prevention event
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2291,6 +2291,11 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
return state.replaceEvent(event, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability targetAbility) {
|
||||
return state.replaceEvent(event, targetAbility, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreventionEffectData preventDamage(GameEvent event, Ability source, Game game, boolean preventAllDamage) {
|
||||
return preventDamage(event, source, game, Integer.MAX_VALUE);
|
||||
|
|
|
|||
|
|
@ -668,7 +668,11 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
|
||||
public boolean replaceEvent(GameEvent event, Game game) {
|
||||
if (effects.preventedByRuleModification(event, null, game, false)) {
|
||||
return replaceEvent(event, null, game);
|
||||
}
|
||||
|
||||
public boolean replaceEvent(GameEvent event, Ability targetAbility, Game game) {
|
||||
if (effects.preventedByRuleModification(event, targetAbility, game, false)) {
|
||||
return true;
|
||||
}
|
||||
return effects.replaceEvent(event, game);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ public class GameEvent implements Serializable {
|
|||
LOSE_LIFE, LOST_LIFE,
|
||||
PLAY_LAND, LAND_PLAYED,
|
||||
CAST_SPELL,
|
||||
/* SPELL_CAST
|
||||
x-Costs are already defined
|
||||
*/
|
||||
CAST_SPELL_LATE,
|
||||
/* SPELL_CAST
|
||||
targetId id of the spell that's cast
|
||||
sourceId sourceId of the spell that's cast
|
||||
|
|
|
|||
|
|
@ -491,21 +491,8 @@ public class Spell extends StackObjImpl implements Card {
|
|||
if (faceDown) {
|
||||
return 0;
|
||||
}
|
||||
for (Ability spellAbility : spellAbilities) {
|
||||
int xMultiplier = 0;
|
||||
for (String symbolString : spellAbility.getManaCosts().getSymbols()) {
|
||||
int index = symbolString.indexOf("{X}");
|
||||
while (index != -1) {
|
||||
xMultiplier++;
|
||||
symbolString = symbolString.substring(index + 3);
|
||||
index = symbolString.indexOf("{X}");
|
||||
}
|
||||
}
|
||||
if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||
cmc += spellAbility.getManaCostsToPay().getX() * xMultiplier;
|
||||
} else {
|
||||
cmc += spellAbility.getManaCosts().convertedManaCost() + spellAbility.getManaCostsToPay().getX() * xMultiplier;
|
||||
}
|
||||
for (SpellAbility spellAbility : spellAbilities) {
|
||||
cmc += spellAbility.getConvertedManaCost();
|
||||
}
|
||||
if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||
cmc += getCard().getManaCost().convertedManaCost();
|
||||
|
|
|
|||
|
|
@ -945,7 +945,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
//20091005 - 601.2a
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
if (card != null) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getId(), ability.getSourceId(), playerId))) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getId(), ability.getSourceId(), playerId), ability)) {
|
||||
int bookmark = game.bookmarkState();
|
||||
Zone fromZone = game.getState().getZone(card.getMainCard().getId());
|
||||
card.cast(game, fromZone, ability, playerId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue